Building (configure+gcc) tcpdump master branch with libpcap 0.6.1 yields the 
following compiler warnings, some of which are as easy as decorating a variable 
declaration with #ifdef:

./tcpdump.c: In function ‘open_interface’:
./tcpdump.c:1382:22: warning: passing argument 1 of ‘pcap_open_live’ discards 
‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  pc = pcap_open_live(device, ndo->ndo_snaplen, !pflag, 1000, ebuf);
                      ^~~~~~
In file included from ./tcpdump.c:97:0:
../libpcap/pcap.h:136:9: note: expected ‘char *’ but argument is of type ‘const 
char *’
 pcap_t *pcap_open_live(char *, int, int, int, char *);
         ^~~~~~~~~~~~~~
./tcpdump.c: At top level:
./tcpdump.c:221:22: warning: ‘show_tstamp_types_and_exit’ declared ‘static’ but 
never defined [-Wunused-function]
 static NORETURN void show_tstamp_types_and_exit(pcap_t *, const char *device);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
./tcpdump.c:195:12: warning: ‘Uflag’ defined but not used [-Wunused-variable]
 static int Uflag;   /* "unbuffered" output of dump files */
            ^~~~~
./tcpdump.c:190:12: warning: ‘jflag’ defined but not used [-Wunused-variable]
 static int jflag = -1;   /* packet time stamp source */
            ^~~~~
./tcpdump.c:155:12: warning: ‘Bflag’ defined but not used [-Wunused-variable]
 static int Bflag;   /* buffer size */
            ^~~~~
./print.c: In function ‘get_if_printer’:
./print.c:304:13: warning: implicit declaration of function 
‘pcap_datalink_val_to_name’; did you mean ‘pcap_datalink’? 
[-Wimplicit-function-declaration]
   dltname = pcap_datalink_val_to_name(type);
             ^~~~~~~~~~~~~~~~~~~~~~~~~
             pcap_datalink
./print.c:304:11: warning: assignment makes pointer from integer without a cast 
[-Wint-conversion]
   dltname = pcap_datalink_val_to_name(type);
           ^
./print-juniper.c: In function ‘juniper_parse_header’:
./print-juniper.c:1203:14: warning: unused variable ‘control_word’ 
[-Wunused-variable]
     uint32_t control_word;
              ^~~~~~~~~~~~
At top level:
./print-juniper.c:1197:1: warning: ‘juniper_parse_header’ defined but not used 
[-Wunused-function]
 juniper_parse_header(netdissect_options *ndo,
 ^~~~~~~~~~~~~~~~~~~~
./print-juniper.c:1079:1: warning: ‘juniper_ppp_heuristic_guess’ defined but 
not used [-Wunused-function]
 juniper_ppp_heuristic_guess(netdissect_options *ndo,
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
./print-juniper.c:441:25: warning: ‘juniper_protocol_values’ defined but not 
used [-Wunused-const-variable=]
 static const struct tok juniper_protocol_values[] = {
                         ^~~~~~~~~~~~~~~~~~~~~~~
./print-juniper.c:67:25: warning: ‘juniper_ipsec_type_values’ defined but not 
used [-Wunused-const-variable=]
 static const struct tok juniper_ipsec_type_values[] = {
                         ^~~~~~~~~~~~~~~~~~~~~~~~~
./util-print.c: In function ‘ts_format.isra.0’:
./util-print.c:265:27: warning: ‘%06u’ directive output may be truncated 
writing between 6 and 10 bytes into a region of size between 5 and 12 
[-Wformat-truncation=]
  format = "%02d:%02d:%02d.%06u";
                           ^~~~
./util-print.c:265:11: note: using the range [0, 4294967295] for directive 
argument
  format = "%02d:%02d:%02d.%06u";
           ^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:862:0,
                 from ./util-print.c:50:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: 
‘__builtin___snprintf_chk’ output between 16 and 27 bytes into a destination of 
size 21
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-- 
    Denis Ovsienko


_______________________________________________
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Reply via email to