summaryrefslogtreecommitdiff
path: root/gcc/cppbuiltin.c
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2010-10-23 03:05:47 +0000
committerNathan Froyd <froydnj@gcc.gnu.org>2010-10-23 03:05:47 +0000
commit18ed6ee4bf95a6d02ff34e0dfa279e8c9a1179a8 (patch)
tree3d3cfc3c02f0c38bb0e407da7fd4e15a6393c11b /gcc/cppbuiltin.c
parent646e6f415ca6b02142132ebb82c8b11f08d2464f (diff)
downloadgcc-18ed6ee4bf95a6d02ff34e0dfa279e8c9a1179a8.tar.gz
cppbuiltin.c (define_builtin_macros_for_type_sizes): Define __BYTE_ORDER__...
gcc/ * cppbuiltin.c (define_builtin_macros_for_type_sizes): Define __BYTE_ORDER__, __ORDER_LITTLE_ENDIAN__, __ORDER_BIG_ENDIAN__, and __ORDER_PDP_ENDIAN__. * libgcc2.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. (struct DWstruct): Define based on __BYTE_ORDER__. * config/fixed-bit.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. (struct INTstruct): Define based on __BYTE_ORDER__. * config/dfp-bit.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Test __BYTE_ORDER__. * system.h (LIBGCC2_WORDS_BIG_ENDIAN): Poison identifier. * config/arc/arc.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * config/arm/arm.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * config/ia64/ia64.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * config/iq2000/iq2000.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * config/lm32/lm32.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * config/m32r/m32r.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * config/mcore/mcore.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * config/mep/mep.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * config/mips/mips.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * config/rs6000/sysv4.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * config/rx/rx.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * config/score/score.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * config/sh/sh.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * config/sparc/sparc.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * config/xtensa/xtensa.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * doc/tm.texi.in (LIBGCC2_WORDS_BIG_ENDIAN): Delete. * doc/tm.texi: Regenerate. * doc/cpp.texi (__BYTE_ORDER__, __ORDER_LITTLE_ENDIAN__): Document. (__ORDER_BIG_ENDIAN__, __ORDER_PDP_ENDIAN__): Likewise. libdecnumber/ * dconfig.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Test __BYTE_ORDER__. libgcc/ * config/libbid/bid_gcc_intrinsics.h (LIBGCC2_WORDS_BIG_ENDIAN): Delete. (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Test __BYTE_ORDER__. From-SVN: r165881
Diffstat (limited to 'gcc/cppbuiltin.c')
-rw-r--r--gcc/cppbuiltin.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/cppbuiltin.c b/gcc/cppbuiltin.c
index 89b0f418be6..7ac4071c322 100644
--- a/gcc/cppbuiltin.c
+++ b/gcc/cppbuiltin.c
@@ -138,6 +138,24 @@ define_builtin_macros_for_type_sizes (cpp_reader *pfile)
cpp_define_formatted (pfile, "__BIGGEST_ALIGNMENT__=%d",
BIGGEST_ALIGNMENT / BITS_PER_UNIT);
+ /* Define constants useful for implementing endian.h. */
+ cpp_define (pfile, "__ORDER_LITTLE_ENDIAN__=1234");
+ cpp_define (pfile, "__ORDER_BIG_ENDIAN__=4321");
+ cpp_define (pfile, "__ORDER_PDP_ENDIAN__=3412");
+
+ if (WORDS_BIG_ENDIAN == BYTES_BIG_ENDIAN)
+ cpp_define_formatted (pfile, "__BYTE_ORDER__=%s",
+ (WORDS_BIG_ENDIAN
+ ? "__ORDER_BIG_ENDIAN__"
+ : "__ORDER_LITTLE_ENDIAN__"));
+ else
+ {
+ /* Assert that we're only dealing with the PDP11 case. */
+ gcc_assert (!BYTES_BIG_ENDIAN && WORDS_BIG_ENDIAN);
+
+ cpp_define (pfile, "__BYTE_ORDER__=__ORDER_PDP_ENDIAN__");
+ }
+
/* ptr_type_node can't be used here since ptr_mode is only set when
toplev calls backend_init which is not done with -E switch. */
cpp_define_formatted (pfile, "__SIZEOF_POINTER__=%d",