r272306 - in /branches/gcc-9-branch/libstdc++-v...

redi@gcc.gnu.org redi@gcc.gnu.org
Fri Jun 14 18:11:00 GMT 2019


Author: redi
Date: Fri Jun 14 18:11:30 2019
New Revision: 272306

URL: https://gcc.gnu.org/viewcvs?rev=272306&root=gcc&view=rev
Log:
Reduce code instantiated by filesystem::path::_S_convert_loc

Jakub noted in https://gcc.gnu.org/ml/libstdc++/2019-04/msg00140.html
that an unwanted std::wstring::_M_replace_dispatch symbol has started to
be exported from the Fedora shared library. This symbol is triggered by
the instantiation of std::wstring::assign(const char*, const char*) from
std::__str_codecvt_in which is called from path::_S_convert_loc. The
branch that triggers that instantiation can't actually happen in that
case, because codecvt facets will only return noconv when the input and
output types are the same. Guarding the assign call with an if-constexpr
check that the types are the same avoids instantiating template
specializations that will never actually be needed.

Backport from mainline
2019-04-26  Jonathan Wakely  <jwakely@redhat.com>

	* config/abi/pre/gnu.ver (GLIBCXX_3.4): Replace wildcard that matches
	wstring::_M_replace_dispatch with more specific patterns.
	* include/bits/fs_path.h (path::_S_convert_loc<_InputIterator>):
	Create const std::string to avoid redundant call to _S_convert_loc
	with non-const pointers.
	* include/bits/locale_conv.h (__do_str_codecvt): Use if-constexpr to
	avoid unnecessary basic_string::assign instantiations.

Modified:
    branches/gcc-9-branch/libstdc++-v3/ChangeLog
    branches/gcc-9-branch/libstdc++-v3/include/bits/fs_path.h
    branches/gcc-9-branch/libstdc++-v3/include/bits/locale_conv.h



More information about the Libstdc++-cvs mailing list