This is the last "cleanup" bit. Remaining is getting rid of HOST_WIDE_INT in favor of [u]int64_t and adjusting interfaces and interface names. That's too disruptive at the moment (thus appropriate for a delay until 4.9.1 is out) and I'm not sure if we want to split that work or if such splitting is even possible sensibly. For example wide-int should get its own "abstraction" of its storage type (which could be simply [u]int64_t - the actual compute routines can happily split a [u]int64_t into two pieces again if that is desirable on some architectures - I suspect GCC is good enough in optimizing the "two" element case inline for them).
This moves the relatively new HALF_WIDE_INT stuff to its only user, wide-int.cc, and uses the PRI*64 stuff in the HOST_WIDE_INT_PRINT macros. Bootstrap / testing in progress on x86_64-unknown-linux-gnu. Richard. 2014-05-26 Richard Biener <rguent...@suse.de> * hwint.h (*_HALF_WIDE_INT*): Move to ... * wide-int.cc (HOST_BITS_PER_HALF_WIDE_INT, HOST_HALF_WIDE_INT): ... here and remove the rest. * hwint.h (HOST_WIDE_INT_PRINT_*): Define in terms of PRI*64. Index: gcc/hwint.h =================================================================== *** gcc/hwint.h.orig 2014-05-26 10:49:23.009339524 +0200 --- gcc/hwint.h 2014-05-26 11:09:43.597255488 +0200 *************** extern char sizeof_long_long_must_be_8[s *** 64,103 **** # endif #endif - /* Print support for half a host wide int. */ - #define HOST_BITS_PER_HALF_WIDE_INT 32 - #if HOST_BITS_PER_HALF_WIDE_INT == HOST_BITS_PER_LONG - # define HOST_HALF_WIDE_INT long - # define HOST_HALF_WIDE_INT_PRINT HOST_LONG_FORMAT - # define HOST_HALF_WIDE_INT_PRINT_C "L" - # define HOST_HALF_WIDE_INT_PRINT_DEC "%" HOST_HALF_WIDE_INT_PRINT "d" - # define HOST_HALF_WIDE_INT_PRINT_DEC_C HOST_HALF_WIDE_INT_PRINT_DEC HOST_HALF_WIDE_INT_PRINT_C - # define HOST_HALF_WIDE_INT_PRINT_UNSIGNED "%" HOST_HALF_WIDE_INT_PRINT "u" - # define HOST_HALF_WIDE_INT_PRINT_HEX "%#" HOST_HALF_WIDE_INT_PRINT "x" - # define HOST_HALF_WIDE_INT_PRINT_HEX_PURE "%" HOST_HALF_WIDE_INT_PRINT "x" - #elif HOST_BITS_PER_HALF_WIDE_INT == HOST_BITS_PER_INT - # define HOST_HALF_WIDE_INT int - # define HOST_HALF_WIDE_INT_PRINT "" - # define HOST_HALF_WIDE_INT_PRINT_C "" - # define HOST_HALF_WIDE_INT_PRINT_DEC "%" HOST_HALF_WIDE_INT_PRINT "d" - # define HOST_HALF_WIDE_INT_PRINT_DEC_C HOST_HALF_WIDE_INT_PRINT_DEC HOST_HALF_WIDE_INT_PRINT_C - # define HOST_HALF_WIDE_INT_PRINT_UNSIGNED "%" HOST_HALF_WIDE_INT_PRINT "u" - # define HOST_HALF_WIDE_INT_PRINT_HEX "%#" HOST_HALF_WIDE_INT_PRINT "x" - # define HOST_HALF_WIDE_INT_PRINT_HEX_PURE "%" HOST_HALF_WIDE_INT_PRINT "x" - #elif HOST_BITS_PER_HALF_WIDE_INT == HOST_BITS_PER_SHORT - # define HOST_HALF_WIDE_INT short - # define HOST_HALF_WIDE_INT_PRINT "" - # define HOST_HALF_WIDE_INT_PRINT_C "" - # define HOST_HALF_WIDE_INT_PRINT_DEC "%" HOST_HALF_WIDE_INT_PRINT "d" - # define HOST_HALF_WIDE_INT_PRINT_DEC_C HOST_HALF_WIDE_INT_PRINT_DEC HOST_HALF_WIDE_INT_PRINT_C - # define HOST_HALF_WIDE_INT_PRINT_UNSIGNED "%" HOST_HALF_WIDE_INT_PRINT "u" - # define HOST_HALF_WIDE_INT_PRINT_HEX "%#" HOST_HALF_WIDE_INT_PRINT "x" - # define HOST_HALF_WIDE_INT_PRINT_HEX_PURE "%" HOST_HALF_WIDE_INT_PRINT "x" - #else - #error Please add support for HOST_HALF_WIDE_INT - #endif - - #define HOST_WIDE_INT_UC(X) HOST_WIDE_INT_C (X ## U) #define HOST_WIDE_INT_1 HOST_WIDE_INT_C (1) #define HOST_WIDE_INT_1U HOST_WIDE_INT_UC (1) --- 64,69 ---- *************** extern char sizeof_long_long_must_be_8[s *** 109,156 **** 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 #undef PRId64 ! #define PRId64 HOST_WIDE_INT_PRINT "d" #undef PRIi64 ! #define PRIi64 HOST_WIDE_INT_PRINT "i" #undef PRIo64 ! #define PRIo64 HOST_WIDE_INT_PRINT "o" #undef PRIu64 ! #define PRIu64 HOST_WIDE_INT_PRINT "u" #undef PRIx64 ! #define PRIx64 HOST_WIDE_INT_PRINT "x" #undef PRIX64 ! #define PRIX64 HOST_WIDE_INT_PRINT "X" #endif /* 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 --- 75,119 ---- typedef before using the __asm_fprintf__ format attribute. */ typedef HOST_WIDE_INT __gcc_host_wide_int__; /* Provide C99 <inttypes.h> style format definitions for 64bits. */ #ifndef HAVE_INTTYPES_H + #if HOST_BITS_PER_LONG == 64 + # define GCC_PRI64 HOST_LONG_FORMAT + #else + # define GCC_PRI64 HOST_LONG_LONG_FORMAT + #endif #undef PRId64 ! #define PRId64 GCC_PRI64 "d" #undef PRIi64 ! #define PRIi64 GCC_PRI64 "i" #undef PRIo64 ! #define PRIo64 GCC_PRI64 "o" #undef PRIu64 ! #define PRIu64 GCC_PRI64 "u" #undef PRIx64 ! #define PRIx64 GCC_PRI64 "x" #undef PRIX64 ! #define PRIX64 GCC_PRI64 "X" ! #endif ! ! /* Various printf format strings for HOST_WIDE_INT. */ ! ! #if HOST_BITS_PER_LONG == 64 ! # 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 Index: gcc/wide-int.cc =================================================================== *** gcc/wide-int.cc.orig 2014-05-19 10:55:30.393953980 +0200 --- gcc/wide-int.cc 2014-05-26 11:07:08.726266150 +0200 *************** along with GCC; see the file COPYING3. *** 27,32 **** --- 27,42 ---- #include "tree.h" #include "dumpfile.h" + + #define HOST_BITS_PER_HALF_WIDE_INT 32 + #if HOST_BITS_PER_HALF_WIDE_INT == HOST_BITS_PER_LONG + # define HOST_HALF_WIDE_INT long + #elif HOST_BITS_PER_HALF_WIDE_INT == HOST_BITS_PER_INT + # define HOST_HALF_WIDE_INT int + #else + #error Please add support for HOST_HALF_WIDE_INT + #endif + #define W_TYPE_SIZE HOST_BITS_PER_WIDE_INT #if GCC_VERSION >= 3000 && (W_TYPE_SIZE == 32 || defined (__SIZEOF_INT128__)) typedef unsigned HOST_HALF_WIDE_INT UHWtype;