public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] gdbsupport: add format attribute to print_xml_feature::add_line
@ 2020-06-27 18:40 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2020-06-27 18:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@efficios.com>

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 | 5 +++++
 gdbsupport/tdesc.h   | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog
index b2fbc56b1b95..4db482b15196 100644
--- a/gdbsupport/ChangeLog
+++ b/gdbsupport/ChangeLog
@@ -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
diff --git a/gdbsupport/tdesc.h b/gdbsupport/tdesc.h
index 73caf24536f3..456e8e070b12 100644
--- a/gdbsupport/tdesc.h
+++ b/gdbsupport/tdesc.h
@@ -438,7 +438,7 @@ class print_xml_feature : public tdesc_element_visitor
      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;
-- 
2.27.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-27 18:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27 18:40 [pushed] gdbsupport: add format attribute to print_xml_feature::add_line Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).