From: paolo Date: Mon, 17 Sep 2007 10:18:51 +0000 (+0000) Subject: 2007-09-17 Paolo Carlini X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=86c291deb5c5a6b68f9730f562411f4371be2cdf;p=thirdparty%2Fgcc.git 2007-09-17 Paolo Carlini * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128542 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ec140d4db6df..f84883f969dc 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,19 @@ +2007-09-17 Paolo Carlini + + * 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 Douglas Gregor diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 4af108315f5b..33442ba5a31e 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 + struct __aligned_storage_msa + { + union __type + { + unsigned char __data[_Len]; + struct __attribute__((__aligned__)) { } __align; + }; + }; + + template::__type)> + struct aligned_storage + { + union type + { + unsigned char __data[_Len]; + struct __attribute__((__aligned__((_Align)))) { } __align; + }; + }; + // Define a nested type if some predicate holds. template diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits index b9b60cfbda13..be73fe77460b 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 + 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 4a31e8b00b33..3c105d6cf129 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 - 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 1565df0ba881..63db0cb8f6dc 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 struct add_pointer; - /// @brief other transformations [4.8]. - template - 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 000000000000..2b6a9d18fb97 --- /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 + +// 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 + +namespace std +{ + typedef short test_type; + template struct aligned_storage<1, alignment_of::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 000000000000..2ea6fee4956c --- /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 +// +// 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 +#include +#include + +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::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::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::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::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::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::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::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 68447a8e2881..ff912c2cc0a7 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 cb50cec41667..5b2b3dc9f82e 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" }