[PATCH 4/4] libstdc++: Avoid '-Wunused-parameter' for 'out' in member function 'std::codecvt_base::result std::__format::{anonymous}::__encoding::conv(std::string_view, std::string&) const'

Jonathan Wakely jwakely@redhat.com
Thu Feb 20 17:01:20 GMT 2025


On Thu, 20 Feb 2025 at 16:59, Thomas Schwinge <tschwinge@baylibre.com> wrote:
>
> In a newlib configuration:
>
>     ../../../../../source-gcc/libstdc++-v3/src/c++20/format.cc: In member function ‘std::codecvt_base::result std::__format::{anonymous}::__encoding::conv(std::string_view, std::string&) const’:
>     ../../../../../source-gcc/libstdc++-v3/src/c++20/format.cc:100:35: error: unused parameter ‘out’ [-Werror=unused-parameter]
>       100 |   conv(string_view input, string& out) const
>           |                           ~~~~~~~~^~~
>
>         libstdc++-v3/
>         * src/c++20/format.cc (conv): Tag 'out' as '[[maybe_unused]]'.

OK


> ---
>  libstdc++-v3/src/c++20/format.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/src/c++20/format.cc b/libstdc++-v3/src/c++20/format.cc
> index 1a24fcab7f7..6967d53259d 100644
> --- a/libstdc++-v3/src/c++20/format.cc
> +++ b/libstdc++-v3/src/c++20/format.cc
> @@ -97,7 +97,7 @@ struct __encoding : locale::facet
>
>    // Convert `input` to UTF-8, using `out` to hold the result.
>    codecvt_base::result
> -  conv(string_view input, string& out) const
> +  conv(string_view input, [[maybe_unused]] string& out) const
>    {
>      if (input.empty()) [[unlikely]]
>        return codecvt_base::noconv;
> --
> 2.34.1
>



More information about the Libstdc++ mailing list