public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Enze Li <enze.li@hotmail.com>, gdb-patches@sourceware.org
Cc: enze.li@gmx.com
Subject: Re: [PATCH] gdb: add ATTRIBUTE_PRINTF to gdb_bfd_error_handler
Date: Sun, 18 Sep 2022 07:45:10 +0200	[thread overview]
Message-ID: <1e04fad6-5160-3897-9b83-15067ed59313@suse.de> (raw)
In-Reply-To: <OS3P286MB215245D586ABBE35D2EA924EF04A9@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM>

On 9/18/22 06:58, Enze Li via Gdb-patches wrote:
> I see this error when building with clang,
> 
>    CXX    gdb_bfd.o
> gdb_bfd.c:1180:43: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
>    const std::string str = string_vprintf (fmt, ap_copy);
>                                            ^~~
> 1 error generated.
> 
> This patch adds missing ATTRIBUTE_PRINTF to fix the error.
> 
> Tested on x86_64-linux  with gcc 12 and clang 14.


LGTM.

Thanks,
- Tom

> ---
>   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_handler;
>      messages which have been printed once already.  This is done on a
>      per-inferior basis.  */
>   
> -static void
> +static void ATTRIBUTE_PRINTF (1, 0)
>   gdb_bfd_error_handler (const char *fmt, va_list ap)
>   {
>     va_list ap_copy;

  reply	other threads:[~2022-09-18  5:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-18  4:58 Enze Li
2022-09-18  5:45 ` Tom de Vries [this message]
2022-09-19 12:49   ` Enze Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e04fad6-5160-3897-9b83-15067ed59313@suse.de \
    --to=tdevries@suse.de \
    --cc=enze.li@gmx.com \
    --cc=enze.li@hotmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).