mescc: Support list of initializers.

* module/language/c99/compiler.mes (ast->info): Support list of initializers.
This commit is contained in:
Jan Nieuwenhuizen 2017-05-03 08:09:19 +02:00
parent 4e0042cae6
commit d9780e66cd
1 changed files with 8 additions and 0 deletions

View File

@ -1736,6 +1736,14 @@
((decl (decl-spec-list (type-spec (fixed-type ,type))) (init-declr-list (init-declr (ftn-declr (ident ,name) (param-list ,param-list (ellipsis))))))
info)
;; int i = 0, j = 0;
((decl (decl-spec-list (type-spec (fixed-type ,type))) (init-declr-list (init-declr (ident ,name) . ,initzer) . ,rest))
(let loop ((inits `((init-declr (ident ,name) ,@initzer) ,@rest)) (info info))
(if (null? inits) info
(loop (cdr inits)
((ast->info info)
`(decl (decl-spec-list (type-spec (fixed-type ,type))) (init-declr-list ,(car inits))))))))
((decl (decl-spec-list (stor-spec (typedef)) ,type) ,name)
(format (current-error-port) "SKIP: typedef=~s\n" o)
info)