diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-12-09 02:52:33 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-12-09 02:52:33 +0000 |
commit | b961881fb35d6d678daeb82fdf51e625b90c206b (patch) | |
tree | 15ee61537fcbbb442c08a228cafd2fdc45871769 /configure.ac | |
parent | ea47ca37b1aca1b6da320597379178a21f8bc388 (diff) |
Add some additional arguments to AC_WIRESHARK_GCC_CFLAGS_CHECK() to make
it do an additional check, if it finds that a given compiler option is
supported by the compiler, to see whether it's supported but
undesirable. The arguments are a chunk of code to try to compile with
-Werror, and a string to be used in the "checking..." message printed
when trying to compile the cunk of code.
Try enabling -Wshadow again, but have it check whether
extern int atoi(char *p);
int
foo(char *p)
{
int (*fptr)(char *p) = atoi;
return fptr(p) * 2;
}
compiles with -Wshadow and -Werror, so that we don't use -Wshadow with
compilers that complain about that; some older versions of GCC complain
about that, and it's really not worth our effort to eliminate or rename
arguments in function prototypes to make -Wshadow work even with those
compilers.
svn path=/trunk/; revision=46475
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index 1f528d7fd4..508d295ebc 100644 --- a/configure.ac +++ b/configure.ac @@ -411,10 +411,6 @@ AC_ARG_ENABLE(extra-gcc-checks, AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wmissing-prototypes) AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wmissing-declarations) # - # epan/dissectors/packet-afs.c blocks this one for now. - # - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wshadow) - # # More cleanup needed for this on LP64. # AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wshorten-64-to-32) @@ -430,6 +426,28 @@ AC_WIRESHARK_GCC_CFLAGS_CHECK(-Warray-bounds) AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-align) AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wformat-security) AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wold-style-definition, C) +# +# XXX - OK for C++? +# +# Make sure -Wshadow doesn't complain about variables in function and +# function pointer declarations shadowing other variables; if not, don't +# turn it on, as some versions of GCC (including the one in at least +# some Xcode versions that came with Mac OS X 10.5) complain about +# that. +# +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wshadow, C, + [ +extern int atoi(char *p); + +int +foo(char *p) +{ + int (*fptr)(char *p) = atoi; + + return fptr(p) * 2; +} + ], + [warns about variables in function declarations shadowing other variables]) AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-error=unused-but-set-variable) ## for now # # Use the faster pre gcc 4.5 floating point precision if available; |