addSym (SymbolTab, newSym, newSym->rname, 0, 0, 1);
/* now lift the code to main */
- if (IS_AGGREGATE (sym->type))
+ if (IS_AGGREGATE (sym->type)) {
work = initAggregates (sym, sym->ival, NULL);
- else
+ } else {
+ if (getNelements(sym->type, sym->ival)>1) {
+ werror (W_EXCESS_INITIALIZERS, "scalar",
+ sym->name, sym->lineDef);
+ }
work = newNode ('=', newAst_VALUE (symbolVal (newSym)),
list2expr (sym->ival));
+ }
setAstLineno (work, sym->lineDef);
if (IS_AGGREGATE (sym->type)) {
work = initAggregates (sym, sym->ival, NULL);
} else {
+ if (getNelements(sym->type, sym->ival)>1) {
+ werror (W_EXCESS_INITIALIZERS, "scalar",
+ sym->name, sym->lineDef);
+ }
work = newNode ('=', newAst_VALUE (symbolVal (sym)),
list2expr (sym->ival));
}
if (IS_AGGREGATE (sym->type)) {
ival = initAggregates (sym, sym->ival, NULL);
} else {
+ if (getNelements(sym->type, sym->ival)>1) {
+ werror (W_EXCESS_INITIALIZERS, "scalar",
+ sym->name, sym->lineDef);
+ }
ival = newNode ('=', newAst_VALUE (symbolVal (sym)),
decorateType (resolveSymbols (list2expr (sym->ival))));
}
if (ilist->type == INIT_DEEP)
ilist = ilist->init.deep;
- if (sym && ilist->next) {
+ if (!IS_AGGREGATE(sym->type) && getNelements(type, ilist)>1) {
werror (W_EXCESS_INITIALIZERS, "scalar", sym->name, sym->lineDef);
}
if (IS_BITFIELD(sflds->type)) {
printIvalBitFields(&sflds,&iloop,oFile);
} else {
- printIval (NULL, sflds->type, iloop, oFile);
+ printIval (sym, sflds->type, iloop, oFile);
}
}
if (iloop) {
for (;;)
{
size++;
- printIval (NULL, type->next, iloop, oFile);
+ printIval (sym, type->next, iloop, oFile);
iloop = (iloop ? iloop->next : NULL);