From: johanknol Date: Mon, 12 Nov 2001 21:08:02 +0000 (+0000) Subject: More excess initializer warnings. Global scalar and auto's yet to come.. X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=1ec549d6b3513fc8a12c07bca667c86766408e2d;p=fw%2Fsdcc More excess initializer warnings. Global scalar and auto's yet to come.. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1578 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCast.c b/src/SDCCast.c index 5d17fab5..e876cc4a 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -804,6 +804,12 @@ createIvalStruct (ast * sym, sym_link * type, initList * ilist) lAst = decorateType (resolveSymbols (lAst)); rast = decorateType (resolveSymbols (createIval (lAst, sflds->type, iloop, rast))); } + + if (iloop) { + werror (W_EXCESS_INITIALIZERS, "struct", + sym->opval.val->sym->name, sym->opval.val->sym->lineDef); + } + return rast; } @@ -1109,11 +1115,12 @@ gatherAutoInit (symbol * autoChain) /* if there is an initial value */ if (sym->ival && SPEC_SCLS (sym->etype) != S_CODE) { - if (IS_AGGREGATE (sym->type)) + if (IS_AGGREGATE (sym->type)) { work = initAggregates (sym, sym->ival, NULL); - else + } else { work = newNode ('=', newAst_VALUE (symbolVal (sym)), list2expr (sym->ival)); + } setAstLineno (work, sym->lineDef); sym->ival = NULL;