g++, pthread.h, and -ansi
Graeme Peterson
gp@qnx.com
Mon Apr 5 19:41:00 GMT 2004
Regarding "g++ -ansi...", this has been discussed before (probably more than
these two spots):
http://gcc.gnu.org/ml/gcc-bugs/1998-06/msg00269.html
and for QNX specifically (sorry I missed it):
http://mail.gnu.org/archive/html/bug-commoncpp/2003-03/msg00035.html
The problem still exists for QNX. We have failure points (#error) in our
system header files if non-ansi stuff like pthreads are asked for when
strict ansi is also asked for. The g++ headers wind up including posix
headers like pthread.h, and I am not sure of the best way to 'fix' this.
- I can define '_QNX_SOURCE' on the command line which (among other things)
defines '__EXT_POSIX1_199309' and overrides the -ansi. Could also put it in
the g++ headers, I suppose.
- Similarly I can define '__EXT_POSIX1_199309' on the command line, or
somewhere in the g++ headers (bits/gthread.h?).
Strict ansi, but posix too. Looks wrong. Has the decision been made to
include some posix functionality in the g++ headers even with '-ansi', or do
I have a problem with my g++ port/configure? I think our system header
files are correct. Are the g++ headers wrong? Anyone?
Thanks.
GP
More information about the Gcc
mailing list