@@ -165,9 +165,9 @@ void predefined_macros(void)
predefined_ctype("INTMAX", intmax_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH);
predefined_ctype("UINTMAX", uintmax_ctype, PTYPE_MAX|PTYPE_TYPE);
- predefined_ctype("INTPTR", ssize_t_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH);
- predefined_ctype("UINTPTR", size_t_ctype, PTYPE_MAX|PTYPE_TYPE);
- predefined_ctype("PTRDIFF", ssize_t_ctype, PTYPE_ALL_T|PTYPE_TYPE);
+ predefined_ctype("INTPTR", intptr_ctype, PTYPE_MAX|PTYPE_TYPE|PTYPE_WIDTH);
+ predefined_ctype("UINTPTR", uintptr_ctype, PTYPE_MAX|PTYPE_TYPE);
+ predefined_ctype("PTRDIFF", ptrdiff_ctype, PTYPE_ALL_T|PTYPE_TYPE);
predefined_ctype("SIZE", size_t_ctype, PTYPE_ALL_T|PTYPE_TYPE);
predefined_ctype("POINTER", &ptr_ctype, PTYPE_SIZEOF);
predefined_ctype("SIG_ATOMIC", sig_atomic_ctype, PTYPE_MAX|PTYPE_MIN|PTYPE_TYPE|PTYPE_WIDTH);
@@ -899,4 +899,11 @@ void init_ctype(void)
char_ctype.ctype.modifiers |= MOD_UNSIGNED;
char_ctype.ctype.modifiers &= ~MOD_SIGNED;
}
+
+ if (!ptrdiff_ctype)
+ ptrdiff_ctype = ssize_t_ctype;
+ if (!intptr_ctype)
+ intptr_ctype = ssize_t_ctype;
+ if (!uintptr_ctype)
+ uintptr_ctype = size_t_ctype;
}
@@ -304,9 +304,6 @@ extern struct symbol float128_ctype;
extern struct symbol const_void_ctype, const_char_ctype;
extern struct symbol const_ptr_ctype, const_string_ctype;
-#define uintptr_ctype size_t_ctype
-#define intptr_ctype ssize_t_ctype
-
/* Special internal symbols */
extern struct symbol zero_int;
@@ -5,6 +5,8 @@
static void init_h8300(const struct target *self)
{
+ intptr_ctype = &int_ctype;
+ uintptr_ctype = &uint_ctype;
ssize_t_ctype = &long_ctype;
size_t_ctype = &ulong_ctype;
wchar_ctype = &ushort_ctype;
@@ -6,6 +6,9 @@
static void init_s390(const struct target *self)
{
+ intptr_ctype = &int_ctype;
+ uintptr_ctype = &uint_ctype;
+
fast16_ctype = &int_ctype;
ufast16_ctype = &uint_ctype;
fast32_ctype = &int_ctype;
@@ -7,6 +7,8 @@ static void init_sh(const struct target *self)
{
int64_ctype = &llong_ctype;
uint64_ctype = &ullong_ctype;
+ intptr_ctype = &int_ctype;
+ uintptr_ctype = &uint_ctype;
fast16_ctype = &int_ctype;
ufast16_ctype = &uint_ctype;
@@ -5,6 +5,9 @@
#include "target.h"
#include "machine.h"
+struct symbol *ptrdiff_ctype;
+struct symbol *intptr_ctype;
+struct symbol *uintptr_ctype;
struct symbol *size_t_ctype = &ulong_ctype;
struct symbol *ssize_t_ctype = &long_ctype;
struct symbol *intmax_ctype = &long_ctype;
@@ -5,6 +5,9 @@
extern struct symbol *size_t_ctype;
extern struct symbol *ssize_t_ctype;
+extern struct symbol *ptrdiff_ctype;
+extern struct symbol *intptr_ctype;
+extern struct symbol *uintptr_ctype;
extern struct symbol *intmax_ctype;
extern struct symbol *uintmax_ctype;
extern struct symbol *int64_ctype;
These types are aliased to size_t & ssize_t but this is not correct for all architectures. So, add a variable for them so that target files can adjust them. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- predefine.c | 6 +++--- symbol.c | 7 +++++++ symbol.h | 3 --- target-h8300.c | 2 ++ target-s390.c | 3 +++ target-sh.c | 2 ++ target.c | 3 +++ target.h | 3 +++ 8 files changed, 23 insertions(+), 6 deletions(-)