From patchwork Fri Mar 4 21:30:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Kosnik X-Patchwork-Id: 85442 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 45F131007D8 for ; Sat, 5 Mar 2011 08:30:28 +1100 (EST) Received: (qmail 11238 invoked by alias); 4 Mar 2011 21:30:26 -0000 Received: (qmail 11208 invoked by uid 22791); 4 Mar 2011 21:30:19 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_CX, TW_DC, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Mar 2011 21:30:09 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p24LU7EC015321 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 4 Mar 2011 16:30:08 -0500 Received: from shotwell (ovpn-113-144.phx2.redhat.com [10.3.113.144]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p24LU6RT017396 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 4 Mar 2011 16:30:06 -0500 Date: Fri, 4 Mar 2011 13:30:05 -0800 From: Benjamin Kosnik To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: [v3] --enable-extern-template Message-ID: <20110304133005.3e8c12d9@shotwell> Mime-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org C++0x linkage audit for "extern template" usage. There is no behavior change here, just an additional group in the src Makefile. The previous macro, _GLIBCXX_EXTERN_TEMPLATE is used as before. This patch allows building libstdc++.so/libstdc++.a without extern template and the instantation files that are required with it, by configuration with --disable-extern-template. tested x86/linux tested x86_64/linux -benjamin 2011-03-04 Benjamin Kosnik * src/Makefile.am (inst_sources): Make source instantion files conditional. (XTEMPLATE_FLAGS): Make -fno-implicit-templates conditional. * src/Makefile.in: Regenerate. * src/valarray-inst.cc: Move to.. * src/valarray.cc: ...this. * acinclude.m4 (GLIBCXX_ENABLE_EXTERN_TEMPLATE]): Define. * configure.ac (GLIBCXX_ENABLE_EXTERN_TEMPLATE): Use it. * configure: Regenerate. * include/Makefile.am (stamp-extern-template): Add. * include/Makefile.in: Regenerate. * doc/xml/manual/configure.xml: Document --enable-extern-template. * include/bits/locale_classes.tcc: Adjust comment. * include/bits/locale_facets.tcc: Same. * include/bits/basic_ios.tcc: Same. * include/bits/istream.tcc: Same. * include/bits/codecvt.h: Same. * include/bits/ostream.tcc: Same. * include/bits/sstream.tcc: Same. * include/bits/c++config: Same. * include/bits/basic_string.tcc: Same. * include/bits/ostream_insert.h: Same. * include/bits/locale_facets_nonio.tcc: Same. * include/bits/streambuf.tcc: Same. * include/bits/allocator.h: Same. * include/bits/fstream.tcc: Same. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line numbers. Index: src/valarray-inst.cc =================================================================== --- src/valarray-inst.cc (revision 170685) +++ src/valarray-inst.cc (working copy) @@ -1,109 +0,0 @@ -// Explicit instantiation file. - -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009 -// 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 3, 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. - -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -// -// ISO C++ 14882: -// - -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - - // Some explicit instantiations. - template void - __valarray_fill(size_t* __restrict__, size_t, const size_t&); - - template void - __valarray_copy(const size_t* __restrict__, size_t, size_t* __restrict__); - - template valarray::valarray(size_t); - template valarray::valarray(const valarray&); - template valarray::~valarray(); - template size_t valarray::size() const; - template size_t& valarray::operator[](size_t); - - inline size_t - __valarray_product(const valarray& __a) - { - typedef const size_t* __restrict__ _Tp; - const size_t __n = __a.size(); - // XXX: This ugly cast is necessary because - // valarray::operator[]() const return a VALUE! - // Try to get the committee to correct that gross error. - valarray& __t = const_cast&>(__a); - return __valarray_product(&__t[0], &__t[0] + __n); - } - - // Map a gslice, described by its multidimensional LENGTHS - // and corresponding STRIDES, to a linear array of INDEXES - // for the purpose of indexing a flat, one-dimensional array - // representation of a gslice_array. - void - __gslice_to_index(size_t __o, const valarray& __l, - const valarray& __s, valarray& __i) - { - // There are as many dimensions as there are strides. - const size_t __n = __l.size(); - - // Holds current multi-index as we go through the gslice for the - // purpose of computing its linear-image. - valarray __t(__l); - - // Note that this should match the product of all numbers appearing - // in __l which describes the multidimensional sizes of the - // generalized slice. - const size_t __z = __i.size(); - - for (size_t __j = 0; __j < __z; ++__j) - { - // Compute the linear-index image of (t_0, ... t_{n-1}). - __i[__j] = __o; - - --__t[__n - 1]; - __o += __s[__n - 1]; - - // Process the next multi-index. The loop ought to be - // backward since we're making a lexicographical visit. - for (size_t __k2 = __n - 1; __k2 && !__t[__k2]; --__k2) - { - __o -= __s[__k2] * __l[__k2]; - __t[__k2] = __l[__k2]; - - --__t[__k2 - 1]; - __o += __s[__k2 - 1]; - } - } - } - - gslice::_Indexer::_Indexer(size_t __o, const valarray& __l, - const valarray& __s) - : _M_count(1), _M_start(__o), _M_size(__l), _M_stride(__s), - _M_index(__l.size() == 0 ? 0 : __valarray_product(__l)) - { __gslice_to_index(__o, __l, __s, _M_index); } - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace Index: src/Makefile.am =================================================================== --- src/Makefile.am (revision 170685) +++ src/Makefile.am (working copy) @@ -1,7 +1,7 @@ ## Makefile for the src subdirectory of the GNU C++ Standard library. ## ## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -## 2006, 2007, 2008, 2009, 2010 +## 2006, 2007, 2008, 2009, 2010, 2011 ## Free Software Foundation, Inc. ## ## This file is part of the libstdc++ version 3 distribution. @@ -108,7 +108,7 @@ messages_members.cc \ monetary_members.cc \ numeric_members.cc \ - time_members.cc + time_members.cc codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC) $(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true @@ -138,7 +138,8 @@ # Source files linked in via configuration/make substitution for a # particular host, but with ad hoc naming rules. host_sources_extra = \ - basic_file.cc c++locale.cc ${ldbl_compat_sources} ${parallel_sources} + basic_file.cc c++locale.cc \ + ${inst_sources} ${ldbl_compat_sources} ${parallel_sources} c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC) $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true @@ -148,8 +149,8 @@ if ENABLE_PARALLEL parallel_sources = parallel_settings.cc \ - compatibility-parallel_list.cc \ - compatibility-parallel_list-2.cc + compatibility-parallel_list.cc \ + compatibility-parallel_list-2.cc else parallel_sources = endif @@ -160,7 +161,30 @@ ldbl_compat_sources = endif -# Sources present in the src directory. +if ENABLE_EXTERN_TEMPLATE +XTEMPLATE_FLAGS = -fno-implicit-templates +inst_sources = \ + allocator-inst.cc \ + concept-inst.cc \ + ext-inst.cc \ + fstream-inst.cc \ + ios-inst.cc \ + iostream-inst.cc \ + istream-inst.cc \ + locale-inst.cc \ + misc-inst.cc \ + ostream-inst.cc \ + sstream-inst.cc \ + streambuf-inst.cc \ + string-inst.cc \ + wlocale-inst.cc \ + wstring-inst.cc +else +XTEMPLATE_FLAGS = +inst_sources = +endif + +# Sources present in the src directory, always present. sources = \ atomic.cc \ bitmap_allocator.cc \ @@ -198,33 +222,18 @@ strstream.cc \ system_error.cc \ tree.cc \ - allocator-inst.cc \ - concept-inst.cc \ - fstream-inst.cc \ - ext-inst.cc \ - ios-inst.cc \ - iostream-inst.cc \ - istream-inst.cc \ istream.cc \ - locale-inst.cc \ - misc-inst.cc \ - ostream-inst.cc \ placeholders.cc \ regex.cc \ - sstream-inst.cc \ - streambuf-inst.cc \ streambuf.cc \ - string-inst.cc \ - valarray-inst.cc \ - wlocale-inst.cc \ - wstring-inst.cc \ mutex.cc \ condition_variable.cc \ chrono.cc \ thread.cc \ future.cc \ + valarray.cc \ ${host_sources} \ - ${host_sources_extra} + ${host_sources_extra} vpath % $(top_srcdir)/src vpath % $(top_srcdir) @@ -240,7 +249,7 @@ $(top_builddir)/libsupc++/libsupc++convenience.la libstdc___la_LDFLAGS = \ - -version-info $(libtool_VERSION) ${version_arg} -lm + -version-info $(libtool_VERSION) ${version_arg} -lm libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) @@ -383,7 +392,7 @@ # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden # as the occasion calls for it. AM_CXXFLAGS = \ - -fno-implicit-templates \ + $(XTEMPLATE_FLAGS) \ $(WARN_CXXFLAGS) \ $(OPTIMIZE_CXXFLAGS) \ $(CONFIG_CXXFLAGS) @@ -407,8 +416,10 @@ # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to # attempt to infer which configuration to use -LTCXXCOMPILE = $(LIBTOOL) --tag CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \ - $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \ + $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) Index: configure.ac =================================================================== --- configure.ac (revision 170685) +++ configure.ac (working copy) @@ -132,6 +132,7 @@ GLIBCXX_ENABLE_PARALLEL([yes]) GLIBCXX_ENABLE_CXX_FLAGS GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no]) +GLIBCXX_ENABLE_EXTERN_TEMPLATE([yes]) # Checks for operating systems support that doesn't require linking. GLIBCXX_CHECK_SYSTEM_ERROR Index: doc/xml/manual/configure.xml =================================================================== --- doc/xml/manual/configure.xml (revision 170685) +++ doc/xml/manual/configure.xml (working copy) @@ -161,6 +161,29 @@ + + --enable-libstdcxx-time + This is an abbreviated form of + '--enable-libstdcxx-time=yes'(described next). + + + + --enable-libstdcxx-time=OPTION + Enables link-type checks for the availability of the + clock_gettime clocks, used in the implementation of [time.clock], + and of the nanosleep and sched_yield functions, used in the + implementation of [thread.thread.this] of the current C++0x draft. + The choice OPTION=yes checks for the availability of the facilities + in libc and libposix4. In case of need the latter is also linked + to libstdc++ as part of the build process. OPTION=rt also searches + (and, in case, links) librt. Note that the latter is not always + desirable because, in glibc, for example, in turn it triggers the + linking of libpthread too, which activates locking, a large overhead + for single-thread programs. OPTION=no skips the tests completely. + The default is OPTION=no. + + + --enable-libstdcxx-debug Build separate debug libraries in addition to what is normally built. By default, the debug libraries are compiled with @@ -313,6 +336,19 @@ + + --enable-extern-template[default] + Use extern template to pre-instantiate all required + specializations for certain types defined in the standard libraries. + These types include string and dependents like + char_traits, the templateized io classes, + allocator, and others. + Disabling means that implicit + template generation will be used when compiling these types. By + default, this option is on. This option can change the library ABI. + + + --disable-hosted-libstdcxx @@ -324,28 +360,6 @@ - --enable-libstdcxx-time - This is an abbreviated form of - '--enable-libstdcxx-time=yes'(described next). - - - - --enable-libstdcxx-time=OPTION - Enables link-type checks for the availability of the - clock_gettime clocks, used in the implementation of [time.clock], - and of the nanosleep and sched_yield functions, used in the - implementation of [thread.thread.this] of the current C++0x draft. - The choice OPTION=yes checks for the availability of the facilities - in libc and libposix4. In case of need the latter is also linked - to libstdc++ as part of the build process. OPTION=rt also searches - (and, in case, links) librt. Note that the latter is not always - desirable because, in glibc, for example, in turn it triggers the - linking of libpthread too, which activates locking, a large overhead - for single-thread programs. OPTION=no skips the tests completely. - The default is OPTION=no. - - - Index: include/bits/locale_classes.tcc =================================================================== --- include/bits/locale_classes.tcc (revision 170685) +++ include/bits/locale_classes.tcc (working copy) @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +// Copyright (C) 2007, 2008, 2009, 2010, 2011 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 @@ -241,7 +241,6 @@ // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template class collate; extern template class collate_byname; @@ -269,6 +268,6 @@ #endif _GLIBCXX_END_NAMESPACE_VERSION -} // namespace +} // namespace std #endif Index: include/bits/locale_facets.tcc =================================================================== --- include/bits/locale_facets.tcc (revision 170685) +++ include/bits/locale_facets.tcc (working copy) @@ -1,7 +1,7 @@ // Locale support -*- C++ -*- // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -// 2006, 2007, 2008, 2009, 2010 +// 2006, 2007, 2008, 2009, 2010, 2011 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -1276,7 +1276,6 @@ // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template class numpunct; extern template class numpunct_byname; Index: include/bits/basic_ios.tcc =================================================================== --- include/bits/basic_ios.tcc (revision 170685) +++ include/bits/basic_ios.tcc (working copy) @@ -1,7 +1,7 @@ // basic_ios member functions -*- C++ -*- // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -// 2009, 2010 Free Software Foundation, Inc. +// 2009, 2010, 2011 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 @@ -175,7 +175,6 @@ // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template class basic_ios; @@ -185,6 +184,6 @@ #endif _GLIBCXX_END_NAMESPACE_VERSION -} // namespace +} // namespace std #endif Index: include/bits/istream.tcc =================================================================== --- include/bits/istream.tcc (revision 170685) +++ include/bits/istream.tcc (working copy) @@ -1038,7 +1038,6 @@ // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template class basic_istream; extern template istream& ws(istream&); @@ -1090,6 +1089,6 @@ #endif _GLIBCXX_END_NAMESPACE_VERSION -} // namespace +} // namespace std #endif Index: include/bits/codecvt.h =================================================================== --- include/bits/codecvt.h (revision 170685) +++ include/bits/codecvt.h (working copy) @@ -1,7 +1,7 @@ // Locale support (codecvt) -*- C++ -*- // Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -// 2009, 2010 Free Software Foundation, Inc. +// 2009, 2010, 2011 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 @@ -476,7 +476,6 @@ // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template class codecvt_byname; @@ -502,6 +501,6 @@ #endif _GLIBCXX_END_NAMESPACE_VERSION -} // namespace +} // namespace std #endif // _CODECVT_H Index: include/bits/ostream.tcc =================================================================== --- include/bits/ostream.tcc (revision 170685) +++ include/bits/ostream.tcc (working copy) @@ -357,7 +357,6 @@ // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template class basic_ostream; extern template ostream& endl(ostream&); @@ -405,6 +404,6 @@ #endif _GLIBCXX_END_NAMESPACE_VERSION -} // namespace +} // namespace std #endif Index: include/bits/sstream.tcc =================================================================== --- include/bits/sstream.tcc (revision 170685) +++ include/bits/sstream.tcc (working copy) @@ -270,7 +270,6 @@ // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template class basic_stringbuf; extern template class basic_istringstream; @@ -286,6 +285,6 @@ #endif _GLIBCXX_END_NAMESPACE_VERSION -} // namespace +} // namespace std #endif Index: include/bits/c++config =================================================================== --- include/bits/c++config (revision 170685) +++ include/bits/c++config (working copy) @@ -109,9 +109,7 @@ // Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern // templates only in basic_string, thus activating its debug-mode // checks even at -O0. -#ifndef _GLIBCXX_EXTERN_TEMPLATE -# define _GLIBCXX_EXTERN_TEMPLATE 1 -#endif +#define _GLIBCXX_EXTERN_TEMPLATE /* Outline of libstdc++ namespaces. Index: include/bits/basic_string.tcc =================================================================== --- include/bits/basic_string.tcc (revision 170685) +++ include/bits/basic_string.tcc (working copy) @@ -1130,7 +1130,6 @@ // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE > 0 extern template class basic_string; extern template @@ -1164,6 +1163,6 @@ #endif _GLIBCXX_END_NAMESPACE_VERSION -} // namespace +} // namespace std #endif Index: include/bits/ostream_insert.h =================================================================== --- include/bits/ostream_insert.h (revision 170685) +++ include/bits/ostream_insert.h (working copy) @@ -114,7 +114,6 @@ // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template ostream& __ostream_insert(ostream&, const char*, streamsize); @@ -125,6 +124,6 @@ #endif _GLIBCXX_END_NAMESPACE_VERSION -} // namespace +} // namespace std #endif /* _OSTREAM_INSERT_H */ Index: include/bits/locale_facets_nonio.tcc =================================================================== --- include/bits/locale_facets_nonio.tcc (revision 170685) +++ include/bits/locale_facets_nonio.tcc (working copy) @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +// Copyright (C) 2007, 2008, 2009, 2010, 2011 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 @@ -1215,7 +1215,6 @@ // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template class moneypunct; extern template class moneypunct; @@ -1369,6 +1368,6 @@ #endif _GLIBCXX_END_NAMESPACE_VERSION -} // namespace +} // namespace std #endif Index: include/bits/streambuf.tcc =================================================================== --- include/bits/streambuf.tcc (revision 170685) +++ include/bits/streambuf.tcc (working copy) @@ -146,7 +146,6 @@ // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template class basic_streambuf; extern template @@ -172,6 +171,6 @@ #endif _GLIBCXX_END_NAMESPACE_VERSION -} // namespace +} // namespace std #endif Index: include/bits/allocator.h =================================================================== --- include/bits/allocator.h (revision 170685) +++ include/bits/allocator.h (working copy) @@ -1,7 +1,7 @@ // Allocators -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -// Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +// 2011 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 @@ -139,7 +139,6 @@ // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template class allocator; extern template class allocator; @@ -235,6 +234,6 @@ #endif _GLIBCXX_END_NAMESPACE_VERSION -} // namespace +} // namespace std #endif Index: include/bits/fstream.tcc =================================================================== --- include/bits/fstream.tcc (revision 170685) +++ include/bits/fstream.tcc (working copy) @@ -964,7 +964,6 @@ // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template class basic_filebuf; extern template class basic_ifstream; @@ -980,6 +979,6 @@ #endif _GLIBCXX_END_NAMESPACE_VERSION -} // namespace +} // namespace std #endif Index: include/Makefile.am =================================================================== --- include/Makefile.am (revision 170685) +++ include/Makefile.am (working copy) @@ -1067,6 +1067,14 @@ echo 0 > stamp-namespace-version endif +if ENABLE_EXTERN_TEMPLATE +stamp-extern-template: + echo 1 > stamp-extern-template +else +stamp-extern-template: + echo 0 > stamp-extern-template +endif + if ENABLE_VISIBILITY stamp-visibility: echo 1 > stamp-visibility @@ -1082,10 +1090,12 @@ stamp-${host_alias} \ ${toplevel_srcdir}/gcc/DATESTAMP \ stamp-namespace-version \ - stamp-visibility + stamp-visibility \ + stamp-extern-template @date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\ ns_version=`cat stamp-namespace-version` ;\ visibility=`cat stamp-visibility` ;\ + externtemplate=`cat stamp-extern-template` ;\ ldbl_compat='s,g,g,' ;\ grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \ ${CONFIG_HEADER} > /dev/null 2>&1 \ @@ -1093,6 +1103,7 @@ sed -e "s,define __GLIBCXX__,define __GLIBCXX__ $$date," \ -e "s,define _GLIBCXX_INLINE_VERSION, define _GLIBCXX_INLINE_VERSION $$ns_version," \ -e "s,define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY, define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY $$visibility," \ + -e "s,define _GLIBCXX_EXTERN_TEMPLATE, define _GLIBCXX_EXTERN_TEMPLATE $$externtemplate," \ -e "$$ldbl_compat" \ < ${glibcxx_srcdir}/include/bits/c++config > $@ ;\ sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \ Index: testsuite/ext/profile/mutex_extensions_neg.cc =================================================================== --- testsuite/ext/profile/mutex_extensions_neg.cc (revision 170685) +++ testsuite/ext/profile/mutex_extensions_neg.cc (working copy) @@ -22,4 +22,4 @@ #include -// { dg-error "multiple inlined namespaces" "" { target *-*-* } 243 } +// { dg-error "multiple inlined namespaces" "" { target *-*-* } 241 } Index: acinclude.m4 =================================================================== --- acinclude.m4 (revision 170685) +++ acinclude.m4 (working copy) @@ -1993,6 +1993,25 @@ ]) dnl +dnl Use extern templates. +dnl +dnl --enable-extern-template defines _GLIBCXX_EXTERN_TEMPLATE to 1 +dnl --disable-extern-template defines _GLIBCXX_EXTERN_TEMPLATE to 0 + +dnl + Usage: GLIBCXX_ENABLE_TEMPLATE[(DEFAULT)] +dnl Where DEFAULT is `yes' or `no'. +dnl +AC_DEFUN([GLIBCXX_ENABLE_EXTERN_TEMPLATE], [ + + GLIBCXX_ENABLE(extern-template,$1,,[enable extern template]) + + AC_MSG_CHECKING([for extern template support]) + AC_MSG_RESULT([$enable_extern_template]) + + GLIBCXX_CONDITIONAL(ENABLE_EXTERN_TEMPLATE, test $enable_extern_template = yes) +]) + +dnl dnl Check for parallel mode pre-requisites, including OpenMP support. dnl dnl + Usage: GLIBCXX_ENABLE_PARALLEL