Re: Switch -Wunused-variable on?

Maciej W. Rozycki
2012-04-25T18:52:33Z

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