aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2007-09-17 10:18:51 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-09-17 10:18:51 +0000
commitfd735b6a2e6839184cd0b4b3f505167b3a35c4e0 (patch)
treebc2c1cec0504e30850d6ab33644c7df82b743612
parent0ab7816b23a53b7558deadf841591ef02e177685 (diff)
downloadgcc-fd735b6a2e6839184cd0b4b3f505167b3a35c4e0.zip
gcc-fd735b6a2e6839184cd0b4b3f505167b3a35c4e0.tar.gz
gcc-fd735b6a2e6839184cd0b4b3f505167b3a35c4e0.tar.bz2
type_traitsfwd.h (aligned_storage): Remove declaration.
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
-rw-r--r--libstdc++-v3/ChangeLog16
-rw-r--r--libstdc++-v3/include/std/type_traits21
-rw-r--r--libstdc++-v3/include/tr1/type_traits11
-rw-r--r--libstdc++-v3/include/tr1_impl/type_traits11
-rw-r--r--libstdc++-v3/include/tr1_impl/type_traitsfwd.h4
-rw-r--r--libstdc++-v3/testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc41
-rw-r--r--libstdc++-v3/testsuite/20_util/aligned_storage/value.cc68
-rw-r--r--libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc4
9 files changed, 161 insertions, 19 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index ec140d4..f84883f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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>
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 4af1083..33442ba 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -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>
diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits
index b9b60cf..be73fe7 100644
--- a/libstdc++-v3/include/tr1/type_traits
+++ b/libstdc++-v3/include/tr1/type_traits
@@ -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
diff --git a/libstdc++-v3/include/tr1_impl/type_traits b/libstdc++-v3/include/tr1_impl/type_traits
index 4a31e8b..3c105d6 100644
--- a/libstdc++-v3/include/tr1_impl/type_traits
+++ b/libstdc++-v3/include/tr1_impl/type_traits
@@ -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
diff --git a/libstdc++-v3/include/tr1_impl/type_traitsfwd.h b/libstdc++-v3/include/tr1_impl/type_traitsfwd.h
index 1565df0..63db0cb 100644
--- a/libstdc++-v3/include/tr1_impl/type_traitsfwd.h
+++ b/libstdc++-v3/include/tr1_impl/type_traitsfwd.h
@@ -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
index 0000000..2b6a9d1
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc
@@ -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
index 0000000..2ea6fee
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/aligned_storage/value.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
index 68447a8..ff912c2 100644
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
@@ -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" }
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
index cb50cec..5b2b3dc 100644
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
@@ -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" }