From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 5641A385DC1D; Wed, 27 Mar 2024 16:19:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5641A385DC1D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1711556394; bh=0vYIN2uO5Pew8UwQdXfES8oAinM75isU93T6WlAT+rk=; h=From:To:Subject:Date:From; b=D6K7jqLgyK1HVpGmxAYy7tOrr8WVRltOTX3bSujfiyW1jYpD7uaDxibjLUzA86gl/ /Ug39sVFzeptUu0m4uDAPsq8A/xZleYDSTvSryl9aflFXqEPdCwjcgWULG5UiFs1tM +E8MjEgL7eTehD2vFa+vL333quOtr2nFUN3pZkgE= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix clang build X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 18d2988e5da8919514c76b83e2c0b56e439018bd X-Git-Newrev: 13ed3225004896142dcb0fbe24411b66f17dfc8e Message-Id: <20240327161954.5641A385DC1D@sourceware.org> Date: Wed, 27 Mar 2024 16:19:54 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D13ed32250048= 96142dcb0fbe24411b66f17dfc8e commit 13ed3225004896142dcb0fbe24411b66f17dfc8e Author: Tom Tromey Date: Wed Mar 27 07:21:56 2024 -0600 Fix clang build =20 Simon pointed out that commit 818ef5f4 ("Capture warnings when writing to the index cache") broke the build with clang. This patch fixes the breakage. Diff: --- 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)); }