aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-11-28 17:07:22 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2018-11-28 17:07:22 +0000
commit345d2d034989be69e97c45e7fcea8fe4c2409a6f (patch)
tree9a8cb688217e70f6787661b740784a7439c46684
parent0a1369fa9598019354484651f1a16dd8cf7d70c9 (diff)
downloadgcc-345d2d034989be69e97c45e7fcea8fe4c2409a6f.zip
gcc-345d2d034989be69e97c45e7fcea8fe4c2409a6f.tar.gz
gcc-345d2d034989be69e97c45e7fcea8fe4c2409a6f.tar.bz2
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
-rw-r--r--libstdc++-v3/ChangeLog4
-rw-r--r--libstdc++-v3/src/filesystem/path.cc52
2 files changed, 32 insertions, 24 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 6d781b5..1107da0 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,9 @@
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
* include/std/string_view (basic_string_view::substr): Add default
argument to first parameter.
diff --git a/libstdc++-v3/src/filesystem/path.cc b/libstdc++-v3/src/filesystem/path.cc
index fb70d30..63da684 100644
--- a/libstdc++-v3/src/filesystem/path.cc
+++ b/libstdc++-v3/src/filesystem/path.cc
@@ -485,28 +485,32 @@ fs::hash_value(const path& p) noexcept
return seed;
}
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-namespace filesystem
-{
- extern string
- fs_err_concat(const string& __what, const string& __path1,
- const string& __path2);
-} // namespace filesystem
-
-namespace experimental::filesystem::v1 {
-_GLIBCXX_BEGIN_NAMESPACE_CXX11
-
- std::string filesystem_error::_M_gen_what()
- {
- using std::filesystem::fs_err_concat;
- return fs_err_concat(system_error::what(), _M_path1.u8string(),
- _M_path2.u8string());
- }
-
-_GLIBCXX_END_NAMESPACE_CXX11
-} // namespace experimental::filesystem::v1
+#include <experimental/string_view>
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace std
+std::string
+fs::filesystem_error::_M_gen_what()
+{
+ const std::string pstr1 = _M_path1.u8string();
+ const std::string pstr2 = _M_path2.u8string();
+ experimental::string_view s = this->system_error::what();
+ const size_t len = 18 + s.length()
+ + (pstr1.length() ? pstr1.length() + 3 : 0)
+ + (pstr2.length() ? pstr2.length() + 3 : 0);
+ std::string w;
+ w.reserve(len);
+ w = "filesystem error: ";
+ w.append(s.data(), s.length());
+ if (!pstr1.empty())
+ {
+ w += " [";
+ w += pstr1;
+ w += ']';
+ }
+ if (!pstr1.empty())
+ {
+ w += " [";
+ w += pstr2;
+ w += ']';
+ }
+ return w;
+}