diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1996-11-15 14:13:36 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1996-11-15 14:13:36 -0500 |
commit | 29cad4a46caadcd54bb746298a392adeef958571 (patch) | |
tree | 5c897371a6772598c31ce6b328785b2eb9d812c2 /gcc/machmode.h | |
parent | 395d53bb1eac6db23ec2e182ba53f1314fe9dfcf (diff) | |
download | gcc-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.h | 67 |
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. */ |