This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[PATCH, libstdc++] Protect thread tests with #ifdef __GTHREADS
- From: David Edelsohn <dje at watson dot ibm dot com>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Wed, 04 May 2005 16:25:30 -0400
- Subject: [PATCH, libstdc++] Protect thread tests with #ifdef __GTHREADS
- References: <200505041425.j44EP2029938@makai.watson.ibm.com> <4278E16D.8030305@suse.de>
A number of libstdc++ testcases are failing on AIX because the
testcases reference specializations that only are present when __GTHREADS
is defined. This patch protects the tests with #ifdef __GTHREADS so that
they compile and run when __GTHREADS is not defined.
Okay for mainline?
Thanks, David
* testsuite/ext/mt_allocator/check_deallocate_null_thread.cc:
Bracket with #ifdef __GTHREADS.
* testsuite/ext/mt_allocator/deallocate_global_thread-1.cc: Same.
* testsuite/ext/mt_allocator/deallocate_global_thread-3.cc: Same.
* testsuite/ext/mt_allocator/deallocate_local_thread-1.cc: Same.
* testsuite/ext/mt_allocator/deallocate_local_thread-3.cc: Same.
Index: check_deallocate_null_thread.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/ext/mt_allocator/check_deallocate_null_thread.cc,v
retrieving revision 1.2
diff -c -p -r1.2 check_deallocate_null_thread.cc
*** check_deallocate_null_thread.cc 28 Oct 2004 20:46:08 -0000 1.2
--- check_deallocate_null_thread.cc 4 May 2005 20:20:40 -0000
***************
*** 24,34 ****
--- 24,37 ----
int main()
{
+ #ifdef __GTHREADS
typedef int value_type;
using __gnu_cxx::__pool;
typedef __gnu_cxx::__common_pool_policy<__pool, true> policy_type;
typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
__gnu_test::check_deallocate_null<allocator_type>();
+ #endif
+
return 0;
}
Index: deallocate_global_thread-1.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-1.cc,v
retrieving revision 1.5
diff -c -p -r1.5 deallocate_global_thread-1.cc
*** deallocate_global_thread-1.cc 28 Oct 2004 20:46:08 -0000 1.5
--- deallocate_global_thread-1.cc 4 May 2005 20:20:40 -0000
***************
*** 19,24 ****
--- 19,26 ----
// 20.4.1.1 allocator members
+ #ifdef __GTHREADS
+
#include <list>
#include <string>
#include <stdexcept>
*************** int main()
*** 82,84 ****
--- 84,93 ----
l.push_back("bayou bend");
return 0;
}
+
+ #else
+
+ int main() {}
+
+ #endif
+
Index: deallocate_global_thread-3.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-3.cc,v
retrieving revision 1.5
diff -c -p -r1.5 deallocate_global_thread-3.cc
*** deallocate_global_thread-3.cc 28 Oct 2004 20:46:08 -0000 1.5
--- deallocate_global_thread-3.cc 4 May 2005 20:20:40 -0000
***************
*** 19,24 ****
--- 19,26 ----
// 20.4.1.1 allocator members
+ #ifdef __GTHREADS
+
#include <list>
#include <string>
#include <stdexcept>
*************** int main()
*** 82,84 ****
--- 84,93 ----
l.push_back("bayou bend");
return 0;
}
+
+ #else
+
+ int main() {}
+
+ #endif
+
Index: deallocate_local_thread-1.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-1.cc,v
retrieving revision 1.5
diff -c -p -r1.5 deallocate_local_thread-1.cc
*** deallocate_local_thread-1.cc 28 Oct 2004 20:46:08 -0000 1.5
--- deallocate_local_thread-1.cc 4 May 2005 20:20:40 -0000
***************
*** 19,24 ****
--- 19,26 ----
// 20.4.1.1 allocator members
+ #ifdef __GTHREADS
+
#include <string>
#include <stdexcept>
#include <ext/mt_allocator.h>
*************** int main()
*** 80,82 ****
--- 82,91 ----
}
return 0;
}
+
+ #else
+
+ int main() {}
+
+ #endif
+
Index: deallocate_local_thread-3.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-3.cc,v
retrieving revision 1.5
diff -c -p -r1.5 deallocate_local_thread-3.cc
*** deallocate_local_thread-3.cc 28 Oct 2004 20:46:08 -0000 1.5
--- deallocate_local_thread-3.cc 4 May 2005 20:20:40 -0000
***************
*** 19,24 ****
--- 19,26 ----
// 20.4.1.1 allocator members
+ #ifdef __GTHREADS
+
#include <string>
#include <stdexcept>
#include <ext/mt_allocator.h>
*************** int main()
*** 81,83 ****
--- 83,91 ----
}
return 0;
}
+
+ #else
+
+ int main() {}
+
+ #endif