This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[patch] replace reinterpret_cast with static_cast in tests
- From: "Jonathan Wakely" <jwakely dot gcc at gmail dot com>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 24 Dec 2007 14:55:49 +0000
- Subject: [patch] replace reinterpret_cast with static_cast in tests
No need to use reinterpret_cast in these tests, static_cast is enough.
The copies of these tests under 20_util already use static_cast.
Texted x86-64/linux - OK for mainline?
* testsuite/tr1/2_general_utilities/shared_ptr/thread/
default_weaktoshared.cc: Use static_cast not reinterpret_cast.
* testsuite/tr1/2_general_utilities/shared_ptr/thread/
mutex_weaktoshared.cc: Likewise.
Index: testsuite/tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc
===================================================================
--- testsuite/tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc (revision 131157)
+++ testsuite/tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc (working copy)
@@ -82,7 +82,7 @@
void* thread_hammer_and_kill(void* opaque_pools)
{
- shared_and_weak_pools& pools = *reinterpret_cast<shared_and_weak_pools*>(opaque_pools);
+ shared_and_weak_pools& pools = *static_cast<shared_and_weak_pools*>(opaque_pools);
// Using the same parameters as in the RNG test cases.
std::tr1::mersenne_twister<
unsigned long, 32, 624, 397, 31,
@@ -117,7 +117,7 @@
void* thread_hammer(void* opaque_weak)
{
- wp_vector_t& weak_pool = *reinterpret_cast<wp_vector_t*>(opaque_weak);
+ wp_vector_t& weak_pool = *static_cast<wp_vector_t*>(opaque_weak);
// Using the same parameters as in the RNG test cases.
std::tr1::mersenne_twister<
unsigned long, 32, 624, 397, 31,
@@ -165,11 +165,11 @@
pthread_attr_init(&tattr);
shared_and_weak_pools pools(obj_pool, weak_pool[0]);
- pthread_create(threads, &tattr, thread_hammer_and_kill, reinterpret_cast<void*>(&pools));
+ pthread_create(threads, &tattr, thread_hammer_and_kill, static_cast<void*>(&pools));
for (unsigned int worker = 1; worker < HAMMER_MAX_THREADS; worker++)
{
if (pthread_create(&threads[worker], &tattr,
- thread_hammer, reinterpret_cast<void*>(&weak_pool[worker])))
+ thread_hammer, static_cast<void*>(&weak_pool[worker])))
std::abort();
}
// Wait for threads to complete, then check integrity of reference.
Index: testsuite/tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc
===================================================================
--- testsuite/tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc (revision 131157)
+++ testsuite/tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc (working copy)
@@ -84,7 +84,7 @@
void* thread_hammer_and_kill(void* opaque_pools)
{
- shared_and_weak_pools& pools = *reinterpret_cast<shared_and_weak_pools*>(opaque_pools);
+ shared_and_weak_pools& pools = *static_cast<shared_and_weak_pools*>(opaque_pools);
// Using the same parameters as in the RNG test cases.
std::tr1::mersenne_twister<
unsigned long, 32, 624, 397, 31,
@@ -119,7 +119,7 @@
void* thread_hammer(void* opaque_weak)
{
- wp_vector_t& weak_pool = *reinterpret_cast<wp_vector_t*>(opaque_weak);
+ wp_vector_t& weak_pool = *static_cast<wp_vector_t*>(opaque_weak);
// Using the same parameters as in the RNG test cases.
std::tr1::mersenne_twister<
unsigned long, 32, 624, 397, 31,
@@ -167,11 +167,11 @@
pthread_attr_init(&tattr);
shared_and_weak_pools pools(obj_pool, weak_pool[0]);
- pthread_create(threads, &tattr, thread_hammer_and_kill, reinterpret_cast<void*>(&pools));
+ pthread_create(threads, &tattr, thread_hammer_and_kill, static_cast<void*>(&pools));
for (unsigned int worker = 1; worker < HAMMER_MAX_THREADS; worker++)
{
if (pthread_create(&threads[worker], &tattr,
- thread_hammer, reinterpret_cast<void*>(&weak_pool[worker])))
+ thread_hammer, static_cast<void*>(&weak_pool[worker])))
std::abort();
}
// Wait for threads to complete, then check integrity of reference.