diff options
| -rw-r--r-- | bootstrap/all.h | 6 | ||||
| -rw-r--r-- | bootstrap/types.c | 15 |
2 files changed, 10 insertions, 11 deletions
diff --git a/bootstrap/all.h b/bootstrap/all.h index bb0711a..e458c15 100644 --- a/bootstrap/all.h +++ b/bootstrap/all.h @@ -491,12 +491,14 @@ struct comfile { /** Target **/ /************/ -#define alignof __alignof__ +#define alignof _Alignof static const struct targ { size_t ptrsize, shortsize, intsize, + i32align, + i64align, longsize, llongsize, sizesize, @@ -509,6 +511,8 @@ static const struct targ { .ptrsize = sizeof(void *), .shortsize = sizeof(short), .intsize = sizeof(int), + .i32align = alignof(int32_t), + .i64align = alignof(int64_t), .longsize = sizeof(long), .llongsize = sizeof(long long), .sizesize = sizeof(size_t), diff --git a/bootstrap/types.c b/bootstrap/types.c index 0be365f..dce85a6 100644 --- a/bootstrap/types.c +++ b/bootstrap/types.c @@ -225,27 +225,22 @@ putprimtypes(struct env *env) { {"f64", &ty_f64, {TYfloat, 8, t.f64align}}, #define IS .int_signed = 1 #define IU .int_signed = 0 +#define A(t) _Alignof(t) {"i8", &ty_i8, {TYint, 1, 1, IS}}, {"u8", &ty_u8, {TYint, 1, 1, IU}}, {"i16", &ty_i16, {TYint, 2, 2, IS}}, {"u16", &ty_u16, {TYint, 2, 2, IU}}, - {"i32", &ty_i32, {TYint, 4, 4, IS}}, - {"u32", &ty_u32, {TYint, 4, 4, IU}}, - {"i64", &ty_i64, {TYint, 8, 8, IS}}, - {"u64", &ty_u64, {TYint, 8, 8, IU}}, + {"i32", &ty_i32, {TYint, 4, t.i32align, IS}}, + {"u32", &ty_u32, {TYint, 4, t.i32align, IU}}, + {"i64", &ty_i64, {TYint, 8, t.i64align, IS}}, + {"u64", &ty_u64, {TYint, 8, t.i64align, IU}}, {"int", &ty_int, {TYint, t.intsize, IS}}, {"uint", &ty_uint, {TYint, t.intsize, IU}}, {"isize", &ty_isize, {TYint, t.sizesize, IS}}, {"usize", &ty_usize, {TYint, t.sizesize, IU}}, {"iptrint", &ty_iptrint, {TYint, t.ptrsize, IS}}, {"uptrint", &ty_uptrint, {TYint, t.ptrsize, IU}}, - {"c_int", &ty_c_int, {TYint, t.intsize, IS}}, - {"c_uint", &ty_c_uint, {TYint, t.intsize, IU}}, {"c_char", &ty_c_char, {TYint, 1, .int_signed = t.charsigned}}, - {"c_schar", &ty_c_schar, {TYint, 1, IS}}, - {"c_uchar", &ty_c_uchar, {TYint, 1, IU}}, - {"c_short", &ty_c_short, {TYint, 2, IS}}, - {"c_ushort", &ty_c_ushort, {TYint, 2, IU}}, {"c_long", &ty_c_long, {TYint, t.longsize, IS}}, {"c_ulong", &ty_c_ulong, {TYint, t.longsize, IU}}, {"c_llong", &ty_c_llong, {TYint, t.llongsize, IS}}, |