This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Avoid -Wformat-security in in output_die
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>, Cary Coutant <ccoutant at google dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 12 Feb 2015 16:03:36 +0100
- Subject: [PATCH] Avoid -Wformat-security in in output_die
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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