From: Pedro Alves <palves@redhat.com>
To: Michael Eager <eager@eagerm.com>,
Simon Marchi <simon.marchi@ericsson.com>,
gdb-patches@sourceware.org
Subject: Re: [pushed] microblaze-tdep: Add ATTRIBUTE_PRINTF to microblaze_debug
Date: Mon, 25 Sep 2017 17:09:00 -0000 [thread overview]
Message-ID: <edf81782-42c9-a2a3-b3f3-f680396d6e39@redhat.com> (raw)
In-Reply-To: <d864a1f2-758f-d0d6-2793-63adc728d27e@eagerm.com>
On 09/25/2017 05:43 PM, Michael Eager wrote:
> On 09/25/2017 09:06 AM, Pedro Alves wrote:
>>> but the better fix
>>> seems to me to
>>> be to turn off the obviously inappropriate -Wformat-nonliteral option in
>>> microblaze_debug() using
>>> #pragma GCC diagnostic ignored "-Wformat-nonliteral"
>> That doesn't make sense to me.
>
> The argument passed to vprintf_unformatted in microblaze_debug is not a
> string
> literal. The diagnostic message is correct. If you don't want the
> diagnostic,
> turning it off seems correct.
The diagnostic hasn't gone away. Instead, a warning is now emitted one
level up, at the microblaze_debug call sites, iff someone passes a
non-literal string as format string by mistake. That makes total
sense, because microblaze_debug is just a wrapper
around *printf_unfiltered.
> This is somewhat moot. All uses of microblaze_debug use literal string
> formats,
> so adding ATTRIBUTE_PRINTF is OK.
And if someone passes a non-literal format, we'll get a warning then.
If we suppressed the warning inside microblaze_debug as you were
suggesting, then we'd risk passing a non-literal as format string to
vprintf_unfiltered. That's the whole point.
Thanks,
Pedro Alves
prev parent reply other threads:[~2017-09-25 17:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-21 12:11 Simon Marchi
2017-09-25 14:14 ` Michael Eager
2017-09-25 16:06 ` Pedro Alves
2017-09-25 16:43 ` Michael Eager
2017-09-25 17:09 ` Pedro Alves [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=edf81782-42c9-a2a3-b3f3-f680396d6e39@redhat.com \
--to=palves@redhat.com \
--cc=eager@eagerm.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@ericsson.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