This is the mail archive of the gcc-patches@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]

Don't pass HOST_WIDE_INT_PRINT_DEC to pp_printf


pp_printf takes a GCC-internal format.  Two places in
tree-pretty-print.c pass it HOST_WIDE_INT_PRINT_DEC, which is a host
printf format instead; pp_printf should be given %wd, which it will
translate internally into HOST_WIDE_INT_PRINT_DEC to call the host
printf, and not HOST_WIDE_INT_PRINT_DEC, which it may not be able to
understand (in particular on Windows hosts where it's %I64d).

This patch corrects the formats; in turn, tree-pretty-print.c needs to
include output.h so that __gcc_host_wide_int__ is defined for the
format checking so these formats can be checked correctly.

Bootstrapped with no regressions on i686-pc-linux-gnu.  OK to commit?

2007-08-31  Joseph Myers  <joseph@codesourcery.com>

	* tree-pretty-print.c: Include output.h.
	(dump_decl_name, dump_generic_node): Use %wd with pp_printf, not
	HOST_WIDE_INT_PRINT_DEC.
	* Makefile.in (tree-pretty-print.o): Add dependency on output.h.

Index: tree-pretty-print.c
===================================================================
--- tree-pretty-print.c	(revision 127964)
+++ tree-pretty-print.c	(working copy)
@@ -24,6 +24,7 @@
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
+#include "output.h"
 #include "diagnostic.h"
 #include "real.h"
 #include "hashtab.h"
@@ -178,7 +179,7 @@
     {
       if (TREE_CODE (t) == LABEL_DECL
           && LABEL_DECL_UID (t) != -1)
-        pp_printf (buffer, "L." HOST_WIDE_INT_PRINT_DEC,
+        pp_printf (buffer, "L.%wd",
 		   LABEL_DECL_UID (t));
       else
 	{
@@ -860,7 +861,7 @@
       if (DECL_NAME (node))
 	dump_decl_name (buffer, node, flags);
       else if (LABEL_DECL_UID (node) != -1)
-        pp_printf (buffer, "<L" HOST_WIDE_INT_PRINT_DEC ">",
+        pp_printf (buffer, "<L%wd>",
 		   LABEL_DECL_UID (node));
       else
         pp_printf (buffer, "<D.%u>", DECL_UID (node));
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 127964)
+++ Makefile.in	(working copy)
@@ -2291,7 +2291,7 @@
 tree-pretty-print.o : tree-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \
    $(TREE_H) $(DIAGNOSTIC_H) $(REAL_H) $(HASHTAB_H) $(TREE_FLOW_H) \
    $(TM_H) coretypes.h tree-iterator.h tree-chrec.h langhooks.h tree-pass.h \
-   value-prof.h fixed-value.h
+   value-prof.h fixed-value.h output.h
 fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(TREE_H) $(FLAGS_H) $(REAL_H) toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) \
    $(GGC_H) $(TM_P_H) langhooks.h $(MD5_H) intl.h fixed-value.h

-- 
Joseph S. Myers
joseph@codesourcery.com


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