This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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]

[PATCH] gcc/dwarf2asm.c: Add static_output_delta() with var_list for dw2_asm_output_delta()


dw2_asm_output_vms_delta() calls dw2_asm_output_delta() in an abnormal
way, so need add a new function just like vprintf() for printf(), and
then the related call will be in normal way.

The related warning:

  ../../gcc/gcc/dwarf2asm.c: In function ‘void dw2_asm_output_vms_delta(int, const char*, const char*, const char*, ...)’:
  ../../gcc/gcc/dwarf2asm.c:167:50: warning: format not a string literal and no format arguments [-Wformat-security]


Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 gcc/ChangeLog   |  6 ++++++
 gcc/dwarf2asm.c | 23 +++++++++++++++--------
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index edb3fc0..0e1df0e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-14  Chen Gang <gang.chen.5i5j@gmail.com>
+
+	* dwarf2asm.c (dw2_asm_output_delta): Add static_output_delta() for
+	dw2_asm_output_delta(), just like vprintf() for printf(), so that
+	dw2_asm_output_vms_delta() can use it in normal way.
+
 2014-06-13  Vladimir Makarov  <vmakarov@redhat.com>
 
 	* lra-assign.c (assign_by_spills): Add code to assign vector regs
diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index 1372b23..69733b3 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -123,14 +123,10 @@ dw2_asm_output_data (int size, unsigned HOST_WIDE_INT value,
    impossible to do here, since the ASM_SET_OP for the difference
    symbol must appear after both symbols are defined.  */
 
-void
-dw2_asm_output_delta (int size, const char *lab1, const char *lab2,
-		      const char *comment, ...)
+static void
+static_output_delta (int size, const char *lab1, const char *lab2,
+		      const char *comment, va_list ap)
 {
-  va_list ap;
-
-  va_start (ap, comment);
-
 #ifdef ASM_OUTPUT_DWARF_DELTA
   ASM_OUTPUT_DWARF_DELTA (asm_out_file, size, lab1, lab2);
 #else
@@ -145,7 +141,18 @@ dw2_asm_output_delta (int size, const char *lab1, const char *lab2,
       vfprintf (asm_out_file, comment, ap);
     }
   fputc ('\n', asm_out_file);
+}
+
 
+
+void
+dw2_asm_output_delta (int size, const char *lab1, const char *lab2,
+		      const char *comment, ...)
+{
+  va_list ap;
+
+  va_start (ap, comment);
+  static_output_delta(size, lab1, lab2, comment, ap);
   va_end (ap);
 }
 
@@ -164,7 +171,7 @@ dw2_asm_output_vms_delta (int size ATTRIBUTE_UNUSED,
 #ifndef ASM_OUTPUT_DWARF_VMS_DELTA
   /* VMS Delta is only special on ia64-vms, but this function also gets
      called on alpha-vms so it has to do something sane.  */
-  dw2_asm_output_delta (size, lab1, lab2, comment);
+  static_output_delta (size, lab1, lab2, comment, ap);
 #else
   ASM_OUTPUT_DWARF_VMS_DELTA (asm_out_file, size, lab1, lab2);
   if (flag_debug_asm && comment)
-- 
1.9.2.459.g68773ac


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