char *name=sym->opval.val->sym->name;
int lineno=sym->opval.val->sym->lineDef;
- werror (W_EXESS_ARRAY_INITIALIZERS, name, lineno);
+ werror (W_EXCESS_INITIALIZERS, "array", name, lineno);
}
}
else
// there has to be a better way
char *name=sym->opval.val->sym->name;
int lineno=sym->opval.val->sym->lineDef;
- werror (W_EXESS_ARRAY_INITIALIZERS, name, lineno);
+ werror (W_EXCESS_INITIALIZERS, "array", name, lineno);
break;
}
/* printIvalType - generates ival for int/char */
/*-----------------------------------------------------------------*/
void
-printIvalType (sym_link * type, initList * ilist, FILE * oFile)
+printIvalType (symbol *sym, sym_link * type, initList * ilist, FILE * oFile)
{
value *val;
if (ilist->type == INIT_DEEP)
ilist = ilist->init.deep;
+ if (sym && ilist->next) {
+ werror (W_EXCESS_INITIALIZERS, "scalar", sym->name, sym->lineDef);
+ }
+
val = list2val (ilist);
switch (getSize (type)) {
case 1:
if (IS_BITFIELD(sflds->type)) {
printIvalBitFields(&sflds,&iloop,oFile);
} else {
- printIval (sflds, sflds->type, iloop, oFile);
+ printIval (NULL, sflds->type, iloop, oFile);
}
}
+ if (iloop) {
+ werror (W_EXCESS_INITIALIZERS, "struct", sym->name, sym->lineDef);
+ }
return;
}
for (;;)
{
size++;
- printIval (sym, type->next, iloop, oFile);
+ printIval (NULL, type->next, iloop, oFile);
iloop = (iloop ? iloop->next : NULL);
if (!--lcnt) {
/* if initializers left */
if (iloop) {
- werror (W_EXESS_ARRAY_INITIALIZERS, sym->name, sym->lineDef);
+ werror (W_EXCESS_INITIALIZERS, "array", sym->name, sym->lineDef);
}
break;
}
/* if type is SPECIFIER */
if (IS_SPEC (type))
{
- printIvalType (type, ilist, oFile);
+ printIvalType (sym, type, ilist, oFile);
return;
}
}