This is the mail archive of the 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]
Other format: [Raw text]

[Bug libstdc++/11953] _REENTRANT defined when compiling non-threaded code.

------- Comment #35 from marc dot waeckerlin at siemens dot com  2005-11-29 09:13 -------
I had a look in google about "#ifdef _REENTRANT", and it gets about 20'200
entries, so this is a widely used funtinality that must not be broken!

Imagine all the code the does the "#ifdef _REENTRANT" to enable threading: If
now _REENTRANT is always true, regardless of whether -pthreads is given or not,
then all this code will crash when compiled with gcc += 3.4!

This is really a severe problem!

Please return to the previous behaviour of _REENTRANT, and fix it for those
platforms, where it previousely did not work (s390x and ia64).

The _REENTRANT must work as 90% of the programmers expect it to work! It wasn't
my idea to look for _REENTRANT, i learnt it from a collegue who has seen it in
system C libraries and e.g. the QpThread library. It is a widely used feature!
It must neither be broken, nor be replaced by something else, sich as
__GCC_PTHREADS__ or the like!

In errno.h, AFAIK they also tested for _REENTRANT, now they test for:
#  if !defined _LIBC || defined _LIBC_REENTRANT

Is this an acceptable way to do it now, test for _LIBC_REENTRANT?

Reentrant is also used in /usr/include/features.h:
/* These are defined by the user (or the compiler)
   to specify the desired environment:
   _REENTRANT           Select additionally reentrant object.
   _THREAD_SAFE         Same as _REENTRANT, often used by other systems.
  --> So it should be set correctly by the compiler!!!!
#if defined _REENTRANT || defined _THREAD_SAFE
# define __USE_REENTRANT        1


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