GPG 1.2.2 on Tru64 4.0F

David Shaw dshaw@jabberwocky.com
Mon May 5 21:24:02 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, May 05, 2003 at 11:34:00AM -0600, Joseph Bruni wrote:
> 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?

That's very odd.  What happens if you change the empty definition of
EXTERN_UNLESS_MAIN_MODULE in include/iobuf.h to:

   #define EXTERN_UNLESS_MAIN_MODULE " "

David
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.3.2-cvs (GNU/Linux)
Comment: http://www.jabberwocky.com/david/keys.asc

iD8DBQE+trpz4mZch0nhy8kRArx5AJ0eDWsrMdTBlxtAIqz6JWANsiqZKACfVseM
x6693/4K6f8wduA4ZX7Cqas=
=IMIk
-----END PGP SIGNATURE-----