]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdbsupport: add format attribute to print_xml_feature::add_line
authorSimon Marchi <simon.marchi@efficios.com>
Sat, 27 Jun 2020 18:38:43 +0000 (14:38 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Sat, 27 Jun 2020 18:39:00 +0000 (14:39 -0400)
Fixes this clang error:

      CXX      tdesc.o
    /home/smarchi/src/binutils-gdb/gdbsupport/tdesc.cc:444:25: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
      string_vappendf (tmp, fmt, ap);
                            ^~~

There is already a but about GCC not emitting this warning:

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

gdbsupport/ChangeLog:

* tdesc.h (class print_xml_feature) <add_line>: Add
ATTRIBUTE_PRINTF.

Change-Id: I7014075e83717f6d7e19d044a3675ff9981ebe17

gdbsupport/ChangeLog
gdbsupport/tdesc.h

index b2fbc56b1b9509ee0ef2cb253484f19a665f5b92..4db482b151961de04f69fd2d2cd7cb1103d79ff8 100644 (file)
@@ -1,3 +1,8 @@
+2020-06-27  Simon Marchi  <simon.marchi@efficios.com>
+
+       * tdesc.h (class print_xml_feature) <add_line>: Add
+       ATTRIBUTE_PRINTF.
+
 2020-06-23  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * tdesc.cc (print_xml_feature::visit_pre): Use add_line to add
index 73caf24536f38043d374832f727171d87d559768..456e8e070b1230dc030cb90ed7cf68fcb5cba690 100644 (file)
@@ -438,7 +438,7 @@ private:
      functions appends a newline, so don't include one in the strings being
      passed.  */
   void add_line (const std::string &str);
-  void add_line (const char *fmt, ...);
+  void add_line (const char *fmt, ...) ATTRIBUTE_PRINTF (2, 3);
 
   /* The buffer we are writing too.  */
   std::string *m_buffer;