[PATCH] Avoid '-Wunused-parameter' diagnostics in 'libstdc++-v3/src/filesystem/ops.cc'

Jonathan Wakely jwakely@redhat.com
Mon Nov 9 09:06:57 GMT 2026


On Mon, 9 Nov 2026 at 09:05, Thomas Schwinge <tschwinge@baylibre.com> wrote:
>
> For '--target=x86_64-w64-mingw32', with '--enable-werror':
>
>     ../../../../../source-gcc/libstdc++-v3/src/filesystem/ops.cc: In function ‘void std::experimental::filesystem::v1::create_directory_symlink(const __cxx11::path&, const __cxx11::path&, std::error_code&)’:
>     ../../../../../source-gcc/libstdc++-v3/src/filesystem/ops.cc:584:42: error: unused parameter ‘to’ [-Werror=unused-parameter]
>       584 | fs::create_directory_symlink(const path& to, const path& new_symlink,
>           |                              ~~~~~~~~~~~~^~
>     ../../../../../source-gcc/libstdc++-v3/src/filesystem/ops.cc:584:58: error: unused parameter ‘new_symlink’ [-Werror=unused-parameter]
>       584 | fs::create_directory_symlink(const path& to, const path& new_symlink,
>           |                                              ~~~~~~~~~~~~^~~~~~~~~~~
>     ../../../../../source-gcc/libstdc++-v3/src/filesystem/ops.cc: In function ‘void std::experimental::filesystem::v1::create_symlink(const __cxx11::path&, const __cxx11::path&, std::error_code&)’:
>     ../../../../../source-gcc/libstdc++-v3/src/filesystem/ops.cc:635:32: error: unused parameter ‘to’ [-Werror=unused-parameter]
>       635 | fs::create_symlink(const path& to, const path& new_symlink,
>           |                    ~~~~~~~~~~~~^~
>     ../../../../../source-gcc/libstdc++-v3/src/filesystem/ops.cc:635:48: error: unused parameter ‘new_symlink’ [-Werror=unused-parameter]
>       635 | fs::create_symlink(const path& to, const path& new_symlink,
>           |                                    ~~~~~~~~~~~~^~~~~~~~~~~
>
>         libstdc++-v3/
>         * src/filesystem/ops.cc (fs::create_directory_symlink): Tag 'to',
>         'path' as '[[maybe_unused]]'.
>         (fs::create_symlink): Tag 'to', 'new_symlink' as
>         '[[maybe_unused]]'.

OK thanks (I've been meaning to do this for ages!)


> ---
>  libstdc++-v3/src/filesystem/ops.cc | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc
> index 80f83c049c7d..9a627cfc87b4 100644
> --- a/libstdc++-v3/src/filesystem/ops.cc
> +++ b/libstdc++-v3/src/filesystem/ops.cc
> @@ -581,7 +581,8 @@ fs::create_directory_symlink(const path& to, const path& new_symlink)
>  }
>
>  void
> -fs::create_directory_symlink(const path& to, const path& new_symlink,
> +fs::create_directory_symlink([[maybe_unused]] const path& to,
> +                            [[maybe_unused]] const path& new_symlink,
>                              error_code& ec) noexcept
>  {
>  #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
> @@ -632,7 +633,8 @@ fs::create_symlink(const path& to, const path& new_symlink)
>  }
>
>  void
> -fs::create_symlink(const path& to, const path& new_symlink,
> +fs::create_symlink([[maybe_unused]] const path& to,
> +                  [[maybe_unused]] const path& new_symlink,
>                    error_code& ec) noexcept
>  {
>  #ifdef _GLIBCXX_HAVE_SYMLINK
> --
> 2.53.0
>



More information about the Libstdc++ mailing list