aboutsummaryrefslogtreecommitdiff
path: root/gcc/machmode.h
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1996-11-15 14:13:36 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1996-11-15 14:13:36 -0500
commit29cad4a46caadcd54bb746298a392adeef958571 (patch)
tree5c897371a6772598c31ce6b328785b2eb9d812c2 /gcc/machmode.h
parent395d53bb1eac6db23ec2e182ba53f1314fe9dfcf (diff)
downloadgcc-29cad4a46caadcd54bb746298a392adeef958571.zip
gcc-29cad4a46caadcd54bb746298a392adeef958571.tar.gz
gcc-29cad4a46caadcd54bb746298a392adeef958571.tar.bz2
(HOST_PTR_PRINTF): Handle char * wider than long.
(HOST_WIDE_INT_PRINT_{DEC,UNSIGNED,HEX,DOUBLE_HEX}): New macros. From-SVN: r13173
Diffstat (limited to 'gcc/machmode.h')
-rw-r--r--gcc/machmode.h67
1 files changed, 66 insertions, 1 deletions
diff --git a/gcc/machmode.h b/gcc/machmode.h
index 927e29d..f1f146f 100644
--- a/gcc/machmode.h
+++ b/gcc/machmode.h
@@ -53,7 +53,72 @@ Boston, MA 02111-1307, USA. */
/* Provide a default way to print an address in hex via printf. */
#ifndef HOST_PTR_PRINTF
-#define HOST_PTR_PRINTF sizeof (int) == sizeof (char *) ? "%x" : "%lx"
+#define HOST_PTR_PRINTF \
+ (sizeof (int) == sizeof (char *) ? "%x" \
+ : sizeof (long) == sizeof (char *) ? "%lx" : "%llx")
+#endif
+
+/* Provide defaults for the way to print a HOST_WIDE_INT
+ in various manners. */
+
+#ifndef HOST_WIDE_INT_PRINT_DEC
+#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+#define HOST_WIDE_INT_PRINT_DEC "%d"
+#else
+#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+#define HOST_WIDE_INT_PRINT_DEC "%ld"
+#else
+#define HOST_WIDE_INT_PRINT_DEC "%lld"
+#endif
+#endif
+#endif
+
+#ifndef HOST_WIDE_INT_PRINT_UNSIGNED
+#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+#define HOST_WIDE_INT_PRINT_UNSIGNED "%u"
+#else
+#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+#define HOST_WIDE_INT_PRINT_UNSIGNED "%lu"
+#else
+#define HOST_WIDE_INT_PRINT_UNSIGNED "%llu"
+#endif
+#endif
+#endif
+
+#ifndef HOST_WIDE_INT_PRINT_HEX
+#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+#define HOST_WIDE_INT_PRINT_HEX "0x%x"
+#else
+#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+#define HOST_WIDE_INT_PRINT_HEX "0x%lx"
+#else
+#define HOST_WIDE_INT_PRINT_HEX "0x%llx"
+#endif
+#endif
+#endif
+
+#ifndef HOST_WIDE_INT_PRINT_DOUBLE_HEX
+#if HOST_BITS_PER_WIDE_INT == 64
+#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%016x"
+#else
+#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%016lx"
+#else
+#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx"
+#endif
+#endif
+#else
+#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%08x"
+#else
+#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx"
+#else
+#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%08llx"
+#endif
+#endif
+#endif
#endif
/* Make an enum class that gives all the machine modes. */