mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 23:25:24 +02:00
This patch implements formatting for std::filesystem::path from P2845R8, and defines the feature test macro __cpp_lib_format_path to 202403L, provided only in <filesystem>. Formatting options are performed (if applicable) in order: 'g', '?', transcoding, fill-and-align & width The standard specifies transcoding behaviour only when literal encoding is UTF-8, leaving all other cases implementation defined. Current implementation of filesystem::path assumes: * char encoding is UTF-8 * wchar_t encoding is either UTF-32 or UTF-16 libstdc++-v3/ChangeLog: * include/bits/fs_path.h: Include bits/formatfwd.h. (std::formatter<filesystem::path, _CharT>): Define. * include/bits/version.def (format_path): Define. * include/bits/version.h: Regenerate. * include/std/filesystem: Expose __cpp_lib_format_path. * testsuite/std/format/fs_path.cc: New test. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Ivan Lazaric <ivan.lazaric1@gmail.com> Co-authored-by: Jonathan Wakely <jwakely@redhat.com>