From 928c95eb0d61447ba767cae34d4f9a8747d674b8 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Mon, 8 Dec 2008 09:33:32 +0000 Subject: [PATCH] Allow sizeof(void) and __alignof__(void) as GCC extension. [r24386] --- ast2firm.c | 2 +- parser.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ast2firm.c b/ast2firm.c index 28cdaa6..1016fe8 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -201,7 +201,7 @@ static void init_atomic_modes(void) mode_uint = atomic_modes[ATOMIC_TYPE_UINT]; /* there's no real void type in firm */ - atomic_modes[ATOMIC_TYPE_VOID] = mode_int; + atomic_modes[ATOMIC_TYPE_VOID] = atomic_modes[ATOMIC_TYPE_CHAR]; /* initialize pointer modes */ char name[64]; diff --git a/parser.c b/parser.c index 00a8ed4..6058419 100644 --- a/parser.c +++ b/parser.c @@ -7874,9 +7874,10 @@ typeprop_expression: tp_expression->typeprop.type = orig_type; type_t const* const type = skip_typeref(orig_type); char const* const wrong_type = - is_type_incomplete(type) ? "incomplete" : - type->kind == TYPE_FUNCTION ? "function designator" : - type->kind == TYPE_BITFIELD ? "bitfield" : + GNU_MODE && is_type_atomic(type, ATOMIC_TYPE_VOID) ? NULL : + is_type_incomplete(type) ? "incomplete" : + type->kind == TYPE_FUNCTION ? "function designator" : + type->kind == TYPE_BITFIELD ? "bitfield" : NULL; if (wrong_type != NULL) { char const* const what = kind == EXPR_SIZEOF ? "sizeof" : "alignof"; -- 2.20.1