summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2019-03-20 08:03:25 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2019-03-20 08:03:25 +0100
commitf37bcbba7bbed10763f84f59a3b4e55bbd30c5b8 (patch)
treea3b1464caf9addc1fca6cc0a38016f7b060e465a
parentcf3a98dc451528b30eb1b91324cee30c0f320fb2 (diff)
Clean up a bit the code to set endianness macros.
-rw-r--r--src/driver/predefs.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/driver/predefs.c b/src/driver/predefs.c
index 2e93079..d978421 100644
--- a/src/driver/predefs.c
+++ b/src/driver/predefs.c
@@ -315,15 +315,16 @@ void add_predefined_macros(void)
/* no support for the XXX_chk functions in cparser yet */
add_define("_FORTIFY_SOURCE", "0", false);
- add_define("__ORDER_BIG_ENDIAN__", "4321", false);
- add_define("__ORDER_LITTLE_ENDIAN__", "1234", false);
- add_define("__ORDER_PDP_ENDIAN__", "3412", false);
- add_define("__BYTE_ORDER__", target.byte_order_big_endian
- ? "__ORDER_BIG_ENDIAN__" : "__ORDER_LITTLE_ENDIAN__", false);
- add_define("__FLOAT_WORD_ORDER__", target.byte_order_big_endian
- ? "__ORDER_BIG_ENDIAN__" : "__ORDER_LITTLE_ENDIAN__", false);
-
- add_define("__FINITE_MATH_ONLY__", "0", false);
+ char const *const big = "__ORDER_BIG_ENDIAN__";
+ char const *const little = "__ORDER_LITTLE_ENDIAN__";
+ add_define(big, "4321", false);
+ add_define(little, "1234", false);
+ add_define("__ORDER_PDP_ENDIAN__", "3412", false);
+ char const *const order = target.byte_order_big_endian ? big : little;
+ add_define("__BYTE_ORDER__", order, false);
+ add_define("__FLOAT_WORD_ORDER__", order, false);
+
+ add_define("__FINITE_MATH_ONLY__", "0", false);
if (is_ILP(4, 8, 8)) {
add_define("_LP64", "1", false);