From bc882ddc3c3e685cfa5c010c75933b292ea437bb Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 14 Feb 2011 23:31:37 +0900 Subject: [PATCH] Fix the parser side of aggregate initializers. --- tools/qfcc/source/qc-parse.y | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/qfcc/source/qc-parse.y b/tools/qfcc/source/qc-parse.y index 3b51ef5da..c9e0b4046 100644 --- a/tools/qfcc/source/qc-parse.y +++ b/tools/qfcc/source/qc-parse.y @@ -373,7 +373,22 @@ external_decl spec.storage); } } - | var_decl '=' var_initializer + | var_decl var_initializer + { + specifier_t spec = $0; + type_t *type; + + type = find_type (append_type ($1->type, spec.type)); + if (spec.is_typedef) { + error (0, "typedef %s is initialized", $1->name); + $1->type = type; + $1->sy_type = sy_type; + symtab_addsymbol (current_symtab, $1); + } else { + initialize_def ($1, type, $2, current_symtab->space, + spec.storage); + } + } | function_decl { specifier_t spec = $0;