[PATCH] libstdc++: unused local declarations
Jonathan Wakely
jwakely@redhat.com
Wed Aug 28 09:45:48 GMT 2024
On Wed, 28 Aug 2024 at 10:38, Jason Merrill <jason@redhat.com> wrote:
>
> Tested x86_64-pc-linux-gnu. OK for trunk, or were these supposed to be used?
I think the _RefT typedef was used in an earlier version of the code
(possibly a much earlier version that was never even pushed). It can
be removed.
I think the __ok variable exists to force constant evaluation of
__check_dynamic_spec_types, although I think that could be done this
way instead:
if (is_constant_evaluated())
__check_dynamic_spec_types();
I'll take care of both changes today, so please don't bother pushing this.
>
> -- 8< --
>
> The __ok variable and _RefT typedef aren't used in the rest of their blocks.
> Should they be?
>
> libstdc++-v3/ChangeLog:
>
> * include/std/format (check_dynamic_spec): Add [[maybe_unused]].
> * include/std/ranges (to): Likewise.
> ---
> libstdc++-v3/include/std/format | 1 +
> libstdc++-v3/include/std/ranges | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
> index 3280dadfb90..376169018ba 100644
> --- a/libstdc++-v3/include/std/format
> +++ b/libstdc++-v3/include/std/format
> @@ -4323,6 +4323,7 @@ namespace __format
> constexpr void
> basic_format_parse_context<_CharT>::check_dynamic_spec(size_t __id) noexcept
> {
> + [[maybe_unused]]
> constexpr bool __ok = __check_dynamic_spec_types<_Ts...>();
>
> if consteval {
> diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
> index b7c7aa36ddc..008461e556b 100644
> --- a/libstdc++-v3/include/std/ranges
> +++ b/libstdc++-v3/include/std/ranges
> @@ -9327,7 +9327,7 @@ namespace __detail
> std::forward<_Args>(__args)...);
> else
> {
> - using _RefT = range_reference_t<_Rg>;
> + using _RefT [[maybe_unused]] = range_reference_t<_Rg>;
> static_assert(constructible_from<_Cont, _Args...>);
> _Cont __c(std::forward<_Args>(__args)...);
> if constexpr (sized_range<_Rg>
>
> base-commit: 48032f28ad4bc5e810c303229bcaa223a0c4d09f
> --
> 2.46.0
>
More information about the Libstdc++
mailing list