Fix undefined references in libstdc++fs.a

The recent patch for PR 83306 removed the fs_err_concat functions that
were used by the experimental::filesystem::filesystem_error class as
well. This fixes it by doing the string generation directly in
filesystem_error::_M_gen_what() instead of using the removed function.

	PR libstdc++/83306
	* src/filesystem/path.cc (filesystem_error::_M_gen_what()): Create
	string directly, instead of calling fs_err_concat.

From-SVN: r266569
This commit is contained in:
Jonathan Wakely 2018-11-28 17:07:22 +00:00 committed by Jonathan Wakely
parent 0a1369fa95
commit 345d2d0349
2 changed files with 32 additions and 24 deletions

View File

@ -1,5 +1,9 @@
2018-11-28 Jonathan Wakely <jwakely@redhat.com> 2018-11-28 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/83306
* src/filesystem/path.cc (filesystem_error::_M_gen_what()): Create
string directly, instead of calling fs_err_concat.
PR libstdc++/83511 PR libstdc++/83511
* include/std/string_view (basic_string_view::substr): Add default * include/std/string_view (basic_string_view::substr): Add default
argument to first parameter. argument to first parameter.

View File

@ -485,28 +485,32 @@ fs::hash_value(const path& p) noexcept
return seed; return seed;
} }
namespace std #include <experimental/string_view>
std::string
fs::filesystem_error::_M_gen_what()
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION const std::string pstr1 = _M_path1.u8string();
namespace filesystem const std::string pstr2 = _M_path2.u8string();
{ experimental::string_view s = this->system_error::what();
extern string const size_t len = 18 + s.length()
fs_err_concat(const string& __what, const string& __path1, + (pstr1.length() ? pstr1.length() + 3 : 0)
const string& __path2); + (pstr2.length() ? pstr2.length() + 3 : 0);
} // namespace filesystem std::string w;
w.reserve(len);
namespace experimental::filesystem::v1 { w = "filesystem error: ";
_GLIBCXX_BEGIN_NAMESPACE_CXX11 w.append(s.data(), s.length());
if (!pstr1.empty())
std::string filesystem_error::_M_gen_what() {
{ w += " [";
using std::filesystem::fs_err_concat; w += pstr1;
return fs_err_concat(system_error::what(), _M_path1.u8string(), w += ']';
_M_path2.u8string()); }
} if (!pstr1.empty())
{
_GLIBCXX_END_NAMESPACE_CXX11 w += " [";
} // namespace experimental::filesystem::v1 w += pstr2;
w += ']';
_GLIBCXX_END_NAMESPACE_VERSION }
} // namespace std return w;
}