This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [v3] use_facet<ctype> clean up
- From: "Chris Fairles" <chris dot fairles at gmail dot com>
- To: luisgpm at linux dot vnet dot ibm dot com
- Cc: "Paolo Carlini" <paolo dot carlini at oracle dot com>, "Gcc Patch List" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 12 Sep 2008 02:47:18 -0400
- Subject: Re: [v3] use_facet<ctype> clean up
- References: <48C83DFA.9030905@oracle.com> <1221194246.18640.109.camel@gargoyle>
On Fri, Sep 12, 2008 at 12:37 AM, Luis Machado
<luisgpm@linux.vnet.ibm.com> wrote:
> Hi,
>
> This patch breaks the compilation of SPEC2000's 252.eon benchmark for
> PPC. Not sure if it does the same for x86. Any idea why?
>
> ./lib/gcc/powerpc64-linux/4.4.0/../../../../lib/libstdc++.so: undefined
> reference to `std::ctype<wchar_t> const&
> std::use_facet<std::ctype<wchar_t> >(std::locale const&)'
> collect2: ld returned 1 exit status
> specmake: *** [eon] Error 1
>
I got the exact same thing initially as well (
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37478 ) and to solve it I
had to basically to a clean bootstrap (like rm -rf gcc-build/*
re-config etc.). The build system does ok with detecting changes to
source and header files but exports and other things, not so much.
Cheers,
Chris
>
> Thanks,
> Luis
>
> On Wed, 2008-09-10 at 23:36 +0200, Paolo Carlini wrote:
>> Hi,
>>
>> noticed today while working on 37455. Tested x86_64-linux, without PCHs,
>> committed to mainline.
>>
>> Paolo.
>>
>> /////////////////////
>> plain text document attachment (CL_use_facet_ctype)
>> 2008-09-10 Paolo Carlini <paolo.carlini@oracle.com>
>>
>> * src/ctype.cc (use_facet<ctype<char> >, use_facet<ctype<wchar_t>):
>> Remove specializations.
>> * src/locale-inst.cc (use_facet<ctype<C> >): Instantiate.
>> * include/bits/locale_facets.tcc (use_facet<ctype<char> >,
>> use_facet<ctype<wchar_t>): Declare as extern template.
>> * include/bits/locale_facets.h (use_facet<ctype<char> >,
>> use_facet<ctype<wchar_t>): Do not declare as specializations.
>> plain text document attachment (patch_use_facet_ctype)
>> Index: src/ctype.cc
>> ===================================================================
>> *** src/ctype.cc (revision 140250)
>> --- src/ctype.cc (working copy)
>> *************** _GLIBCXX_BEGIN_NAMESPACE(std)
>> *** 53,78 ****
>> locale::id ctype<wchar_t>::id;
>> #endif
>>
>> - template<>
>> - const ctype<char>&
>> - use_facet<ctype<char> >(const locale& __loc)
>> - {
>> - size_t __i = ctype<char>::id._M_id();
>> - const locale::_Impl* __tmp = __loc._M_impl;
>> - return static_cast<const ctype<char>&>(*(__tmp->_M_facets[__i]));
>> - }
>> -
>> - #ifdef _GLIBCXX_USE_WCHAR_T
>> - template<>
>> - const ctype<wchar_t>&
>> - use_facet<ctype<wchar_t> >(const locale& __loc)
>> - {
>> - size_t __i = ctype<wchar_t>::id._M_id();
>> - const locale::_Impl* __tmp = __loc._M_impl;
>> - return static_cast<const ctype<wchar_t>&>(*(__tmp->_M_facets[__i]));
>> - }
>> - #endif
>> -
>> // XXX At some point, just rename this file to ctype_configure_char.cc
>> // and compile it as a separate file instead of including it here.
>> // Platform-specific initialization code for ctype tables.
>> --- 53,58 ----
>> Index: src/locale-inst.cc
>> ===================================================================
>> *** src/locale-inst.cc (revision 140250)
>> --- src/locale-inst.cc (working copy)
>> ***************
>> *** 1,6 ****
>> // Locale support -*- C++ -*-
>>
>> ! // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
>> // Free Software Foundation, Inc.
>> //
>> // This file is part of the GNU ISO C++ Library. This library is free
>> --- 1,6 ----
>> // Locale support -*- C++ -*-
>>
>> ! // Copyright (C) 1999, 2000, 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
>> *************** _GLIBCXX_END_LDBL_NAMESPACE
>> *** 192,198 ****
>> template class collate_byname<C>;
>>
>> // use_facet
>> ! // NB: use_facet<ctype> is specialized
>> template
>> const codecvt<C, char, mbstate_t>&
>> use_facet<codecvt<C, char, mbstate_t> >(const locale&);
>> --- 192,201 ----
>> template class collate_byname<C>;
>>
>> // use_facet
>> ! template
>> ! const ctype<C>&
>> ! use_facet<ctype<C> >(const locale&);
>> !
>> template
>> const codecvt<C, char, mbstate_t>&
>> use_facet<codecvt<C, char, mbstate_t> >(const locale&);
>> Index: include/bits/locale_facets.tcc
>> ===================================================================
>> *** include/bits/locale_facets.tcc (revision 140250)
>> --- include/bits/locale_facets.tcc (working copy)
>> ***************
>> *** 1,7 ****
>> // Locale support -*- C++ -*-
>>
>> // 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
>> --- 1,7 ----
>> // Locale support -*- C++ -*-
>>
>> // Copyright (C) 1997, 1998, 1999, 2000, 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
>> *************** _GLIBCXX_END_LDBL_NAMESPACE
>> *** 1284,1289 ****
>> --- 1284,1293 ----
>> extern template class ctype_byname<char>;
>>
>> extern template
>> + const ctype<char>&
>> + use_facet<ctype<char> >(const locale&);
>> +
>> + extern template
>> const numpunct<char>&
>> use_facet<numpunct<char> >(const locale&);
>>
>> *************** _GLIBCXX_END_LDBL_NAMESPACE
>> *** 1319,1324 ****
>> --- 1323,1332 ----
>> extern template class ctype_byname<wchar_t>;
>>
>> extern template
>> + const ctype<wchar_t>&
>> + use_facet<ctype<wchar_t> >(const locale&);
>> +
>> + extern template
>> const numpunct<wchar_t>&
>> use_facet<numpunct<wchar_t> >(const locale&);
>>
>> Index: include/bits/locale_facets.h
>> ===================================================================
>> *** include/bits/locale_facets.h (revision 140250)
>> --- include/bits/locale_facets.h (working copy)
>> *************** _GLIBCXX_BEGIN_NAMESPACE(std)
>> *** 1165,1174 ****
>> void _M_widen_init() const;
>> };
>>
>> - template<>
>> - const ctype<char>&
>> - use_facet<ctype<char> >(const locale& __loc);
>> -
>> #ifdef _GLIBCXX_USE_WCHAR_T
>> // 22.2.1.3 ctype<wchar_t> specialization
>> /**
>> --- 1165,1170 ----
>> *************** _GLIBCXX_BEGIN_NAMESPACE(std)
>> *** 1470,1479 ****
>> void
>> _M_initialize_ctype();
>> };
>> -
>> - template<>
>> - const ctype<wchar_t>&
>> - use_facet<ctype<wchar_t> >(const locale& __loc);
>> #endif //_GLIBCXX_USE_WCHAR_T
>>
>> /// class ctype_byname [22.2.1.2].
>> --- 1466,1471 ----
>> Index: ChangeLog
>> ===================================================================
>> *** ChangeLog (revision 140250)
>> --- ChangeLog (working copy)
>> ***************
>> *** 1,5 ****
>> --- 1,15 ----
>> 2008-09-10 Paolo Carlini <paolo.carlini@oracle.com>
>>
>> + * src/ctype.cc (use_facet<ctype<char> >, use_facet<ctype<wchar_t>):
>> + Remove specializations.
>> + * src/locale-inst.cc (use_facet<ctype<C> >): Instantiate.
>> + * include/bits/locale_facets.tcc (use_facet<ctype<char> >,
>> + use_facet<ctype<wchar_t>): Declare as extern template.
>> + * include/bits/locale_facets.h (use_facet<ctype<char> >,
>> + use_facet<ctype<wchar_t>): Do not declare as specializations.
>> +
>> + 2008-09-10 Paolo Carlini <paolo.carlini@oracle.com>
>> +
>> * config/locale/darwin/ctype_members.cc (ctype<char>::_M_narrow_init,
>> ctype<char>::_M_widen_init): Don't define here.
>> * config/locale/gnu/ctype_members.cc: Likewise.
>
>