Switch -Wunused-variable on?

Sterling Augustine saugustine@google.com
Wed Apr 25 18:20:00 GMT 2012


On Wed, Apr 25, 2012 at 11:13 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> "Maciej W. Rozycki" <macro@codesourcery.com> writes:
>
>>  Then you don't actually need a definition, because the call will be
>> optimised away
>
> You still need to support unoptimized builds.

GCC eliminates the unreachable block of an "if (0)" even without
optimization. Many other compilers don't. It is an ongoing source of
complications for getting compilers other than GCC to build the linux
kernel which uses this approach extensively.

If the project cares about being able to build with compilers other
than GCC, then it should consider this approach as carefully as it
considers using any other GCC extension.

Sterling



More information about the Gdb mailing list