[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 23:33:51 PST 2021
mstorsjo added inline comments.
Comment at: libcxx/src/filesystem/filesystem_common.h:115
+#define PS_FMT "%s"
> Quuxplusone wrote:
> > How about moving the escaped-double-quotes into this format string?
> > ```
> > #define PS_FMT "\"%ls\""
> > #define PS_FMT "\"%s\""
> > ```
> > That'll make the call-sites look less wacky.
> > (I admit it doesn't really make any sense that we double-quote these paths in the first place. It's not as if we're going to actually escape the backslashes/quotes //in// the paths; so the quotation marks are kind of a lie. But I don't feel like unilaterally suggesting their complete removal.)
> Personally I'd go the opposite way and rather see these macros closer to PRIxYYx macros (cf. https://en.cppreference.com/w/c/types/integer) and so not even include the % sign. This way, they could be used in the future with additional format options, like width, between % and the macro.
> #define PS_FMT "ls"
> #define PS_FMT "s"
> And put % in the format string. WDYT?
Something along those lines were my original intent, but I don't object to going the other way and including more parts in the macro.
I'll leave resolving the rest of the bits in D98097 to you, thanks!
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the libcxx-commits