mirror of git://gcc.gnu.org/git/gcc.git
				
				
				
			default_weaktoshared.cc: Use static_cast not reinterpret_cast.
2007-12-24 Jonathan Wakely <jwakely.gcc@gmail.com> * 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. From-SVN: r131158
This commit is contained in:
		
							parent
							
								
									861d6c431f
								
							
						
					
					
						commit
						045fcc24c9
					
				|  | @ -1,3 +1,10 @@ | ||||||
|  | 2007-12-24  Jonathan Wakely  <jwakely.gcc@gmail.com> | ||||||
|  | 
 | ||||||
|  | 	* 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. | ||||||
|  | 
 | ||||||
| 2007-12-24  Paolo Carlini  <pcarlini@suse.de> | 2007-12-24  Paolo Carlini  <pcarlini@suse.de> | ||||||
| 
 | 
 | ||||||
| 	* include/tr1_impl/hashtable_policy.h (_Prime_rehash_policy:: | 	* include/tr1_impl/hashtable_policy.h (_Prime_rehash_policy:: | ||||||
|  |  | ||||||
|  | @ -82,7 +82,7 @@ struct shared_and_weak_pools | ||||||
| 
 | 
 | ||||||
| void* thread_hammer_and_kill(void* opaque_pools) | 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.
 |   // Using the same parameters as in the RNG test cases.
 | ||||||
|   std::tr1::mersenne_twister< |   std::tr1::mersenne_twister< | ||||||
|     unsigned long, 32, 624, 397, 31, |     unsigned long, 32, 624, 397, 31, | ||||||
|  | @ -117,7 +117,7 @@ void* thread_hammer_and_kill(void* opaque_pools) | ||||||
| 
 | 
 | ||||||
| void* thread_hammer(void* opaque_weak) | 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.
 |   // Using the same parameters as in the RNG test cases.
 | ||||||
|   std::tr1::mersenne_twister< |   std::tr1::mersenne_twister< | ||||||
|     unsigned long, 32, 624, 397, 31, |     unsigned long, 32, 624, 397, 31, | ||||||
|  | @ -165,11 +165,11 @@ test01() | ||||||
|   pthread_attr_init(&tattr); |   pthread_attr_init(&tattr); | ||||||
| 
 | 
 | ||||||
|   shared_and_weak_pools pools(obj_pool, weak_pool[0]); |   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++) |   for (unsigned int worker = 1; worker < HAMMER_MAX_THREADS; worker++) | ||||||
|     { |     { | ||||||
|       if (pthread_create(&threads[worker], &tattr, |       if (pthread_create(&threads[worker], &tattr, | ||||||
| 			 thread_hammer, reinterpret_cast<void*>(&weak_pool[worker]))) | 			 thread_hammer, static_cast<void*>(&weak_pool[worker]))) | ||||||
| 	std::abort(); | 	std::abort(); | ||||||
|     } |     } | ||||||
|   // Wait for threads to complete, then check integrity of reference.
 |   // Wait for threads to complete, then check integrity of reference.
 | ||||||
|  |  | ||||||
|  | @ -84,7 +84,7 @@ struct shared_and_weak_pools | ||||||
| 
 | 
 | ||||||
| void* thread_hammer_and_kill(void* opaque_pools) | 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.
 |   // Using the same parameters as in the RNG test cases.
 | ||||||
|   std::tr1::mersenne_twister< |   std::tr1::mersenne_twister< | ||||||
|     unsigned long, 32, 624, 397, 31, |     unsigned long, 32, 624, 397, 31, | ||||||
|  | @ -119,7 +119,7 @@ void* thread_hammer_and_kill(void* opaque_pools) | ||||||
| 
 | 
 | ||||||
| void* thread_hammer(void* opaque_weak) | 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.
 |   // Using the same parameters as in the RNG test cases.
 | ||||||
|   std::tr1::mersenne_twister< |   std::tr1::mersenne_twister< | ||||||
|     unsigned long, 32, 624, 397, 31, |     unsigned long, 32, 624, 397, 31, | ||||||
|  | @ -167,11 +167,11 @@ test01() | ||||||
|   pthread_attr_init(&tattr); |   pthread_attr_init(&tattr); | ||||||
| 
 | 
 | ||||||
|   shared_and_weak_pools pools(obj_pool, weak_pool[0]); |   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++) |   for (unsigned int worker = 1; worker < HAMMER_MAX_THREADS; worker++) | ||||||
|     { |     { | ||||||
|       if (pthread_create(&threads[worker], &tattr, |       if (pthread_create(&threads[worker], &tattr, | ||||||
| 			 thread_hammer, reinterpret_cast<void*>(&weak_pool[worker]))) | 			 thread_hammer, static_cast<void*>(&weak_pool[worker]))) | ||||||
| 	std::abort(); | 	std::abort(); | ||||||
|     } |     } | ||||||
|   // Wait for threads to complete, then check integrity of reference.
 |   // Wait for threads to complete, then check integrity of reference.
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Jonathan Wakely
						Jonathan Wakely