public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Avoid -Wformat-security in in output_die
@ 2015-02-12 15:03 Jakub Jelinek
  2015-02-12 15:41 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2015-02-12 15:03 UTC (permalink / raw)
  To: Jason Merrill, Cary Coutant; +Cc: gcc-patches

Hi!

While name will not contain any % characters, because it is what
dwarf_attr_name returns and there aren't attribute names with % in them,
all other spots that call dw2_asm_output_data use "%s", name instead of
name, so I think we should do the same here.

Ok for trunk if testing succeeds?

2015-02-12  Jakub Jelinek  <jakub@redhat.com>

	* dwarf2out.c (output_die): Use "%s", name instead of name to
	avoid -Wformat-security warning.

--- gcc/dwarf2out.c.jj	2015-02-12 15:41:59.000000000 +0100
+++ gcc/dwarf2out.c	2015-02-12 15:43:32.793119058 +0100
@@ -8897,14 +8897,14 @@ output_die (dw_die_ref die)
 	      for (i = len - 1; i >= 0; --i)
 		{
 		  dw2_asm_output_data (l, a->dw_attr_val.v.val_wide->elt (i),
-				       name);
+				       "%s", name);
 		  name = NULL;
 		}
 	    else
 	      for (i = 0; i < len; ++i)
 		{
 		  dw2_asm_output_data (l, a->dw_attr_val.v.val_wide->elt (i),
-				       name);
+				       "%s", name);
 		  name = NULL;
 		}
 	  }

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Avoid -Wformat-security in in output_die
  2015-02-12 15:03 [PATCH] Avoid -Wformat-security in in output_die Jakub Jelinek
@ 2015-02-12 15:41 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2015-02-12 15:41 UTC (permalink / raw)
  To: Jakub Jelinek, Cary Coutant; +Cc: gcc-patches

OK.

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-12 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-12 15:03 [PATCH] Avoid -Wformat-security in in output_die Jakub Jelinek
2015-02-12 15:41 ` Jason Merrill

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).