aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-03-27 07:21:56 -0600
committerTom Tromey <tromey@adacore.com>2024-03-27 10:14:49 -0600
commit13ed3225004896142dcb0fbe24411b66f17dfc8e (patch)
tree11a1e817bd8a3f6c92d759f0ec0fd353715b5d3b
parent18d2988e5da8919514c76b83e2c0b56e439018bd (diff)
downloadbinutils-13ed3225004896142dcb0fbe24411b66f17dfc8e.zip
binutils-13ed3225004896142dcb0fbe24411b66f17dfc8e.tar.gz
binutils-13ed3225004896142dcb0fbe24411b66f17dfc8e.tar.bz2
Fix clang build
Simon pointed out that commit 818ef5f4 ("Capture warnings when writing to the index cache") broke the build with clang. This patch fixes the breakage.
-rw-r--r--gdb/utils.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/gdb/utils.h b/gdb/utils.h
index d7db1d8..875a258 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));
}