Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [pushed] Fix clang build
@ 2024-03-27 16:19 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2024-03-27 16:19 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Simon pointed out that commit 818ef5f4 ("Capture warnings when writing
to the index cache") broke the build with clang.  This patch fixes the
breakage.
---
 gdb/utils.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gdb/utils.h b/gdb/utils.h
index d7db1d84e2f..875a2583179 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -444,10 +444,18 @@ struct deferred_warnings
      hook; see scoped_restore_warning_hook.  Note that no locking is
      done, so users have to be careful to only install this into a
      single thread at a time.  */
-  void operator() (const char *format, va_list args) ATTRIBUTE_PRINTF (2, 0)
+  void operator() (const char *format, va_list args)
   {
     string_file msg (m_can_style);
+    /* Clang warns if we add ATTRIBUTE_PRINTF to this method (because
+       the function-view wrapper doesn't also have the attribute), but
+       then warns again if we remove it, because this vprintf call
+       does not use a literal format string.  So, suppress the
+       warnings here.  */
+    DIAGNOSTIC_PUSH
+    DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
     msg.vprintf (format, args);
+    DIAGNOSTIC_POP
     m_warnings.emplace_back (std::move (msg));
   }
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-27 16:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-27 16:19 [pushed] Fix clang build Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox