Hello,
 I'd like to propose that we convert our
#ifdef HAVE_FOO
to
#if HAVE_FOO
 The reason for this is that the sooner cannot tell a difference between the 
FOO feature not being there and any mistake (such as typo in name or #include 
<config_xxx.h> missing). As a practical example, I found out few days back 
that there was some code in the KDE vclplug that was never enabled, because I 
when writing it back then I added the necessary dmake stuff for the #define, 
but later vcl was converted to gbuild using gbuild patches from OOo, which 
didn't have it, so the feature was silently dropped.
 If we use the #if HAVE_FOO form, then with -Wundef any such mistake will be 
easily detected. It will also require adding #ifndef HAVE_FOO #define 
HAVE_FOO 0 #endif to config_xxx.h files, and the actual conversion, but that 
can be an easy hack.
 The problem with this change is that there still may be some cases where 
#ifdef is used, either because some system #defines work that way (so those 
would be valid but different), or people would still use #ifdef out of habbit 
or from AOO, which would then be broken, since the macro would be always 
defined. This however still should be possible to check mechanically, while I 
do not see a way to prevent the problem above.
 Opinions on this?
-- 
 Lubos Lunak
 l.lunak@suse.cz
Context
- #ifdef vs #if for feature checks · Lubos Lunak
 
   
 
  Privacy Policy |
  
Impressum (Legal Info) |
  
Copyright information: Unless otherwise specified, all text and images
  on this website are licensed under the
  
Creative Commons Attribution-Share Alike 3.0 License.
  This does not include the source code of LibreOffice, which is
  licensed under the Mozilla Public License (
MPLv2).
  "LibreOffice" and "The Document Foundation" are
  registered trademarks of their corresponding registered owners or are
  in actual use as trademarks in one or more countries. Their respective
  logos and icons are also subject to international copyright laws. Use
  thereof is explained in our 
trademark policy.