You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by vi...@apache.org on 2008/06/17 02:03:39 UTC

svn commit: r668350 - in /stdcxx/branches/4.3.x: include/rw/_defs.h include/rw/_meta_sign.h tests/utilities/20.meta.trans.sign.cpp

Author: vitek
Date: Mon Jun 16 17:03:39 2008
New Revision: 668350

URL: http://svn.apache.org/viewvc?rev=668350&view=rev
Log:
2008-06-16  Travis Vitek  <vi...@roguewave.com>

	STDCXX-947
	* include/rw/_defs.h [_RWSTD_UWCHAR_INT_T,_RWSTD_SWCHAR_INT_T]: Revert
	changes from r667365.
	* include/rw/_meta_sign.h: Define make_signed and make_unsigned to
	properly handle char and wchar_t according to current standard.
	* tests/utilities/20.meta.trans.sign.cpp: Use size_t as appropriate.
	Update test to correctly reflect behaviors required by the standard.



Modified:
    stdcxx/branches/4.3.x/include/rw/_defs.h
    stdcxx/branches/4.3.x/include/rw/_meta_sign.h
    stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.sign.cpp

Modified: stdcxx/branches/4.3.x/include/rw/_defs.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_defs.h?rev=668350&r1=668349&r2=668350&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_defs.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_defs.h Mon Jun 16 17:03:39 2008
@@ -1274,21 +1274,6 @@
 #  endif
 #endif   // _RWSTD_SSIZE_T
 
-// _RWSTD_SWCHAR_INT_T is "signed wchar_t"
-#ifndef _RWSTD_SWCHAR_INT_T
-#  if _RWSTD_CHAR_SIZE == _RWSTD_WCHAR_SIZE
-#    define _RWSTD_SWCHAR_INT_T   signed char
-#  elif _RWSTD_SHRT_SIZE == _RWSTD_WCHAR_SIZE
-#    define _RWSTD_SWCHAR_INT_T   signed short
-#  elif _RWSTD_INT_SIZE == _RWSTD_WCHAR_SIZE
-#    define _RWSTD_SWCHAR_INT_T   signed int
-#  elif _RWSTD_LONG_SIZE == _RWSTD_WCHAR_SIZE
-#    define _RWSTD_SWCHAR_INT_T   signed long
-#  else
-#    define _RWSTD_SWCHAR_INT_T   signed long long
-#  endif
-#endif   // _RWSTD_SWCHAR_INT_T
-
 // _RWSTD_UWCHAR_INT_T is "unsigned wchar_t"
 #ifndef _RWSTD_UWCHAR_INT_T
 #  if _RWSTD_CHAR_SIZE == _RWSTD_WCHAR_SIZE
@@ -1297,10 +1282,8 @@
 #    define _RWSTD_UWCHAR_INT_T unsigned short
 #  elif _RWSTD_INT_SIZE == _RWSTD_WCHAR_SIZE
 #    define _RWSTD_UWCHAR_INT_T unsigned int
-#  elif _RWSTD_LONG_SIZE == _RWSTD_WCHAR_SIZE
-#    define _RWSTD_UWCHAR_INT_T unsigned long
 #  else
-#    define _RWSTD_UWCHAR_INT_T unsigned long long
+#    define _RWSTD_UWCHAR_INT_T _RWSTD_SIZE_T
 #  endif
 #endif   // _RWSTD_UWCHAR_INT_T
 

Modified: stdcxx/branches/4.3.x/include/rw/_meta_sign.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_meta_sign.h?rev=668350&r1=668349&r2=668350&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_meta_sign.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_meta_sign.h Mon Jun 16 17:03:39 2008
@@ -52,17 +52,55 @@
 template <>
 struct __rw_sign_helper<char>
 {
-    typedef   signed char _C_Sint;
+#if (_RWSTD_CHAR_MIN < 0)
+    typedef          char _C_Sint;
     typedef unsigned char _C_Uint;
+#else
+    typedef   signed char _C_Sint;
+    typedef          char _C_Uint;
+#endif
 };
 
+#ifndef _RWSTD_NO_NATIVE_WCHAR_T
+
 template <>
 struct __rw_sign_helper<wchar_t>
 {
-    typedef _RWSTD_SWCHAR_INT_T _C_Sint;
-    typedef _RWSTD_UWCHAR_INT_T _C_Uint;
+#if (_RWSTD_WCHAR_MIN < 0)
+    typedef wchar_t             _C_Sint;
+
+#  if (_RWSTD_WCHAR_SIZE == _RWSTD_CHAR_SIZE)
+    typedef unsigned char _C_Uint;
+#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_SHORT_SIZE)
+    typedef unsigned short _C_Uint;
+#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_INT_SIZE)
+    typedef unsigned int _C_Uint;
+#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_LONG_SIZE)
+    typedef unsigned long _C_Uint;
+#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_LLONG_SIZE)
+    typedef unsigned long long _C_Uint;
+#  endif
+
+#  else   // 0 <= _RWSTD_WCHAR_MIN
+
+#  if (_RWSTD_WCHAR_SIZE == _RWSTD_CHAR_SIZE)
+    typedef signed char _C_Sint;
+#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_SHORT_SIZE)
+    typedef signed short _C_Sint;
+#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_INT_SIZE)
+    typedef signed int _C_Sint;
+#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_LONG_SIZE)
+    typedef signed long _C_Sint;
+#  elif (_RWSTD_WCHAR_SIZE == _RWSTD_LLONG_SIZE)
+    typedef signed long long _C_Sint;
+#  endif
+
+    typedef wchar_t             _C_Uint;
+#  endif   // 0 <= _RWSTD_WCHAR_MIN
 };
 
+#endif   // _RWSTD_NO_NATIVE_WCHAR_T
+
 template <>
 struct __rw_sign_helper<signed char>
 {
@@ -186,7 +224,7 @@
 #  if (_RWSTD_LONG_SIZE != _RWSTD_LLONG_SIZE)
 
 template <>
-struct __rw_enum_helper<sizeof (long long)> //_RWSTD_LLONG_SIZE>
+struct __rw_enum_helper<_RWSTD_LLONG_SIZE>
 {
     typedef   signed long long _C_Sint;
     typedef unsigned long long _C_Uint;

Modified: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.sign.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.sign.cpp?rev=668350&r1=668349&r2=668350&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.sign.cpp (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.sign.cpp Mon Jun 16 17:03:39 2008
@@ -27,6 +27,8 @@
  *
  **************************************************************************/
 
+#include <stddef.h>
+
 #include <rw_driver.h>
 
 // compile out all test code if extensions disabled
@@ -143,7 +145,7 @@
 void test_sign_and_cv (int line,
                        const char* trait_name,
                        const char* type_name,
-                       _RWSTD_SIZE_T got_size, _RWSTD_SIZE_T exp_size,
+                       size_t got_size, size_t exp_size,
                        bool got_sign, bool exp_sign,
                        bool got_c, bool exp_c,
                        bool got_v, bool exp_v)
@@ -194,8 +196,14 @@
 
 static void test_make_signed ()
 {
+#if (_RWSTD_CHAR_MIN < 0)
+    TEST (std::make_signed,   char, char);
+#else
+    TEST (std::make_signed,   char, signed char);
+#endif
+
     TEST (std::make_signed,   signed char, signed char);
-    TEST (std::make_signed, unsigned char, signed char);
+    TEST (std::make_signed, unsigned char, signed char); // unsure
 
     TEST (std::make_signed,   signed short, signed short);
     TEST (std::make_signed, unsigned short, signed short);
@@ -227,7 +235,13 @@
 
 static void test_make_unsigned ()
 {
-    TEST (std::make_unsigned,   signed char, unsigned char);
+#if (_RWSTD_CHAR_MIN < 0)
+    TEST (std::make_unsigned,   char, unsigned char);
+#else
+    TEST (std::make_unsigned,   char, char);
+#endif
+
+    TEST (std::make_unsigned,   signed char, unsigned char); // unsure
     TEST (std::make_unsigned, unsigned char, unsigned char);
 
     TEST (std::make_unsigned,   signed short, unsigned short);