<div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 1, 2026 at 10:55 PM Jonathan Wakely <<a href="mailto:jwakely@redhat.com" target="_blank">jwakely@redhat.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Only define windows_create_symlink when it will actually be functional,<br>
and adjust its callers to not use it unless it's defined.</blockquote><div> I would add: "To make it consistient with windows_read_symlink_handle."</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
libstdc++-v3/ChangeLog:<br>
<br>
* src/c++17/fs_ops.cc (windows_create_symlink): Adjust<br>
preprocessor conditions to not define this at all unless<br>
SYMBOLIC_LINK_FLAG_DIRECTORY is defined.<br>
(fs::create_directory_symlink): Adjust preprocessor conditions<br>
accordingly.<br>
(fs::create_symlink): Likewise.<br>
---<br>
<br>
This is the change Tomasz asked for.<br></blockquote><div>LGTM, Thanks. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Tested x86_64-linux and briefly under mingw-w64/Wine.<br>
<br>
libstdc++-v3/src/c++17/fs_ops.cc | 17 +++++++++--------<br>
1 file changed, 9 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/libstdc++-v3/src/c++17/fs_ops.cc b/libstdc++-v3/src/c++17/fs_ops.cc<br>
index 387869751c58..81bffc7b1513 100644<br>
--- a/libstdc++-v3/src/c++17/fs_ops.cc<br>
+++ b/libstdc++-v3/src/c++17/fs_ops.cc<br>
@@ -646,7 +646,8 @@ fs::create_directory(const path& p, const path& attributes,<br>
#endif<br>
}<br>
<br>
-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS<br>
+#if defined(_GLIBCXX_FILESYSTEM_IS_WINDOWS) \<br>
+ && defined(SYMBOLIC_LINK_FLAG_DIRECTORY)<br>
namespace<br>
{<br>
void<br>
@@ -654,7 +655,6 @@ namespace<br>
const fs::file_type target_type,<br>
std::error_code& ec) noexcept<br>
{<br>
-#ifdef SYMBOLIC_LINK_FLAG_DIRECTORY // Implies CreateSymbolicLinkW support.<br>
DWORD symlink_type = target_type == fs::file_type::directory<br>
? SYMBOLIC_LINK_FLAG_DIRECTORY : 0;<br>
// Windows can't handle relative symlinks with non-preferred slashes.<br>
@@ -686,9 +686,6 @@ namespace<br>
ec.clear();<br>
else<br>
ec = std::__last_system_error();<br>
-#else<br>
- ec = std::make_error_code(std::errc::function_not_supported);<br>
-#endif<br>
}<br>
}<br>
#endif<br>
@@ -707,10 +704,13 @@ void<br>
fs::create_directory_symlink(const path& to, const path& new_symlink,<br>
error_code& ec) noexcept<br>
{<br>
-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS<br>
+#ifdef _GLIBCXX_HAVE_SYMLINK<br>
+ create_symlink(to, new_symlink, ec);<br>
+#elif defined(_GLIBCXX_FILESYSTEM_IS_WINDOWS) \<br>
+ && defined(SYMBOLIC_LINK_FLAG_DIRECTORY)<br>
windows_create_symlink(to, new_symlink, file_type::directory, ec);<br>
#else<br>
- create_symlink(to, new_symlink, ec);<br>
+ ec = std::make_error_code(std::errc::function_not_supported);<br>
#endif<br>
}<br>
<br>
@@ -763,7 +763,8 @@ fs::create_symlink(const path& to, const path& new_symlink,<br>
ec.assign(errno, std::generic_category());<br>
else<br>
ec.clear();<br>
-#elif _GLIBCXX_FILESYSTEM_IS_WINDOWS<br>
+#elif defined(_GLIBCXX_FILESYSTEM_IS_WINDOWS) \<br>
+ && defined(SYMBOLIC_LINK_FLAG_DIRECTORY)<br>
windows_create_symlink(to, new_symlink, file_type::regular, ec);<br>
#else<br>
ec = std::make_error_code(std::errc::function_not_supported);<br>
-- <br>
2.54.0<br>
<br>
</blockquote></div></div>
</div>