diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-12-09 18:00:53 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-12-17 21:56:32 +0100 |
commit | 841a80bb813e6a9d424193dd6cf7fbef70f7feb6 (patch) | |
tree | d65f789a79c899ed233a2ac778740db178955409 | |
parent | af4d1b73c7f935eeb883eada6823758f78d7ed21 (diff) | |
download | sparse-841a80bb813e6a9d424193dd6cf7fbef70f7feb6.tar.gz |
add predefined macros for [u]int64_t
All LP32 archs use [u]llong and all LP64 use [u]long for these
but Darwin which seems to always use [u]llong.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | lib.c | 8 | ||||
-rw-r--r-- | target.c | 6 | ||||
-rw-r--r-- | target.h | 2 | ||||
-rw-r--r-- | validation/preprocessor/predef.c | 2 |
4 files changed, 18 insertions, 0 deletions
@@ -471,9 +471,13 @@ static void handle_arch_m64_finalize(void) max_int_alignment = 8; predefine("__ILP32__", 1, "1"); predefine("_ILP32", 1, "1"); + int64_ctype = &llong_ctype; + uint64_ctype = &ullong_ctype; goto case_x86_64; case ARCH_LP32: /* default values */ + int64_ctype = &llong_ctype; + uint64_ctype = &ullong_ctype; intmax_ctype = &llong_ctype; uintmax_ctype = &ullong_ctype; return; @@ -492,6 +496,8 @@ static void handle_arch_m64_finalize(void) max_int_alignment = 8; size_t_ctype = &ullong_ctype; ssize_t_ctype = &llong_ctype; + int64_ctype = &llong_ctype; + uint64_ctype = &ullong_ctype; predefine("__LLP64__", 1, "1"); goto case_64bit_common; case_64bit_common: @@ -1245,6 +1251,8 @@ static void predefined_macros(void) predefined_ctype("UINT8", &uchar_ctype, PTYPE_MAX|PTYPE_TYPE); predefined_ctype("INT16", &short_ctype, PTYPE_MAX|PTYPE_TYPE); predefined_ctype("UINT16", &ushort_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("INT64", int64_ctype, PTYPE_MAX|PTYPE_TYPE); + predefined_ctype("UINT64", uint64_ctype, PTYPE_MAX|PTYPE_TYPE); predefined_sizeof("INT128", "", 128); @@ -8,6 +8,8 @@ struct symbol *size_t_ctype = &uint_ctype; struct symbol *ssize_t_ctype = &int_ctype; struct symbol *intmax_ctype = &llong_ctype; struct symbol *uintmax_ctype = &ullong_ctype; +struct symbol *int64_ctype = &long_ctype; +struct symbol *uint64_ctype = &ulong_ctype; struct symbol *wchar_ctype = &int_ctype; struct symbol *wint_ctype = &uint_ctype; @@ -78,4 +80,8 @@ void init_target(void) #if defined(__FreeBSD__) || defined(__APPLE__) wint_ctype = &int_ctype; #endif +#if defined(__APPLE__) + int64_ctype = &llong_ctype; + uint64_ctype = &ullong_ctype; +#endif } @@ -5,6 +5,8 @@ extern struct symbol *size_t_ctype; extern struct symbol *ssize_t_ctype; extern struct symbol *intmax_ctype; extern struct symbol *uintmax_ctype; +extern struct symbol *int64_ctype; +extern struct symbol *uint64_ctype; extern struct symbol *wchar_ctype; extern struct symbol *wint_ctype; diff --git a/validation/preprocessor/predef.c b/validation/preprocessor/predef.c index 7a7b575a..f00a471f 100644 --- a/validation/preprocessor/predef.c +++ b/validation/preprocessor/predef.c @@ -21,6 +21,8 @@ int test(void) TEST_MAX(UINT8, 0xffU); TEST_MAX( INT16, 0x7fff); TEST_MAX(UINT16, 0xffffU); + TEST_MAX( INT64, 0x7fffffffffffffffLL); + TEST_MAX(UINT64, 0xffffffffffffffffULL); TEST_SMAX(INTMAX, __INTMAX_TYPE__); TEST_UMAX(UINTMAX, __UINTMAX_TYPE__); TEST_SMAX(INTPTR, __INTPTR_TYPE__); |