mescc: Tinycc support: struct foo {int bar; int baz} = {0}.
* module/language/c99/compiler.mes (decl->info): struct foo {int bar; int baz} = {0}. * scaffold/tests/72-typedef-struct-def.c (test):
This commit is contained in:
parent
dcce4bae8a
commit
ce3233f998
|
@ -1832,8 +1832,8 @@
|
|||
(let loop ((fields fields) (initzers initzers) (info info))
|
||||
(if (null? fields) info
|
||||
(let ((offset (field-offset info type (field:name (car fields))))
|
||||
(initzer (car initzers)))
|
||||
(loop (cdr fields) (cdr initzers)
|
||||
(initzer (if (null? initzers) '(p-expr (fixed "0")) (car initzers))))
|
||||
(loop (cdr fields) (if (null? initzers) '() (cdr initzers))
|
||||
(clone info #:text
|
||||
(append
|
||||
(.text info)
|
||||
|
|
|
@ -97,5 +97,11 @@ test ()
|
|||
printf ("baz[1].f.i=%d\n", baz[1].f.i);
|
||||
if (baz[1].f.i != 5) return 1;
|
||||
|
||||
bar one = {0};
|
||||
printf ("one.i\n", one.i);
|
||||
if (one.i != 0) return 1;
|
||||
printf ("one.f.i\n", one.f.i);
|
||||
if (one.f.i != 0) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue