create_test_sourcelist: fails to compile correctly with latest GCC
The test suite fails to compile with the new version of GCC (8.1.0) on my machine. I am running CMake 3.11.2.
[ 64%] Building C object src/ipcpd/normal/tests/CMakeFiles/normal_test.dir/test_suite.c.o
In function ‘lowercase’,
inlined from ‘main’ at /home/sander/upstream/ouroboros/build/src/ipcpd/normal/tests/test_suite.c:104:11:
/home/sander/upstream/ouroboros/build/src/ipcpd/normal/tests/test_suite.c:56:3: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
strncpy(new_string, string, stringSize);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sander/upstream/ouroboros/build/src/ipcpd/normal/tests/test_suite.c: In function ‘main’:
/home/sander/upstream/ouroboros/build/src/ipcpd/normal/tests/test_suite.c:50:32: note: length computed here
stringSize = CM_CAST(size_t, strlen(string) + 1);
^~~~~~~~~~~~~~
/home/sander/upstream/ouroboros/build/src/ipcpd/normal/tests/test_suite.c:19:36: note: in definition of macro ‘CM_CAST’
#define CM_CAST(TYPE, EXPR) (TYPE)(EXPR)
^~~~
cc1: all warnings being treated as errors
make[3]: *** [src/ipcpd/normal/tests/CMakeFiles/normal_test.dir/build.make:63: src/ipcpd/normal/tests/CMakeFiles/normal_test.dir/test_suite.c.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:615: src/ipcpd/normal/tests/CMakeFiles/normal_test.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:109: CMakeFiles/check.dir/rule] Error 2
make: *** [Makefile:210: check] Error 2
Flags used:
C_FLAGS = -std=c89 -Wall -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough -Wmissing-field-initializers -Wmissing-parameter-type -Wold-style-declaration -Woverride-init -Wsign-compare -Wtype-limits -Wuninitialized -Wshift-negative-value -Wunused-parameter -Wunused-but-set-parameter -Werror -Wundef -Wpointer-arith -Wstrict-prototypes -Wunreachable-code -Wdeclaration-after-statement -fmax-errors=5 -O3 -O3 -DNDEBUG
Edited by Brad King