Bug 17398 - _REENTRANT is getting defined.
Summary: _REENTRANT is getting defined.
Status: RESOLVED DUPLICATE of bug 11953
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 3.4.2
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-10 15:09 UTC by Bill Crocker
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bill Crocker 2004-09-10 15:09:52 UTC
GCC Team:

Version of GCC: 3.4.2
System type: Linux juno 2.4.20-20.8 #1 Mon Aug 18 14:59:07 EDT 2003 i686 i686
i386 GNU/Linux
Build options: [whc@juno gcc]$ usr_local_3.4.2/bin/g++ -v
    Reading specs from
/home/whc/lintel/gcc/usr_local_3.4.2/lib/gcc/i686-pc-linux-gnu/3.4.2/specs
    Configured with: ./configure  : (reconfigured) ./configure
--prefix=/home/whc/lintel/gcc/usr_local_3.4.2
    Thread model: posix
    gcc version 3.4.2

I tried to compile my non-threaded application.
(I have some experimental thread code which is IFDEFed
 out using #ifdef _REENTRANT).

It be came apparent that this code was being
seen by the compiler implying that someone, somewhere
was defining _REENTRANT.

The following program demonstrated that fact.
(Yes, I know I should include iostream
 instead of iostream.h but I still have a couple of ports
 to compilers which do not support the standard yet and until
 iostream.h disappears completely it should work.)

-----------------------------

#include <iostream.h>

int
main() {
#   ifdef _REENTRANT
        cerr << "_REENTRANT is defined" << endl;
#   else
        cerr << "_REENTRANT is NOT defined" << endl;
#   endif
    return 1;
}

------------- Building and running

[whc@juno usl_t]$ make z.o
/home/whc/lintel/gcc/usr_local_3.4.2/bin/g++ -c  -O3 -ffast-math  -I. -DNDEBUG
-DLINTEL -DGCC_VER=2 -fwritable-strings -Wno-deprecated -fno-for-scope
-fcheck-new -Wno-invalid-offsetof -I../purify -I../compat -I../setpaths z.cc
cc1plus: note: -fwritable-strings is deprecated; see documentation for details
[whc@juno usl_t]$ make z
/home/whc/lintel/gcc/usr_local_3.4.2/bin/g++   z.o   -o z
[whc@juno usl_t]$ ./z
_REENTRANT is defined

-----------------------------

I traced it to this file:

	i686-pc-linux-gnu/bits/c++io.h

in which I commented out a couple of lines and
then _REENTRANT stopped being defined.

-------------------- My quick fix.
...
...
...
#include <cstdio>
#include <cstddef>
// #include <bits/gthr.h>				<--- Commented out.

namespace std
{
  // typedef __gthread_mutex_t __c_lock;		<--- Commented out.

  // for basic_file.h
  typedef FILE __c_file;
...
...
...
--------------------

What the-right-thing-to-do-here is I will
leave up to you.

Bill
Comment 1 Andrew Pinski 2004-09-10 15:25:15 UTC

*** This bug has been marked as a duplicate of 11953 ***