diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-20 19:29:54 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-20 19:29:54 +0000 |
commit | 7a4b9af6316315fef771961b3dc88aa8f7b3ba24 (patch) | |
tree | 02053f4973278ee3f017db7ee1f45c1d1dbb09ae /libstdc++-v3 | |
parent | 949bf6a9482a209dd9a42539200919731ead6ecd (diff) | |
download | gcc-7a4b9af6316315fef771961b3dc88aa8f7b3ba24.tar.gz |
2008-08-20 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/33979 (partial)
* include/bits/postypes.h (u16streampos, u32streampos): Add.
* include/bits/char_traits.h (char_traits<char16_t>,
char_traits<char32_t>): Add.
* include/bits/stringfwd.h (u16string, u32string): Add.
* include/ext/vstring_fwd.h: Add typedefs for char16_t/char32_t.
* testsuite/21_strings/char_traits/requirements/char32_t/typedefs.cc:
New.
* testsuite/21_strings/char_traits/requirements/
explicit_instantiation/short/1.cc: Likewise.
* testsuite/21_strings/char_traits/requirements/
explicit_instantiation/char32_t/1.cc: Likewise.
* testsuite/21_strings/char_traits/requirements/
explicit_instantiation/wchar_t/1.cc: Likewise.
* testsuite/21_strings/char_traits/requirements/
explicit_instantiation/char16_t/1.cc: Likewise.
* testsuite/21_strings/char_traits/requirements/
explicit_instantiation/char/1.cc: Likewise.
* testsuite/21_strings/char_traits/requirements/char16_t/typedefs.cc:
Likewise.
* testsuite/21_strings/basic_string/requirements/
explicit_instantiation/char32_t/1.cc: Likewise.
* testsuite/21_strings/basic_string/requirements/
explicit_instantiation/wchar_t/1.cc: Likewise.
* testsuite/21_strings/basic_string/requirements/
explicit_instantiation/char16_t/1.cc: Likewise.
* testsuite/21_strings/basic_string/requirements/
explicit_instantiation/char/1.cc: Likewise.
* testsuite/21_strings/headers/string/types_std_c++0x.cc: Likewise.
* testsuite/ext/vstring/requirements/explicit_instantiation/
char32_t/1.cc: Likewise.
* testsuite/ext/vstring/requirements/explicit_instantiation/
char16_t/1.cc: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139339 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
19 files changed, 674 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ab960cb2b49..f4d076eb481 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,39 @@ +2008-08-20 Paolo Carlini <paolo.carlini@oracle.com> + + PR libstdc++/33979 (partial) + * include/bits/postypes.h (u16streampos, u32streampos): Add. + * include/bits/char_traits.h (char_traits<char16_t>, + char_traits<char32_t>): Add. + * include/bits/stringfwd.h (u16string, u32string): Add. + * include/ext/vstring_fwd.h: Add typedefs for char16_t/char32_t. + * testsuite/21_strings/char_traits/requirements/char32_t/typedefs.cc: + New. + * testsuite/21_strings/char_traits/requirements/ + explicit_instantiation/short/1.cc: Likewise. + * testsuite/21_strings/char_traits/requirements/ + explicit_instantiation/char32_t/1.cc: Likewise. + * testsuite/21_strings/char_traits/requirements/ + explicit_instantiation/wchar_t/1.cc: Likewise. + * testsuite/21_strings/char_traits/requirements/ + explicit_instantiation/char16_t/1.cc: Likewise. + * testsuite/21_strings/char_traits/requirements/ + explicit_instantiation/char/1.cc: Likewise. + * testsuite/21_strings/char_traits/requirements/char16_t/typedefs.cc: + Likewise. + * testsuite/21_strings/basic_string/requirements/ + explicit_instantiation/char32_t/1.cc: Likewise. + * testsuite/21_strings/basic_string/requirements/ + explicit_instantiation/wchar_t/1.cc: Likewise. + * testsuite/21_strings/basic_string/requirements/ + explicit_instantiation/char16_t/1.cc: Likewise. + * testsuite/21_strings/basic_string/requirements/ + explicit_instantiation/char/1.cc: Likewise. + * testsuite/21_strings/headers/string/types_std_c++0x.cc: Likewise. + * testsuite/ext/vstring/requirements/explicit_instantiation/ + char32_t/1.cc: Likewise. + * testsuite/ext/vstring/requirements/explicit_instantiation/ + char16_t/1.cc: Likewise. + 2008-08-18 Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/37149 diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h index 52158efff33..9dac2226237 100644 --- a/libstdc++-v3/include/bits/char_traits.h +++ b/libstdc++-v3/include/bits/char_traits.h @@ -374,6 +374,195 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _GLIBCXX_END_NAMESPACE +#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \ + && defined(_GLIBCXX_USE_C99_STDINT_TR1)) + +#include <cstdint> + +_GLIBCXX_BEGIN_NAMESPACE(std) + + template<> + struct char_traits<char16_t> + { + typedef char16_t char_type; + typedef uint_least16_t int_type; + typedef streamoff off_type; + typedef u16streampos pos_type; + typedef mbstate_t state_type; + + static void + assign(char_type& __c1, const char_type& __c2) + { __c1 = __c2; } + + static bool + eq(const char_type& __c1, const char_type& __c2) + { return __c1 == __c2; } + + static bool + lt(const char_type& __c1, const char_type& __c2) + { return __c1 < __c2; } + + static int + compare(const char_type* __s1, const char_type* __s2, size_t __n) + { + for (size_t __i = 0; __i < __n; ++__i) + if (lt(__s1[__i], __s2[__i])) + return -1; + else if (lt(__s2[__i], __s1[__i])) + return 1; + return 0; + } + + static size_t + length(const char_type* __s) + { + size_t __i = 0; + while (!eq(__s[__i], char_type())) + ++__i; + return __i; + } + + static const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) + { + for (size_t __i = 0; __i < __n; ++__i) + if (eq(__s[__i], __a)) + return __s + __i; + return 0; + } + + static char_type* + move(char_type* __s1, const char_type* __s2, size_t __n) + { + return (static_cast<char_type*> + (__builtin_memmove(__s1, __s2, __n * sizeof(char_type)))); + } + + static char_type* + copy(char_type* __s1, const char_type* __s2, size_t __n) + { + return (static_cast<char_type*> + (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type)))); + } + + static char_type* + assign(char_type* __s, size_t __n, char_type __a) + { + std::fill_n(__s, __n, __a); + return __s; + } + + static char_type + to_char_type(const int_type& __c) { return char_type(__c); } + + static int_type + to_int_type(const char_type& __c) { return int_type(__c); } + + static bool + eq_int_type(const int_type& __c1, const int_type& __c2) + { return __c1 == __c2; } + + static int_type + eof() { return static_cast<int_type>(-1); } + + static int_type + not_eof(const int_type& __c) + { return eq_int_type(__c, eof()) ? 0 : __c; } + }; + + template<> + struct char_traits<char32_t> + { + typedef char32_t char_type; + typedef uint_least32_t int_type; + typedef streamoff off_type; + typedef u32streampos pos_type; + typedef mbstate_t state_type; + + static void + assign(char_type& __c1, const char_type& __c2) + { __c1 = __c2; } + + static bool + eq(const char_type& __c1, const char_type& __c2) + { return __c1 == __c2; } + + static bool + lt(const char_type& __c1, const char_type& __c2) + { return __c1 < __c2; } + + static int + compare(const char_type* __s1, const char_type* __s2, size_t __n) + { + for (size_t __i = 0; __i < __n; ++__i) + if (lt(__s1[__i], __s2[__i])) + return -1; + else if (lt(__s2[__i], __s1[__i])) + return 1; + return 0; + } + + static size_t + length(const char_type* __s) + { + size_t __i = 0; + while (!eq(__s[__i], char_type())) + ++__i; + return __i; + } + + static const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) + { + for (size_t __i = 0; __i < __n; ++__i) + if (eq(__s[__i], __a)) + return __s + __i; + return 0; + } + + static char_type* + move(char_type* __s1, const char_type* __s2, size_t __n) + { + return (static_cast<char_type*> + (__builtin_memmove(__s1, __s2, __n * sizeof(char_type)))); + } + + static char_type* + copy(char_type* __s1, const char_type* __s2, size_t __n) + { + return (static_cast<char_type*> + (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type)))); + } + + static char_type* + assign(char_type* __s, size_t __n, char_type __a) + { + std::fill_n(__s, __n, __a); + return __s; + } + + static char_type + to_char_type(const int_type& __c) { return char_type(__c); } + + static int_type + to_int_type(const char_type& __c) { return int_type(__c); } + + static bool + eq_int_type(const int_type& __c1, const int_type& __c2) + { return __c1 == __c2; } + + static int_type + eof() { return static_cast<int_type>(-1); } + + static int_type + not_eof(const int_type& __c) + { return eq_int_type(__c, eof()) ? 0 : __c; } + }; + +_GLIBCXX_END_NAMESPACE + +#endif + #undef _CHAR_TRAITS_EOF -#endif +#endif // _CHAR_TRAITS_H diff --git a/libstdc++-v3/include/bits/postypes.h b/libstdc++-v3/include/bits/postypes.h index 1bc972af187..6d57a24701e 100644 --- a/libstdc++-v3/include/bits/postypes.h +++ b/libstdc++-v3/include/bits/postypes.h @@ -222,6 +222,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /// File position for wchar_t streams. typedef fpos<mbstate_t> wstreampos; +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /// File position for char16_t streams. + typedef fpos<mbstate_t> u16streampos; + /// File position for char32_t streams. + typedef fpos<mbstate_t> u32streampos; +#endif + _GLIBCXX_END_NAMESPACE #endif diff --git a/libstdc++-v3/include/bits/stringfwd.h b/libstdc++-v3/include/bits/stringfwd.h index d27ef14be4b..10ecfd70236 100644 --- a/libstdc++-v3/include/bits/stringfwd.h +++ b/libstdc++-v3/include/bits/stringfwd.h @@ -1,6 +1,7 @@ // String support -*- C++ -*- -// Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +// 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 @@ -65,6 +66,17 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typedef basic_string<wchar_t> wstring; #endif +#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \ + && defined(_GLIBCXX_USE_C99_STDINT_TR1)) + + template<> struct char_traits<char16_t>; + template<> struct char_traits<char32_t>; + + typedef basic_string<char16_t> u16string; + typedef basic_string<char32_t> u32string; + +#endif + _GLIBCXX_END_NAMESPACE #endif // _STRINGFWD_H diff --git a/libstdc++-v3/include/ext/vstring_fwd.h b/libstdc++-v3/include/ext/vstring_fwd.h index bc11d603815..1dd0b65fe8f 100644 --- a/libstdc++-v3/include/ext/vstring_fwd.h +++ b/libstdc++-v3/include/ext/vstring_fwd.h @@ -1,6 +1,6 @@ // Versatile string forward -*- C++ -*- -// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007, 2008 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 @@ -70,6 +70,23 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) std::allocator<wchar_t>, __rc_string_base> __wrc_string; #endif +#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \ + && defined(_GLIBCXX_USE_C99_STDINT_TR1)) + + typedef __versa_string<char16_t> __u16vstring; + typedef __u16vstring __u16sso_string; + typedef + __versa_string<char16_t, std::char_traits<char16_t>, + std::allocator<char16_t>, __rc_string_base> __u16rc_string; + + typedef __versa_string<char32_t> __u32vstring; + typedef __u32vstring __u32sso_string; + typedef + __versa_string<char32_t, std::char_traits<char32_t>, + std::allocator<char32_t>, __rc_string_base> __u32rc_string; + +#endif + _GLIBCXX_END_NAMESPACE #endif /* _VSTRING_FWD_H */ diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char/1.cc new file mode 100644 index 00000000000..95b6846c225 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char/1.cc @@ -0,0 +1,23 @@ +// { dg-do compile } + +// Copyright (C) 2008 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 <string> + +template class std::basic_string<char>; diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char16_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char16_t/1.cc new file mode 100644 index 00000000000..27401fe4352 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char16_t/1.cc @@ -0,0 +1,25 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// Copyright (C) 2008 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 <string> + +template class std::basic_string<char16_t>; diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char32_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char32_t/1.cc new file mode 100644 index 00000000000..cdc6a8246c7 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char32_t/1.cc @@ -0,0 +1,25 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// Copyright (C) 2008 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 <string> + +template class std::basic_string<char32_t>; diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/wchar_t/1.cc new file mode 100644 index 00000000000..fcf0dad31c7 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/wchar_t/1.cc @@ -0,0 +1,23 @@ +// { dg-do compile } + +// Copyright (C) 2008 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 <string> + +template class std::basic_string<wchar_t>; diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char16_t/typedefs.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char16_t/typedefs.cc new file mode 100644 index 00000000000..dd7de958bfb --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char16_t/typedefs.cc @@ -0,0 +1,41 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// Copyright (C) 2008 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 <string> +#include <cstdint> + +int main() +{ + // Check for required typedefs. + typedef std::char_traits<char16_t> test_type; + typedef test_type::char_type char_type; + typedef test_type::int_type int_type; + typedef test_type::off_type off_type; + typedef test_type::pos_type pos_type; + typedef test_type::state_type state_type; + + // char_traits<char16_t>::int_type == uint_least16_t + test_type::int_type* p = 0; + std::uint_least16_t* q __attribute__((unused)) = p; + + return 0; +} diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char32_t/typedefs.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char32_t/typedefs.cc new file mode 100644 index 00000000000..819a78cc2bf --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char32_t/typedefs.cc @@ -0,0 +1,41 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// Copyright (C) 2008 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 <string> +#include <cstdint> + +int main() +{ + // Check for required typedefs. + typedef std::char_traits<char32_t> test_type; + typedef test_type::char_type char_type; + typedef test_type::int_type int_type; + typedef test_type::off_type off_type; + typedef test_type::pos_type pos_type; + typedef test_type::state_type state_type; + + // char_traits<char16_t>::int_type == uint_least32_t + test_type::int_type* p = 0; + std::uint_least32_t* q __attribute__((unused)) = p; + + return 0; +} diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char/1.cc new file mode 100644 index 00000000000..6bb5a7e6f56 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char/1.cc @@ -0,0 +1,23 @@ +// { dg-do compile } + +// Copyright (C) 2008 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 <string> + +template class std::char_traits<char>; diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char16_t/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char16_t/1.cc new file mode 100644 index 00000000000..9626e10d34b --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char16_t/1.cc @@ -0,0 +1,25 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// Copyright (C) 2008 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 <string> + +template class std::char_traits<char16_t>; diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char32_t/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char32_t/1.cc new file mode 100644 index 00000000000..be94c6c52a7 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char32_t/1.cc @@ -0,0 +1,25 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// Copyright (C) 2008 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 <string> + +template class std::char_traits<char32_t>; diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/short/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/short/1.cc new file mode 100644 index 00000000000..d31c3250b0b --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/short/1.cc @@ -0,0 +1,23 @@ +// { dg-do compile } + +// Copyright (C) 2008 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 <string> + +template class std::char_traits<short>; diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/wchar_t/1.cc new file mode 100644 index 00000000000..dbe5362ac4e --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/wchar_t/1.cc @@ -0,0 +1,23 @@ +// { dg-do compile } + +// Copyright (C) 2008 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 <string> + +template class std::char_traits<wchar_t>; diff --git a/libstdc++-v3/testsuite/21_strings/headers/string/types_std_c++0x.cc b/libstdc++-v3/testsuite/21_strings/headers/string/types_std_c++0x.cc new file mode 100644 index 00000000000..b26463d9484 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/headers/string/types_std_c++0x.cc @@ -0,0 +1,29 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// Copyright (C) 2008 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 <string> + +namespace gnu +{ + typedef std::u16string t3; + typedef std::u32string t4; +} diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char16_t/1.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char16_t/1.cc new file mode 100644 index 00000000000..7f62f3e0394 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char16_t/1.cc @@ -0,0 +1,42 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// Copyright (C) 2008 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. + +// This file tests explicit instantiation of __versa_string + +#include <ext/vstring.h> + +template class __gnu_cxx::__versa_string<char16_t, std::char_traits<char16_t>, + std::allocator<char16_t>, + __gnu_cxx::__sso_string_base>; + +template class __gnu_cxx::__versa_string<char16_t, std::char_traits<char16_t>, + std::allocator<char16_t>, + __gnu_cxx::__rc_string_base>; diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char32_t/1.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char32_t/1.cc new file mode 100644 index 00000000000..6fd0b78ac71 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char32_t/1.cc @@ -0,0 +1,42 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } +// { dg-require-cstdint "" } + +// Copyright (C) 2008 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. + +// This file tests explicit instantiation of __versa_string + +#include <ext/vstring.h> + +template class __gnu_cxx::__versa_string<char32_t, std::char_traits<char32_t>, + std::allocator<char32_t>, + __gnu_cxx::__sso_string_base>; + +template class __gnu_cxx::__versa_string<char32_t, std::char_traits<char32_t>, + std::allocator<char32_t>, + __gnu_cxx::__rc_string_base>; |