[libcxx-commits] [PATCH] D98077: [libcxx] Fix the format strings for formatting paths in directory_iterator.cpp
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Mar 5 13:34:20 PST 2021
mstorsjo created this revision.
mstorsjo added a reviewer: Quuxplusone.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D98077
Files:
libcxx/src/filesystem/directory_iterator.cpp
libcxx/src/filesystem/filesystem_common.h
libcxx/src/filesystem/operations.cpp
Index: libcxx/src/filesystem/operations.cpp
===================================================================
--- libcxx/src/filesystem/operations.cpp
+++ libcxx/src/filesystem/operations.cpp
@@ -667,12 +667,6 @@
filesystem_error::~filesystem_error() {}
-#if defined(_LIBCPP_WIN32API)
-#define PS_FMT "%ls"
-#else
-#define PS_FMT "%s"
-#endif
-
void filesystem_error::__create_what(int __num_paths) {
const char* derived_what = system_error::what();
__storage_->__what_ = [&]() -> string {
Index: libcxx/src/filesystem/filesystem_common.h
===================================================================
--- libcxx/src/filesystem/filesystem_common.h
+++ libcxx/src/filesystem/filesystem_common.h
@@ -108,6 +108,12 @@
return result;
}
+#if defined(_LIBCPP_WIN32API)
+#define PS_FMT "%ls"
+#else
+#define PS_FMT "%s"
+#endif
+
const path::value_type* unwrap(path::string_type const& s) { return s.c_str(); }
const path::value_type* unwrap(path const& p) { return p.native().c_str(); }
template <class Arg>
Index: libcxx/src/filesystem/directory_iterator.cpp
===================================================================
--- libcxx/src/filesystem/directory_iterator.cpp
+++ libcxx/src/filesystem/directory_iterator.cpp
@@ -272,7 +272,7 @@
path root = move(__imp_->__root_);
__imp_.reset();
if (m_ec)
- err.report(m_ec, "at root \"%s\"", root);
+ err.report(m_ec, "at root \"" PS_FMT "\"", root);
}
return *this;
}
@@ -359,7 +359,7 @@
if (m_ec) {
path root = move(stack.top().__root_);
__imp_.reset();
- err.report(m_ec, "at root \"%s\"", root);
+ err.report(m_ec, "at root \"" PS_FMT "\"", root);
} else {
__imp_.reset();
}
@@ -404,7 +404,7 @@
} else {
path at_ent = move(curr_it.__entry_.__p_);
__imp_.reset();
- err.report(m_ec, "attempting recursion into \"%s\"", at_ent);
+ err.report(m_ec, "attempting recursion into \"" PS_FMT "\"", at_ent);
}
}
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98077.328634.patch
Type: text/x-patch
Size: 1997 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210305/acc28ffc/attachment-0001.bin>
More information about the libcxx-commits
mailing list