stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r686537 - in /stdcxx/branches/4.2.x: include/rw/_allocator.h src/memory.cpp
Date Sat, 16 Aug 2008 19:03:53 GMT
Author: sebor
Date: Sat Aug 16 12:03:53 2008
New Revision: 686537

URL: http://svn.apache.org/viewvc?rev=686537&view=rev
Log:
2008-08-16  Martin Sebor  <sebor@roguewave.com>

	STDCXX-998
	* include/rw/_allocator.h (__rw_deallocate): Added the empty
	exception specification.
	(allocator::destroy): Decorated with attribute nothrow to
	help optimizers generate better code by letting them assume
	that the type's dtor doesn't throw even if it's not explicitly
	declared not to.

Modified:
    stdcxx/branches/4.2.x/include/rw/_allocator.h
    stdcxx/branches/4.2.x/src/memory.cpp

Modified: stdcxx/branches/4.2.x/include/rw/_allocator.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_allocator.h?rev=686537&r1=686536&r2=686537&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_allocator.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_allocator.h Sat Aug 16 12:03:53 2008
@@ -39,7 +39,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2006 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -54,8 +54,11 @@
 _RWSTD_NAMESPACE (__rw) {
 
 // [de]allocate storage (in bytes)
-_RWSTD_EXPORT void* __rw_allocate (_RWSTD_SIZE_T, int = 0);
-_RWSTD_EXPORT void  __rw_deallocate (void*, _RWSTD_SIZE_T, int = 0);
+_RWSTD_EXPORT void*
+__rw_allocate (_RWSTD_SIZE_T, int = 0);
+
+_RWSTD_EXPORT void
+__rw_deallocate (void*, _RWSTD_SIZE_T, int = 0) _THROWS (());
 
 }   // namespace __rw
 
@@ -149,9 +152,9 @@
     }
 
 #ifdef _RWSTD_ALLOCATOR        
-    void deallocate (pointer __p, size_type __n)
+    void deallocate (pointer __p, size_type __n) _THROWS (())
 #else
-    void deallocate (void* __p, size_type __n)
+    void deallocate (void* __p, size_type __n) _THROWS (())
 #endif   // _RWSTD_ALLOCATOR
     {
         _RW::__rw_deallocate (__p, __n);
@@ -168,7 +171,10 @@
         _RW::__rw_construct (__p, __val);
     }
     
-    void destroy (pointer __p) {
+    // declared as nothrow since the behavior of programs that
+    // instantiate library templates on types whose dtors throw
+    // is undefined 
+    void destroy (pointer __p) _RWSTD_ATTRIBUTE_NOTHROW (()) {
         _RWSTD_ASSERT (0 != __p);
         __p->~_TypeT ();
     }
@@ -239,11 +245,11 @@
     }
 
 #ifdef _RWSTD_ALLOCATOR        
-    void deallocate (const_pointer __p, size_type __nelems) {
+    void deallocate (const_pointer __p, size_type __nelems) _THROWS (()) {
         _RW::__rw_deallocate (_RWSTD_CONST_CAST (_TypeT*, __p), __nelems);
     }
 #else
-    void deallocate (const void* __p, size_type __nbytes) {
+    void deallocate (const void* __p, size_type __nbytes) _THROWS (()) {
         _RW::__rw_deallocate (_RWSTD_CONST_CAST (void*, __p), __nbytes);
     }
 #endif   // _RWSTD_ALLOCATOR
@@ -258,8 +264,11 @@
     void construct (const_pointer __p, const_reference __val) {
         _RW::__rw_construct (_RWSTD_CONST_CAST (_TypeT*, __p), __val);
     }
-    
-    void destroy (const_pointer __p) {
+
+    // declared as nothrow since the behavior of programs that
+    // instantiate library templates on types whose dtors throw
+    // is undefined 
+    void destroy (const_pointer __p) _RWSTD_ATTRIBUTE_NOTHROW {
         _RWSTD_ASSERT (0 != __p);
         __p->~_TypeT ();
     }

Modified: stdcxx/branches/4.2.x/src/memory.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/memory.cpp?rev=686537&r1=686536&r2=686537&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/memory.cpp (original)
+++ stdcxx/branches/4.2.x/src/memory.cpp Sat Aug 16 12:03:53 2008
@@ -76,7 +76,7 @@
 
 
 _RWSTD_EXPORT void
-__rw_deallocate (void *p, _RWSTD_SIZE_T, int /* = 0 */)
+__rw_deallocate (void *p, _RWSTD_SIZE_T, int /* = 0 */) _THROWS (())
 {
     ::operator delete (p);
 }



Mime
View raw message