Patch [3.4/3.3] G++ cast argument of %p format specifier
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Thu Apr 3 05:42:00 GMT 2003
Patch fixes:
> 8 ??? format, ??? arg (arg ???)
It's just casts to silence -pedantic since %p is only guaranteed with
void* I guess. Same as we do elsewhere for HOST_PTR_PRINTF.
Tested on solaris2.7, no regressions.
Ok for mainline and 3.3?
2003-04-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* decl.c (print_binding_level, print_other_binding_stack,
print_binding_stack): Cast argument of %p specifier to void*.
* ptree.c (cxx_print_decl): Likewise.
diff -rup orig/egcc-CVS20030331/gcc/cp/decl.c egcc-CVS20030331/gcc/cp/decl.c
--- orig/egcc-CVS20030331/gcc/cp/decl.c 2003-03-30 21:01:24.000000000 -0500
+++ egcc-CVS20030331/gcc/cp/decl.c 2003-04-01 18:49:10.226929000 -0500
@@ -1860,7 +1868,7 @@ print_binding_level (struct cp_binding_l
tree t;
int i = 0, len;
fprintf (stderr, " blocks=");
- fprintf (stderr, HOST_PTR_PRINTF, lvl->blocks);
+ fprintf (stderr, HOST_PTR_PRINTF, (void *) lvl->blocks);
if (lvl->tag_transparent)
fprintf (stderr, " tag-transparent");
if (lvl->more_cleanups_ok)
@@ -1961,7 +1969,7 @@ print_other_binding_stack (struct cp_bin
for (level = stack; level != global_binding_level; level = level->level_chain)
{
fprintf (stderr, "binding level ");
- fprintf (stderr, HOST_PTR_PRINTF, level);
+ fprintf (stderr, HOST_PTR_PRINTF, (void *) level);
fprintf (stderr, "\n");
print_binding_level (level);
}
@@ -1972,11 +1980,11 @@ print_binding_stack (void)
{
struct cp_binding_level *b;
fprintf (stderr, "current_binding_level=");
- fprintf (stderr, HOST_PTR_PRINTF, current_binding_level);
+ fprintf (stderr, HOST_PTR_PRINTF, (void *) current_binding_level);
fprintf (stderr, "\nclass_binding_level=");
- fprintf (stderr, HOST_PTR_PRINTF, class_binding_level);
+ fprintf (stderr, HOST_PTR_PRINTF, (void *) class_binding_level);
fprintf (stderr, "\nglobal_binding_level=");
- fprintf (stderr, HOST_PTR_PRINTF, global_binding_level);
+ fprintf (stderr, HOST_PTR_PRINTF, (void *) global_binding_level);
fprintf (stderr, "\n");
if (class_binding_level)
{
diff -rup orig/egcc-CVS20030331/gcc/cp/ptree.c egcc-CVS20030331/gcc/cp/ptree.c
--- orig/egcc-CVS20030331/gcc/cp/ptree.c 2003-03-16 01:04:24.000000000 -0500
+++ egcc-CVS20030331/gcc/cp/ptree.c 2003-04-01 18:31:46.382109000 -0500
@@ -48,19 +48,19 @@ cxx_print_decl (FILE *file, tree node, i
&& DECL_PENDING_INLINE_INFO (node))
{
fprintf (file, " pending-inline-info ");
- fprintf (file, HOST_PTR_PRINTF, DECL_PENDING_INLINE_INFO (node));
+ fprintf (file, HOST_PTR_PRINTF, (void *) DECL_PENDING_INLINE_INFO (node));
}
if (TREE_CODE (node) == TYPE_DECL
&& DECL_SORTED_FIELDS (node))
{
fprintf (file, " sorted-fields ");
- fprintf (file, HOST_PTR_PRINTF, DECL_SORTED_FIELDS (node));
+ fprintf (file, HOST_PTR_PRINTF, (void *) DECL_SORTED_FIELDS (node));
}
if ((TREE_CODE (node) == FUNCTION_DECL || TREE_CODE (node) == VAR_DECL)
&& DECL_TEMPLATE_INFO (node))
{
fprintf (file, " template-info ");
- fprintf (file, HOST_PTR_PRINTF, DECL_TEMPLATE_INFO (node));
+ fprintf (file, HOST_PTR_PRINTF, (void *) DECL_TEMPLATE_INFO (node));
}
}
More information about the Gcc-patches
mailing list