mescc: Tinycc support: Array typedefs.

This commit is contained in:
Jan Nieuwenhuizen 2018-05-11 18:26:01 +02:00
parent 6bcc9a91e3
commit b42ecbd928
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 10 additions and 0 deletions

View file

@ -1722,6 +1722,13 @@
(let* ((info (type->info type name info))
(type (ast->type type info)))
(clone info #:types (acons name type (.types info)))))
;; FIXME: recursive types, pointer, array
(((decl-spec-list (stor-spec (typedef)) (type-spec ,type)) (init-declr-list (init-declr (array-of (ident ,name) ,count))))
(let* ((info (type->info type name info))
(type (ast->type type info))
(count (expr->number info count))
(type (make-c-array type count)))
(clone info #:types (acons name type (.types info)))))
(((decl-spec-list (stor-spec (,store)) (type-spec ,type)) (init-declr-list . ,inits))
(let* ((type (ast->type type info))
(function (.function info)))

View file

@ -43,6 +43,9 @@ struct anion {union {int foo; int bar;}; union {int baz; int bla;};};
struct here {int and;} there;
typedef int int_array_t[1];
int_array_t bar;
int
test (struct foo* p)
{