On 26/04/19 18:44 +0200, Jakub Jelinek wrote:
On Fri, Apr 26, 2019 at 03:05:36PM +0100, Jonathan Wakely wrote:
    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.

Can you please commit this part to 9.1 now as well (so that we don't export
it from 9.1.0 by accident)?

Done 8 seconds before your email, as r270611 :-)

The rest is fine for 9.2 if you want or just on the trunk, whatever you
think is better.

It's on trunk for now. I'll probably do it for 9.2 as well, because
the bits/fs_path.h change avoids an unnecessary dynamic allocation,
and the bits/locale_conv.h change makes the library smaller:

$ size /home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.26 text data bss dec hex filename
1855147   50792   13536 1919475  1d49f3 
/home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.26.before
1853624   50792   13536 1917952  1d4400 
/home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.26.after

It's certainly not critical, but it's a small improvement with no
downside.



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

        Jakub

Reply via email to