public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Minor fixes for some warnings in <format>
Date: Wed,  9 Aug 2023 15:21:22 +0100	[thread overview]
Message-ID: <20230809142146.1014795-1-jwakely@redhat.com> (raw)

Tested x86_64-linux. Pushed to trunk.

-- >8 --

libstdc++-v3/ChangeLog:

	* include/std/format: Fix some warnings.
	(__format::__write(Ctx&, basic_string_view<CharT>)): Remove
	unused function template.
---
 libstdc++-v3/include/std/format | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index f68308e7210..96eb4cd742e 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -79,7 +79,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 namespace __format
 {
   // Type-erased character sink.
-  template<typename _CharT> struct _Sink;
+  template<typename _CharT> class _Sink;
   // Output iterator that writes to a type-erase character sink.
   template<typename _CharT>
     class _Sink_iter;
@@ -280,7 +280,6 @@ namespace __format
 	}
       else
 	{
-	  unsigned short __val = 0;
 	  constexpr int __n = 32;
 	  char __buf[__n]{};
 	  for (int __i = 0; __i < __n && (__first + __i) != __last; ++__i)
@@ -1468,6 +1467,8 @@ namespace __format
 	      if (__use_prec)
 		__fmt = chars_format::general;
 	      break;
+	    default:
+	      __builtin_unreachable();
 	  }
 
 	  // Write value into buffer using std::to_chars.
@@ -2083,7 +2084,11 @@ namespace __format
 
 // _GLIBCXX_RESOLVE_LIB_DEFECTS
 // P2510R3 Formatting pointers
-#define _GLIBCXX_P2518R3 (__cplusplus > 202302L || ! defined __STRICT_ANSI__)
+#if __cplusplus > 202302L || ! defined __STRICT_ANSI__
+#define _GLIBCXX_P2518R3 1
+#else
+#define _GLIBCXX_P2518R3 0
+#endif
 
 #if _GLIBCXX_P2518R3
 	__first = __spec._M_parse_zero_fill(__first, __last);
@@ -2641,7 +2646,7 @@ namespace __format
     _Arg_none, _Arg_bool, _Arg_c, _Arg_i, _Arg_u, _Arg_ll, _Arg_ull,
     _Arg_flt, _Arg_dbl, _Arg_ldbl, _Arg_str, _Arg_sv, _Arg_ptr, _Arg_handle,
     _Arg_i128, _Arg_u128,
-    _Arg_bf16, _Arg_f16, _Arg_f32, _Arg_f64,
+    _Arg_bf16, _Arg_f16, _Arg_f32, _Arg_f64, // These are unused.
 #ifdef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT
     _Arg_next_value_,
     _Arg_f128 = _Arg_ldbl,
@@ -3106,14 +3111,16 @@ namespace __format
 	    case _Arg_u128:
 	      return std::forward<_Visitor>(__vis)(_M_val._M_u128);
 #endif
-	      // TODO _Arg_f16 etc.
 
 #if _GLIBCXX_FORMAT_F128 == 2
 	    case _Arg_f128:
 	      return std::forward<_Visitor>(__vis)(_M_val._M_f128);
 #endif
+
+	    default:
+	      // _Arg_f16 etc.
+	      __builtin_unreachable();
 	  }
-	  __builtin_unreachable();
 	}
     };
 
@@ -3422,15 +3429,6 @@ namespace __format
 /// @cond undocumented
 namespace __format
 {
-  template<typename _Ctx, typename _CharT>
-    [[__gnu__::__always_inline__]]
-    inline void
-    __write(_Ctx& __ctx, basic_string_view<_CharT> __str)
-    requires requires { { __ctx.out() } -> output_iterator<const _CharT&>; }
-    {
-      __ctx.advance_to(__format::__write(__ctx.out()));
-    }
-
   // Abstract base class defining an interface for scanning format strings.
   // Scan the characters in a format string, dividing it up into strings of
   // ordinary characters, escape sequences, and replacement fields.
-- 
2.41.0


                 reply	other threads:[~2023-08-09 14:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230809142146.1014795-1-jwakely@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).