@@ -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;
@@ -75,4 +77,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;
@@ -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__);
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> --- lib.c | 8 ++++++++ target.c | 6 ++++++ target.h | 2 ++ validation/preprocessor/predef.c | 2 ++ 4 files changed, 18 insertions(+)