tcpdump mailing list archives

Re: -W options to gcc


From: Guy Harris <guy () alum mit edu>
Date: Tue, 7 May 2013 00:11:19 -0700


On Mar 28, 2013, at 5:02 PM, Guy Harris <guy () alum mit edu> wrote:

On Mar 28, 2013, at 4:41 PM, Michael Richardson <mcr () sandelman ca> wrote:


"Guy" == Guy Harris <guy () alum mit edu> writes:
  Guy> Wireshark's configure script checks whether the GCC shell
  Guy> variable is "yes" or the CC shell variable is "clang" and, if
  Guy> true, sets a flag saying "this compiler supports -W options". 

Cooll.. can we copy and paste :-)

Wireshark's configuration scripts are GPLed, along with the rest of Wireshark, so, in principle, that might be a 
problem.

I didn't originally write that macro, so I can't just relicense it.

...and it's been a while since I looked at it, so I had to reimplement it from scratch, which eliminates the licensing 
issues.

So I've checked in changes to tcpdump and libpcap's configure scripts that add a macro to check whether the compiler 
supports a particular flag, and, if the .devel file is present, uses that to decide whether to add various -W flags.  
(It doesn't bother checking whether the compiler is GCC or not, nor does it explicitly check for clang; the easiest way 
to compile with clang on OS X is --without-gcc, which means you end up compiling with "cc", not "clang".)

We can use that to add some more -W flags to libpcap and tcpdump.  The ones that have been suggested are:

        -Wunused -Wunused-parameter - you suggested those;

        -W along with -Wno-unused-but-set-variable -Wno-unused-function -Wno-strict-aliasing - Gisle suggested those 
(tcpdump, but not libpcap, is built with -W).

It should probably also do a test to see whether the compiler supports -M and do the dependency-generation stuff iff 
.devel is present and the compiler supports -M, so that

        1) you can create .devel if you have a compiler that doesn't support -M for dependency generation

and

        2) if you have .devel, the dependency generation will be done if the compiler supports -M, regardless of 
whether it's GCC or not.
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Current thread: