aboutsummaryrefslogtreecommitdiff
path: root/gcc/hwint.h
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-06-04 12:35:26 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-06-04 12:35:26 +0000
commit35987ae95da833242def2e32fcc24100c20ef4b5 (patch)
tree4a55929af84e7326cea76394ff68cffedc557108 /gcc/hwint.h
parent0ea48022b83f9f960724dab8fd75a4dc9d6e2269 (diff)
downloadgcc-35987ae95da833242def2e32fcc24100c20ef4b5.zip
gcc-35987ae95da833242def2e32fcc24100c20ef4b5.tar.gz
gcc-35987ae95da833242def2e32fcc24100c20ef4b5.tar.bz2
configure.ac: Check whether the underlying type of int64_t is long or long long.
2014-06-04 Richard Biener <rguenther@suse.de> * configure.ac: Check whether the underlying type of int64_t is long or long long. * configure: Regenerate. * config.in: Likewise. * hwint.h (HOST_WIDE_INT): Match the underlying type of int64_t. (HOST_WIDE_INT_PRINT_*): Define in terms of PRI*64. From-SVN: r211228
Diffstat (limited to 'gcc/hwint.h')
-rw-r--r--gcc/hwint.h69
1 files changed, 32 insertions, 37 deletions
diff --git a/gcc/hwint.h b/gcc/hwint.h
index e3b8a8aa..fd961fd 100644
--- a/gcc/hwint.h
+++ b/gcc/hwint.h
@@ -46,13 +46,11 @@ extern char sizeof_long_long_must_be_8[sizeof (long long) == 8 ? 1 : -1];
#endif
/* Set HOST_WIDE_INT, this should be always 64 bits.
-
- With a sane ABI, 'long' is the largest efficient host integer type.
- Thus, we use that unless we have to use 'long long'
- because we're on a 32-bit host. */
+ The underlying type is matched to that of int64_t and assumed
+ to be either long or long long. */
#define HOST_BITS_PER_WIDE_INT 64
-#if HOST_BITS_PER_LONG == 64
+#if INT64_T_IS_LONG
# define HOST_WIDE_INT long
# define HOST_WIDE_INT_C(X) X ## L
#else
@@ -75,48 +73,45 @@ extern char sizeof_long_long_must_be_8[sizeof (long long) == 8 ? 1 : -1];
typedef before using the __asm_fprintf__ format attribute. */
typedef HOST_WIDE_INT __gcc_host_wide_int__;
-/* Various printf format strings for HOST_WIDE_INT. */
-
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
-# define HOST_WIDE_INT_PRINT HOST_LONG_FORMAT
-# define HOST_WIDE_INT_PRINT_C "L"
- /* HOST_BITS_PER_WIDE_INT is 64 bits. */
-# define HOST_WIDE_INT_PRINT_DOUBLE_HEX \
- "0x%" HOST_LONG_FORMAT "x%016" HOST_LONG_FORMAT "x"
-# define HOST_WIDE_INT_PRINT_PADDED_HEX \
- "%016" HOST_LONG_FORMAT "x"
-#else
-# define HOST_WIDE_INT_PRINT HOST_LONG_LONG_FORMAT
-# define HOST_WIDE_INT_PRINT_C "LL"
- /* HOST_BITS_PER_WIDE_INT is 64 bits. */
-# define HOST_WIDE_INT_PRINT_DOUBLE_HEX \
- "0x%" HOST_LONG_LONG_FORMAT "x%016" HOST_LONG_LONG_FORMAT "x"
-# define HOST_WIDE_INT_PRINT_PADDED_HEX \
- "%016" HOST_LONG_LONG_FORMAT "x"
-#endif /* HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG */
-
-#define HOST_WIDE_INT_PRINT_DEC "%" HOST_WIDE_INT_PRINT "d"
-#define HOST_WIDE_INT_PRINT_DEC_C HOST_WIDE_INT_PRINT_DEC HOST_WIDE_INT_PRINT_C
-#define HOST_WIDE_INT_PRINT_UNSIGNED "%" HOST_WIDE_INT_PRINT "u"
-#define HOST_WIDE_INT_PRINT_HEX "%#" HOST_WIDE_INT_PRINT "x"
-#define HOST_WIDE_INT_PRINT_HEX_PURE "%" HOST_WIDE_INT_PRINT "x"
-
/* Provide C99 <inttypes.h> style format definitions for 64bits. */
#ifndef HAVE_INTTYPES_H
+#if INT64_T_IS_LONG
+# define GCC_PRI64 HOST_LONG_FORMAT
+#else
+# define GCC_PRI64 HOST_LONG_LONG_FORMAT
+#endif
#undef PRId64
-#define PRId64 HOST_WIDE_INT_PRINT "d"
+#define PRId64 GCC_PRI64 "d"
#undef PRIi64
-#define PRIi64 HOST_WIDE_INT_PRINT "i"
+#define PRIi64 GCC_PRI64 "i"
#undef PRIo64
-#define PRIo64 HOST_WIDE_INT_PRINT "o"
+#define PRIo64 GCC_PRI64 "o"
#undef PRIu64
-#define PRIu64 HOST_WIDE_INT_PRINT "u"
+#define PRIu64 GCC_PRI64 "u"
#undef PRIx64
-#define PRIx64 HOST_WIDE_INT_PRINT "x"
+#define PRIx64 GCC_PRI64 "x"
#undef PRIX64
-#define PRIX64 HOST_WIDE_INT_PRINT "X"
+#define PRIX64 GCC_PRI64 "X"
#endif
+/* Various printf format strings for HOST_WIDE_INT. */
+
+#if INT64_T_IS_LONG
+# define HOST_WIDE_INT_PRINT HOST_LONG_FORMAT
+# define HOST_WIDE_INT_PRINT_C "L"
+#else
+# define HOST_WIDE_INT_PRINT HOST_LONG_LONG_FORMAT
+# define HOST_WIDE_INT_PRINT_C "LL"
+#endif
+
+#define HOST_WIDE_INT_PRINT_DEC "%" PRId64
+#define HOST_WIDE_INT_PRINT_DEC_C "%" PRId64 HOST_WIDE_INT_PRINT_C
+#define HOST_WIDE_INT_PRINT_UNSIGNED "%" PRIu64
+#define HOST_WIDE_INT_PRINT_HEX "%#" PRIx64
+#define HOST_WIDE_INT_PRINT_HEX_PURE "%" PRIx64
+#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%" PRIx64 "%016" PRIx64
+#define HOST_WIDE_INT_PRINT_PADDED_HEX "%016" PRIx64
+
/* Define HOST_WIDEST_FAST_INT to the widest integer type supported
efficiently in hardware. (That is, the widest integer type that fits
in a hardware register.) Normally this is "long" but on some hosts it