Liviu Nicoara wrote:
> A minor issue: -Wextra in gcc.config added for CXX_MAJOR != 2 breaks gcc
> builds. AFAICT, it's a valid option starting with 3.4.x.
I tested the flag with gcc 3.0 and it didn't object, but now I see
that it doesn't seem to mind just about anything:
$ echo "int main () { }" > t.cpp \
&& gcc -Wextra t.cpp
&& gcc -Wfoobar t.cpp
&& gcc -v
Reading specs from
/usr/local/gcc-3.0/lib/gcc-lib/sparc-sun-solaris2.9/3.0/specs
Configured with: /build/gcc-3.0/configure --prefix=/usr/local/gcc-3.0
--enable-languages=c,c++
Thread model: posix
gcc version 3.0
[...]
> -# enable additional warnings with gcc 3 and above
> -ifneq ($(CXX_MAJOR),2)
> +# enable additional warnings with gcc 3.4 and above
> +ifeq ($(shell expr $(CXX_MAJOR) \> 2),1)
> +ifeq ($(shell expr $(CXX_MINOR) \> 3),1)
I don't think this is quite right -- it fails to add the flag
for gcc 4.0 (and all other gcc x.y with y < 4). What we want
is:
ifeq ($(shell expr \( $(CXX_MAJOR) \> 2 \& $(CXX_MINOR) \> 3 \) \
\| $(CXX_MAJOR) \> 3 ))
But let me double-check that -Wextra is different than -W -- the
manual says they are the same but I could have sworn I've seen
it emit warnings not seen without it:
http://gcc.gnu.org/onlinedocs/gcc-4.0.2/gcc/Warning-Options.html#index-W-240
Martin
|