From 41b4d44baccc40bfbed0352aa1239ee71bb4bc95 Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Fri, 8 Mar 2002 06:05:21 +0000 Subject: [PATCH] stl_alloc.h: Add extern implicit allocator instantiations. 2002-03-07 Benjamin Kosnik * include/bits/stl_alloc.h: Add extern implicit allocator instantiations. * include/bits/basic_string.tcc: Tweak. * include/bits/locale_facets.tcc: Remove default args. Add has_facet, use_facet extern instantiations. * src/stl-inst.cc: Add explicit instantiation. * src/locale-inst.cc: Clean. Remove locale member template instantiations. * testsuite/22_locale/operators.cc (test02): Enable. From-SVN: r50426 --- libstdc++-v3/ChangeLog | 13 ++ libstdc++-v3/config/linker-map.gnu | 2 +- libstdc++-v3/include/bits/basic_string.tcc | 2 +- libstdc++-v3/include/bits/locale_facets.tcc | 242 ++++++++++++++++++-- libstdc++-v3/include/bits/stl_alloc.h | 5 + libstdc++-v3/src/locale-inst.cc | 310 +++++++++++++++++--------- libstdc++-v3/src/locale.cc | 2 +- libstdc++-v3/src/stl-inst.cc | 5 +- libstdc++-v3/testsuite/22_locale/operators.cc | 8 +- 9 files changed, 451 insertions(+), 138 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index eaf39bf..4d0d917 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,16 @@ +2002-03-07 Benjamin Kosnik + + * include/bits/stl_alloc.h: Add extern implicit allocator + instantiations. + * include/bits/basic_string.tcc: Tweak. + * include/bits/locale_facets.tcc: Remove default args. Add + has_facet, use_facet extern instantiations. + * src/stl-inst.cc: Add explicit instantiation. + * src/locale-inst.cc: Clean. Remove locale member template + instantiations. + + * testsuite/22_locale/operators.cc (test02): Enable. + 2002-03-06 Benjamin Kosnik Stephen M. Webb diff --git a/libstdc++-v3/config/linker-map.gnu b/libstdc++-v3/config/linker-map.gnu index 27c6f66..7139552 100644 --- a/libstdc++-v3/config/linker-map.gnu +++ b/libstdc++-v3/config/linker-map.gnu @@ -37,6 +37,7 @@ GLIBCPP_3.1 { }; # Names not in an 'extern' block are mangled names. + _ZSt9has_facet*; # operator new(unsigned) _Znwj; @@ -101,4 +102,3 @@ CXXABI_1 { local: *; }; - diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc index dce9b38f..01a3fe6 100644 --- a/libstdc++-v3/include/bits/basic_string.tcc +++ b/libstdc++-v3/include/bits/basic_string.tcc @@ -945,7 +945,7 @@ namespace std // which are defined via explicit instantiations elsewhere. // NB: This syntax is a GNU extension. extern template class basic_string; - extern template + extern template basic_istream& operator>>(basic_istream&, string&); extern template diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index 8513f8b..e08dc36 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -2061,36 +2061,38 @@ namespace std // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. // NB: This syntax is a GNU extension. + extern template class vector; + extern template class moneypunct; extern template class moneypunct; extern template class moneypunct_byname; extern template class moneypunct_byname; - extern template class money_get >; - extern template class money_put >; + extern template class money_get; + extern template class money_put; extern template class moneypunct; extern template class moneypunct; extern template class moneypunct_byname; extern template class moneypunct_byname; - extern template class money_get >; - extern template class money_put >; + extern template class money_get; + extern template class money_put; extern template class numpunct; extern template class numpunct_byname; - extern template class num_get >; - extern template class num_put >; + extern template class num_get; + extern template class num_put; extern template class numpunct; extern template class numpunct_byname; - extern template class num_get >; - extern template class num_put >; + extern template class num_get; + extern template class num_put; extern template class __timepunct; - extern template class time_put >; - extern template class time_put_byname >; - extern template class time_get >; - extern template class time_get_byname >; + extern template class time_put; + extern template class time_put_byname; + extern template class time_get; + extern template class time_get_byname; extern template class __timepunct; - extern template class time_put >; - extern template class time_put_byname >; - extern template class time_get >; - extern template class time_get_byname >; + extern template class time_put; + extern template class time_put_byname; + extern template class time_get; + extern template class time_get_byname; extern template class messages; extern template class messages_byname; extern template class messages; @@ -2103,13 +2105,217 @@ namespace std extern template class collate_byname; extern template class collate; extern template class collate_byname; -} // namespace std -#endif + extern template + const codecvt& + use_facet >(const locale&); + + extern template + const collate& + use_facet >(const locale&); + + extern template + const numpunct& + use_facet >(const locale&); + + extern template + const num_put& + use_facet >(const locale&); + + extern template + const num_get& + use_facet >(const locale&); + + extern template + const moneypunct& + use_facet >(const locale&); + + extern template + const moneypunct& + use_facet >(const locale&); + + extern template + const money_put& + use_facet >(const locale&); + + extern template + const money_get& + use_facet >(const locale&); + + extern template + const __timepunct& + use_facet<__timepunct >(const locale&); + + extern template + const time_put& + use_facet >(const locale&); + + extern template + const time_get& + use_facet >(const locale&); + + extern template + const messages& + use_facet >(const locale&); + + extern template + const codecvt& + use_facet >(locale const&); + + extern template + const collate& + use_facet >(const locale&); + + extern template + const numpunct& + use_facet >(const locale&); + + extern template + const num_put& + use_facet >(const locale&); + + extern template + const num_get& + use_facet >(const locale&); + extern template + const moneypunct& + use_facet >(const locale&); + extern template + const moneypunct& + use_facet >(const locale&); + + extern template + const money_put& + use_facet >(const locale&); + + extern template + const money_get& + use_facet >(const locale&); + + extern template + const __timepunct& + use_facet<__timepunct >(const locale&); + + extern template + const time_put& + use_facet >(const locale&); + + extern template + const time_get& + use_facet >(const locale&); + + extern template + const messages& + use_facet >(const locale&); + + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + extern template + bool + has_facet >(const locale&); + extern template + bool + has_facet >(const locale&); + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet<__timepunct >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet<__timepunct >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); +} // namespace std + +#endif diff --git a/libstdc++-v3/include/bits/stl_alloc.h b/libstdc++-v3/include/bits/stl_alloc.h index 7a4d9e9..4ff816b 100644 --- a/libstdc++-v3/include/bits/stl_alloc.h +++ b/libstdc++-v3/include/bits/stl_alloc.h @@ -922,6 +922,11 @@ struct _Alloc_traits<_Tp, __allocator<_Tp1, __debug_alloc<_Alloc> > > }; //@} + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. + // NB: This syntax is a GNU extension. + extern template class allocator; + extern template class allocator; } // namespace std #endif /* __GLIBCPP_INTERNAL_ALLOC_H */ diff --git a/libstdc++-v3/src/locale-inst.cc b/libstdc++-v3/src/locale-inst.cc index 324b07e..9e449e6 100644 --- a/libstdc++-v3/src/locale-inst.cc +++ b/libstdc++-v3/src/locale-inst.cc @@ -43,126 +43,124 @@ namespace std { - typedef ostreambuf_iterator obuf_iterator; - typedef istreambuf_iterator ibuf_iterator; - typedef ostreambuf_iterator wobuf_iterator; - typedef istreambuf_iterator wibuf_iterator; - // moneypunct, money_get, and money_put template class moneypunct; template class moneypunct; template class moneypunct_byname; template class moneypunct_byname; - template class money_get; - template class money_put; + template class money_get >; + template class money_put >; #ifdef _GLIBCPP_USE_WCHAR_T template class moneypunct; template class moneypunct; template class moneypunct_byname; template class moneypunct_byname; - template class money_get; - template class money_put; + template class money_get >; + template class money_put >; #endif // numpunct, numpunct_byname, num_get, and num_put template class numpunct; template class numpunct_byname; - template class num_get; - template class num_put; + template class num_get >; + template class num_put >; template - obuf_iterator - num_put:: - _M_convert_int(obuf_iterator, ios_base&, char, char, char, long) const; + ostreambuf_iterator + num_put >:: + _M_convert_int(ostreambuf_iterator, ios_base&, char, char, char, + long) const; template - obuf_iterator - num_put:: - _M_convert_int(obuf_iterator, ios_base&, char, char, char, + ostreambuf_iterator + num_put >:: + _M_convert_int(ostreambuf_iterator, ios_base&, char, char, char, unsigned long) const; #ifdef _GLIBCPP_USE_LONG_LONG template - obuf_iterator - num_put:: - _M_convert_int(obuf_iterator, ios_base&, char, char, char, + ostreambuf_iterator + num_put >:: + _M_convert_int(ostreambuf_iterator, ios_base&, char, char, char, long long) const; template - obuf_iterator - num_put:: - _M_convert_int(obuf_iterator, ios_base&, char, char, char, + ostreambuf_iterator + num_put >:: + _M_convert_int(ostreambuf_iterator, ios_base&, char, char, char, unsigned long long) const; #endif template - obuf_iterator - num_put:: - _M_convert_float(obuf_iterator, ios_base&, char, char, double) const; + ostreambuf_iterator + num_put >:: + _M_convert_float(ostreambuf_iterator, ios_base&, char, char, + double) const; template - obuf_iterator - num_put:: - _M_convert_float(obuf_iterator, ios_base&, char, char, + ostreambuf_iterator + num_put >:: + _M_convert_float(ostreambuf_iterator, ios_base&, char, char, long double) const; #ifdef _GLIBCPP_USE_WCHAR_T template class numpunct; template class numpunct_byname; - template class num_get; - template class num_put; + template class num_get >; + template class num_put >; template - wobuf_iterator - num_put:: - _M_convert_int(wobuf_iterator, ios_base&, wchar_t, char, char, long) const; + ostreambuf_iterator + num_put >:: + _M_convert_int(ostreambuf_iterator, ios_base&, wchar_t, char, + char, long) const; template - wobuf_iterator - num_put:: - _M_convert_int(wobuf_iterator, ios_base&, wchar_t, char, char, - unsigned long) const; + ostreambuf_iterator + num_put >:: + _M_convert_int(ostreambuf_iterator, ios_base&, wchar_t, char, + char, unsigned long) const; #ifdef _GLIBCPP_USE_LONG_LONG template - wobuf_iterator - num_put:: - _M_convert_int(wobuf_iterator, ios_base&, wchar_t, char, char, - long long) const; + ostreambuf_iterator + num_put >:: + _M_convert_int(ostreambuf_iterator, ios_base&, wchar_t, char, + char, long long) const; template - wobuf_iterator - num_put:: - _M_convert_int(wobuf_iterator, ios_base&, wchar_t, char, char, - unsigned long long) const; + ostreambuf_iterator + num_put >:: + _M_convert_int(ostreambuf_iterator, ios_base&, wchar_t, char, + char, unsigned long long) const; #endif template - wobuf_iterator - num_put:: - _M_convert_float(wobuf_iterator, ios_base&, wchar_t, char, + ostreambuf_iterator + num_put >:: + _M_convert_float(ostreambuf_iterator, ios_base&, wchar_t, char, double) const; template - wobuf_iterator - num_put:: - _M_convert_float(wobuf_iterator, ios_base&, wchar_t, char, + ostreambuf_iterator + num_put >:: + _M_convert_float(ostreambuf_iterator, ios_base&, wchar_t, char, long double) const; #endif // time_get and time_put template class __timepunct; - template class time_put; - template class time_put_byname; - template class time_get; - template class time_get_byname; + template class time_put >; + template class time_put_byname >; + template class time_get >; + template class time_get_byname >; #ifdef _GLIBCPP_USE_WCHAR_T template class __timepunct; - template class time_put; - template class time_put_byname; - template class time_get; - template class time_get_byname; + template class time_put >; + template class time_put_byname >; + template class time_get >; + template class time_get_byname >; #endif // messages @@ -198,18 +196,7 @@ namespace std #endif // use_facet - template - const numpunct& - use_facet >(const locale&); - - template - const num_put& - use_facet >(const locale&); - - template - const num_get& - use_facet >(const locale&); - + // NB: use_facet is specialized template const codecvt& use_facet >(const locale&); @@ -219,6 +206,18 @@ namespace std use_facet >(const locale&); template + const numpunct& + use_facet >(const locale&); + + template + const num_put& + use_facet >(const locale&); + + template + const num_get& + use_facet >(const locale&); + + template const moneypunct& use_facet >(const locale&); @@ -226,23 +225,31 @@ namespace std const moneypunct& use_facet >(const locale&); + template + const money_put& + use_facet >(const locale&); + + template + const money_get& + use_facet >(const locale&); + template const __timepunct& use_facet<__timepunct >(const locale&); -#ifdef _GLIBCPP_USE_WCHAR_T - template - const numpunct& - use_facet >(const locale&); + template + const time_put& + use_facet >(const locale&); template - const num_put& - use_facet >(const locale&); + const time_get& + use_facet >(const locale&); template - const num_get& - use_facet >(const locale&); + const messages& + use_facet >(const locale&); +#ifdef _GLIBCPP_USE_WCHAR_T template const codecvt& use_facet >(locale const&); @@ -252,78 +259,165 @@ namespace std use_facet >(const locale&); template + const numpunct& + use_facet >(const locale&); + + template + const num_put& + use_facet >(const locale&); + + template + const num_get& + use_facet >(const locale&); + + template const moneypunct& use_facet >(const locale&); template const moneypunct& use_facet >(const locale&); + + template + const money_put& + use_facet >(const locale&); + + template + const money_get& + use_facet >(const locale&); template const __timepunct& use_facet<__timepunct >(const locale&); + + template + const time_put& + use_facet >(const locale&); + + template + const time_get& + use_facet >(const locale&); + + template + const messages& + use_facet >(const locale&); #endif // has_facet template bool + has_facet >(const locale&); + + template + bool + has_facet >(const locale&); + + template + bool + has_facet >(const locale&); + + template + bool has_facet >(const locale&); + template bool has_facet >(const locale&); + template bool has_facet >(const locale&); + template bool - has_facet >(const locale&); + has_facet >(const locale&); + + template + bool + has_facet >(const locale&); + + template + bool + has_facet >(const locale&); + + template + bool + has_facet<__timepunct >(const locale&); + + template + bool + has_facet >(const locale&); + + template + bool + has_facet >(const locale&); + + template + bool + has_facet >(const locale&); #ifdef _GLIBCPP_USE_WCHAR_T + template + bool + has_facet >(const locale&); + + template + bool + has_facet >(const locale&); + + template + bool + has_facet >(const locale&); + template bool has_facet >(const locale&); + template bool has_facet >(const locale&); + template bool has_facet >(const locale&); + template bool - has_facet >(const locale&); -#endif + has_facet >(const locale&); - // - // iterator - // - typedef vector vec_pfacet; template - void - vec_pfacet:: - insert(vec_pfacet::iterator, vec_pfacet::size_type, - const vec_pfacet::value_type&); + bool + has_facet >(const locale&); + template - void - vec_pfacet:: - _M_fill_insert(vec_pfacet::iterator, vec_pfacet::size_type, - const vec_pfacet::value_type&); + bool + has_facet >(const locale&); + template + bool + has_facet<__timepunct >(const locale&); - // - // locale - // - typedef istreambuf_iterator > istreambuf_iter; - typedef ostreambuf_iterator > ostreambuf_iter; + template + bool + has_facet >(const locale&); -#ifdef _GLIBCPP_USE_WCHAR_T - typedef istreambuf_iterator > wistreambuf_iter; - typedef ostreambuf_iterator > wostreambuf_iter; -#endif + template + bool + has_facet >(const locale&); template bool - locale::operator()(const string&, const string&) const; + has_facet >(const locale&); +#endif + + // iterator + typedef vector vec_pfacet; + template class vector; + template class __normal_iterator >; + template class __normal_iterator >; + // locale template char* __add_grouping(char*, char, char const*, char const*, @@ -344,12 +438,6 @@ namespace std streamsize, streamsize, const bool); #ifdef _GLIBCPP_USE_WCHAR_T - template - bool - locale::operator()(const wstring&, const wstring&) const; - - typedef ostreambuf_iterator wostreambuf_iter; - template wchar_t* __add_grouping(wchar_t*, wchar_t, char const*, char const*, diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc index 43e9103..d2fd763 100644 --- a/libstdc++-v3/src/locale.cc +++ b/libstdc++-v3/src/locale.cc @@ -63,7 +63,7 @@ namespace std const size_t locale::_S_num_categories; const size_t locale::_S_num_facets; - // Definitions for locale::id of standard facets. + // Definitions for locale::id of standard facets that are specialized. locale::id ctype::id; locale::id codecvt::id; diff --git a/libstdc++-v3/src/stl-inst.cc b/libstdc++-v3/src/stl-inst.cc index eaf5559..94d26b3 100644 --- a/libstdc++-v3/src/stl-inst.cc +++ b/libstdc++-v3/src/stl-inst.cc @@ -34,11 +34,12 @@ #include #include #include -#include -#include namespace std { + template class allocator; + template class allocator; + template class __malloc_alloc_template<0>; #ifndef __USE_MALLOC diff --git a/libstdc++-v3/testsuite/22_locale/operators.cc b/libstdc++-v3/testsuite/22_locale/operators.cc index 9037dd8..f0e40d4 100644 --- a/libstdc++-v3/testsuite/22_locale/operators.cc +++ b/libstdc++-v3/testsuite/22_locale/operators.cc @@ -1,6 +1,6 @@ // 2000-09-11 Benjamin Kosnik -// Copyright (C) 2000, 2001 Free Software Foundation +// Copyright (C) 2000, 2001, 2002 Free Software Foundation // // 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 @@ -47,9 +47,9 @@ void test01() } // bool operator()(const string_type&, const string_type&) const -typedef std::collate ccollate; long gnu_count; -class gnu_collate: public ccollate + +class gnu_collate: public std::collate { protected: virtual int @@ -79,7 +79,7 @@ void test02() int main () { test01(); - + test02(); return 0; } -- 2.7.4