On Wed, Oct 29, 2014 at 08:12:49PM +0100, Geert Uytterhoeven wrote: > On Wed, Oct 29, 2014 at 7:15 PM, Josh Triplett <j...@joshtriplett.org> wrote: > > Document several common practices and conventions regarding conditional > > compilation, most notably the preference for ifdefs in headers rather > > than .c files. > > > > Signed-off-by: Josh Triplett <j...@joshtriplett.org> > > > +If you have a function or variable which may potentially go unused in a > > +particular configuration, and the compiler would warn about its definition > > +going unused, mark the definition as __maybe_unused rather than wrapping > > it in > > +a preprocessor conditional. (However, if a function or variable *always* > > goes > > +unused, delete it.) > > Personally, I don't like __maybe_unused. Once it's there, the compiler > will stop warning about it, even if it really becomes unused.
True. It's a tradeoff between getting the compiler to warn about unused code to allow removing it, and putting #ifdefs in .c files. However, in previous patch discussions, developers seem to come down pretty consistently on the side of "don't put #ifdefs in .c files". > Apart from that: > Acked-by: Geert Uytterhoeven <ge...@linux-m68k.org> Thanks! - Josh Triplett -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/