[PATCH] libstdc++: unused local declarations

Jason Merrill jason@redhat.com
Wed Aug 28 09:35:24 GMT 2024


Tested x86_64-pc-linux-gnu.  OK for trunk, or were these supposed to be used?

-- 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