[Fwd: Strange behavior of preprocessor]

Neil Booth neil@daikokuya.demon.co.uk
Wed Sep 26 15:22:00 GMT 2001


David Taylor wrote:-

> Didn't receive any responce to this from help-gcc - is this a bug?
> 
> thanks,
> dtayl

It's some obscure silliness with Solaris headers and __STDC__.  It's
been explained to me many times, but I still can't remember what the
issue is.

Basically, it'll only work for you if it recognises the directory as a
system header directory.  I'd guess, therefore, that -isystem. instead
of -I. would work.

Neil.

> Subject: Strange behavior of preprocessor
> From: David Taylor <dtaylor@ejasent.com>
> To: help-gcc@gnu.org
> Date: Mon, 24 Sep 2001 22:41:55 -0700
> 
> I'm baffled by the behavior of the preprocessor in gcc 2.95.2 on Solaris
> 7.
> For example, this test program includes thread.h, which includes
> sys/signal.h, which conditionally includes sys/siginfo.h. But if I copy
> /usr/include/sys/signal.h to ./sys and compile with "-I.", the condition
> fails and sys/siginfo.h is not included (and a structure definition in
> sys/signal.h is skipped, which generates a parse error in thread.h).
> 
> The condition in sys/signal.h is:
> 
> #if defined(__EXTENSIONS__) || (__STDC__ - 0 == 0) || \
>         defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
>         defined(_XPG4_2)
> 
> The Sun SparcWorks compiler doesn't do this - the condition succeeds in
> both cases.
> The steps to reproduce are below.
> 
> Any help appreciated.
> dtayl



More information about the Gcc-bugs mailing list