]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
type_traitsfwd.h (aligned_storage): Remove declaration.
authorPaolo Carlini <pcarlini@suse.de>
Mon, 17 Sep 2007 10:18:51 +0000 (10:18 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 17 Sep 2007 10:18:51 +0000 (10:18 +0000)
2007-09-17  Paolo Carlini  <pcarlini@suse.de>

* include/tr1_impl/type_traitsfwd.h (aligned_storage): Remove
declaration.
* include/tr1_impl/type_traits (aligned_storage): Remove.
* include/std/type_traits (aligned_storage, __aligned_storage_msa):
Add.
* include/tr1/type_traits (aligned_storage): Add.
* testsuite/20_util/aligned_storage/value.cc: New.
* testsuite/20_util/aligned_storage/requirements/
explicit_instantiation.cc: Likewise.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust
dg-error lines.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
Likewise.

From-SVN: r128542

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/type_traits
libstdc++-v3/include/tr1/type_traits
libstdc++-v3/include/tr1_impl/type_traits
libstdc++-v3/include/tr1_impl/type_traitsfwd.h
libstdc++-v3/testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/aligned_storage/value.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc

index ec140d4db6df36ab3f5858488cbbf8c5aa385d67..f84883f969dcf21e9a42244142a66065714decfb 100644 (file)
@@ -1,3 +1,19 @@
+2007-09-17  Paolo Carlini  <pcarlini@suse.de>
+
+       * include/tr1_impl/type_traitsfwd.h (aligned_storage): Remove
+       declaration.
+       * include/tr1_impl/type_traits (aligned_storage): Remove.
+       * include/std/type_traits (aligned_storage, __aligned_storage_msa):
+       Add.
+       * include/tr1/type_traits (aligned_storage): Add.
+       * testsuite/20_util/aligned_storage/value.cc: New.
+       * testsuite/20_util/aligned_storage/requirements/
+       explicit_instantiation.cc: Likewise.
+       * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust
+       dg-error lines.
+       * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
+       Likewise.
+
 2007-09-16  Paolo Carlini  <pcarlini@suse.de>
            Douglas Gregor  <doug.gregor@gmail.com>
 
index 4af108315f5b463998d30eb4a977f1e25c3b0067..33442ba5a31ec93f53b0f777309f89b2b6e60af5 100644 (file)
@@ -258,6 +258,27 @@ namespace std
                               __is_convertible_helper<_From, _To>::__value>
     { };
 
+  template<std::size_t _Len>
+    struct __aligned_storage_msa
+    { 
+      union __type
+      {
+       unsigned char __data[_Len];
+       struct __attribute__((__aligned__)) { } __align; 
+      };
+    };
+
+  template<std::size_t _Len, std::size_t _Align =
+          __alignof__(typename __aligned_storage_msa<_Len>::__type)>
+    struct aligned_storage
+    { 
+      union type
+      {
+       unsigned char __data[_Len];
+       struct __attribute__((__aligned__((_Align)))) { } __align; 
+      };
+    };
+
 
   // Define a nested type if some predicate holds.
   template<bool, typename _Tp = void>
index b9b60cfbda13318ff0bbcd8fcca57b25b061d178..be73fe77460be78043c187fe21d3ef7745c805f8 100644 (file)
@@ -230,6 +230,17 @@ namespace tr1
     : public __add_reference_helper<_Tp>
     { };
 
+  /// @brief  other transformations [4.8].
+  template<std::size_t _Len, std::size_t _Align>
+    struct aligned_storage
+    { 
+      union type
+      {
+       unsigned char __data[_Len];
+       struct __attribute__((__aligned__((_Align)))) { } __align; 
+      };
+    };
+
 #undef _DEFINE_SPEC_0_HELPER
 #undef _DEFINE_SPEC
 #undef _DEFINE_SPEC_BODY
index 4a31e8b00b3355883f273e8460f63d232c53e176..3c105d6cf129d4bb6873df766896915cae0b6dd5 100644 (file)
@@ -374,17 +374,6 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
     struct add_pointer
     { typedef typename remove_reference<_Tp>::type*     type; };
 
-  /// @brief  other transformations [4.8].
-  template<std::size_t _Len, std::size_t _Align>
-    struct aligned_storage
-    { 
-      union type
-      {
-       unsigned char __data[_Len];
-       struct __attribute__((__aligned__((_Align)))) { } __aligner; 
-      };
-    };
-
 #undef _DEFINE_SPEC_0_HELPER
 #undef _DEFINE_SPEC_1_HELPER
 #undef _DEFINE_SPEC_2_HELPER
index 1565df0ba881ad672e4b44c0e87e3bdd262f9190..63db0cb8f6dc6c45ff5d0ec653b154adf4d4488c 100644 (file)
@@ -170,9 +170,5 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
   template<typename _Tp>
     struct add_pointer;
 
-  /// @brief  other transformations [4.8].
-  template<std::size_t _Len, std::size_t _Align>
-    struct aligned_storage;
-
 _GLIBCXX_END_NAMESPACE_TR1
 }
diff --git a/libstdc++-v3/testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc
new file mode 100644 (file)
index 0000000..2b6a9d1
--- /dev/null
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2007-09-17  Paolo Carlini  <pcarlini@suse.de>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+namespace std
+{
+  typedef short test_type;
+  template struct aligned_storage<1, alignment_of<test_type>::value>;
+  template struct aligned_storage<2>;
+}
diff --git a/libstdc++-v3/testsuite/20_util/aligned_storage/value.cc b/libstdc++-v3/testsuite/20_util/aligned_storage/value.cc
new file mode 100644 (file)
index 0000000..2ea6fee
--- /dev/null
@@ -0,0 +1,68 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-09-17  Paolo Carlini  <pcarlini@suse.de>
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <type_traits>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+struct MSAlignType { } __attribute__((__aligned__));  
+
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  using std::aligned_storage;
+  using std::alignment_of;
+  using namespace __gnu_test;
+  
+  const std::size_t align_c = alignment_of<char>::value;
+  VERIFY( (sizeof(aligned_storage<4, align_c>::type) >= 4) );
+  VERIFY( (__alignof__(aligned_storage<4, align_c>::type) == align_c) );
+
+  const std::size_t align_s = alignment_of<short>::value;
+  VERIFY( (sizeof(aligned_storage<1, align_s>::type) >= 1) );
+  VERIFY( (__alignof__(aligned_storage<1, align_s>::type) == align_s) );
+
+  const std::size_t align_i = alignment_of<int>::value;
+  VERIFY( (sizeof(aligned_storage<7, align_i>::type) >= 7) );
+  VERIFY( (__alignof__(aligned_storage<7, align_i>::type) == align_i) );
+
+  const std::size_t align_d = alignment_of<double>::value;
+  VERIFY( (sizeof(aligned_storage<2, align_d>::type) >= 2) );
+  VERIFY( (__alignof__(aligned_storage<2, align_d>::type) == align_d) );
+
+  const std::size_t align_ai = alignment_of<int[4]>::value;
+  VERIFY( (sizeof(aligned_storage<20, align_ai>::type) >= 20) );
+  VERIFY( (__alignof__(aligned_storage<20, align_ai>::type) == align_ai) );
+
+  const std::size_t align_ct = alignment_of<ClassType>::value;
+  VERIFY( (sizeof(aligned_storage<11, align_ct>::type) >= 11) );
+  VERIFY( (__alignof__(aligned_storage<11, align_ct>::type) == align_ct) );
+
+  const std::size_t align_msa = alignment_of<MSAlignType>::value;
+  VERIFY( (sizeof(aligned_storage<5>::type) >= 5) );
+  VERIFY( (__alignof__(aligned_storage<5>::type) == align_msa) );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
index 68447a8e2881e609760ab9f03f16d2f77f05a3ed..ff912c2cc0a7069ba032db84aec2956230cd8081 100644 (file)
@@ -49,8 +49,8 @@ void test01()
 // { dg-error "instantiated from here" "" { target *-*-* } 41 }
 // { dg-error "instantiated from here" "" { target *-*-* } 43 }
 
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 490 }
-// { dg-error "declaration of" "" { target *-*-* } 456 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 511 }
+// { dg-error "declaration of" "" { target *-*-* } 477 }
 
 // { dg-excess-errors "At global scope" }
 // { dg-excess-errors "In instantiation of" }
index cb50cec4166791e932c3937d8b7f80da24ac2c9a..5b2b3dc9f82e2949962da1a028a6be9e81a4478e 100644 (file)
@@ -49,8 +49,8 @@ void test01()
 // { dg-error "instantiated from here" "" { target *-*-* } 41 }
 // { dg-error "instantiated from here" "" { target *-*-* } 43 }
 
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 415 }
-// { dg-error "declaration of" "" { target *-*-* } 381 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 436 }
+// { dg-error "declaration of" "" { target *-*-* } 402 }
 
 // { dg-excess-errors "At global scope" }
 // { dg-excess-errors "In instantiation of" }