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]
Other format: [Raw text]

[Bug preprocessor/17398] New: _REENTRANT is getting defined.


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

-- 
           Summary: _REENTRANT is getting defined.
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: william dot crocker at analog dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17398


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