GPG 1.2.2 on Tru64 4.0F

Joseph Bruni jbruni@mac.com
Mon May 5 19:33:02 2003


This is so much fun. The file ./include/iobuf.h contains the following snipet:

#ifndef EXTERN_UNLESS_MAIN_MODULE
 #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
  #define EXTERN_UNLESS_MAIN_MODULE extern
 #else
  #define EXTERN_UNLESS_MAIN_MODULE 
 #endif
#endif
EXTERN_UNLESS_MAIN_MODULE int iobuf_debug_mode;


While trying to compile ./util/g10u.c it seems that I've encountered a bug in DEC's (HP's) compiler. At the time that this header file is being compiled, the macro EXTERN_UNLESS_MAIN_MODULE is not defined. But, wonder of wonders, the C preprocessor does not evaluate either of the branches. At the point that iobuf_debug_mode is being defined, the macro EXTERN_UNLESS_MAIN_MODULE remains not defined at all. I ran this through the compiler with the -E option and was aghast at the results. For grins I inserted the following just before iobuf_debug_mode:


#ifndef EXTERN_UNLESS_MAIN_MODULE
#error
#endif
EXTERN_UNLESS_MAIN_MODULE int iobuf_debug_mode;

and the compile aborts because it hit my #error directive though it shouldn't have. I guess DEC's compiler doesn't like nested #if directives?


 

-- 
PGP Fingerprint:
886F 6A8A 68A1 5E90 EF3F  8EFA E2B8 3F99 7343 C1E3