You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2008/08/16 21:48:14 UTC

svn commit: r686554 - in /stdcxx/branches/4.2.x/include/rw: _config-acc.h _config-gcc.h _config-msvc.h _defs.h

Author: sebor
Date: Sat Aug 16 12:48:12 2008
New Revision: 686554

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

	STDCXX-1006
	* include/rw/_config-acc.h (_RWSTD_NORETURN): New macro to decorate
	functions that do no return. Replaces _RWSTD_ATTRIBUTE_NORETURN to
	make it possible to use Visual C++ __declspec(noreturn).
	(_RWSTD_ATTRIBUTE_NORETURN): Renamed to _RWSTD_NORETURN.
	* include/rw/_config-gcc.h (_RWSTD_NORETURN, _RWSTD_ATTRIBUTE_NORETURN):
	Same as above.
	* include/rw/_config-msvc.h (_RWSTD_NORETURN): New.
	* include/rw/_defs.h (_RWSTD_ATTRIBUTE_NORETURN): Renamed to
	_RWSTD_NORETURN.
	(__rw_assert_fail): Used _RWSTD_NORETURN in a way to make
	the declaration well-formed for both acc/gcc and Visual C++.

Modified:
    stdcxx/branches/4.2.x/include/rw/_config-acc.h
    stdcxx/branches/4.2.x/include/rw/_config-gcc.h
    stdcxx/branches/4.2.x/include/rw/_config-msvc.h
    stdcxx/branches/4.2.x/include/rw/_defs.h

Modified: stdcxx/branches/4.2.x/include/rw/_config-acc.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_config-acc.h?rev=686554&r1=686553&r2=686554&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_config-acc.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_config-acc.h Sat Aug 16 12:48:12 2008
@@ -99,8 +99,7 @@
 #endif   // __HPACC_NOEH
 
 #if 6 <= _RWSTD_HP_aCC_MAJOR
-   // aCC 6 attribute((noreturn)) to indicate that a function
+   // aCC 6 attribute((noreturn)) indicates that a function
    // doesn't return (it may exit by throwing an exception)
-#  define _RWSTD_ATTRIBUTE_NORETURN __attribute__ ((noreturn))
+#  define _RWSTD_NORETURN __attribute__ ((noreturn))
 #endif   // aCC >= 6
-

Modified: stdcxx/branches/4.2.x/include/rw/_config-gcc.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_config-gcc.h?rev=686554&r1=686553&r2=686554&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_config-gcc.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_config-gcc.h Sat Aug 16 12:48:12 2008
@@ -84,9 +84,9 @@
 
 #define _RWSTD_GNUC_ATTRIBUTE(attr)   __attribute__ (attr)
 
-// gcc attribute((noreturn)) to indicate that a function doesn't return
+// gcc attribute((noreturn)) indicates that a function doesn't return
 // (it may still exit by throwing an exception or by calling longjmp)
-#define _RWSTD_ATTRIBUTE_NORETURN   _RWSTD_GNUC_ATTRIBUTE ((noreturn))
+#define _RWSTD_NORETURN __attribute__ ((noreturn))
 
 #if __GNUG__ > 3 || __GNUG__ == 3 && __GNUC_MINOR__ >= 3
   // gcc attribute((nothrow)) to indicate that a function doesn't throw

Modified: stdcxx/branches/4.2.x/include/rw/_config-msvc.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_config-msvc.h?rev=686554&r1=686553&r2=686554&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_config-msvc.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_config-msvc.h Sat Aug 16 12:48:12 2008
@@ -25,7 +25,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.
  * 
  **************************************************************************/
 
@@ -86,3 +86,7 @@
 
 // disable "'function': was declared deprecated"
 #pragma warning (disable: 4996)
+
+// MSVC __declspec(noreturn) indicates that a function doesn't return
+// see: http://msdn.microsoft.com/en-us/library/aa235362(VS.60).aspx
+#define _RWSTD_NORETURN __declspec (noreturn)

Modified: stdcxx/branches/4.2.x/include/rw/_defs.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/rw/_defs.h?rev=686554&r1=686553&r2=686554&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/rw/_defs.h (original)
+++ stdcxx/branches/4.2.x/include/rw/_defs.h Sat Aug 16 12:48:12 2008
@@ -1177,10 +1177,13 @@
 #endif   // _RWSTD_NO_EXCEPTION_SPECIFICATION_ON_NEW
 
 
-#ifndef _RWSTD_ATTRIBUTE_NORETURN
-   // gcc (and others) __attribute__ ((noreturn))
-#  define _RWSTD_ATTRIBUTE_NORETURN   /* empty */
-#endif   // _RWSTD_ATTR_NORETURN
+#ifndef _RWSTD_NORETURN
+   // gcc (and some other) compilers provide __attribute__ ((noreturn)),
+   // MSVC has __declspec (noreturn); other compilers (e.g., Sun C++)
+   // may have a #pragma for the same thing, oothers still may not
+   // have an equivalent
+#  define _RWSTD_NORETURN   /* empty */
+#endif   // _RWSTD_NORETURN
 
 
 #ifdef _RWSTD_ATTRIBUTE_NOTHROW
@@ -1195,7 +1198,7 @@
    // be specified for both declarations and definitions
 #  define _RWSTD_DECLARE_NOTHROW  _THROWS(())
 #  define _RWSTD_DEFINE_NOTHROW   _THROWS(())
-#endif   // _RWSTD_ATTR_NORETURN
+#endif   // _RWSTD_ATTRIBUTE_NOTHROW
 
 
 // compile-time assertion - asserts constant expressions during
@@ -1216,10 +1219,10 @@
 #define _RWSTD_COMPILE_ASSERT(const_expr) \
         ((void)_RW::__rw_compile_assert<(const_expr)>::_C_ok)
 
-// called for failed assertions
-void _RWSTD_EXPORT
+// called for failed assertions; does not return or throw
+void _RWSTD_EXPORT _RWSTD_NORETURN
 __rw_assert_fail (const char*, const char*, int, const char*)
-    _RWSTD_DECLARE_NOTHROW _RWSTD_ATTRIBUTE_NORETURN;
+    _RWSTD_DECLARE_NOTHROW;