Re: RFC: Use -Wall -Wextra

Eli Zaretskii
2006-12-30T15:32:40Z

> Date: Fri, 29 Dec 2006 16:02:06 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: gdb-patches@sourceware.org
>
> How about -Wall without -Wextra then?

Fine with me.

> I think neither of us is actually talking about -Walways-true.

Maybe. I was talking about this one (happens with yesterday's
snapshot):

gcc -c -DHAVE_CONFIG_H -I. -I.././readline -DRL_LIBRARY_VERSION='"5.1"' -g -O2 bind.c
bind.c: In function 'rl_function_of_keyseq':
bind.c:682: warning: comparison is always true due to limited range of data type
rm -f display.o
gcc -c -DHAVE_CONFIG_H -I. -I.././readline -DRL_LIBRARY_VERSION='"5.1"' -g -O2 display.c
display.c: In function 'rl_character_len':
display.c:1844: warning: comparison is always true due to limited range of data type

It looks like this happens even without -Wall. What a screwup!

> > gcc -c -g -O2 -I. -I. -I./config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../readline/.. -I../bfd -I./../bfd -I./../include -DMI_OUT=1 -DTUI=1 -Wall -Wextra -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused-parameter -Wno-unused -Wno-sign-compare -Wno-switch -Wno-missing-field-initializers -Werror infrun.c
> > cc1: warnings being treated as errors
> > infrun.c: In function 'handle_inferior_event':
> > infrun.c:1458: warning: statement with no effect
> > make[2]: *** [infrun.o] Error 1
>
> Thanks. That comes from the default definition of a macro which no
> longer has any non-default definitions; we may as well garbage collect
> it. I don't know why I didn't get the warning; I can provoke it for
> a small testcase.
>
> I'll remove the macro, since that's an unrelated cleanup.

I'll wait for the patch, thanks.