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

On 2019-10-13 14:17, Kevin Buettner wrote:
> 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

Thanks, I pushed it.

Simon


      reply	other threads:[~2019-10-14  0:00 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
2019-10-14  0:00   ` Simon Marchi [this message]

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=b2cd243c39de9d0d7dbe97af845647a1@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    --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