diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-12-17 00:09:33 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-12-17 22:50:28 +0100 |
commit | eadae505b5d1e22fc39e24a3e437afb00f7313f1 (patch) | |
tree | 4d3dd3368caf4779f2ec2a1f0fa49971f89c4bb5 | |
parent | 01bd0384f3a1bcba7a129418af7acb4087dd8904 (diff) | |
download | sparse-eadae505b5d1e22fc39e24a3e437afb00f7313f1.tar.gz |
add predefine for __CHAR_UNSIGNED__
This macro is needed by <limits.h> to get, among others things,
CHAR_MAX from __SCHAR_MAX__.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | lib.c | 4 | ||||
-rw-r--r-- | machine.h | 6 |
2 files changed, 9 insertions, 1 deletions
@@ -302,7 +302,7 @@ unsigned long fdump_ir; int fmem_report = 0; unsigned long long fmemcpy_max_count = 100000; unsigned long fpasses = ~0UL; -int funsigned_char = 0; +int funsigned_char = UNSIGNED_CHAR; int preprocess_only; @@ -1236,6 +1236,8 @@ static void predefined_macros(void) } predefine("__CHAR_BIT__", 1, "%d", bits_in_char); + if (funsigned_char) + predefine("__CHAR_UNSIGNED__", 1, "1"); predefined_ctype("SHORT", &short_ctype, PTYPE_SIZEOF); predefined_ctype("SHRT", &short_ctype, PTYPE_MAX|PTYPE_WIDTH); @@ -74,4 +74,10 @@ enum machine { #define MACH_NATIVE MACH_UNKNOWN #endif +#if defined(__CHAR_UNSIGNED__) +#define UNSIGNED_CHAR 1 +#else +#define UNSIGNED_CHAR 0 +#endif + #endif |