]> git.ipfire.org Git - thirdparty/gcc.git/commit
Reduce code instantiated by filesystem::path::_S_convert_loc
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Apr 2019 14:04:45 +0000 (14:04 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Apr 2019 14:04:45 +0000 (14:04 +0000)
commit469336183598717b8764c09950702b2ef8c1f767
treefbfb8aa99ea6a9acdf78561de7e7747ac2b47856
parent051e444d264353ba2557d59c5b9640d943c100cb
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.

* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@270602 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/config/abi/pre/gnu.ver
libstdc++-v3/include/bits/fs_path.h
libstdc++-v3/include/bits/locale_conv.h