From: Paolo Carlini Date: Wed, 20 Aug 2008 19:29:54 +0000 (+0000) Subject: PR libstdc++/33979 (partial) X-Git-Tag: releases/gcc-4.4.0~2999 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5e44d591c87e04e4a9acf6817f729a053dcfbc89;p=thirdparty%2Fgcc.git PR libstdc++/33979 (partial) 2008-08-20 Paolo Carlini PR libstdc++/33979 (partial) * include/bits/postypes.h (u16streampos, u32streampos): Add. * include/bits/char_traits.h (char_traits, char_traits): 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. From-SVN: r139339 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ab960cb2b490..f4d076eb4814 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,39 @@ +2008-08-20 Paolo Carlini + + PR libstdc++/33979 (partial) + * include/bits/postypes.h (u16streampos, u32streampos): Add. + * include/bits/char_traits.h (char_traits, + char_traits): 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 PR libstdc++/37149 diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h index 52158efff336..9dac22262376 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 + +_GLIBCXX_BEGIN_NAMESPACE(std) + + template<> + struct char_traits + { + 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 + (__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 + (__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(-1); } + + static int_type + not_eof(const int_type& __c) + { return eq_int_type(__c, eof()) ? 0 : __c; } + }; + + template<> + struct char_traits + { + 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 + (__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 + (__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(-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 1bc972af1873..6d57a24701e0 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 wstreampos; +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /// File position for char16_t streams. + typedef fpos u16streampos; + /// File position for char32_t streams. + typedef fpos u32streampos; +#endif + _GLIBCXX_END_NAMESPACE #endif diff --git a/libstdc++-v3/include/bits/stringfwd.h b/libstdc++-v3/include/bits/stringfwd.h index d27ef14be4b5..10ecfd70236b 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 wstring; #endif +#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \ + && defined(_GLIBCXX_USE_C99_STDINT_TR1)) + + template<> struct char_traits; + template<> struct char_traits; + + typedef basic_string u16string; + typedef basic_string 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 bc11d6038151..1dd0b65fe8fd 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, __rc_string_base> __wrc_string; #endif +#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \ + && defined(_GLIBCXX_USE_C99_STDINT_TR1)) + + typedef __versa_string __u16vstring; + typedef __u16vstring __u16sso_string; + typedef + __versa_string, + std::allocator, __rc_string_base> __u16rc_string; + + typedef __versa_string __u32vstring; + typedef __u32vstring __u32sso_string; + typedef + __versa_string, + std::allocator, __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 000000000000..95b6846c2250 --- /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 + +template class std::basic_string; 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 000000000000..27401fe43527 --- /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 + +template class std::basic_string; 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 000000000000..cdc6a8246c75 --- /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 + +template class std::basic_string; 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 000000000000..fcf0dad31c7b --- /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 + +template class std::basic_string; 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 000000000000..dd7de958bfbc --- /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 +#include + +int main() +{ + // Check for required typedefs. + typedef std::char_traits 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::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 000000000000..819a78cc2bf2 --- /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 +#include + +int main() +{ + // Check for required typedefs. + typedef std::char_traits 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::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 000000000000..6bb5a7e6f56f --- /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 + +template class std::char_traits; 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 000000000000..9626e10d34ba --- /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 + +template class std::char_traits; 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 000000000000..be94c6c52a79 --- /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 + +template class std::char_traits; 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 000000000000..d31c3250b0b1 --- /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 + +template class std::char_traits; 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 000000000000..dbe5362ac4e5 --- /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 + +template class std::char_traits; 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 000000000000..b26463d94848 --- /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 + +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 000000000000..7f62f3e03941 --- /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 + +template class __gnu_cxx::__versa_string, + std::allocator, + __gnu_cxx::__sso_string_base>; + +template class __gnu_cxx::__versa_string, + std::allocator, + __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 000000000000..6fd0b78ac717 --- /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 + +template class __gnu_cxx::__versa_string, + std::allocator, + __gnu_cxx::__sso_string_base>; + +template class __gnu_cxx::__versa_string, + std::allocator, + __gnu_cxx::__rc_string_base>;