From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7872) id 9F4513858D1E; Mon, 19 Sep 2022 12:48:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F4513858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663591713; bh=2tgKRgOfAQS+gRdWT+h57Z8gHnOZDTpUrVEJ8Vljy5M=; h=From:To:Subject:Date:From; b=OLOjVTeZ605kk08XiBUBzR2G1ZtH35LiytIEOVG16bRHpjJCrJhsoPuta+m0jAnmZ ujDe+hwm7klC5F3P/YnFdzFuJikzdBEuNPgTnzG2+ndsh/Uf+yXd5NRsNLIFXnNiU5 psN/rbrHXxoJzl+vULPHQ+V6zwbJaQO6dakLPxvk= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Enze Li To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: add ATTRIBUTE_PRINTF to gdb_bfd_error_handler X-Act-Checkin: binutils-gdb X-Git-Author: Enze Li X-Git-Refname: refs/heads/master X-Git-Oldrev: c99b2113a478a075e8d8f7c3848a92f1ce73f847 X-Git-Newrev: 77b7377bc4c8d404de00c5a360e64daee75acf80 Message-Id: <20220919124833.9F4513858D1E@sourceware.org> Date: Mon, 19 Sep 2022 12:48:33 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D77b7377bc4c8= d404de00c5a360e64daee75acf80 commit 77b7377bc4c8d404de00c5a360e64daee75acf80 Author: Enze Li Date: Mon Sep 19 20:43:50 2022 +0800 gdb: add ATTRIBUTE_PRINTF to gdb_bfd_error_handler =20 I see this error when building with clang, =20 CXX gdb_bfd.o gdb_bfd.c:1180:43: error: format string is not a string literal [-Werro= r,-Wformat-nonliteral] const std::string str =3D string_vprintf (fmt, ap_copy); ^~~ 1 error generated. =20 This patch adds missing ATTRIBUTE_PRINTF to fix the error. =20 Tested on x86_64-linux with gcc 12 and clang 14. Diff: --- gdb/gdb_bfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index 6299148d419..c5a5ed95e8e 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -1170,7 +1170,7 @@ static bfd_error_handler_type default_bfd_error_handl= er; messages which have been printed once already. This is done on a per-inferior basis. */ =20 -static void +static void ATTRIBUTE_PRINTF (1, 0) gdb_bfd_error_handler (const char *fmt, va_list ap) { va_list ap_copy;