@@ -492,12 +492,16 @@ static void handle_arch_m64_finalize(void)
goto case_x86_64;
case ARCH_LP32:
/* default values */
+ intmax_ctype = &llong_ctype;
+ uintmax_ctype = &ullong_ctype;
return;
case ARCH_LP64:
bits_in_long = 64;
max_int_alignment = 8;
size_t_ctype = &ulong_ctype;
ssize_t_ctype = &long_ctype;
+ intmax_ctype = &long_ctype;
+ uintmax_ctype = &ulong_ctype;
predefine("__LP64__", 1, "1");
predefine("_LP64", 1, "1");
goto case_64bit_common;
@@ -1260,6 +1264,8 @@ static void predefined_macros(void)
predefined_ctype("UINTPTR", size_t_ctype, PTYPE_TYPE|PTYPE_MAX);
predefined_ctype("INTPTR", ssize_t_ctype, PTYPE_TYPE|PTYPE_MAX|PTYPE_WIDTH);
predefined_ctype("PTRDIFF", ssize_t_ctype, PTYPE_ALL|PTYPE_T);
+ predefined_ctype("INTMAX", intmax_ctype, PTYPE_TYPE|PTYPE_MAX);
+ predefined_ctype("UINTMAX", uintmax_ctype, PTYPE_TYPE|PTYPE_MAX);
predefined_sizeof("POINTER", "", bits_in_pointer);
predefined_sizeof("FLOAT", "", bits_in_float);
@@ -5,6 +5,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 *wchar_ctype = &int_ctype;
/*
@@ -3,6 +3,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 *wchar_ctype;
/*
@@ -17,6 +17,8 @@ int test(void)
TEST_MAX(PTRDIFF, __PTRDIFF_TYPE__);
TEST_MAX(INTPTR, __INTPTR_TYPE__);
TEST_MAX(UINTPTR, __UINTPTR_TYPE__);
+ TEST_MAX(INTMAX, __INTMAX_TYPE__);
+ TEST_MAX(UINTMAX, __UINTMAX_TYPE__);
#define TEST_SIZEOF(X, T) if (__SIZEOF_ ## X ## __ != sizeof(T)) return 1
TEST_SIZEOF(SHORT, short);