aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-02-02 21:28:03 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-02-04 00:37:18 +0100
commite6e60e370f4309431de9d488f6dc1fe96a976879 (patch)
tree3318644e576f4b21825994bf8fc1c1f589c03da3
parent3b246718ea3341a09fe6f7ecba5a9a882c590452 (diff)
downloadsparse-e6e60e370f4309431de9d488f6dc1fe96a976879.tar.gz
predefs: fix for MIPS system headers needing _MIPS_SZ{INT,LONG,PTR}
System headers (at least glibc's ones) define and use __WORDSIZE which, on most archs, is defined depending on __LP64 or __ILP32. But on MIPS, __WORDISZE is defined depending on the value of the builtin macro _MIPS_SZPTR. So, add the predefine for _MIPS_SZPTR on MIPS. Reported-by: Uwe Kleine-König <uwe@kleine-koenig.org> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--lib.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index b68d0ff2..ee439b5b 100644
--- a/lib.c
+++ b/lib.c
@@ -1320,6 +1320,15 @@ static void predefined_macros(void)
predefine("__x86_64", 1, "1");
#endif
}
+
+ switch (arch_mach) {
+ case MACH_MIPS64:
+ case MACH_MIPS32:
+ predefine("_MIPS_SZINT", 1, "%d", int_ctype.bit_size);
+ predefine("_MIPS_SZLONG", 1, "%d", long_ctype.bit_size);
+ predefine("_MIPS_SZPTR", 1, "%d", ptr_ctype.bit_size);
+ break;
+ }
}
static void create_builtin_stream(void)