Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@ericsson.com>
Subject: [pushed] microblaze-tdep: Add ATTRIBUTE_PRINTF to microblaze_debug
Date: Thu, 21 Sep 2017 12:11:00 -0000	[thread overview]
Message-ID: <1505995878-10687-1-git-send-email-simon.marchi@ericsson.com> (raw)

I am getting this warning with clang:

/home/emaisin/src/binutils-gdb/gdb/microblaze-tdep.c:94:28: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
       vprintf_unfiltered (fmt, args);
                           ^~~

Adding ATTRIBUTE_PRINTF to microblaze_debug gets rid of it.  Strangely,
gcc doesn't warn about non-literal format strings when calling vprintf
(or a vprintf-style function, like vprintf_unfiltered).  I filed this
gcc bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82206

gdb/ChangeLog:

	* microblaze-tdep.c (microblaze_debug): Add ATTRIBUTE_PRINTF.
---
 gdb/ChangeLog         | 4 ++++
 gdb/microblaze-tdep.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index adafa4c..88e7a6e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2017-09-21  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* microblaze-tdep.c (microblaze_debug): Add ATTRIBUTE_PRINTF.
+
 2017-09-21  Yao Qi  <yao.qi@linaro.org>
 
 	* configure.tgt (aarch64*-*-freebsd*): Add fbsd-tdep.o solib-svr4.o
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 7547581..caa7d2f 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -82,7 +82,7 @@ static const char *microblaze_register_names[] =
 \f
 static unsigned int microblaze_debug_flag = 0;
 
-static void
+static void ATTRIBUTE_PRINTF (1, 2)
 microblaze_debug (const char *fmt, ...)
 { 
   if (microblaze_debug_flag)
-- 
2.7.4


             reply	other threads:[~2017-09-21 12:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-21 12:11 Simon Marchi [this message]
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

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=1505995878-10687-1-git-send-email-simon.marchi@ericsson.com \
    --to=simon.marchi@ericsson.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