#ifdef vs #if for feature checks

Lubos Lunak l.lunak at suse.cz
Mon Mar 18 09:17:30 PDT 2013


On Monday 18 of March 2013, Tor Lillqvist wrote:
> > Sounds great to me too; though of course I'd prefer to keep the diff
> > smaller and not replace all the header guards:
> >
> > #ifndef INCLUDED_OOXML_FAST_CONTEXT_HANDLER_HXX
> > #define INCLUDED_OOXML_FAST_CONTEXT_HANDLER_HXX

 This is not about include guards at all (there's nothing to set the value to 
0 for starters). This is only about #ifdef checks for values from 
config_xxx.hxx (and those that should eventually be converted to such ones).

 I have pushed commits adding -Wundef in order to detect such problems, and 
fixed various problems found by it.

 All the feature macros used in config_xxx.hxx headers now should be 
converted. I think it should be possible to do a compiler plugin to catch 
incorrect #ifdef usage later too.

> Oh the other hand, it would be nice if the header guards were
> consistently named... and didn't start with an underscore (such
> identifiers are supposed to be reserved for the language and/or OS
> implementation, unless I am mistaken). Somebody just needs to come up
> with a consistent naming style and do it (with some nice script). (The
> style of above example would be fine with me.)

 Yes, a script should be enough for this. And yes, "somebody" just needs to do 
it :). 

-- 
 Lubos Lunak
 l.lunak at suse.cz


More information about the LibreOffice mailing list