From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 1D1F13858D32; Mon, 15 Apr 2024 15:37:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D1F13858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1713195472; bh=wEouT3E11ofP+w5R7RKoDLRCPy6rijNQ0azmsMZ6yEE=; h=From:To:Subject:Date:From; b=w0RxZmJvCAh36HoRtSqtbLAUgKatojEPXyPpWjrzOyH8NnKHy9J7dPNnKVZ2XnZ73 9CYze4JiSZ7jAPFnjHYepiNCFUi1M5DVkNgWknO3wqFBCF8vWCdlANXU7D5JHi7auB Ze4G9myIU+wDzkVwOFG0yEYvbbzEdR84d1hRyCEY= 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] Change printf attribute to fix clang build X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: ccbf42ec88f3e8bbb74dbdc1d6c9da3a9d805cff X-Git-Newrev: 5cb1d84e595aac021641622028d0e7f1e8ea8adf Message-Id: <20240415153752.1D1F13858D32@sourceware.org> Date: Mon, 15 Apr 2024 15:37:51 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D5cb1d84e595a= ac021641622028d0e7f1e8ea8adf commit 5cb1d84e595aac021641622028d0e7f1e8ea8adf Author: Tom Tromey Date: Mon Apr 15 09:33:21 2024 -0600 Change printf attribute to fix clang build =20 commit e8cd90f0 ("Rewrite gdb_bfd_error_handler") broke the clang build. =20 The problem here is that print_error_callback isn't marked as being printf-like, but it calls string_file::vprintf, triggering: =20 ../../binutils-gdb/gdb/gdb_bfd.c:1202:18: error: format string is not a= string literal [-Werror,-Wformat-nonliteral] =20 This patch applies the attribute to this function. =20 It also removes the attribute from gdb_bfd_error_handler, because that function is no longer really printf-like. Diff: --- gdb/gdb_bfd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index 0120dd034fa..1462aaf0f89 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -1192,7 +1192,7 @@ increment_bfd_error_count (const std::string &str) =20 /* A print callback for bfd_print_error. */ =20 -static int +static int ATTRIBUTE_PRINTF (2, 0) print_error_callback (void *stream, const char *fmt, ...) { string_file *file =3D (string_file *) stream; @@ -1208,7 +1208,7 @@ print_error_callback (void *stream, const char *fmt, = ...) messages which have been printed once already. This is done on a per-inferior basis. */ =20 -static void ATTRIBUTE_PRINTF (1, 0) +static void gdb_bfd_error_handler (const char *fmt, va_list ap) { string_file output;