]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix -Wunused-variable warning in <format>
authorJonathan Wakely <jwakely@redhat.com>
Wed, 28 Aug 2024 11:09:58 +0000 (12:09 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 28 Aug 2024 20:34:22 +0000 (21:34 +0100)
libstdc++-v3/ChangeLog:

* include/std/format (format_parse_context::check_dynamic_spec):
Add [[maybe_unused]] attribute and comment.

libstdc++-v3/include/std/format

index 3280dadfb90e149eeb78e73a8d1133c8a976442c..52243eb54792470cab99806e495f7a89a5c5d1be 100644 (file)
@@ -4323,6 +4323,11 @@ namespace __format
     constexpr void
     basic_format_parse_context<_CharT>::check_dynamic_spec(size_t __id) noexcept
     {
+      // This call enforces the Mandates: condition that _Ts contains valid
+      // types and each type appears at most once. It could be a static_assert
+      // but this way failures give better diagnostics, due to calling the
+      // non-constexpr __invalid_dynamic_spec function.
+      [[maybe_unused]]
       constexpr bool __ok = __check_dynamic_spec_types<_Ts...>();
 
       if consteval {