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] common-utils-selftests.c: Add ATTRIBUTE_PRINTF


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

commit b5540b5f2b9cd5fcbac6504359b856d3f43267b5
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Fri Oct 27 23:36:19 2017 -0400

    common-utils-selftests.c: Add ATTRIBUTE_PRINTF
    
    Fix this, when building with clang:
    
    /home/emaisin/src/binutils-gdb/gdb/unittests/common-utils-selftests.c:50:40: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
      std::string result = string_vprintf (fmt, vp);
                                           ^~~
    gdb/ChangeLog:
    
    	* unittests/common-utils-selftests.c (format): Add
    	ATTRIBUTE_PRINTF.

Diff:
---
 gdb/ChangeLog                          | 5 +++++
 gdb/unittests/common-utils-selftests.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 51e3422..9fe6329 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2017-10-27  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* unittests/common-utils-selftests.c (format): Add
+	ATTRIBUTE_PRINTF.
+
 2017-10-27  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* xml-syscall.c (struct syscall_desc): Add constructor.
diff --git a/gdb/unittests/common-utils-selftests.c b/gdb/unittests/common-utils-selftests.c
index 0f26b21..c48904b 100644
--- a/gdb/unittests/common-utils-selftests.c
+++ b/gdb/unittests/common-utils-selftests.c
@@ -41,7 +41,7 @@ string_printf_tests ()
   SELF_CHECK (string_printf ("%s", X100000) == X100000);
 }
 
-static std::string
+static std::string ATTRIBUTE_PRINTF (1, 2)
 format (const char *fmt, ...)
 {
   va_list vp;


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