Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH] gdb: Silence -Wformat-nonliteral warning with clang
Date: Sun, 13 Oct 2019 18:17:00 -0000	[thread overview]
Message-ID: <20191013111714.4a46dbdb@f29-4.lan> (raw)
In-Reply-To: <20191011205426.1859-1-simon.marchi@efficios.com>

On Fri, 11 Oct 2019 16:54:26 -0400
Simon Marchi <simon.marchi@efficios.com> wrote:

> We get this warning when building with clang:
> 
>       CXX    ui-out.o
>     /home/smarchi/src/binutils-gdb/gdb/ui-out.c:590:22: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
>       do_message (style, format, args);
>                          ^~~~~~
> 
> This can be considered a legitimate warning, as call_do_message's format
> parameter is not marked as a format string.  Therefore, we should
> normally mark the call_do_message method with the `format` attribute.
> However, doing so just moves (and multiplies) the problem, as all the
> uses of call_do_message in the vmessage method now warn.  If we wanted
> to continue on that path, we should silence the warning for each of
> them, as a way of telling the compiler "it's ok, we know what we are
> doing".
> 
> But since call_do_message is really just vmessage's little helper, it's
> simpler to just silence the warning at that single point.
> 
> gdb/ChangeLog:
> 
> 	* ui-out.c (ui_out::call_do_message): Silence
> 	-Wformat-nonliteral warning.

LGTM.

Kevin


  reply	other threads:[~2019-10-13 18:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11 20:54 Simon Marchi
2019-10-13 18:17 ` Kevin Buettner [this message]
2019-10-14  0:00   ` Simon Marchi

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=20191013111714.4a46dbdb@f29-4.lan \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    /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