This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] linux-waitpid: Get rid of format string warning


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1e5b66ed4285ecf063e7801a46178ebb0ce5be41

commit 1e5b66ed4285ecf063e7801a46178ebb0ce5be41
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Thu Sep 21 15:19:40 2017 +0200

    linux-waitpid: Get rid of format string warning
    
    Clang gives this warning:
    
    /home/emaisin/src/binutils-gdb/gdb/gdbserver/../nat/linux-waitpid.c:45:25: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
          vfprintf (stderr, format, args);
                            ^~~~~~
    
    Get rid of it by adding ATTRIBUTE_PRINTF.
    
    gdb/ChangeLog:
    
    	* nat/linux-waitpid.c (linux_debug): Add ATTRIBUTE_PRINTF.

Diff:
---
 gdb/ChangeLog           | 4 ++++
 gdb/nat/linux-waitpid.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 88e7a6e..5803abf 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2017-09-21  Simon Marchi  <simon.marchi@ericsson.com>
 
+	* nat/linux-waitpid.c (linux_debug): Add ATTRIBUTE_PRINTF.
+
+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>
diff --git a/gdb/nat/linux-waitpid.c b/gdb/nat/linux-waitpid.c
index bf5e725..05d1e26 100644
--- a/gdb/nat/linux-waitpid.c
+++ b/gdb/nat/linux-waitpid.c
@@ -34,7 +34,7 @@
 /* Print debugging output based on the format string FORMAT and
    its parameters.  */
 
-static inline void
+static inline void ATTRIBUTE_PRINTF (1,2)
 linux_debug (const char *format, ...)
 {
 #ifdef GDBSERVER


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]