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: "ro at techfak dot uni-bielefeld dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jun 2004 19:25:19 -0000
- Subject: [Bug libstdc++/11953] _REENTRANT defined when compiling non-threaded code.
- References: <20030817022106.11953.carlo@alinoe.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From ro at techfak dot uni-bielefeld dot de 2004-06-09 19:24 -------
Subject: Re: _REENTRANT defined when compiling non-threaded code.
mmitchel at gcc dot gnu dot org writes:
> Can we conditionalize the definition of _REENTRANT only for those platforms
> whose POSIX threads implementation really does depend on this?
That would be one possibility. Currently, only Tru64 UNIX V5.1[AB] is
known to need this.
Otherwise, a patch like the following would be necessary, which is really
ugly. It requires every user of gthr.h to define _REENTRANT for Tru64 UNIX
(or other platforms that need might it), even without knowing if pthreads
are in use at all. Currently, libjava has a mechanism for
platform-specific defines, while libobjc (the other gthr.h user) has not.
Rainer
Index: gcc/gthr-posix.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gthr-posix.h,v
retrieving revision 1.28
diff -u -p -r1.28 gthr-posix.h
--- gcc/gthr-posix.h 28 May 2004 20:18:23 -0000 1.28
+++ gcc/gthr-posix.h 9 Jun 2004 14:09:19 -0000
@@ -35,11 +35,6 @@ Software Foundation, 59 Temple Place - S
#define __GTHREADS 1
-/* Some implementations of <pthread.h> require this to be defined. */
-#ifndef _REENTRANT
-#define _REENTRANT 1
-#endif
-
#include <pthread.h>
#include <unistd.h>
Index: gcc/config/alpha/t-osf-pthread
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/t-osf-pthread,v
retrieving revision 1.1
diff -u -p -r1.1 t-osf-pthread
--- gcc/config/alpha/t-osf-pthread 31 Jul 2003 12:01:06 -0000 1.1
+++ gcc/config/alpha/t-osf-pthread 9 Jun 2004 14:09:21 -0000
@@ -2,4 +2,4 @@
LIB2FUNCS_EXTRA += $(srcdir)/gthr-posix.c
# Compile libgcc2 with POSIX threads supports
-TARGET_LIBGCC2_CFLAGS=-pthread
+TARGET_LIBGCC2_CFLAGS += -pthread
Index: libobjc/thr-objc.c
===================================================================
RCS file: /cvs/gcc/gcc/libobjc/thr-objc.c,v
retrieving revision 1.3
diff -u -p -r1.3 thr-objc.c
--- libobjc/thr-objc.c 23 May 2003 20:25:39 -0000 1.3
+++ libobjc/thr-objc.c 9 Jun 2004 14:10:43 -0000
@@ -30,6 +30,10 @@ Boston, MA 02111-1307, USA. */
#include "defaults.h"
#include <objc/thr.h>
#include "runtime.h"
+/* Tru64 UNIX V5.1[AB] <pthread.h> requires this to be defined. */
+#ifndef _REENTRANT
+#define _REENTRANT 1
+#endif
#include <gthr.h>
/* Backend initialization functions */
Index: libstdc++-v3/configure.host
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/configure.host,v
retrieving revision 1.25
diff -u -p -r1.25 configure.host
--- libstdc++-v3/configure.host 27 Feb 2004 20:56:43 -0000 1.25
+++ libstdc++-v3/configure.host 9 Jun 2004 14:10:43 -0000
@@ -184,6 +184,9 @@ case "${host_os}" in
netbsd*)
os_include_dir="os/bsd/netbsd"
;;
+ osf*)
+ os_include_dir="os/osf"
+ ;;
qnx6.[12]*)
os_include_dir="os/qnx/qnx6.1"
c_model=c
with libstdc++-v3/config/os/osf containing copies of the generic ctype*.h
files and os_defines.h changed like this:
--- ../generic/os_defines.h Mon Jul 7 13:29:14 2003
+++ os_defines.h Mon May 24 17:08:38 2004
@@ -1,6 +1,6 @@
-// Specific definitions for generic platforms -*- C++ -*-
+// Specific definitions for HP Tru64 UNIX -*- C++ -*-
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// Copyright (C) 2004 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -34,4 +34,9 @@
// System-specific #define, typedefs, corrections, etc, go here. This
// file will come before all others.
+// Tru64 UNIX V5.1[AB] <pthread.h> requires this to be defined.
+#ifndef _REENTRANT
+#define _REENTRANT 1
+#endif
+
#endif
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11953