phaag / nfdump

Netflow processing tools
Other
765 stars 201 forks source link

FYI : warning on compile time ‘long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] #541

Closed atbohmer closed 2 months ago

atbohmer commented 2 months ago

All seems to be working oke, but FYI Peter. Cheers, André

Description: Red Hat Enterprise Linux 9.4 (Plow) 5.14.0-427.18.1.el9_4.x86_64 phaag/nfsen#1 SMP PREEMPT_DYNAMIC nfdump/.libs/lt-nfdump: Version: 1.7.4-ce52547 Options: ZSTD BZIP2 Date: 2024-06-24 07:40:09 +0200

./configure --enable-nftrack --enable-nfprofile --enable-sflow --enable-readpcap make ..... output_csv.c: In function ‘String_flowId’: output_csv.c:2054:27: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 2054 fprintf(stream, "0x%llu", flowId ? flowId->flowId : 0); ~^ ~~~~~~~~~
long long unsigned int uint64_t {aka long unsigned int}
%lu
depbase=echo output_fmt.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';\
gcc -DHAVE_CONFIG_H -I. -I../.. -I.. -I../include -I../libnffile -I../libnfdump -I../inline -g -O3 -std=gnu17 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -fno-strict-aliasing -pthread -MT output_fmt.o -MD -MP -MF $depbase.Tpo -c -o output_fmt.o output_fmt.c &&\ mv -f $depbase.Tpo $depbase.Po output_fmt.c: In function ‘String_flowId’: output_fmt.c:2550:29: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 2550 fprintf(stream, "0x%13llu", flowId ? flowId->flowId : 0); ~^ ~~~~~~~
long long unsigned int uint64_t {aka long unsigned int}
%13lu
depbase=echo output_json.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';\
gcc -DHAVE_CONFIG_H -I. -I../.. -I.. -I../include -I../libnffile -I../libnfdump -I../inline -g -O3 -std=gnu17 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -fno-strict-aliasing -pthread -MT output_json.o -MD -MP -MF $depbase.Tpo -c -o output_json.o output_json.c &&\ mv -f $depbase.Tpo $depbase.Po output_json.c: In function ‘stringEXflowId’: output_json.c:665:40: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 665 fprintf(stream, "%s\"flowID\" : %llu%s", indent, flowId->flowId, fs); ~^ ~~~~
uint64_t {aka long unsigned int}
long long unsigned int
%lu
depbase=echo output_raw.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';\
gcc -DHAVE_CONFIG_H -I. -I../.. -I.. -I../include -I../libnffile -I../libnfdump -I../inline -g -O3 -std=gnu17 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -fno-strict-aliasing -pthread -MT output_raw.o -MD -MP -MF $depbase.Tpo -c -o output_raw.o output_raw.c &&\ mv -f $depbase.Tpo $depbase.Po output_raw.c: In function ‘stringsEXflowId’: output_raw.c:824:46: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 824 fprintf(stream, " flow ID = 0x%13llx\n", flowId->flowId); ~^ ~~~~~~
uint64_t {aka long unsigned int}
long long unsigned int
%13lx

rm -f liboutput.a ar cru liboutput.a output.o output_util.o output_csv.o output_fmt.o output_json.o output_raw.o

nfstat.c: In function ‘PrintJsonStatLine’: nfstat.c:1234:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 10 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 1234 "{ \"first\" : \"%s.%03u\", \"last\" : \"%s.%03u\", \"proto\" : %u, \"%s\" : \"%s\", \"geo\" : \"%s\"," ^~~~~~~~~~~~~~~~~~~~~~~ ...... 1237 valstr, geo, count_flows, count_packets, count_bytes, pps, bps, bpp); ~~~
uint64_t {aka long unsigned int}
nfstat.c:1235:29: note: format string is defined here 1235 "\"flows\" : %llu, \"packets\" : %llu, \"bytes\" : %llu, \"pps\" : %llu, \"bps\" : %llu, \"bpp\" : %u}\n", ~~~^
long long unsigned int
%lu
nfstat.c:1234:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 11 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 1234 "{ \"first\" : \"%s.%03u\", \"last\" : \"%s.%03u\", \"proto\" : %u, \"%s\" : \"%s\", \"geo\" : \"%s\"," ^~~~~~~~~~~~~~~~~~~~~~~ ...... 1237 valstr, geo, count_flows, count_packets, count_bytes, pps, bps, bpp); ~~~~~
uint64_t {aka long unsigned int}
nfstat.c:1235:49: note: format string is defined here 1235 "\"flows\" : %llu, \"packets\" : %llu, \"bytes\" : %llu, \"pps\" : %llu, \"bps\" : %llu, \"bpp\" : %u}\n", ~~~^
long long unsigned int
%lu
nfstat.c:1234:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 12 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 1234 "{ \"first\" : \"%s.%03u\", \"last\" : \"%s.%03u\", \"proto\" : %u, \"%s\" : \"%s\", \"geo\" : \"%s\"," ^~~~~~~~~~~~~~~~~~~~~~~ ...... 1237 valstr, geo, count_flows, count_packets, count_bytes, pps, bps, bpp); ~~~
uint64_t {aka long unsigned int}
nfstat.c:1235:67: note: format string is defined here 1235 "\"flows\" : %llu, \"packets\" : %llu, \"bytes\" : %llu, \"pps\" : %llu, \"bps\" : %llu, \"bpp\" : %u}\n", ~~~^
long long unsigned int
%lu
nfstat.c:1234:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 13 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 1234 "{ \"first\" : \"%s.%03u\", \"last\" : \"%s.%03u\", \"proto\" : %u, \"%s\" : \"%s\", \"geo\" : \"%s\"," ^~~~~~~~~~~~~~~~~~~~~~~ ...... 1237 valstr, geo, count_flows, count_packets, count_bytes, pps, bps, bpp); ~~~
uint64_t {aka long unsigned int}
nfstat.c:1235:83: note: format string is defined here 1235 "\"flows\" : %llu, \"packets\" : %llu, \"bytes\" : %llu, \"pps\" : %llu, \"bps\" : %llu, \"bpp\" : %u}\n", ~~~^
long long unsigned int
%lu
nfstat.c:1234:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 14 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 1234 "{ \"first\" : \"%s.%03u\", \"last\" : \"%s.%03u\", \"proto\" : %u, \"%s\" : \"%s\", \"geo\" : \"%s\"," ^~~~~~~~~~~~~~~~~~~~~~~ ...... 1237 valstr, geo, count_flows, count_packets, count_bytes, pps, bps, bpp); ~~~
uint64_t {aka long unsigned int}
nfstat.c:1235:99: note: format string is defined here 1235 "\"flows\" : %llu, \"packets\" : %llu, \"bytes\" : %llu, \"pps\" : %llu, \"bps\" : %llu, \"bpp\" : %u}\n", ~~~^
long long unsigned int
%lu
nfstat.c:1240:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 9 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 1240 "{ \"first\" : \"%s.%03u\", \"last\" : \"%s.%03u\", \"proto\" : %u, \"%s\" : \"%s\", " ^~~~~~~~~~~~~~~~~~ ...... 1243 valstr, count_flows, count_packets, count_bytes, pps, bps, bpp); ~~~
uint64_t {aka long unsigned int}
nfstat.c:1241:29: note: format string is defined here 1241 "\"flows\" : %llu, \"packets\" : %llu, \"bytes\" : %llu, \"pps\" : %llu, \"bps\" : %llu, \"bpp\" : %u}\n", ~~~^
long long unsigned int
%lu
nfstat.c:1240:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 10 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 1240 "{ \"first\" : \"%s.%03u\", \"last\" : \"%s.%03u\", \"proto\" : %u, \"%s\" : \"%s\", " ^~~~~~~~~~~~~~~~~~ ...... 1243 valstr, count_flows, count_packets, count_bytes, pps, bps, bpp); ~~~~~
uint64_t {aka long unsigned int}
nfstat.c:1241:49: note: format string is defined here 1241 "\"flows\" : %llu, \"packets\" : %llu, \"bytes\" : %llu, \"pps\" : %llu, \"bps\" : %llu, \"bpp\" : %u}\n", ~~~^
long long unsigned int
%lu
nfstat.c:1240:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 11 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 1240 "{ \"first\" : \"%s.%03u\", \"last\" : \"%s.%03u\", \"proto\" : %u, \"%s\" : \"%s\", " ^~~~~~~~~~~~~~~~~~ ...... 1243 valstr, count_flows, count_packets, count_bytes, pps, bps, bpp); ~~~
uint64_t {aka long unsigned int}
nfstat.c:1241:67: note: format string is defined here 1241 "\"flows\" : %llu, \"packets\" : %llu, \"bytes\" : %llu, \"pps\" : %llu, \"bps\" : %llu, \"bpp\" : %u}\n", ~~~^
long long unsigned int
%lu
nfstat.c:1240:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 12 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 1240 "{ \"first\" : \"%s.%03u\", \"last\" : \"%s.%03u\", \"proto\" : %u, \"%s\" : \"%s\", " ^~~~~~~~~~~~~~~~~~ ...... 1243 valstr, count_flows, count_packets, count_bytes, pps, bps, bpp); ~~~
uint64_t {aka long unsigned int}
nfstat.c:1241:83: note: format string is defined here 1241 "\"flows\" : %llu, \"packets\" : %llu, \"bytes\" : %llu, \"pps\" : %llu, \"bps\" : %llu, \"bpp\" : %u}\n", ~~~^
long long unsigned int
%lu
nfstat.c:1240:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 13 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] 1240 "{ \"first\" : \"%s.%03u\", \"last\" : \"%s.%03u\", \"proto\" : %u, \"%s\" : \"%s\", " ^~~~~~~~~~~~~~~~~~ ...... 1243 valstr, count_flows, count_packets, count_bytes, pps, bps, bpp); ~~~
uint64_t {aka long unsigned int}
nfstat.c:1241:99: note: format string is defined here 1241 "\"flows\" : %llu, \"packets\" : %llu, \"bytes\" : %llu, \"pps\" : %llu, \"bps\" : %llu, \"bpp\" : %u}\n", ~~~^
long long unsigned int
%lu

nfstat.c:1101:10: warning: variable ‘tag_string’ set but not used [-Wunused-but-set-variable] 1101 | char tag_string[2] = {'\0', '\0'}; | ^~~~~~ depbase=echo nflowcache.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';\ gcc -DHAVE_CONFIG_H -I. -I../.. -I.. -Icompat_1_6_x -I../include -I../libnffile -I../libnfdump -I../output -I../tor -I../netflow -I../collector -I../inline -g -O3 -std=gnu17 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -fno-strict-aliasing -pthread -MT nflowcache.o -MD -MP -MF $depbase.Tpo -c -o nflowcache.o nflowcache.c &&\ mv -f $depbase.Tpo $depbase.Po nflowcache.c: In function ‘AddFlowCache’: nflowcache.c:876:13: warning: array subscript ‘int128 unsigned[1]’ is partly outside array bounds of ‘hashValue_t[1]’ {aka ‘struct hashValue_s[1]’} [-Warray-bounds] 876 | memcpy((void )keyptr->dstAddr, (void )ipv6Flow->dstAddr, 16); | ^~~~~~~~~~~~~~ nflowcache.c:1475:17: note: while referencing ‘hashValue’ 1475 | hashValue_t hashValue = {0}; | ^~~~~ nflowcache.c:877:29: warning: array subscript ‘FlowKeyV6_t {aka struct FlowKeyV6_s}[0]’ is partly outside array bounds of ‘hashValue_t[1]’ {aka ‘struct hashValue_s[1]’} [-Warray-bounds] 877 | keyptr->srcPort = genericFlow->srcPort; | ~~~~^~~~~~ nflowcache.c:1475:17: note: while referencing ‘hashValue’ 1475 | hashValue_t hashValue = {0}; | ^~~~~ nflowcache.c:878:29: warning: array subscript ‘FlowKeyV6_t {aka struct FlowKeyV6_s}[0]’ is partly outside array bounds of ‘hashValue_t[1]’ {aka ‘struct hashValue_s[1]’} [-Warray-bounds] 878 | keyptr->dstPort = genericFlow->dstPort; | ~~~~^~~~~~ nflowcache.c:1475:17: note: while referencing ‘hashValue’ 1475 | hashValue_t hashValue = {0}; | ^~~~~ nflowcache.c:879:27: warning: array subscript ‘FlowKeyV6_t {aka struct FlowKeyV6_s}[0]’ is partly outside array bounds of ‘hashValue_t[1]’ {aka ‘struct hashValue_s[1]’} [-Warray-bounds] 879 | keyptr->proto = genericFlow->proto; | ~~~~^~~~~~ nflowcache.c:1475:17: note: while referencing ‘hashValue’ 1475 | hashValue_t hashValue = {0}; | ^~~~~ nflowcache.c:880:24: warning: array subscript ‘FlowKeyV6_t {aka struct FlowKeyV6_s}[0]’ is partly outside array bounds of ‘hashValue_t[1]’ {aka ‘struct hashValue_s[1]’} [-Warray-bounds] 880 | keyptr->af = AF_INET6; | ^ nflowcache.c:1475:17: note: while referencing ‘hashValue’ 1475 | hashValue_t hashValue = {0}; | ^~~~~ nflowcache.c:876:13: warning: array subscript ‘int128 unsigned[1]’ is partly outside array bounds of ‘hashValue_t[1]’ {aka ‘struct hashValue_s[1]’} [-Warray-bounds] 876 | memcpy((void )keyptr->dstAddr, (void )ipv6Flow->dstAddr, 16); | ^~~~~~~~~~~~~~ nflowcache.c:1321:17: note: while referencing ‘hashValue’ 1321 | hashValue_t hashValue = {0}; | ^~~~~ nflowcache.c:877:29: warning: array subscript ‘FlowKeyV6_t {aka struct FlowKeyV6_s}[0]’ is partly outside array bounds of ‘hashValue_t[1]’ {aka ‘struct hashValue_s[1]’} [-Warray-bounds] 877 | keyptr->srcPort = genericFlow->srcPort; | ~~~~^~~~~~ nflowcache.c:1321:17: note: while referencing ‘hashValue’ 1321 | hashValue_t hashValue = {0}; | ^~~~~ nflowcache.c:878:29: warning: array subscript ‘FlowKeyV6_t {aka struct FlowKeyV6_s}[0]’ is partly outside array bounds of ‘hashValue_t[1]’ {aka ‘struct hashValue_s[1]’} [-Warray-bounds] 878 | keyptr->dstPort = genericFlow->dstPort; | ~~~~^~~~~~ nflowcache.c:1321:17: note: while referencing ‘hashValue’ 1321 | hashValue_t hashValue = {0}; | ^~~~~ nflowcache.c:879:27: warning: array subscript ‘FlowKeyV6_t {aka struct FlowKeyV6_s}[0]’ is partly outside array bounds of ‘hashValue_t[1]’ {aka ‘struct hashValue_s[1]’} [-Warray-bounds] 879 | keyptr->proto = genericFlow->proto; | ~~~~^~~~~~ nflowcache.c:1321:17: note: while referencing ‘hashValue’ 1321 | hashValue_t hashValue = {0}; | ^~~~~ nflowcache.c:880:24: warning: array subscript ‘FlowKeyV6_t {aka struct FlowKeyV6_s}[0]’ is partly outside array bounds of ‘hashValue_t[1]’ {aka ‘struct hashValue_s[1]’} [-Warray-bounds] 880 | keyptr->af = AF_INET6; | ^ nflowcache.c:1321:17: note: while referencing ‘hashValue’ 1321 | hashValue_t hashValue = {0}; | ^~~~~ depbase=echo nfprof.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';\

phaag commented 2 months ago

Fixed in master repo.