Switch -Wunused-variable on?

Maciej W. Rozycki macro@codesourcery.com
Wed Apr 25 18:52:00 GMT 2012


On Wed, 25 Apr 2012, Sterling Augustine wrote:

> >>  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.

 That sounds silly, I didn't know that.  In this case a "static inline" 
dummy function would have to be provided indeed that makes the solution a 
bit less elegant then I would like it to be.  Still probably better than a 
maze of #ifdefs scattered throughout code, but YMMV.

  Maciej



More information about the Gdb mailing list