This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/11953] _REENTRANT defined when compiling non-threaded code.
- From: "marc dot waeckerlin at siemens dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Nov 2005 09:27:10 -0000
- Subject: [Bug libstdc++/11953] _REENTRANT defined when compiling non-threaded code.
- References: <bug-11953-794@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #36 from marc dot waeckerlin at siemens dot com 2005-11-29 09:27 -------
New information:
_REENTRANT is definitively defined in the headers:
> echo "" | g++ \
-I /usr/include/c++/4.0.2 -I /usr/include/c++/4.0.2/i586-suse-linux \
-E -dM -c - | grep REENTRANT
> echo "" | g++ \
-I /usr/include/c++/4.0.2 -I /usr/include/c++/4.0.2/i586-suse-linux \
-E -dM -c -pthread - | grep REENTRANT
#define _REENTRANT 1
> echo "#include<iostream>" | g++ \
-I /usr/include/c++/4.0.2 -I /usr/include/c++/4.0.2/i586-suse-linux \
-E -dM -c - | grep REENTRANT
#define _REENTRANT 1
#define _POSIX_REENTRANT_FUNCTIONS 1
--> So, without "#include <iostream>" it works as expected!
This opens a new possibility to work around this bug:
--------------file.cpp
#define GCC_BUGFIX _REENTRANT
#include <iostream>
#include ...
#undef _REENTRANT
#define _REENTRANT GCC_BUGFIX
#ifdef _REENTRANT
...
#endif
----------------------
> g++ -v
Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib
--enable-languages=c,c++,objc,f95,java,ada --disable-checking
--with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-java-awt=gtk
--disable-libjava-multilib --with-slibdir=/lib --with-system-zlib
--enable-shared --enable-__cxa_atexit --without-system-libunwind
--host=i586-suse-linux
Thread model: posix
gcc version 4.0.2 20050901 (prerelease) (SUSE Linux)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11953