This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[v3] Adjust c++config vs extern templates
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Thu, 15 Oct 2009 02:02:25 +0200
- Subject: [v3] Adjust c++config vs extern templates
Hi,
noticed while looking into the curious issue with .clone symbols: there
is no reason to disable extern templates for string when special modes
not involving debug-mode are involved. As a "side effect" the patchlet
also largely solves the issue I was investigating,in the sense that now
only happens in debug-mode + parallel-mode at the same time. Committed
to mainline.
Paolo.
///////////////
2009-10-14 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/c++config: Do not disable extern templates for string
in plain parallel-mode and in profile-mode; add comment explaining
_GLIBCXX_EXTERN_TEMPLATE == -1.
* testsuite/ext/profile/mutex_extensions.cc: Adjust dg-error line.
Index: include/bits/c++config
===================================================================
--- include/bits/c++config (revision 152771)
+++ include/bits/c++config (working copy)
@@ -147,7 +147,6 @@
# define _GLIBCXX_STD __cxx1998
# define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
# define _GLIBCXX_END_NAMESPACE }
-# define _GLIBCXX_EXTERN_TEMPLATE -1
# endif
// debug + parallel
@@ -172,7 +171,6 @@
# define _GLIBCXX_STD __cxx1998
# define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
# define _GLIBCXX_END_NAMESPACE }
-# define _GLIBCXX_EXTERN_TEMPLATE -1
# endif
# if __NO_INLINE__ && !__GXX_WEAK__
@@ -287,6 +285,10 @@
// library to avoid multiple weak definitions for required types that
// are already explicitly instantiated in the library binary. This
// substantially reduces the binary size of resulting executables.
+
+// 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
Index: testsuite/ext/profile/mutex_extensions.cc
===================================================================
--- testsuite/ext/profile/mutex_extensions.cc (revision 152771)
+++ testsuite/ext/profile/mutex_extensions.cc (working copy)
@@ -22,5 +22,5 @@
#include <vector>
-// { dg-error "Cannot use -D_GLIBCXX_PROFILE with " "" { target *-*-* } 166 }
+// { dg-error "Cannot use -D_GLIBCXX_PROFILE with " "" { target *-*-* } 165 }
// { dg-excess-errors "In file included from" }