This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Fwd: Strange behavior of preprocessor]


Hi -

"gcc -isystem.  -H test.c" produces the same output as  "gcc -H test.c", i.e.
it searches only system header directories:

/usr/include/thread.h
 /usr/include/sys/signal.h
  /usr/include/sys/feature_tests.h
   /usr/include/sys/isa_defs.h
  /usr/include/sys/unistd.h
  /usr/include/sys/siginfo.h

which doesn't solve the problem - getting "-I." to do what it's  supposed to
do:

/usr/include/thread.h
 ./sys/signal.h
  /usr/include/sys/feature_tests.h
   /usr/include/sys/isa_defs.h
  /usr/include/sys/unistd.h
  /usr/include/sys/siginfo.h

Is there any way to get "-I" to behave correctly, or is it broken on Solaris?

Thanks for the prompt response,
dtayl

Neil Booth wrote:

> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]