This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[Patch] Fix ctype_byname vs synopsis.cc
- From: Paolo Carlini <pcarlini at suse dot de>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Sun, 25 Feb 2007 02:58:02 +0100
- Subject: [Patch] Fix ctype_byname vs synopsis.cc
Hi,
the obvious changes seem safe wrt the ABI (also double checked that the
set of exported symbols is the same and that an old binary using
ctype_byname linked vs the new library still works). I'll wait 'til
tomorrow italian time, anyway...
Tested x86-linux, gnu/generic locale models.
Paolo.
////////////////
2007-02-25 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.h (class ctype_byname<char>,
class ctype_byname<wchar_t>): Declare.
* src/ctype.cc (ctype_byname<wchar_t>::ctype_byname(const char*,
size_t), ctype_byname<wchar_t>::~ctype_byname): Define.
* config/locale/generic/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/gnu/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* config/locale/darwin/ctype_members.cc (ctype_byname<char>::
ctype_byname(const char*, size_t), ctype_byname<char>::~ctype_byname):
Likewise.
* testsuite/22_locale/headers/locale/synopsis.cc: Remove xfail.
Index: src/ctype.cc
===================================================================
--- src/ctype.cc (revision 122296)
+++ src/ctype.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
+// 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -98,17 +99,20 @@
ctype<wchar_t>::~ctype()
{ _S_destroy_c_locale(_M_c_locale_ctype); }
- template<>
- ctype_byname<wchar_t>::ctype_byname(const char* __s, size_t __refs)
- : ctype<wchar_t>(__refs)
- {
- if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
- {
- this->_S_destroy_c_locale(this->_M_c_locale_ctype);
- this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
- this->_M_initialize_ctype();
- }
- }
+ ctype_byname<wchar_t>::ctype_byname(const char* __s, size_t __refs)
+ : ctype<wchar_t>(__refs)
+ {
+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
+ {
+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
+ this->_M_initialize_ctype();
+ }
+ }
+
+ ctype_byname<wchar_t>::~ctype_byname()
+ { }
+
#endif
_GLIBCXX_END_NAMESPACE
Index: include/bits/locale_facets.h
===================================================================
--- include/bits/locale_facets.h (revision 122296)
+++ include/bits/locale_facets.h (working copy)
@@ -1,6 +1,7 @@
// Locale support -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -1510,7 +1511,7 @@
class ctype_byname : public ctype<_CharT>
{
public:
- typedef _CharT char_type;
+ typedef typename ctype<_CharT>::mask mask;
explicit
ctype_byname(const char* __s, size_t __refs = 0);
@@ -1522,11 +1523,31 @@
/// 22.2.1.4 Class ctype_byname specializations.
template<>
- ctype_byname<char>::ctype_byname(const char*, size_t refs);
+ class ctype_byname<char> : public ctype<char>
+ {
+ public:
+ explicit
+ ctype_byname(const char* __s, size_t __refs = 0);
+ protected:
+ virtual
+ ~ctype_byname();
+ };
+
+#ifdef _GLIBCXX_USE_WCHAR_T
template<>
- ctype_byname<wchar_t>::ctype_byname(const char*, size_t refs);
+ class ctype_byname<wchar_t> : public ctype<wchar_t>
+ {
+ public:
+ explicit
+ ctype_byname(const char* __s, size_t __refs = 0);
+ protected:
+ virtual
+ ~ctype_byname();
+ };
+#endif
+
_GLIBCXX_END_NAMESPACE
// Include host and configuration specific ctype inlines.
Index: testsuite/22_locale/headers/locale/synopsis.cc
===================================================================
--- testsuite/22_locale/headers/locale/synopsis.cc (revision 122296)
+++ testsuite/22_locale/headers/locale/synopsis.cc (working copy)
@@ -1,5 +1,4 @@
-// { dg-do compile { xfail *-*-* } }
-// { dg-excess-errors "" }
+// { dg-do compile }
// Copyright (C) 2007 Free Software Foundation, Inc.
//
Index: config/locale/darwin/ctype_members.cc
===================================================================
--- config/locale/darwin/ctype_members.cc (revision 122296)
+++ config/locale/darwin/ctype_members.cc (working copy)
@@ -1,6 +1,7 @@
// std::ctype implementation details, GNU version -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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
@@ -40,17 +41,20 @@
{
// NB: The other ctype<char> specializations are in src/locale.cc and
// various /config/os/* files.
- template<>
- ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
- : ctype<char>(0, false, __refs)
- {
- if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
- {
- this->_S_destroy_c_locale(this->_M_c_locale_ctype);
- this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
- }
- }
+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
+ : ctype<char>(0, false, __refs)
+ {
+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
+ {
+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
+ }
+ }
+
+ ctype_byname<char>::~ctype_byname()
+ { }
+
#ifdef _GLIBCXX_USE_WCHAR_T
ctype<wchar_t>::__wmask_type
ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
Index: config/locale/gnu/ctype_members.cc
===================================================================
--- config/locale/gnu/ctype_members.cc (revision 122296)
+++ config/locale/gnu/ctype_members.cc (working copy)
@@ -1,6 +1,7 @@
// std::ctype implementation details, GNU version -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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
@@ -40,20 +41,22 @@
// NB: The other ctype<char> specializations are in src/locale.cc and
// various /config/os/* files.
- template<>
- ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
- : ctype<char>(0, false, __refs)
- {
- if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
- {
- this->_S_destroy_c_locale(this->_M_c_locale_ctype);
- this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
- this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
- this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
- this->_M_table = this->_M_c_locale_ctype->__ctype_b;
- }
- }
+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
+ : ctype<char>(0, false, __refs)
+ {
+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
+ {
+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
+ }
+ }
+ ctype_byname<char>::~ctype_byname()
+ { }
+
#ifdef _GLIBCXX_USE_WCHAR_T
ctype<wchar_t>::__wmask_type
ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
Index: config/locale/generic/ctype_members.cc
===================================================================
--- config/locale/generic/ctype_members.cc (revision 122296)
+++ config/locale/generic/ctype_members.cc (working copy)
@@ -1,6 +1,7 @@
// std::ctype implementation details, generic version -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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
@@ -39,17 +40,19 @@
// NB: The other ctype<char> specializations are in src/locale.cc and
// various /config/os/* files.
- template<>
- ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
- : ctype<char>(0, false, __refs)
- {
- if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
- {
- this->_S_destroy_c_locale(this->_M_c_locale_ctype);
- this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
- }
- }
+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
+ : ctype<char>(0, false, __refs)
+ {
+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
+ {
+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
+ }
+ }
+ ctype_byname<char>::~ctype_byname()
+ { }
+
#ifdef _GLIBCXX_USE_WCHAR_T
ctype<wchar_t>::__wmask_type
ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const