diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b9dc80407d8..a4c4c717dc0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2009-08-25 Douglas B Rupp + + * hwint.h (HOST_LONG_FORMAT): New macro + * bitmap.c, c-decl.c, mips-tfile.c, print-rtl.c, print-tree.c: + Use HOST_PTR_PRINTF. + * system.h (HOST_PTR_PRINTF): Resurrect old macro + * doc/hostconfig.texi (HOST_LONG_FORMAT): Document. + (HOST_PTR_PRINTF): Document. + 2009-08-25 Jan Hubicka * config/i386/bmmintrin.h: Replace by #error. diff --git a/gcc/bitmap.c b/gcc/bitmap.c index deca5e535a9..93c13866b28 100644 --- a/gcc/bitmap.c +++ b/gcc/bitmap.c @@ -2028,14 +2028,16 @@ debug_bitmap_file (FILE *file, const_bitmap head) { const bitmap_element *ptr; - fprintf (file, "\nfirst = %p current = %p indx = %u\n", + fprintf (file, "\nfirst = " HOST_PTR_PRINTF + " current = " HOST_PTR_PRINTF " indx = %u\n", (void *) head->first, (void *) head->current, head->indx); for (ptr = head->first; ptr; ptr = ptr->next) { unsigned int i, j, col = 26; - fprintf (file, "\t%p next = %p prev = %p indx = %u\n\t\tbits = {", + fprintf (file, "\t" HOST_PTR_PRINTF " next = " HOST_PTR_PRINTF + " prev = " HOST_PTR_PRINTF " indx = %u\n\t\tbits = {", (const void*) ptr, (const void*) ptr->next, (const void*) ptr->prev, ptr->indx); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 9940f928ae8..1bc97914f96 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -579,7 +579,7 @@ c_print_identifier (FILE *file, tree node, int indent) { tree rid = ridpointers[C_RID_CODE (node)]; indent_to (file, indent + 4); - fprintf (file, "rid %p \"%s\"", + fprintf (file, "rid " HOST_PTR_PRINTF " \"%s\"", (void *) rid, IDENTIFIER_POINTER (rid)); } } diff --git a/gcc/doc/hostconfig.texi b/gcc/doc/hostconfig.texi index a9b7ca1559b..c02f39bf937 100644 --- a/gcc/doc/hostconfig.texi +++ b/gcc/doc/hostconfig.texi @@ -1,5 +1,6 @@ @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -@c 2000, 2001, 2002, 2003, 2004, 2005, 2008 Free Software Foundation, Inc. +@c 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 +@c Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gccint.texi. @@ -212,6 +213,14 @@ initialization when a compilation driver is being initialized. If defined, the string used to indicate an argument of type @code{long long} to functions like @code{printf}. The default value is @code{"ll"}. + +@item HOST_LONG_FORMAT +If defined, the string used to indicate an argument of type @code{long} +to functions like @code{printf}. The default value is @code{"l"}. + +@item HOST_PTR_PRINTF +If defined, the string used to indicate an argument of type @code{void *} +to functions like @code{printf}. The default value is @code{"%p"}. @end ftable In addition, if @command{configure} generates an incorrect definition of diff --git a/gcc/hwint.h b/gcc/hwint.h index 18085156ac2..32f88062df3 100644 --- a/gcc/hwint.h +++ b/gcc/hwint.h @@ -1,5 +1,5 @@ /* HOST_WIDE_INT definitions for the GNU compiler. - Copyright (C) 1998, 2002, 2004, 2008 Free Software Foundation, Inc. + Copyright (C) 1998, 2002, 2004, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -15,6 +15,12 @@ #define HOST_BITS_PER_INT (CHAR_BIT * SIZEOF_INT) #define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG) +/* The string that should be inserted into a printf style format to + indicate a "long" operand. */ +#ifndef HOST_LONG_FORMAT +#define HOST_LONG_FORMAT "l" +#endif + /* The string that should be inserted into a printf style format to indicate a "long long" operand. */ #ifndef HOST_LONG_LONG_FORMAT @@ -70,14 +76,16 @@ extern char sizeof_long_long_must_be_8[sizeof(long long) == 8 ? 1 : -1]; /* Various printf format strings for HOST_WIDE_INT. */ #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG -# define HOST_WIDE_INT_PRINT "l" +# define HOST_WIDE_INT_PRINT HOST_LONG_FORMAT # define HOST_WIDE_INT_PRINT_C "L" /* 'long' might be 32 or 64 bits, and the number of leading zeroes must be tweaked accordingly. */ # if HOST_BITS_PER_WIDE_INT == 64 -# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%016lx" +# define HOST_WIDE_INT_PRINT_DOUBLE_HEX \ + "0x%" HOST_LONG_FORMAT "x%016" HOST_LONG_FORMAT "x" # else -# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx" +# define HOST_WIDE_INT_PRINT_DOUBLE_HEX \ + "0x%" HOST_LONG_FORMAT "x%08" HOST_LONG_FORMAT "x" # endif #else # define HOST_WIDE_INT_PRINT HOST_LONG_LONG_FORMAT diff --git a/gcc/mips-tfile.c b/gcc/mips-tfile.c index 07d229e672c..dfd630867da 100644 --- a/gcc/mips-tfile.c +++ b/gcc/mips-tfile.c @@ -3993,7 +3993,8 @@ write_varray (varray_t *vp, /* virtual array */ return; if (debug) - fprintf (stderr, "\twarray\tvp = %p, offset = %7lu, size = %7lu, %s\n", + fprintf (stderr, "\twarray\tvp = " HOST_PTR_PRINTF + ", offset = %7lu, size = %7lu, %s\n", (void *) vp, (unsigned long) offset, vp->num_allocated * vp->object_size, str); @@ -4032,7 +4033,8 @@ write_object (void) off_t offset; if (debug) - fprintf (stderr, "\n\twrite\tvp = %p, offset = %7u, size = %7lu, %s\n", + fprintf (stderr, "\n\twrite\tvp = " HOST_PTR_PRINTF + ", offset = %7u, size = %7lu, %s\n", (void *) &symbolic_header, 0, (unsigned long) sizeof (symbolic_header), "symbolic header"); @@ -4062,7 +4064,8 @@ write_object (void) pfatal_with_name (object_name); if (debug) - fprintf (stderr, "\twrite\tvp = %p, offset = %7lu, size = %7lu, %s\n", + fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF + ", offset = %7lu, size = %7lu, %s\n", (void *) &orig_linenum, (long) symbolic_header.cbLineOffset, (long) symbolic_header.cbLine, "Line numbers"); @@ -4093,7 +4096,8 @@ write_object (void) pfatal_with_name (object_name); if (debug) - fprintf (stderr, "\twrite\tvp = %p, offset = %7lu, size = %7lu, %s\n", + fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF + ", offset = %7lu, size = %7lu, %s\n", (void *) &orig_opt_syms, (long) symbolic_header.cbOptOffset, num_write, "Optimizer symbols"); @@ -4181,7 +4185,8 @@ write_object (void) file_ptr = file_ptr->next_file) { if (debug) - fprintf (stderr, "\twrite\tvp = %p, offset = %7lu, size = %7lu, %s\n", + fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF + ", offset = %7lu, size = %7lu, %s\n", (void *) &file_ptr->fdr, file_offset, (unsigned long) sizeof (FDR), "File header"); @@ -4213,7 +4218,8 @@ write_object (void) pfatal_with_name (object_name); if (debug) - fprintf (stderr, "\twrite\tvp = %p, offset = %7lu, size = %7lu, %s\n", + fprintf (stderr, "\twrite\tvp = " HOST_PTR_PRINTF + ", offset = %7lu, size = %7lu, %s\n", (void *) &orig_rfds, (long) symbolic_header.cbRfdOffset, num_write, "Relative file descriptors"); @@ -5006,7 +5012,7 @@ allocate_cluster (Size_t npages) pfatal_with_name ("allocate_cluster"); if (debug > 3) - fprintf (stderr, "\talloc\tnpages = %lu, value = %p\n", + fprintf (stderr, "\talloc\tnpages = %lu, value = " HOST_PTR_PRINTF "\n", (unsigned long) npages, (void *) ptr); return ptr; diff --git a/gcc/print-tree.c b/gcc/print-tree.c index 28235c5e57d..26f467cba8e 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -1,6 +1,7 @@ /* Prints out tree in human readable form - GCC Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Free Software Foundation, Inc. This file is part of GCC. @@ -66,7 +67,7 @@ dump_addr (FILE *file, const char *prefix, const void *addr) if (flag_dump_noaddr || flag_dump_unnumbered) fprintf (file, "%s#", prefix); else - fprintf (file, "%s%p", prefix, addr); + fprintf (file, "%s" HOST_PTR_PRINTF, prefix, addr); } /* Print a node in brief fashion, with just the code, address and name. */ diff --git a/gcc/system.h b/gcc/system.h index f73097a035d..b74e0e5df2f 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -518,6 +518,11 @@ extern int vsnprintf(char *, size_t, const char *, va_list); # define mkdir(a,b) mkdir(a) #endif +/* Provide a way to print an address via printf. */ +#ifndef HOST_PTR_PRINTF +#define HOST_PTR_PRINTF "%p" +#endif /* ! HOST_PTR_PRINTF */ + /* By default, colon separates directories in a path. */ #ifndef PATH_SEPARATOR #define PATH_SEPARATOR ':' @@ -742,7 +747,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; TARGET_ESC TARGET_FF TARGET_NEWLINE TARGET_TAB TARGET_VT \ LINK_LIBGCC_SPECIAL DONT_ACCESS_GBLS_AFTER_EPILOGUE \ TARGET_OPTIONS TARGET_SWITCHES EXTRA_CC_MODES FINALIZE_PIC \ - PREDICATE_CODES SPECIAL_MODE_PREDICATES HOST_PTR_PRINTF \ + PREDICATE_CODES SPECIAL_MODE_PREDICATES \ EXTRA_SECTIONS EXTRA_SECTION_FUNCTIONS READONLY_DATA_SECTION \ TARGET_ASM_EXCEPTION_SECTION TARGET_ASM_EH_FRAME_SECTION \ SMALL_ARG_MAX ASM_OUTPUT_SHARED_BSS ASM_OUTPUT_SHARED_COMMON \