This is the mail archive of the gcc-patches@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]

Hurd STL patch


Not all systems that use glibc 2.x have a pthreads library.  So
defining __STL_PTHREADS if __GLIBC__ >= 2 is not right.  Currently
only the Linux port comes with a pthreads implementation.
The following patch fixes the problem by checking if __linux__ is
defined.  I know this is evil, but I do not see an other option at
this moment.  The best thing to do would be to check if _POSIX_THREADS
is defined, but this demands the inclusion of <unistd.h>, which would
result in major name-space pollution.  An other solution would be to
check this at configure time, but there is no infrastructure for this
for the STL part of the library.

A better solution should be found for the new libstdc++ library
(that's why I CC'ed you folks).

Mark


1999-05-13  Mark Kettenis  <kettenis@gnu.org>

	* stl_config.h: Only define __STL_PTHREADS with GLIBC >= 2 for
	Linux.


Index: egcs/libstdc++/stl/stl_config.h
===================================================================
RCS file: /var/cvsroot/egcs/libstdc++/stl/stl_config.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 stl_config.h
--- stl_config.h	1999/05/13 13:34:00	1.1.1.1
+++ stl_config.h	1999/05/13 18:15:04
@@ -165,14 +165,16 @@
 #     define __SGI_STL_USE_AUTO_PTR_CONVERSIONS
 #     define __STL_USE_NAMESPACES
 #   endif
-    /* glibc pre 2.0 is very buggy. We have to disable thread for it.
-       It should be upgraded to glibc 2.0 or later. */
-#   if !defined(_NOTHREADS) && __GLIBC__ >= 2 && defined(_G_USING_THUNKS)
-#     define __STL_PTHREADS
-#     ifdef __STRICT_ANSI__
-        /* Work around a bug in the glibc 2.0.x pthread.h.  */
-#       define sigset_t __sigset_t
-#     endif
+#   if defined(__linux__)
+     /* glibc pre 2.0 is very buggy. We have to disable thread for it.
+        It should be upgraded to glibc 2.0 or later. */
+#    if !defined(_NOTHREADS) && __GLIBC__ >= 2 && defined(_G_USING_THUNKS)
+#      define __STL_PTHREADS
+#      ifdef __STRICT_ANSI__
+         /* Work around a bug in the glibc 2.0.x pthread.h.  */
+#        define sigset_t __sigset_t
+#      endif
+#    endif
 #   endif
 #   ifdef __EXCEPTIONS
 #     define __STL_USE_EXCEPTIONS


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