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/20 01:31:53 UTC

svn commit: r669742 - in /stdcxx/branches/4.3.x: include/rw/_meta_other.h include/type_traits tests/utilities/20.meta.trans.other.cpp

Author: vitek
Date: Thu Jun 19 16:31:53 2008
New Revision: 669742

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

	STDCXX-926
	* include/type_traits: Replace tabs with spaces. Remove bad
	declaration of aligned_union.
	* include/rw/_meta_other.h: Fix partial specialization of both
	__rw_strictest and __rw_biggest. Use correct name for the
	__rw_aligned_struct nested type in __rw_aligned_union. Compile
	out definition of member constants as they cause errors on gcc.
	* tests/utilities/20.meta.trans.other.cpp: Remove unnecessary
	semicolon.
	(test_aligned_union): Add a typedef for the aligned type inside
	aligned_union.


Modified:
    stdcxx/branches/4.3.x/include/rw/_meta_other.h
    stdcxx/branches/4.3.x/include/type_traits
    stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.other.cpp

Modified: stdcxx/branches/4.3.x/include/rw/_meta_other.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_meta_other.h?rev=669742&r1=669741&r2=669742&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_meta_other.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_meta_other.h Thu Jun 19 16:31:53 2008
@@ -172,16 +172,14 @@
 struct __rw_biggest;
 
 template <class _TypeT, class... _Types>
-struct __rw_biggest
+struct __rw_biggest<_TypeT, _Types...>
 {
     typedef typename
     __rw_biggest<_Types...>::type _TypeU;
 
     typedef typename
-    __rw_conditional<   sizeof _TypeT
-                      < sizeof _TypeU
-                      ? _TypeU
-                      : _TypeT>::type type;
+    __rw_conditional<sizeof _TypeT < sizeof _TypeU,
+	                 _TypeU, _TypeT>::type type;
 };
 
 template <class _TypeT>
@@ -199,16 +197,15 @@
 struct __rw_strictest;
 
 template <class _TypeT, class... _Types>
-struct __rw_strictest
+struct __rw_strictest<_TypeT, _Types...>
 {
     typedef typename
     __rw_strictest<_Types...>::type _TypeU;
 
     typedef typename
     __rw_conditional<   __rw_alignment_of<_TypeT>::value
-                      < __rw_alignment_of<_TypeU>::value
-                      ? _TypeU
-                      : _TypeT>::type type;
+                      < __rw_alignment_of<_TypeU>::value,
+                     _TypeU, _TypeT>::type type;
 };
 
 template <class _TypeT>
@@ -217,8 +214,11 @@
     typedef _TypeT type;
 };
 
+template <_RWSTD_SIZE_T _Len, class... _Types>
+struct __rw_aligned_union;
+
 template <_RWSTD_SIZE_T _Len, class _TypeT, class... _Types>
-struct __rw_aligned_union
+struct __rw_aligned_union<_Len, _TypeT, _Types...>
 {
     typedef typename
     __rw_biggest<_TypeT, _Types...>::type _C_biggest;
@@ -234,10 +234,11 @@
 
     typedef typename
     __rw_aligned_storage<_Len < _C_size_value ? _C_size_value : _Len,
-                         alignment_value>::_C_type type;
+                         alignment_value>::type type;
 };
 
-#ifndef _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION
+#if 0
+#  ifndef _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION
 
 template <_RWSTD_SIZE_T _Len, class... _Types>
 const _RWSTD_SIZE_T
@@ -247,7 +248,8 @@
 const _RWSTD_SIZE_T
 __rw_aligned_union<_Len, _Types...>::_C_size_value;
 
-#endif // _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION
+#  endif // _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION
+#endif
 
 #else // _RWSTD_NO_VARIADIC_TEMPLATES
 

Modified: stdcxx/branches/4.3.x/include/type_traits
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/type_traits?rev=669742&r1=669741&r2=669742&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/type_traits (original)
+++ stdcxx/branches/4.3.x/include/type_traits Thu Jun 19 16:31:53 2008
@@ -846,7 +846,7 @@
  */
 template <class _TypeT>
 struct is_signed
-	: integral_constant<bool, _RW::__rw_is_signed<_TypeT>::value>
+    : integral_constant<bool, _RW::__rw_is_signed<_TypeT>::value>
 {
 };
 
@@ -860,7 +860,7 @@
  */
 template <class _TypeT>
 struct is_unsigned
-	: integral_constant<bool, _RW::__rw_is_unsigned<_TypeT>::value>
+    : integral_constant<bool, _RW::__rw_is_unsigned<_TypeT>::value>
 {
 };
 
@@ -1221,9 +1221,6 @@
  * @tparam _Len The minimum size of the aligned storage.
  * @tparam _Types List of types which might be stored.
  */
-template <_RWSTD_SIZE_T _Len, class... _Types>
-struct aligned_union;
-
 template <_RWSTD_SIZE_T _Len, class _TypeT, class... _Types>
 struct aligned_union
     : _RW::__rw_aligned_union<_Len, _TypeT, _Types...>

Modified: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.other.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.other.cpp?rev=669742&r1=669741&r2=669742&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.other.cpp (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.other.cpp Thu Jun 19 16:31:53 2008
@@ -144,7 +144,7 @@
     rw_assert (is_pow_2, 0, line,
         "std::aligned_storage<%zu, %zu>::type alignment expected "
         "to be a power-of-two; got %zu", exp_sz, exp_al, got_al);
-};
+}
 
 /**************************************************************************/
 
@@ -251,14 +251,15 @@
         }
 
         typedef std::aligned_union<Len,T1,T2,T3,T4,T5,T6,T7,T8> aligned_t;
+        typedef typename aligned_t::type aligned_type_t;
 
-        const bool pass1 =    std::alignment_of<aligned_t::type>::value
+        const bool pass1 =    std::alignment_of<aligned_type_t>::value
                            == aligned_t::alignment_value;
         rw_assert (pass1, 0, line,
                    "std::aligned_union<%s>::alignment_value is %zu; "
                    "expected %zu",
                    pbuf, aligned_t::alignment_value, 
-                   std::alignment_of<aligned_t::type>::value); 
+                   std::alignment_of<aligned_type_t>::value); 
 
         const size_t exp_al = max8(std::alignment_of<T1>::value,
                                    std::alignment_of<T2>::value,
@@ -268,7 +269,7 @@
                                    std::alignment_of<T6>::value,
                                    std::alignment_of<T7>::value,
                                    std::alignment_of<T8>::value);
-        const size_t got_al = std::alignment_of<aligned_t::type>::value;
+        const size_t got_al = std::alignment_of<aligned_type_t>::value;
 
         const bool pass2 = exp_al == got_al;
         rw_assert (pass2, 0, line,
@@ -277,7 +278,7 @@
                    pbuf, got_al, exp_al); 
 
         const size_t min_sz = Len;
-        const size_t got_sz = sizeof (aligned_t::type);
+        const size_t got_sz = sizeof (aligned_type_t);
 
         const bool pass3 = min_sz <= got_sz;