gcc 8.0.1 on Fedora "Rawhide" -- compile warnings
Compiler warnings for review from a build I did on Fedora "Rawhide" using gcc 8.0.1.
HEAD commit
[root@fedraw-pa01 ntpsec]# git log
commit 861012e34b983bdaf2ec1c9567862669cd67d503 (HEAD -> master, origin/master, origin/HEAD)
Author: Stephen Walker <stephendwalker+github@gmail.com>
Date: Sun Apr 8 19:13:57 2018 -0400
attic: build on OpenSSL without Camellia
Signed-off-by: Stephen Walker <stephendwalker+github@gmail.com>
Build commands and CFLAGS
./waf configure
./waf build
CFLAGS : -DUNITY_EXCLUDE_FLOAT_PRINT -fstack-protector-all -Wshadow -Wpacked -Wcast-qual -Wmissing-declarations -Wdisabled-optimization -Wimplicit-function-declaration -Winvalid-pch -Wpointer-arith -Wwrite-strings -Winit-self -Wfloat-equal -Wformat -Wformat-signedness -Wformat-security -Wsuggest-attribute=noreturn -fPIC -O1 -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wundef -Wunused -std=c99 -D_GNU_SOURCE
Warnings
[57/95] Compiling ntpd/ntp_peer.c
[58/95] Compiling ntpd/ntp_proto.c
../../ntpd/ntp_loopfilter.c: In function ‘ntp_adjtime_error_handler’:
../../ntpd/ntp_loopfilter.c:366:13: warning: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Wrestrict]
snprintf(des, sizeof(des), "%s%sClock Unsynchronized",
^~~
des, (*des) ? "; " : "");
~~~
../../ntpd/ntp_loopfilter.c:370:13: warning: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Wrestrict]
snprintf(des, sizeof(des), "%s%sClock Error",
^~~
des, (*des) ? "; " : "");
~~~
../../ntpd/ntp_loopfilter.c:375:13: warning: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Wrestrict]
snprintf(des, sizeof(des), "%s%sPPS Frequency Sync wanted but no PPS",
^~~
des, (*des) ? "; " : "");
~~~
../../ntpd/ntp_loopfilter.c:380:13: warning: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Wrestrict]
snprintf(des, sizeof(des), "%s%sPPS Time Sync wanted but no PPS signal",
^~~
des, (*des) ? "; " : "");
~~~
../../ntpd/ntp_loopfilter.c:385:13: warning: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Wrestrict]
snprintf(des, sizeof(des), "%s%sPPS Time Sync wanted but PPS Jitter exceeded",
^~~
des, (*des) ? "; " : "");
~~~
../../ntpd/ntp_loopfilter.c:390:13: warning: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Wrestrict]
snprintf(des, sizeof(des), "%s%sPPS Frequency Sync wanted but PPS Wander exceeded",
^~~
des, (*des) ? "; " : "");
~~~
../../ntpd/ntp_loopfilter.c:395:13: warning: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Wrestrict]
snprintf(des, sizeof(des), "%s%sPPS Frequency Sync wanted but Calibration error detected",
^~~
des, (*des) ? "; " : "");
~~~
../../ntpd/ntp_loopfilter.c:366:36: warning: ‘Clock Unsynchronized’ directive output may be truncated writing 20 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
snprintf(des, sizeof(des), "%s%sClock Unsynchronized",
^~~~~~~~~~~~~~~~~~~~
../../ntpd/ntp_loopfilter.c:366:4: note: ‘snprintf’ output between 21 and 1044 bytes into a destination of size 1024
snprintf(des, sizeof(des), "%s%sClock Unsynchronized",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
des, (*des) ? "; " : "");
~~~~~~~~~~~~~~~~~~~~~~~~
../../ntpd/ntp_loopfilter.c:370:34: warning: ‘%s’ directive output may be truncated writing up to 2 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
snprintf(des, sizeof(des), "%s%sClock Error",
^~
../../ntpd/ntp_loopfilter.c:370:4: note: ‘snprintf’ output between 12 and 1037 bytes into a destination of size 1024
snprintf(des, sizeof(des), "%s%sClock Error",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
des, (*des) ? "; " : "");
~~~~~~~~~~~~~~~~~~~~~~~~
../../ntpd/ntp_loopfilter.c:375:34: warning: ‘%s’ directive output may be truncated writing up to 2 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
snprintf(des, sizeof(des), "%s%sPPS Frequency Sync wanted but no PPS",
^~
../../ntpd/ntp_loopfilter.c:375:4: note: ‘snprintf’ output between 37 and 1062 bytes into a destination of size 1024
snprintf(des, sizeof(des), "%s%sPPS Frequency Sync wanted but no PPS",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
des, (*des) ? "; " : "");
~~~~~~~~~~~~~~~~~~~~~~~~
../../ntpd/ntp_loopfilter.c:380:34: warning: ‘%s’ directive output may be truncated writing up to 2 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
snprintf(des, sizeof(des), "%s%sPPS Time Sync wanted but no PPS signal",
^~
../../ntpd/ntp_loopfilter.c:380:4: note: ‘snprintf’ output between 39 and 1064 bytes into a destination of size 1024
snprintf(des, sizeof(des), "%s%sPPS Time Sync wanted but no PPS signal",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
des, (*des) ? "; " : "");
~~~~~~~~~~~~~~~~~~~~~~~~
../../ntpd/ntp_loopfilter.c:385:34: warning: ‘%s’ directive output may be truncated writing up to 2 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
snprintf(des, sizeof(des), "%s%sPPS Time Sync wanted but PPS Jitter exceeded",
^~
../../ntpd/ntp_loopfilter.c:385:4: note: ‘snprintf’ output between 45 and 1070 bytes into a destination of size 1024
snprintf(des, sizeof(des), "%s%sPPS Time Sync wanted but PPS Jitter exceeded",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
des, (*des) ? "; " : "");
~~~~~~~~~~~~~~~~~~~~~~~~
../../ntpd/ntp_loopfilter.c:390:34: warning: ‘%s’ directive output may be truncated writing up to 2 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
snprintf(des, sizeof(des), "%s%sPPS Frequency Sync wanted but PPS Wander exceeded",
^~
../../ntpd/ntp_loopfilter.c:390:4: note: ‘snprintf’ output between 50 and 1075 bytes into a destination of size 1024
snprintf(des, sizeof(des), "%s%sPPS Frequency Sync wanted but PPS Wander exceeded",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
des, (*des) ? "; " : "");
~~~~~~~~~~~~~~~~~~~~~~~~
../../ntpd/ntp_loopfilter.c:395:34: warning: ‘%s’ directive output may be truncated writing up to 2 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
snprintf(des, sizeof(des), "%s%sPPS Frequency Sync wanted but Calibration error detected",
^~
../../ntpd/ntp_loopfilter.c:395:4: note: ‘snprintf’ output between 57 and 1082 bytes into a destination of size 1024
snprintf(des, sizeof(des), "%s%sPPS Frequency Sync wanted but Calibration error detected",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
des, (*des) ? "; " : "");
~~~~~~~~~~~~~~~~~~~~~~~~
[59/95] Compiling ntpd/ntp_sandbox.c
[60/95] Compiling ntpd/ntp_scanner.c
[164/220] Compiling build/main/ntpclients/ntptrace.pyo
[165/220] Compiling build/main/ntpclients/ntpviz.pyc
../../tests/ntpd/leapsec.c: In function ‘TEST_leapsec_lsQueryPristineState_’:
../../tests/ntpd/leapsec.c:434:19: warning: cast between incompatible function types from ‘int (*)(FILE * restrict, const char * restrict, ...)’ {aka ‘int (*)(struct _IO_FILE * restrict, const char * restrict, ...)’} to ‘void (*)(void *, const char *, ...)’ [-Wcast-function-type]
leapsec_dump(pt, (leapsec_dumper)fprintf, stdout);
^
../../tests/ntpd/leapsec.c: In function ‘TEST_leapsec_ls2009limdata_’:
../../tests/ntpd/leapsec.c:554:19: warning: cast between incompatible function types from ‘int (*)(FILE * restrict, const char * restrict, ...)’ {aka ‘int (*)(struct _IO_FILE * restrict, const char * restrict, ...)’} to ‘void (*)(void *, const char *, ...)’ [-Wcast-function-type]
leapsec_dump(pt, (leapsec_dumper)fprintf, stdout);
^
../../tests/ntpd/leapsec.c: In function ‘TEST_leapsec_addDynamic_’:
../../tests/ntpd/leapsec.c:612:19: warning: cast between incompatible function types from ‘int (*)(FILE * restrict, const char * restrict, ...)’ {aka ‘int (*)(struct _IO_FILE * restrict, const char * restrict, ...)’} to ‘void (*)(void *, const char *, ...)’ [-Wcast-function-type]
leapsec_dump(pt, (leapsec_dumper)fprintf, stdout);
^
[166/220] Compiling build/main/ntpclients/ntpviz.pyo
[167/220] Compiling build/main/ntpclients/ntpwait.pyc