aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas B Rupp <rupp@gnat.com>2009-08-25 23:19:16 +0000
committerDouglas Rupp <rupp@gcc.gnu.org>2009-08-25 23:19:16 +0000
commitedb890249f17668ad09ad13f14198d4a2b307413 (patch)
tree2e0d6e06ebfd77fe4e8485508cb0f70215fbb4aa
parentff22013ab297213bbd9a5df1badb767f896a71ec (diff)
downloadgcc-edb890249f17668ad09ad13f14198d4a2b307413.zip
gcc-edb890249f17668ad09ad13f14198d4a2b307413.tar.gz
gcc-edb890249f17668ad09ad13f14198d4a2b307413.tar.bz2
hwint.h (HOST_LONG_FORMAT): New macro
* 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. From-SVN: r151108
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/bitmap.c6
-rw-r--r--gcc/c-decl.c2
-rw-r--r--gcc/doc/hostconfig.texi11
-rw-r--r--gcc/hwint.h16
-rw-r--r--gcc/mips-tfile.c20
-rw-r--r--gcc/print-tree.c5
-rw-r--r--gcc/system.h7
8 files changed, 58 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b9dc804..a4c4c71 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2009-08-25 Douglas B Rupp <rupp@gnat.com>
+
+ * 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 <jh@suse.cz>
* config/i386/bmmintrin.h: Replace by #error.
diff --git a/gcc/bitmap.c b/gcc/bitmap.c
index deca5e5..93c1386 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 9940f92..1bc9791 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 a9b7ca1..c02f39b 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 1808515..32f8806 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.
@@ -16,6 +16,12 @@
#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
#define HOST_LONG_LONG_FORMAT "ll"
@@ -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 07d229e..dfd6308 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 28235c5..26f467c 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 f73097a..b74e0e5 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 \