* Re: [Bug libstdc++/83077] sso-string @ gnu-versioned-namespace.
2021-12-08 16:21 ` Jonathan Wakely
@ 2021-12-09 21:10 ` François Dumont
2021-12-09 22:30 ` Jonathan Wakely
0 siblings, 1 reply; 5+ messages in thread
From: François Dumont @ 2021-12-09 21:10 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: libstdc++
[-- Attachment #1: Type: text/plain, Size: 1411 bytes --]
On 08/12/21 5:21 pm, Jonathan Wakely wrote:
> It looks like I never replied to this one, sorry.
>
> On Sun, 28 Feb 2021 at 14:51, François Dumont via Libstdc++
> <libstdc++@gcc.gnu.org> wrote:
>> Hi
>>
>> I took in bugzilla and started working on this enhancement.
>>
>> I am in the step of implementing what is in
>> src/c++11/cow-stdexception.cc for the sso string.
> Maybe I've misunderstood, but why? The content of that file is
> explicitly for the COW string, and only the COW string.
I meant to do something similar for the sso string.
>
> If we make the versioned namespace **only** support SSO strings (and I
> think we should do that) then that file won't even be compiled,
> because the DUAL_ABI macro will not be defined.
>
>> As I do not know much
>> about transactionnal memory yet I prefer to ask confirmation first that
>> it is indeed a necessary step to complete PR 83077 ?
>
> It's not essential. If needed, we can disable TM for the versioned namespace.
>
Ok, thanks for the information.
But this mail has been the occasion to check where I was on this
subject. Attached is my current work. I managed to build the lib, no
more transactional memory issue. But when building the tests I have this
error in different tests:
double free or corruption (out)
FAIL: 27_io/basic_filebuf/overflow/char/13858.cc execution test
Still need to find time to work on this.
François
[-- Attachment #2: sso_version_ns.patch --]
[-- Type: text/x-patch, Size: 47748 bytes --]
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 6d9a8875e31..3f0e87d0115 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -4384,7 +4384,7 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_DUAL_ABI], [
fi
if test x"$enable_libstdcxx_dual_abi" != xyes; then
AC_MSG_NOTICE([dual ABI is disabled])
- default_libstdcxx_abi="gcc4-compatible"
+ default_libstdcxx_abi="new"
fi
GLIBCXX_CONDITIONAL(ENABLE_DUAL_ABI, test $enable_libstdcxx_dual_abi = yes)
])
diff --git a/libstdc++-v3/config/locale/dragonfly/monetary_members.cc b/libstdc++-v3/config/locale/dragonfly/monetary_members.cc
index e1decc61cbf..1ded9ebea06 100644
--- a/libstdc++-v3/config/locale/dragonfly/monetary_members.cc
+++ b/libstdc++-v3/config/locale/dragonfly/monetary_members.cc
@@ -39,7 +39,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// This file might be compiled twice, but we only want to define the members
// of money_base once.
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
// Construct and return valid pattern consisting of some combination of:
// space none symbol sign value
@@ -207,7 +207,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
return __ret;
}
-#endif
+#endif // ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
template<>
void
diff --git a/libstdc++-v3/config/locale/generic/monetary_members.cc b/libstdc++-v3/config/locale/generic/monetary_members.cc
index 47c0a2b1009..ff07127a05a 100644
--- a/libstdc++-v3/config/locale/generic/monetary_members.cc
+++ b/libstdc++-v3/config/locale/generic/monetary_members.cc
@@ -36,7 +36,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// This file might be compiled twice, but we only want to define the members
// of money_base once.
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
// Construct and return valid pattern consisting of some combination of:
// space none symbol sign value
diff --git a/libstdc++-v3/config/locale/gnu/monetary_members.cc b/libstdc++-v3/config/locale/gnu/monetary_members.cc
index 0b7e0ec0974..a9ee551e6a1 100644
--- a/libstdc++-v3/config/locale/gnu/monetary_members.cc
+++ b/libstdc++-v3/config/locale/gnu/monetary_members.cc
@@ -37,7 +37,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// This file might be compiled twice, but we only want to define the members
// of money_base once.
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
// Construct and return valid pattern consisting of some combination of:
// space none symbol sign value
@@ -205,7 +205,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
return __ret;
}
-#endif
+#endif // ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
extern char __narrow_multibyte_chars(const char* s, __locale_t cloc);
diff --git a/libstdc++-v3/config/locale/gnu/numeric_members.cc b/libstdc++-v3/config/locale/gnu/numeric_members.cc
index 19bf7d10c70..9309484c014 100644
--- a/libstdc++-v3/config/locale/gnu/numeric_members.cc
+++ b/libstdc++-v3/config/locale/gnu/numeric_members.cc
@@ -39,7 +39,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
extern char __narrow_multibyte_chars(const char* s, __locale_t cloc);
// This file might be compiled twice, but we only want to define this once.
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
char
__narrow_multibyte_chars(const char* s, __locale_t cloc)
{
@@ -84,7 +84,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
return '\0';
}
-#endif
+#endif // ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
template<>
void
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 61a14a2cb3b..b0f7ff92017 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -75082,7 +75082,7 @@ fi
if test x"$enable_libstdcxx_dual_abi" != xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: dual ABI is disabled" >&5
$as_echo "$as_me: dual ABI is disabled" >&6;}
- default_libstdcxx_abi="gcc4-compatible"
+ default_libstdcxx_abi="new"
fi
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index f2d704f57eb..efd833fcaab 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -315,26 +315,6 @@ namespace std
#define _GLIBCXX_USE_CXX11_ABI
#endif
-#if _GLIBCXX_USE_CXX11_ABI
-namespace std
-{
- inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
-}
-namespace __gnu_cxx
-{
- inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
-}
-# define _GLIBCXX_NAMESPACE_CXX11 __cxx11::
-# define _GLIBCXX_BEGIN_NAMESPACE_CXX11 namespace __cxx11 {
-# define _GLIBCXX_END_NAMESPACE_CXX11 }
-# define _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_ABI_TAG_CXX11
-#else
-# define _GLIBCXX_NAMESPACE_CXX11
-# define _GLIBCXX_BEGIN_NAMESPACE_CXX11
-# define _GLIBCXX_END_NAMESPACE_CXX11
-# define _GLIBCXX_DEFAULT_ABI_TAG
-#endif
-
// Defined if inline namespaces are used for versioning.
#define _GLIBCXX_INLINE_VERSION
@@ -379,7 +359,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Non-inline namespace for components replaced by alternates in active mode.
namespace __cxx1998
{
-# if _GLIBCXX_USE_CXX11_ABI
+# if _GLIBCXX_USE_CXX11_ABI && ! _GLIBCXX_VERSION_NAMESPACE
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
# endif
}
@@ -409,6 +389,26 @@ _GLIBCXX_END_NAMESPACE_VERSION
# endif
#endif
+#if _GLIBCXX_USE_CXX11_ABI && ! _GLIBCXX_INLINE_VERSION
+namespace std
+{
+ inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
+}
+namespace __gnu_cxx
+{
+ inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
+}
+# define _GLIBCXX_NAMESPACE_CXX11 __cxx11::
+# define _GLIBCXX_BEGIN_NAMESPACE_CXX11 namespace __cxx11 {
+# define _GLIBCXX_END_NAMESPACE_CXX11 }
+# define _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_ABI_TAG_CXX11
+#else
+# define _GLIBCXX_NAMESPACE_CXX11
+# define _GLIBCXX_BEGIN_NAMESPACE_CXX11
+# define _GLIBCXX_END_NAMESPACE_CXX11
+# define _GLIBCXX_DEFAULT_ABI_TAG
+#endif
+
// Macros for namespace scope. Either namespace std:: or the name
// of some nested namespace within it corresponding to the active mode.
// _GLIBCXX_STD_A
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index f27d3f8c87e..9bbac895190 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -72,15 +72,9 @@ ldbl_compat_sources =
endif
if GLIBCXX_LDBL_ALT128_COMPAT
-if ENABLE_DUAL_ABI
-ldbl_alt128_compat_cxx11_sources = \
- compatibility-ldbl-alt128-cxx11.cc
-else
-ldbl_alt128_compat_cxx11_sources =
-endif
ldbl_alt128_compat_sources = \
compatibility-ldbl-alt128.cc \
- ${ldbl_alt128_compat_cxx11_sources}
+ compatibility-ldbl-alt128-cxx11.cc
else
ldbl_alt128_compat_sources =
endif
@@ -152,13 +146,11 @@ compatibility-ldbl-alt128.lo: compatibility-ldbl-alt128.cc
$(LTCXXCOMPILE) $(LONG_DOUBLE_ALT128_COMPAT_FLAGS) -std=gnu++11 -c $<
compatibility-ldbl-alt128.o: compatibility-ldbl-alt128.cc
$(CXXCOMPILE) $(LONG_DOUBLE_ALT128_COMPAT_FLAGS) -std=gnu++11 -c $<
-if ENABLE_DUAL_ABI
compatibility-ldbl-alt128-cxx11.lo: compatibility-ldbl-alt128-cxx11.cc
$(LTCXXCOMPILE) $(LONG_DOUBLE_ALT128_COMPAT_FLAGS) -std=gnu++11 -c $<
compatibility-ldbl-alt128-cxx11.o: compatibility-ldbl-alt128-cxx11.cc
$(CXXCOMPILE) $(LONG_DOUBLE_ALT128_COMPAT_FLAGS) -std=gnu++11 -c $<
endif
-endif
# Use special rules for C++11 files/objects.
compatibility-c++0x.lo: compatibility-c++0x.cc
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index 05b25ed5e9d..57a8a8af4c9 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -153,14 +153,13 @@ am__DEPENDENCIES_1 =
@GLIBCXX_LDBL_COMPAT_TRUE@am__objects_1 = compatibility-ldbl.lo
am__objects_2 = compatibility.lo compatibility-debug_list.lo \
compatibility-debug_list-2.lo $(am__objects_1)
-@ENABLE_DUAL_ABI_TRUE@@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@am__objects_3 = compatibility-ldbl-alt128-cxx11.lo
-@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@am__objects_4 = \
+@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@am__objects_3 = \
@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ compatibility-ldbl-alt128.lo \
-@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ $(am__objects_3)
-am__objects_5 = compatibility-c++0x.lo compatibility-atomic-c++0x.lo \
+@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ compatibility-ldbl-alt128-cxx11.lo
+am__objects_4 = compatibility-c++0x.lo compatibility-atomic-c++0x.lo \
compatibility-thread-c++0x.lo compatibility-chrono.lo \
- compatibility-condvar.lo $(am__objects_4)
-am_libstdc___la_OBJECTS = $(am__objects_2) $(am__objects_5)
+ compatibility-condvar.lo $(am__objects_3)
+am_libstdc___la_OBJECTS = $(am__objects_2) $(am__objects_4)
libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
@VTV_CYGMIN_FALSE@am_libstdc___la_rpath = -rpath $(toolexeclibdir)
@VTV_CYGMIN_TRUE@am_libstdc___la_rpath = -rpath $(toolexeclibdir)
@@ -491,14 +490,10 @@ SUBDIRS = c++98 c++11 c++17 c++20 $(filesystem_dir)
@GLIBCXX_LDBL_COMPAT_FALSE@ldbl_compat_sources =
@GLIBCXX_LDBL_COMPAT_TRUE@ldbl_compat_sources = compatibility-ldbl.cc
-@ENABLE_DUAL_ABI_FALSE@@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ldbl_alt128_compat_cxx11_sources =
-@ENABLE_DUAL_ABI_TRUE@@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ldbl_alt128_compat_cxx11_sources = \
-@ENABLE_DUAL_ABI_TRUE@@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ compatibility-ldbl-alt128-cxx11.cc
-
@GLIBCXX_LDBL_ALT128_COMPAT_FALSE@ldbl_alt128_compat_sources =
@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ldbl_alt128_compat_sources = \
@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ compatibility-ldbl-alt128.cc \
-@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ ${ldbl_alt128_compat_cxx11_sources}
+@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ compatibility-ldbl-alt128-cxx11.cc
parallel_compat_sources = \
compatibility-parallel_list.cc compatibility-parallel_list-2.cc
@@ -1003,10 +998,10 @@ vpath % $(top_srcdir)/src/c++20
@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ $(LTCXXCOMPILE) $(LONG_DOUBLE_ALT128_COMPAT_FLAGS) -std=gnu++11 -c $<
@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@compatibility-ldbl-alt128.o: compatibility-ldbl-alt128.cc
@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ $(CXXCOMPILE) $(LONG_DOUBLE_ALT128_COMPAT_FLAGS) -std=gnu++11 -c $<
-@ENABLE_DUAL_ABI_TRUE@@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@compatibility-ldbl-alt128-cxx11.lo: compatibility-ldbl-alt128-cxx11.cc
-@ENABLE_DUAL_ABI_TRUE@@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ $(LTCXXCOMPILE) $(LONG_DOUBLE_ALT128_COMPAT_FLAGS) -std=gnu++11 -c $<
-@ENABLE_DUAL_ABI_TRUE@@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@compatibility-ldbl-alt128-cxx11.o: compatibility-ldbl-alt128-cxx11.cc
-@ENABLE_DUAL_ABI_TRUE@@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ $(CXXCOMPILE) $(LONG_DOUBLE_ALT128_COMPAT_FLAGS) -std=gnu++11 -c $<
+@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@compatibility-ldbl-alt128-cxx11.lo: compatibility-ldbl-alt128-cxx11.cc
+@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ $(LTCXXCOMPILE) $(LONG_DOUBLE_ALT128_COMPAT_FLAGS) -std=gnu++11 -c $<
+@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@compatibility-ldbl-alt128-cxx11.o: compatibility-ldbl-alt128-cxx11.cc
+@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@ $(CXXCOMPILE) $(LONG_DOUBLE_ALT128_COMPAT_FLAGS) -std=gnu++11 -c $<
# Use special rules for C++11 files/objects.
compatibility-c++0x.lo: compatibility-c++0x.cc
diff --git a/libstdc++-v3/src/c++11/Makefile.am b/libstdc++-v3/src/c++11/Makefile.am
index a26903db6bc..6d315c0d711 100644
--- a/libstdc++-v3/src/c++11/Makefile.am
+++ b/libstdc++-v3/src/c++11/Makefile.am
@@ -40,22 +40,22 @@ ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
$(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
if ENABLE_DUAL_ABI
-cxx11_abi_sources = \
- cow-locale_init.cc \
+dual_abi_sources = \
cow-shim_facets.cc \
- cxx11-hash_tr1.cc \
- cxx11-ios_failure.cc \
- cxx11-shim_facets.cc \
- cxx11-stdexcept.cc
+ cxx11-shim_facets.cc
else
-cxx11_abi_sources =
+dual_abi_sources =
endif
sources = \
chrono.cc \
codecvt.cc \
condition_variable.cc \
+ cow-locale_init.cc \
cow-stdexcept.cc \
+ cxx11-hash_tr1.cc \
+ cxx11-ios_failure.cc \
+ cxx11-stdexcept.cc \
ctype.cc \
debug.cc \
functexcept.cc \
@@ -74,19 +74,11 @@ sources = \
snprintf_lite.cc \
system_error.cc \
thread.cc \
- ${cxx11_abi_sources} \
+ ${dual_abi_sources} \
${host_sources}
if ENABLE_DUAL_ABI
extra_string_inst_sources = \
- cow-fstream-inst.cc \
- cow-sstream-inst.cc \
- cow-string-inst.cc \
- cow-string-io-inst.cc \
- cow-wstring-inst.cc \
- cow-wstring-io-inst.cc \
- cxx11-locale-inst.cc \
- cxx11-wlocale-inst.cc \
sso_string.cc
else
extra_string_inst_sources =
@@ -96,6 +88,14 @@ if ENABLE_EXTERN_TEMPLATE
# XTEMPLATE_FLAGS = -fno-implicit-templates
inst_sources = \
$(extra_string_inst_sources) \
+ cow-fstream-inst.cc \
+ cow-sstream-inst.cc \
+ cow-string-inst.cc \
+ cow-string-io-inst.cc \
+ cow-wstring-inst.cc \
+ cow-wstring-io-inst.cc \
+ cxx11-locale-inst.cc \
+ cxx11-wlocale-inst.cc \
ext11-inst.cc \
fstream-inst.cc \
ios-inst.cc \
diff --git a/libstdc++-v3/src/c++11/Makefile.in b/libstdc++-v3/src/c++11/Makefile.in
index 86540509e81..baa37cd2a63 100644
--- a/libstdc++-v3/src/c++11/Makefile.in
+++ b/libstdc++-v3/src/c++11/Makefile.in
@@ -122,25 +122,26 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libc__11convenience_la_LIBADD =
-@ENABLE_DUAL_ABI_TRUE@am__objects_1 = cow-locale_init.lo \
-@ENABLE_DUAL_ABI_TRUE@ cow-shim_facets.lo cxx11-hash_tr1.lo \
-@ENABLE_DUAL_ABI_TRUE@ cxx11-ios_failure.lo \
-@ENABLE_DUAL_ABI_TRUE@ cxx11-shim_facets.lo cxx11-stdexcept.lo
+@ENABLE_DUAL_ABI_TRUE@am__objects_1 = cow-shim_facets.lo \
+@ENABLE_DUAL_ABI_TRUE@ cxx11-shim_facets.lo
am__objects_2 = ctype_configure_char.lo ctype_members.lo
am__objects_3 = chrono.lo codecvt.lo condition_variable.lo \
- cow-stdexcept.lo ctype.lo debug.lo functexcept.lo \
- functional.lo futex.lo future.lo hash_c++0x.lo \
+ cow-locale_init.lo cow-stdexcept.lo cxx11-hash_tr1.lo \
+ cxx11-ios_failure.lo cxx11-stdexcept.lo ctype.lo debug.lo \
+ functexcept.lo functional.lo futex.lo future.lo hash_c++0x.lo \
hashtable_c++0x.lo ios.lo limits.lo mutex.lo placeholders.lo \
random.lo regex.lo shared_ptr.lo snprintf_lite.lo \
system_error.lo thread.lo $(am__objects_1) $(am__objects_2)
-@ENABLE_DUAL_ABI_TRUE@am__objects_4 = cow-fstream-inst.lo \
-@ENABLE_DUAL_ABI_TRUE@ cow-sstream-inst.lo cow-string-inst.lo \
-@ENABLE_DUAL_ABI_TRUE@ cow-string-io-inst.lo \
-@ENABLE_DUAL_ABI_TRUE@ cow-wstring-inst.lo \
-@ENABLE_DUAL_ABI_TRUE@ cow-wstring-io-inst.lo \
-@ENABLE_DUAL_ABI_TRUE@ cxx11-locale-inst.lo \
-@ENABLE_DUAL_ABI_TRUE@ cxx11-wlocale-inst.lo sso_string.lo
+@ENABLE_DUAL_ABI_TRUE@am__objects_4 = sso_string.lo
@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_5 = $(am__objects_4) \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cow-fstream-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cow-sstream-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cow-string-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cow-string-io-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cow-wstring-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cow-wstring-io-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cxx11-locale-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cxx11-wlocale-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ ext11-inst.lo fstream-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ ios-inst.lo iostream-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ istream-inst.lo locale-inst.lo \
@@ -448,20 +449,20 @@ host_sources = \
ctype_configure_char.cc \
ctype_members.cc
-@ENABLE_DUAL_ABI_FALSE@cxx11_abi_sources =
-@ENABLE_DUAL_ABI_TRUE@cxx11_abi_sources = \
-@ENABLE_DUAL_ABI_TRUE@ cow-locale_init.cc \
+@ENABLE_DUAL_ABI_FALSE@dual_abi_sources =
+@ENABLE_DUAL_ABI_TRUE@dual_abi_sources = \
@ENABLE_DUAL_ABI_TRUE@ cow-shim_facets.cc \
-@ENABLE_DUAL_ABI_TRUE@ cxx11-hash_tr1.cc \
-@ENABLE_DUAL_ABI_TRUE@ cxx11-ios_failure.cc \
-@ENABLE_DUAL_ABI_TRUE@ cxx11-shim_facets.cc \
-@ENABLE_DUAL_ABI_TRUE@ cxx11-stdexcept.cc
+@ENABLE_DUAL_ABI_TRUE@ cxx11-shim_facets.cc
sources = \
chrono.cc \
codecvt.cc \
condition_variable.cc \
+ cow-locale_init.cc \
cow-stdexcept.cc \
+ cxx11-hash_tr1.cc \
+ cxx11-ios_failure.cc \
+ cxx11-stdexcept.cc \
ctype.cc \
debug.cc \
functexcept.cc \
@@ -480,19 +481,11 @@ sources = \
snprintf_lite.cc \
system_error.cc \
thread.cc \
- ${cxx11_abi_sources} \
+ ${dual_abi_sources} \
${host_sources}
@ENABLE_DUAL_ABI_FALSE@extra_string_inst_sources =
@ENABLE_DUAL_ABI_TRUE@extra_string_inst_sources = \
-@ENABLE_DUAL_ABI_TRUE@ cow-fstream-inst.cc \
-@ENABLE_DUAL_ABI_TRUE@ cow-sstream-inst.cc \
-@ENABLE_DUAL_ABI_TRUE@ cow-string-inst.cc \
-@ENABLE_DUAL_ABI_TRUE@ cow-string-io-inst.cc \
-@ENABLE_DUAL_ABI_TRUE@ cow-wstring-inst.cc \
-@ENABLE_DUAL_ABI_TRUE@ cow-wstring-io-inst.cc \
-@ENABLE_DUAL_ABI_TRUE@ cxx11-locale-inst.cc \
-@ENABLE_DUAL_ABI_TRUE@ cxx11-wlocale-inst.cc \
@ENABLE_DUAL_ABI_TRUE@ sso_string.cc
# XTEMPLATE_FLAGS =
@@ -501,6 +494,14 @@ sources = \
# XTEMPLATE_FLAGS = -fno-implicit-templates
@ENABLE_EXTERN_TEMPLATE_TRUE@inst_sources = \
@ENABLE_EXTERN_TEMPLATE_TRUE@ $(extra_string_inst_sources) \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cow-fstream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cow-sstream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cow-string-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cow-string-io-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cow-wstring-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cow-wstring-io-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cxx11-locale-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ cxx11-wlocale-inst.cc \
@ENABLE_EXTERN_TEMPLATE_TRUE@ ext11-inst.cc \
@ENABLE_EXTERN_TEMPLATE_TRUE@ fstream-inst.cc \
@ENABLE_EXTERN_TEMPLATE_TRUE@ ios-inst.cc \
diff --git a/libstdc++-v3/src/c++11/compatibility-ldbl-alt128-cxx11.cc b/libstdc++-v3/src/c++11/compatibility-ldbl-alt128-cxx11.cc
index 383ba524346..9d9f9caf200 100644
--- a/libstdc++-v3/src/c++11/compatibility-ldbl-alt128-cxx11.cc
+++ b/libstdc++-v3/src/c++11/compatibility-ldbl-alt128-cxx11.cc
@@ -25,7 +25,7 @@
#define _GLIBCXX_USE_CXX11_ABI 1
#include <locale>
-#ifdef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT
+#if defined (_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT) && _GLIBCXX_USE_CXX11_ABI
#if !defined(_GLIBCXX_USE_DUAL_ABI)
#error "compatibility-ldbl-alt128-cxx11.cc must only be compiled when dual ABI is enabled"
diff --git a/libstdc++-v3/src/c++11/compatibility-ldbl-alt128.cc b/libstdc++-v3/src/c++11/compatibility-ldbl-alt128.cc
index 36154540101..64c406da315 100644
--- a/libstdc++-v3/src/c++11/compatibility-ldbl-alt128.cc
+++ b/libstdc++-v3/src/c++11/compatibility-ldbl-alt128.cc
@@ -25,7 +25,7 @@
#define _GLIBCXX_USE_CXX11_ABI 0
#include <locale>
-#ifdef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT
+#if defined (_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT) && ! _GLIBCXX_USE_CXX11_ABI
#if ! defined __LONG_DOUBLE_IBM128__ && ! defined __LONG_DOUBLE_IEEE128__
#error "compatibility-ldbl-alt128.cc must only be compiled for 128-bit long double"
diff --git a/libstdc++-v3/src/c++11/cow-fstream-inst.cc b/libstdc++-v3/src/c++11/cow-fstream-inst.cc
index 6419288519d..f85bf7f2a23 100644
--- a/libstdc++-v3/src/c++11/cow-fstream-inst.cc
+++ b/libstdc++-v3/src/c++11/cow-fstream-inst.cc
@@ -29,10 +29,7 @@
#define _GLIBCXX_USE_CXX11_ABI 0
#include <fstream>
-#if ! _GLIBCXX_USE_DUAL_ABI
-# error This file should not be compiled for this configuration.
-#endif
-
+#if ! _GLIBCXX_USE_CXX11_ABI
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -76,3 +73,4 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
+#endif
diff --git a/libstdc++-v3/src/c++11/cow-locale_init.cc b/libstdc++-v3/src/c++11/cow-locale_init.cc
index ef1872492fd..7115946eb96 100644
--- a/libstdc++-v3/src/c++11/cow-locale_init.cc
+++ b/libstdc++-v3/src/c++11/cow-locale_init.cc
@@ -24,10 +24,7 @@
#define _GLIBCXX_USE_CXX11_ABI 0
#include <locale>
-#if ! _GLIBCXX_USE_DUAL_ABI
-# error This file should not be compiled for this configuration.
-#endif
-
+#if ! _GLIBCXX_USE_CXX11_ABI
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -193,3 +190,4 @@ namespace
_GLIBCXX_END_NAMESPACE_VERSION
}
+#endif // ! _GLIBCXX_USE_CXX11_ABI
diff --git a/libstdc++-v3/src/c++11/cow-sstream-inst.cc b/libstdc++-v3/src/c++11/cow-sstream-inst.cc
index 5d6432da53d..577d95c9701 100644
--- a/libstdc++-v3/src/c++11/cow-sstream-inst.cc
+++ b/libstdc++-v3/src/c++11/cow-sstream-inst.cc
@@ -27,8 +27,8 @@
//
#define _GLIBCXX_USE_CXX11_ABI 0
-#include "sstream-inst.cc"
+#include <bits/c++config.h>
-#if ! _GLIBCXX_USE_DUAL_ABI
-# error This file should not be compiled for this configuration.
+#if ! _GLIBCXX_USE_CXX11_ABI
+# include "sstream-inst.cc"
#endif
diff --git a/libstdc++-v3/src/c++11/cow-stdexcept.cc b/libstdc++-v3/src/c++11/cow-stdexcept.cc
index 2d47acb55b2..d73f00f4dad 100644
--- a/libstdc++-v3/src/c++11/cow-stdexcept.cc
+++ b/libstdc++-v3/src/c++11/cow-stdexcept.cc
@@ -41,7 +41,7 @@ _txnal_logic_error_get_msg(void* e);
void*
_txnal_runtime_error_get_msg(void* e);
-// All exception classes still use the classic COW std::string.
+// In dual abi all exception classes still use the classic COW std::string.
#define _GLIBCXX_USE_CXX11_ABI 0
#define _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS 1
#define __cow_string __cow_stringxxx
@@ -169,6 +169,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
"alignof(std::string) has changed");
#endif
+#if ! _GLIBCXX_USE_CXX11_ABI
// Return error_category::message() as an SSO string
__sso_string
error_category::_M_message(int i) const
@@ -176,10 +177,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
string msg = this->message(i);
return {msg.c_str(), msg.length()};
}
+#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
+#if ! _GLIBCXX_USE_CXX11_ABI
// Support for the Transactional Memory TS (N4514).
//
// logic_error and runtime_error both carry a message in the form of a COW
@@ -459,3 +462,4 @@ CTORDTOR(15underflow_error, std::underflow_error, runtime_error)
#endif // _GLIBCXX_USE_C99_STDINT_TR1
#endif // _GLIBCXX_USE_WEAK_REF
+#endif // ! _GLIBCXX_USE_CXX11_ABI
diff --git a/libstdc++-v3/src/c++11/cow-string-inst.cc b/libstdc++-v3/src/c++11/cow-string-inst.cc
index 65dece2ff6e..e85a866abf0 100644
--- a/libstdc++-v3/src/c++11/cow-string-inst.cc
+++ b/libstdc++-v3/src/c++11/cow-string-inst.cc
@@ -27,17 +27,17 @@
//
#define _GLIBCXX_USE_CXX11_ABI 0
-#include "string-inst.cc"
+#include <bits/c++config.h>
-#if ! _GLIBCXX_USE_DUAL_ABI
-# error This file should not be compiled for this configuration.
-#endif
+#if ! _GLIBCXX_USE_CXX11_ABI
+#include "string-inst.cc"
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
#include <random>
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
void
random_device::_M_init(const std::string& token)
{ _M_init(token.c_str(), token.length()); }
@@ -45,5 +45,8 @@ namespace std _GLIBCXX_VISIBILITY(default)
void
random_device::_M_init_pretr1(const std::string& token)
{ _M_init(token.c_str(), token.length()); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
+#endif
diff --git a/libstdc++-v3/src/c++11/cow-string-io-inst.cc b/libstdc++-v3/src/c++11/cow-string-io-inst.cc
index 093888e3dea..91cffd7efe4 100644
--- a/libstdc++-v3/src/c++11/cow-string-io-inst.cc
+++ b/libstdc++-v3/src/c++11/cow-string-io-inst.cc
@@ -30,10 +30,7 @@
#include <istream>
#include <ostream>
-#if ! _GLIBCXX_USE_DUAL_ABI
-# error This file should not be compiled for this configuration.
-#endif
-
+#if ! _GLIBCXX_USE_CXX11_ABI
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -57,3 +54,4 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
+#endif
diff --git a/libstdc++-v3/src/c++11/cow-wstring-inst.cc b/libstdc++-v3/src/c++11/cow-wstring-inst.cc
index e871f76d12d..e2d2b697ffa 100644
--- a/libstdc++-v3/src/c++11/cow-wstring-inst.cc
+++ b/libstdc++-v3/src/c++11/cow-wstring-inst.cc
@@ -29,12 +29,9 @@
#define _GLIBCXX_USE_CXX11_ABI 0
#include <bits/c++config.h>
+#if ! _GLIBCXX_USE_CXX11_ABI
#ifdef _GLIBCXX_USE_WCHAR_T
#define C wchar_t
#include "string-inst.cc"
-
-#if ! _GLIBCXX_USE_DUAL_ABI
-# error This file should not be compiled for this configuration.
#endif
-
#endif
diff --git a/libstdc++-v3/src/c++11/cow-wstring-io-inst.cc b/libstdc++-v3/src/c++11/cow-wstring-io-inst.cc
index b79f16c9004..67d59d494f3 100644
--- a/libstdc++-v3/src/c++11/cow-wstring-io-inst.cc
+++ b/libstdc++-v3/src/c++11/cow-wstring-io-inst.cc
@@ -29,14 +29,11 @@
#define _GLIBCXX_USE_CXX11_ABI 0
#include <bits/c++config.h>
+#if ! _GLIBCXX_USE_CXX11_ABI
#ifdef _GLIBCXX_USE_WCHAR_T
#include <ostream>
#include <istream>
-#if ! _GLIBCXX_USE_DUAL_ABI
-# error This file should not be compiled for this configuration.
-#endif
-
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -61,3 +58,4 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
+#endif
diff --git a/libstdc++-v3/src/c++11/cxx11-hash_tr1.cc b/libstdc++-v3/src/c++11/cxx11-hash_tr1.cc
index 4415e6a3a0c..9ce284d9e23 100644
--- a/libstdc++-v3/src/c++11/cxx11-hash_tr1.cc
+++ b/libstdc++-v3/src/c++11/cxx11-hash_tr1.cc
@@ -25,9 +25,7 @@
#define _GLIBCXX_USE_CXX11_ABI 1
#include <string>
-#if ! _GLIBCXX_USE_DUAL_ABI
-# error This file should not be compiled for this configuration.
-#endif
+#if _GLIBCXX_USE_CXX11_ABI
#include <tr1/functional>
namespace std _GLIBCXX_VISIBILITY(default)
@@ -57,3 +55,5 @@ namespace std _GLIBCXX_VISIBILITY(default)
#endif
}
}
+
+#endif // _GLIBCXX_USE_CXX11_ABI
diff --git a/libstdc++-v3/src/c++11/cxx11-ios_failure.cc b/libstdc++-v3/src/c++11/cxx11-ios_failure.cc
index a918ab21015..9009318c4f4 100644
--- a/libstdc++-v3/src/c++11/cxx11-ios_failure.cc
+++ b/libstdc++-v3/src/c++11/cxx11-ios_failure.cc
@@ -38,9 +38,7 @@
# define _(msgid) (msgid)
#endif
-#if ! _GLIBCXX_USE_DUAL_ABI
-# error This file should not be compiled for this configuration.
-#endif
+#if _GLIBCXX_USE_CXX11_ABI
namespace
{
@@ -174,3 +172,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
+
+#endif // _GLIBCXX_USE_CXX11_ABI
diff --git a/libstdc++-v3/src/c++11/cxx11-locale-inst.cc b/libstdc++-v3/src/c++11/cxx11-locale-inst.cc
index a4c4139762b..28aa80cc8a0 100644
--- a/libstdc++-v3/src/c++11/cxx11-locale-inst.cc
+++ b/libstdc++-v3/src/c++11/cxx11-locale-inst.cc
@@ -27,11 +27,5 @@
// Facet instantiations using new ABI strings.
#define _GLIBCXX_USE_CXX11_ABI 1
-#include <bits/c++config.h>
-#if ! _GLIBCXX_USE_DUAL_ABI
-# error This file should not be compiled for this configuration.
-#endif
-#define C char
-#define C_is_char
-# include "locale-inst.cc"
+#include "locale-inst.cc"
diff --git a/libstdc++-v3/src/c++11/cxx11-stdexcept.cc b/libstdc++-v3/src/c++11/cxx11-stdexcept.cc
index d1f5da9203f..185fdc1224c 100644
--- a/libstdc++-v3/src/c++11/cxx11-stdexcept.cc
+++ b/libstdc++-v3/src/c++11/cxx11-stdexcept.cc
@@ -29,9 +29,7 @@
#define _GLIBCXX_USE_CXX11_ABI 1
#include <stdexcept>
-#if ! _GLIBCXX_USE_DUAL_ABI
-# error This file should not be compiled for this configuration.
-#endif
+#if _GLIBCXX_USE_CXX11_ABI
namespace std _GLIBCXX_VISIBILITY(default)
{
@@ -70,9 +68,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
underflow_error::underflow_error(const string& __arg)
: runtime_error(__arg) { }
+# if _GLIBCXX_USE_DUAL_ABI
// Converting constructor from ABI-tagged std::string to COW string.
__cow_string::__cow_string(const string& s)
: __cow_string(s.c_str(), s.length()) { }
+# endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
+
+#endif // _GLIBCXX_USE_CXX11_ABI
diff --git a/libstdc++-v3/src/c++11/cxx11-wlocale-inst.cc b/libstdc++-v3/src/c++11/cxx11-wlocale-inst.cc
index d5b6025924e..0ff07399f00 100644
--- a/libstdc++-v3/src/c++11/cxx11-wlocale-inst.cc
+++ b/libstdc++-v3/src/c++11/cxx11-wlocale-inst.cc
@@ -28,11 +28,10 @@
#define _GLIBCXX_USE_CXX11_ABI 1
#include <bits/c++config.h>
-#if ! _GLIBCXX_USE_DUAL_ABI
-# error This file should not be compiled for this configuration.
-#endif
-#ifdef _GLIBCXX_USE_WCHAR_T
-#define C wchar_t
-#include "locale-inst.cc"
+#if _GLIBCXX_USE_CXX11_ABI
+# ifdef _GLIBCXX_USE_WCHAR_T
+# define C wchar_t
+# include "locale-inst.cc"
+# endif
#endif
diff --git a/libstdc++-v3/src/c++11/fstream-inst.cc b/libstdc++-v3/src/c++11/fstream-inst.cc
index 12cbb936545..8e056f7ee58 100644
--- a/libstdc++-v3/src/c++11/fstream-inst.cc
+++ b/libstdc++-v3/src/c++11/fstream-inst.cc
@@ -29,6 +29,7 @@
#define _GLIBCXX_USE_CXX11_ABI 1
#include <fstream>
+#if _GLIBCXX_USE_CXX11_ABI
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -47,3 +48,4 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
+#endif
diff --git a/libstdc++-v3/src/c++11/locale-inst-monetary.h b/libstdc++-v3/src/c++11/locale-inst-monetary.h
index a34fa58eef7..dc93e761c87 100644
--- a/libstdc++-v3/src/c++11/locale-inst-monetary.h
+++ b/libstdc++-v3/src/c++11/locale-inst-monetary.h
@@ -32,6 +32,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
template const money_put<C>& use_facet<money_put<C> >(const locale&);
template const money_get<C>& use_facet<money_get<C> >(const locale&);
@@ -66,4 +67,5 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11
_M_insert<false>(ostreambuf_iterator<C>, ios_base&, C,
const string_type&) const;
_GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
diff --git a/libstdc++-v3/src/c++11/locale-inst-numeric.h b/libstdc++-v3/src/c++11/locale-inst-numeric.h
index 175da9fecc7..676e8972fd2 100644
--- a/libstdc++-v3/src/c++11/locale-inst-numeric.h
+++ b/libstdc++-v3/src/c++11/locale-inst-numeric.h
@@ -28,7 +28,8 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
-#if ! _GLIBCXX_USE_CXX11_ABI
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
template const num_get<C>& use_facet<num_get<C> >(const locale&);
template const num_put<C>& use_facet<num_put<C> >(const locale&);
@@ -38,7 +39,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
_GLIBCXX_BEGIN_NAMESPACE_LDBL
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
template class num_get<C, istreambuf_iterator<C> >;
template class num_put<C, ostreambuf_iterator<C> >;
#endif
@@ -88,7 +89,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
unsigned long long&) const;
#endif
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
// num_put member function templates
template
ostreambuf_iterator<C>
@@ -130,4 +131,5 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL
#endif
_GLIBCXX_END_NAMESPACE_LDBL
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
diff --git a/libstdc++-v3/src/c++11/locale-inst.cc b/libstdc++-v3/src/c++11/locale-inst.cc
index 1cc9119c27d..cdbd77bcc24 100644
--- a/libstdc++-v3/src/c++11/locale-inst.cc
+++ b/libstdc++-v3/src/c++11/locale-inst.cc
@@ -35,8 +35,15 @@
# define _GLIBCXX_USE_CXX11_ABI 0
#endif
+#if _GLIBCXX_USE_CXX11_ABI
+# define _GLIBCXX_BUILT_CXX11_ABI 1
+#else
+# define _GLIBCXX_BUILT_CXX11_ABI 0
+#endif
+
#include <locale>
+#if _GLIBCXX_BUILT_CXX11_ABI == _GLIBCXX_USE_CXX11_ABI
// Instantiation configuration.
#ifndef C
# define C char
@@ -51,7 +58,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// moneypunct, money_get, and money_put
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
template struct __moneypunct_cache<C, false>;
template struct __moneypunct_cache<C, true>;
#endif
@@ -63,7 +70,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
_GLIBCXX_END_NAMESPACE_CXX11
// numpunct, numpunct_byname, num_get, and num_put
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
template struct __numpunct_cache<C>;
#endif
_GLIBCXX_BEGIN_NAMESPACE_CXX11
@@ -72,7 +79,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
_GLIBCXX_END_NAMESPACE_CXX11
// time_get and time_put
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
template class __timepunct<C>;
template struct __timepunct_cache<C>;
template class time_put<C, ostreambuf_iterator<C> >;
@@ -96,13 +103,13 @@ _GLIBCXX_END_NAMESPACE_CXX11
ctype_byname<C>::ctype_byname(const string& __s, size_t __refs)
: ctype_byname(__s.c_str(), __refs) { }
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
inline template class __ctype_abstract_base<C>;
template class ctype_byname<C>;
#endif
// codecvt
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
inline template class __codecvt_abstract_base<C, char, mbstate_t>;
template class codecvt_byname<C, char, mbstate_t>;
#else
@@ -117,7 +124,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
_GLIBCXX_END_NAMESPACE_CXX11
// use_facet
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
template
const ctype<C>&
use_facet<ctype<C> >(const locale&);
@@ -143,7 +150,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
const moneypunct<C, false>&
use_facet<moneypunct<C, false> >(const locale&);
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
template
const __timepunct<C>&
use_facet<__timepunct<C> >(const locale&);
@@ -162,7 +169,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
use_facet<messages<C> >(const locale&);
// has_facet
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
template
bool
has_facet<ctype<C> >(const locale&);
@@ -184,7 +191,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
bool
has_facet<moneypunct<C> >(const locale&);
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
template
bool
has_facet<__timepunct<C> >(const locale&);
@@ -203,7 +210,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
has_facet<messages<C> >(const locale&);
-#if ! _GLIBCXX_USE_CXX11_ABI
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
// locale functions.
template
C*
@@ -229,6 +236,8 @@ _GLIBCXX_END_NAMESPACE_VERSION
} // namespace
// XXX GLIBCXX_ABI Deprecated
-#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && ! _GLIBCXX_USE_CXX11_ABI
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && (! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI)
#include "compatibility-ldbl-facets-aliases.h"
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
+
+#endif // _GLIBCXX_BUILT_CXX11_ABI == _GLIBCXX_USE_CXX11_ABI
diff --git a/libstdc++-v3/src/c++11/wlocale-inst.cc b/libstdc++-v3/src/c++11/wlocale-inst.cc
index d06ff1cca55..64cbf4fd61f 100644
--- a/libstdc++-v3/src/c++11/wlocale-inst.cc
+++ b/libstdc++-v3/src/c++11/wlocale-inst.cc
@@ -30,7 +30,9 @@
#define _GLIBCXX_USE_CXX11_ABI 0
#include <bits/c++config.h>
-#ifdef _GLIBCXX_USE_WCHAR_T
-#define C wchar_t
-#include "locale-inst.cc"
-#endif // _GLIBCXX_USE_WCHAR_T
+#if ! _GLIBCXX_USE_CXX11_ABI
+# ifdef _GLIBCXX_USE_WCHAR_T
+# define C wchar_t
+# include "locale-inst.cc"
+# endif // _GLIBCXX_USE_WCHAR_T
+#endif
diff --git a/libstdc++-v3/src/c++98/Makefile.am b/libstdc++-v3/src/c++98/Makefile.am
index b48b57a2945..65bcd3cc15a 100644
--- a/libstdc++-v3/src/c++98/Makefile.am
+++ b/libstdc++-v3/src/c++98/Makefile.am
@@ -90,13 +90,6 @@ c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
$(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
-if ENABLE_DUAL_ABI
-cxx11_abi_sources = \
- cow-istream-string.cc
-else
-cxx11_abi_sources =
-endif
-
if ENABLE_EXTERN_TEMPLATE
# XTEMPLATE_FLAGS = -fno-implicit-templates
inst_sources = \
@@ -118,6 +111,7 @@ sources = \
mt_allocator.cc \
codecvt.cc \
complex_io.cc \
+ cow-istream-string.cc \
globals_io.cc \
hash_tr1.cc \
hashtable_tr1.cc \
@@ -142,7 +136,6 @@ sources = \
istream-string.cc \
streambuf.cc \
valarray.cc \
- ${cxx11_abi_sources} \
${host_sources} \
${host_sources_extra}
diff --git a/libstdc++-v3/src/c++98/Makefile.in b/libstdc++-v3/src/c++98/Makefile.in
index f9ebb0ff4f4..f8b4fcea46b 100644
--- a/libstdc++-v3/src/c++98/Makefile.in
+++ b/libstdc++-v3/src/c++98/Makefile.in
@@ -122,30 +122,29 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libc__98convenience_la_LIBADD =
-@ENABLE_DUAL_ABI_TRUE@am__objects_1 = cow-istream-string.lo
-@ENABLE_DUAL_ABI_TRUE@am__objects_2 = collate_members_cow.lo \
+@ENABLE_DUAL_ABI_TRUE@am__objects_1 = collate_members_cow.lo \
@ENABLE_DUAL_ABI_TRUE@ messages_members_cow.lo \
@ENABLE_DUAL_ABI_TRUE@ monetary_members_cow.lo \
@ENABLE_DUAL_ABI_TRUE@ numeric_members_cow.lo
-am__objects_3 = $(am__objects_2) codecvt_members.lo collate_members.lo \
+am__objects_2 = $(am__objects_1) codecvt_members.lo collate_members.lo \
messages_members.lo monetary_members.lo numeric_members.lo \
time_members.lo
-@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_4 = allocator-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_3 = allocator-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ concept-inst.lo ext-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ misc-inst.lo
-am__objects_5 = parallel_settings.lo
-am__objects_6 = basic_file.lo c++locale.lo $(am__objects_4) \
- $(am__objects_5)
-am__objects_7 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \
- codecvt.lo complex_io.lo globals_io.lo hash_tr1.lo \
- hashtable_tr1.lo ios_failure.lo ios_init.lo ios_locale.lo \
- list.lo list-aux.lo list-aux-2.lo list_associated.lo \
- list_associated-2.lo locale.lo locale_init.lo locale_facets.lo \
- localename.lo math_stubs_float.lo math_stubs_long_double.lo \
- stdexcept.lo strstream.lo tree.lo istream.lo istream-string.lo \
- streambuf.lo valarray.lo $(am__objects_1) $(am__objects_3) \
- $(am__objects_6)
-am_libc__98convenience_la_OBJECTS = $(am__objects_7)
+am__objects_4 = parallel_settings.lo
+am__objects_5 = basic_file.lo c++locale.lo $(am__objects_3) \
+ $(am__objects_4)
+am__objects_6 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \
+ codecvt.lo complex_io.lo cow-istream-string.lo globals_io.lo \
+ hash_tr1.lo hashtable_tr1.lo ios_failure.lo ios_init.lo \
+ ios_locale.lo list.lo list-aux.lo list-aux-2.lo \
+ list_associated.lo list_associated-2.lo locale.lo \
+ locale_init.lo locale_facets.lo localename.lo \
+ math_stubs_float.lo math_stubs_long_double.lo stdexcept.lo \
+ strstream.lo tree.lo istream.lo istream-string.lo streambuf.lo \
+ valarray.lo $(am__objects_2) $(am__objects_5)
+am_libc__98convenience_la_OBJECTS = $(am__objects_6)
libc__98convenience_la_OBJECTS = $(am_libc__98convenience_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -462,10 +461,6 @@ host_sources_extra = \
basic_file.cc c++locale.cc \
${inst_sources} ${parallel_sources}
-@ENABLE_DUAL_ABI_FALSE@cxx11_abi_sources =
-@ENABLE_DUAL_ABI_TRUE@cxx11_abi_sources = \
-@ENABLE_DUAL_ABI_TRUE@ cow-istream-string.cc
-
# XTEMPLATE_FLAGS =
@ENABLE_EXTERN_TEMPLATE_FALSE@inst_sources =
@@ -485,6 +480,7 @@ sources = \
mt_allocator.cc \
codecvt.cc \
complex_io.cc \
+ cow-istream-string.cc \
globals_io.cc \
hash_tr1.cc \
hashtable_tr1.cc \
@@ -509,7 +505,6 @@ sources = \
istream-string.cc \
streambuf.cc \
valarray.cc \
- ${cxx11_abi_sources} \
${host_sources} \
${host_sources_extra}
diff --git a/libstdc++-v3/src/c++98/compatibility-ldbl.cc b/libstdc++-v3/src/c++98/compatibility-ldbl.cc
index eff8fe8144c..7f9f58607d1 100644
--- a/libstdc++-v3/src/c++98/compatibility-ldbl.cc
+++ b/libstdc++-v3/src/c++98/compatibility-ldbl.cc
@@ -35,6 +35,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
#define C char
template class num_get<C, istreambuf_iterator<C> >;
template class num_put<C, ostreambuf_iterator<C> >;
@@ -65,6 +66,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
template bool has_facet<money_get<C> >(const locale&);
#undef C
#endif
+_GLIBCXX_END_NAMESPACE_VERSION
}
// For std::tr1::hash<long double>::operator()
diff --git a/libstdc++-v3/src/c++98/cow-istream-string.cc b/libstdc++-v3/src/c++98/cow-istream-string.cc
index 4a49a9794c9..52c66908261 100644
--- a/libstdc++-v3/src/c++98/cow-istream-string.cc
+++ b/libstdc++-v3/src/c++98/cow-istream-string.cc
@@ -27,4 +27,8 @@
//
#define _GLIBCXX_USE_CXX11_ABI 0
-#include "istream-string.cc"
+#include <bits/c++config.h>
+
+#if ! _GLIBCXX_USE_CXX11_ABI
+# include "istream-string.cc"
+#endif
diff --git a/libstdc++-v3/src/c++98/hash_tr1.cc b/libstdc++-v3/src/c++98/hash_tr1.cc
index 78b8b3dc5f7..46a0cf0a03a 100644
--- a/libstdc++-v3/src/c++98/hash_tr1.cc
+++ b/libstdc++-v3/src/c++98/hash_tr1.cc
@@ -28,6 +28,7 @@
#include "hash-long-double-tr1-aux.cc"
+#if ! _GLIBCXX_USE_CXX11_ABI
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace tr1
@@ -57,3 +58,4 @@ namespace std _GLIBCXX_VISIBILITY(default)
#endif
}
}
+#endif // ! _GLIBCXX_USE_CXX11_ABI
diff --git a/libstdc++-v3/src/c++98/ios_failure.cc b/libstdc++-v3/src/c++98/ios_failure.cc
index ed14acd2d21..341dcc24b84 100644
--- a/libstdc++-v3/src/c++98/ios_failure.cc
+++ b/libstdc++-v3/src/c++98/ios_failure.cc
@@ -29,22 +29,24 @@
#define _GLIBCXX_USE_CXX11_ABI 0
#include <ios>
-#if _GLIBCXX_USE_DUAL_ABI && __cpp_rtti
-#include <cxxabi.h>
-#include <typeinfo>
-#endif
-
-#ifdef _GLIBCXX_USE_NLS
-# include <libintl.h>
-# define _(msgid) gettext (msgid)
-#else
-# define _(msgid) (msgid)
-#endif
+#if ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
+# if (_GLIBCXX_USE_DUAL_ABI || _GLIBCXX_USE_CXX11_ABI) && __cpp_rtti
+# include <cxxabi.h>
+# include <typeinfo>
+# endif
+
+# ifdef _GLIBCXX_USE_NLS
+# include <libintl.h>
+# define _(msgid) gettext (msgid)
+# else
+# define _(msgid) (msgid)
+# endif
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+# if ! _GLIBCXX_USE_CXX11_ABI
ios_base::failure::failure(const string& __str) throw()
: _M_msg(__str) { }
@@ -54,11 +56,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const char*
ios_base::failure::what() const throw()
{ return _M_msg.c_str(); }
+# endif
-#if _GLIBCXX_USE_DUAL_ABI
+# if _GLIBCXX_USE_DUAL_ABI || _GLIBCXX_USE_CXX11_ABI
// When the dual ABI is enabled __throw_ios_failure() is defined in
// src/c++11/cxx11-ios_failure.cc
-#if __cpp_rtti
+# if __cpp_rtti
// If RTTI is enabled the exception type thrown will use these functions to
// construct/destroy a gcc4-compatible ios::failure object in a buffer,
// and to catch that object via a handler of the gcc4-compatible type.
@@ -74,15 +77,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__is_ios_failure_handler(const __cxxabiv1::__class_type_info* type)
{ return *type == typeid(ios::failure); }
+# if ! _GLIBCXX_USE_CXX11_ABI
namespace {
// C++98-style static assertions to ensure ios::failure fits in a buffer
// with the same size and alignment as runtime_error:
typedef char S[1 / (sizeof(ios::failure) <= sizeof(runtime_error))];
typedef char A[1 / (__alignof(ios::failure) <= __alignof(runtime_error))];
}
-#endif // __cpp_rtti
+# endif
+# endif // __cpp_rtti
-#else // ! _GLIBCXX_USE_DUAL_ABI
+# else // ! _GLIBCXX_USE_DUAL_ABI && ! _GLIBCXX_USE_CXX11_ABI
void
__throw_ios_failure(const char* __s __attribute__((unused)))
@@ -92,7 +97,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__throw_ios_failure(const char* str, int)
{ __throw_ios_failure(str); }
-#endif // _GLIBCXX_USE_DUAL_ABI
+# endif // _GLIBCXX_USE_DUAL_ABI || _GLIBCXX_USE_CXX11_ABI
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
+
+#endif // ! _GLIBCXX_USE_CXX11_ABI || ! _GLIBCXX_USE_DUAL_ABI
diff --git a/libstdc++-v3/src/c++98/istream-string.cc b/libstdc++-v3/src/c++98/istream-string.cc
index 55cfe2949b9..d39c57b0799 100644
--- a/libstdc++-v3/src/c++98/istream-string.cc
+++ b/libstdc++-v3/src/c++98/istream-string.cc
@@ -31,9 +31,17 @@
// by another file which defines _GLIBCXX_USE_CXX11_ABI=0.
# define _GLIBCXX_USE_CXX11_ABI 1
#endif
+
+#if _GLIBCXX_USE_CXX11_ABI
+# define _GLIBCXX_BUILT_CXX11_ABI 1
+#else
+# define _GLIBCXX_BUILT_CXX11_ABI 0
+#endif
+
#include <istream>
#include <string>
+#if _GLIBCXX_BUILT_CXX11_ABI == _GLIBCXX_USE_CXX11_ABI
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -289,3 +297,4 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
+#endif // _GLIBCXX_BUILT_CXX11_ABI == _GLIBCXX_USE_CXX11_ABI
diff --git a/libstdc++-v3/src/c++98/locale_facets.cc b/libstdc++-v3/src/c++98/locale_facets.cc
index ec0a9813758..dc1ed063705 100644
--- a/libstdc++-v3/src/c++98/locale_facets.cc
+++ b/libstdc++-v3/src/c++98/locale_facets.cc
@@ -125,6 +125,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __test;
}
+#if ! _GLIBCXX_USE_CXX11_ABI
bool
__verify_grouping(const char* __grouping, size_t __grouping_size,
const string& __grouping_tmp) throw()
@@ -133,6 +134,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__grouping_tmp.c_str(),
__grouping_tmp.size());
}
+#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
diff --git a/libstdc++-v3/src/c++98/stdexcept.cc b/libstdc++-v3/src/c++98/stdexcept.cc
index 2cb039b649f..e938401f627 100644
--- a/libstdc++-v3/src/c++98/stdexcept.cc
+++ b/libstdc++-v3/src/c++98/stdexcept.cc
@@ -26,7 +26,7 @@
// ISO C++ 14882: 19.1 Exception classes
//
-// All exception classes still use the classic COW std::string.
+// In dual abi all exception classes still use the classic COW std::string.
#define _GLIBCXX_USE_CXX11_ABI 0
#include <string>
#include <stdexcept>
@@ -35,8 +35,10 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#if ! _GLIBCXX_USE_CXX11_ABI
logic_error::logic_error(const string& __arg)
: exception(), _M_msg(__arg) { }
+#endif
logic_error::~logic_error() _GLIBCXX_USE_NOEXCEPT { }
@@ -44,28 +46,38 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
logic_error::what() const _GLIBCXX_USE_NOEXCEPT
{ return _M_msg.c_str(); }
+#if ! _GLIBCXX_USE_CXX11_ABI
domain_error::domain_error(const string& __arg)
: logic_error(__arg) { }
+#endif
domain_error::~domain_error() _GLIBCXX_USE_NOEXCEPT { }
+#if ! _GLIBCXX_USE_CXX11_ABI
invalid_argument::invalid_argument(const string& __arg)
: logic_error(__arg) { }
+#endif
invalid_argument::~invalid_argument() _GLIBCXX_USE_NOEXCEPT { }
+#if ! _GLIBCXX_USE_CXX11_ABI
length_error::length_error(const string& __arg)
: logic_error(__arg) { }
+#endif
length_error::~length_error() _GLIBCXX_USE_NOEXCEPT { }
+#if ! _GLIBCXX_USE_CXX11_ABI
out_of_range::out_of_range(const string& __arg)
: logic_error(__arg) { }
+#endif
out_of_range::~out_of_range() _GLIBCXX_USE_NOEXCEPT { }
+#if ! _GLIBCXX_USE_CXX11_ABI
runtime_error::runtime_error(const string& __arg)
: exception(), _M_msg(__arg) { }
+#endif
runtime_error::~runtime_error() _GLIBCXX_USE_NOEXCEPT { }
@@ -73,18 +85,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
runtime_error::what() const _GLIBCXX_USE_NOEXCEPT
{ return _M_msg.c_str(); }
+#if ! _GLIBCXX_USE_CXX11_ABI
range_error::range_error(const string& __arg)
: runtime_error(__arg) { }
+#endif
range_error::~range_error() _GLIBCXX_USE_NOEXCEPT { }
+#if ! _GLIBCXX_USE_CXX11_ABI
overflow_error::overflow_error(const string& __arg)
: runtime_error(__arg) { }
+#endif
overflow_error::~overflow_error() _GLIBCXX_USE_NOEXCEPT { }
+#if ! _GLIBCXX_USE_CXX11_ABI
underflow_error::underflow_error(const string& __arg)
: runtime_error(__arg) { }
+#endif
underflow_error::~underflow_error() _GLIBCXX_USE_NOEXCEPT { }
^ permalink raw reply [flat|nested] 5+ messages in thread