- dbuf_init(&tmpBuf, 4096);
- // before allocation we must parse the sym->ival tree
- // but without actually generating initialization code
- noAlloc++;
- resolveIvalSym (sym->ival, sym->type);
- printIval (sym, sym->type, sym->ival, &tmpBuf);
- noAlloc--;
- dbuf_destroy(&tmpBuf);
- }
- } else {
- if (IS_AGGREGATE (sym->type)) {
- ival = initAggregates (sym, sym->ival, NULL);
- } else {
- if (getNelements(sym->type, sym->ival)>1) {
- werrorfl (sym->fileDef, sym->lineDef, W_EXCESS_INITIALIZERS, "scalar",
- sym->name);
- }
- ival = newNode ('=', newAst_VALUE (symbolVal (sym)),
- decorateType (resolveSymbols (list2expr (sym->ival)), RESULT_TYPE_NONE));
- }
- codeOutBuf = &statsg->oBuf;
-
- if (ival) {
- // set ival's lineno to where the symbol was defined
- setAstLineno (ival, lineno=sym->lineDef);
- // check if this is not a constant expression
- if (!constExprTree(ival)) {
- werror (E_CONST_EXPECTED, "found expression");
- // but try to do it anyway
+ if (ival)
+ {
+ // set ival's lineno to where the symbol was defined
+ setAstFileLine (ival, filename = sym->fileDef, lineno = sym->lineDef);
+ // check if this is not a constant expression
+ if (!constExprTree (ival))
+ {
+ werror (E_CONST_EXPECTED, "found expression");
+ // but try to do it anyway
+ }
+ allocInfo = 0;
+ if (!astErrors (ival))
+ eBBlockFromiCode (iCodeFromAst (ival));
+ allocInfo = 1;
+ }