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@xxxxxxxxx> --- lib.c | 12 ++++++++++++ target.c | 2 ++ target.h | 2 ++ validation/preprocessor/predef.c | 2 ++ 4 files changed, 18 insertions(+) diff --git a/lib.c b/lib.c index 39ee1290d..2aac93955 100644 --- a/lib.c +++ b/lib.c @@ -490,9 +490,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; @@ -501,6 +505,10 @@ static void handle_arch_m64_finalize(void) max_int_alignment = 8; size_t_ctype = &ulong_ctype; ssize_t_ctype = &long_ctype; +#if defined(__APPLE__) + int64_ctype = &llong_ctype; + uint64_ctype = &ullong_ctype; +#endif intmax_ctype = &long_ctype; uintmax_ctype = &ulong_ctype; predefine("__LP64__", 1, "1"); @@ -511,6 +519,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: @@ -1268,6 +1278,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); diff --git a/target.c b/target.c index 8178450c4..0476f0cd6 100644 --- a/target.c +++ b/target.c @@ -7,6 +7,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; diff --git a/target.h b/target.h index d764d4182..7b1d96498 100644 --- a/target.h +++ b/target.h @@ -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 7a7b575a3..f00a471fc 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__); -- 2.19.0