This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[PATCH] Fix spurious failures on Solaris 2.6 and below
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: libstdc++ at gcc dot gnu dot org
- Date: Thu, 17 Feb 2005 09:07:57 +0100
- Subject: [PATCH] Fix spurious failures on Solaris 2.6 and below
Hi,
We always have had the following failures on Solaris 2.6 and below:
FAIL: thread/pthread1.cc (test for excess errors)
WARNING: thread/pthread1.cc compilation failed to produce executable
FAIL: thread/pthread2.cc (test for excess errors)
WARNING: thread/pthread2.cc compilation failed to produce executable
FAIL: thread/pthread3.cc (test for excess errors)
WARNING: thread/pthread3.cc compilation failed to produce executable
FAIL: thread/pthread4.cc (test for excess errors)
WARNING: thread/pthread4.cc compilation failed to produce executable
FAIL: thread/pthread5.cc (test for excess errors)
WARNING: thread/pthread5.cc compilation failed to produce executable
FAIL: thread/pthread6.cc (test for excess errors)
WARNING: thread/pthread6.cc compilation failed to produce executable
FAIL: thread/pthread7-rope.cc (test for excess errors)
WARNING: thread/pthread7-rope.cc compilation failed to produce executable
They come from the Solaris-specific tweak present in every pthread*.cc file:
#if defined(__sun) && defined(__svr4__)
pthread_setconcurrency (thread_pairs * 2);
#endif
It turns out that pthread_setconcurrency is only available in Solaris 7 and
later, so we need to differentiate the Solaris versions. It's easy: the
macro _XOPEN_VERSION is at most 4 up to Solaris 2.6, while it is at least 500
from Solaris 7 and on.
The patch has been tested on Solaris 2.5.1, 2.6, 7 (all branches) and I have
manually verified with gcc -E that the call to pthread_setconcurrency is
still present on Solaris 7. OK for all active branches?
2005-02-17 Eric Botcazou <ebotcazou@libertysurf.fr>
* testsuite/thread/pthread1.cc: Do not invoke pthread_setconcurrency
on Solaris 2.6 and below.
* testsuite/thread/pthread2.cc: Likewise.
* testsuite/thread/pthread3.cc: Likewise.
* testsuite/thread/pthread4.cc: Likewise.
* testsuite/thread/pthread5.cc: Likewise.
* testsuite/thread/pthread6.cc: Likewise.
* testsuite/thread/pthread7-rope.cc: Likewise.
--
Eric Botcazou
Index: testsuite/thread/pthread1.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/thread/pthread1.cc,v
retrieving revision 1.11
diff -u -r1.11 pthread1.cc
--- testsuite/thread/pthread1.cc 6 Oct 2004 22:12:34 -0000 1.11
+++ testsuite/thread/pthread1.cc 17 Feb 2005 07:36:13 -0000
@@ -111,7 +111,7 @@
task_queue* tq[thread_pairs];
-#if defined(__sun) && defined(__svr4__)
+#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500
pthread_setconcurrency (thread_pairs * 2);
#endif
Index: testsuite/thread/pthread2.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/thread/pthread2.cc,v
retrieving revision 1.6
diff -u -r1.6 pthread2.cc
--- testsuite/thread/pthread2.cc 6 Oct 2004 22:12:34 -0000 1.6
+++ testsuite/thread/pthread2.cc 17 Feb 2005 07:36:13 -0000
@@ -48,7 +48,7 @@
{
pthread_t tid[max_thread_count];
-#if defined(__sun) && defined(__svr4__)
+#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500
pthread_setconcurrency (max_thread_count);
#endif
Index: testsuite/thread/pthread3.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/thread/pthread3.cc,v
retrieving revision 1.6
diff -u -r1.6 pthread3.cc
--- testsuite/thread/pthread3.cc 6 Oct 2004 22:12:34 -0000 1.6
+++ testsuite/thread/pthread3.cc 17 Feb 2005 07:36:13 -0000
@@ -45,7 +45,7 @@
{
pthread_t tid[max_thread_count];
-#if defined(__sun) && defined(__svr4__)
+#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500
pthread_setconcurrency (max_thread_count);
#endif
Index: testsuite/thread/pthread4.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/thread/pthread4.cc,v
retrieving revision 1.10
diff -u -r1.10 pthread4.cc
--- testsuite/thread/pthread4.cc 6 Oct 2004 22:12:34 -0000 1.10
+++ testsuite/thread/pthread4.cc 17 Feb 2005 07:36:13 -0000
@@ -98,7 +98,7 @@
int
main (void)
{
-#if defined(__sun) && defined(__svr4__)
+#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500
pthread_setconcurrency (2);
#endif
Index: testsuite/thread/pthread5.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/thread/pthread5.cc,v
retrieving revision 1.10
diff -u -r1.10 pthread5.cc
--- testsuite/thread/pthread5.cc 6 Oct 2004 22:12:34 -0000 1.10
+++ testsuite/thread/pthread5.cc 17 Feb 2005 07:36:13 -0000
@@ -100,7 +100,7 @@
int ids[NTHREADS];
void* status;
-#if defined(__sun) && defined(__svr4__)
+#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500
pthread_setconcurrency (NTHREADS);
#endif
Index: testsuite/thread/pthread6.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/thread/pthread6.cc,v
retrieving revision 1.8
diff -u -r1.8 pthread6.cc
--- testsuite/thread/pthread6.cc 6 Oct 2004 22:12:34 -0000 1.8
+++ testsuite/thread/pthread6.cc 17 Feb 2005 07:36:13 -0000
@@ -80,7 +80,7 @@
{
pthread_t tid[max_thread_count];
-#if defined(__sun) && defined(__svr4__)
+#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500
pthread_setconcurrency (max_thread_count);
#endif
Index: testsuite/thread/pthread7-rope.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/thread/pthread7-rope.cc,v
retrieving revision 1.9
diff -u -r1.9 pthread7-rope.cc
--- testsuite/thread/pthread7-rope.cc 6 Oct 2004 22:12:34 -0000 1.9
+++ testsuite/thread/pthread7-rope.cc 17 Feb 2005 07:36:13 -0000
@@ -68,7 +68,7 @@
pthread_t tid[max_thread_count];
-#if defined(__sun) && defined(__svr4__)
+#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500
pthread_setconcurrency (max_thread_count);
#endif