From 04abf412e147e55986850ba6df42f94f6088e698 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sun, 18 Nov 2007 12:07:31 +0000 Subject: [PATCH] Array as last part of a paramter type is just syntactic sugar. Turn it into a pointer. [r18483] --- ast2firm.c | 1 - parser.c | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ast2firm.c b/ast2firm.c index a1f0af6..3f90847 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -2061,7 +2061,6 @@ static int count_local_declarations(const declaration_t * decl, for (; decl != end; decl = decl->next) { const type_t *type = skip_typeref(decl->type); switch (type->type) { - case TYPE_ARRAY: /* HACK for parameters declared in array style */ case TYPE_ATOMIC: case TYPE_ENUM: case TYPE_POINTER: diff --git a/parser.c b/parser.c index 1d9e15f..6bf4752 100644 --- a/parser.c +++ b/parser.c @@ -1535,6 +1535,15 @@ static declaration_t *parse_parameter(void) parse_error("typedef not allowed in parameter list"); } + /* Array as last part of a paramter type is just syntactic sugar. Turn it + * into a pointer */ + if (declaration->type->type == TYPE_ARRAY) { + const array_type_t *const arr_type = + (const array_type_t*)declaration->type; + declaration->type = + make_pointer_type(arr_type->element_type, TYPE_QUALIFIER_NONE); + } + return declaration; } -- 2.20.1