From: johanknol Date: Tue, 2 Oct 2001 12:20:14 +0000 (+0000) Subject: a more general fix for bug #466586 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=ca834085e1b572ad998dfc87c8cc061df85fb280;p=fw%2Fsdcc a more general fix for bug #466586 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1343 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCC.y b/src/SDCC.y index d1590b2f..952d3532 100644 --- a/src/SDCC.y +++ b/src/SDCC.y @@ -777,12 +777,6 @@ struct_declarator_list struct_declarator : declarator - { - // if this was a function declarator, remove the symbol args (if any) - if (IS_FUNC($1->etype)) { - cleanUpLevel(SymbolTab,NestLevel+1); - } - } | ':' constant_expr { $$ = newSymbol (genSymName(NestLevel),NestLevel) ; $$->bitVar = (int) floatFromVal(constExprValue($2,TRUE)); @@ -927,6 +921,15 @@ declarator2 /* nest level was incremented to take care of the parms */ NestLevel-- ; currBlockno--; + + // if this was a pointer to a function, remove the symbol args + // (if any) + if (IS_PTR($1->type) && IS_FUNC($1->etype)) { + cleanUpLevel(SymbolTab,NestLevel+1); + /* fprintf (stderr, "Removed parm symbols of %s in line %d\n", + $1->name, yylineno); */ + } + $$ = $1; } | declarator2 '(' parameter_identifier_list ')' diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 3d9987a3..4a7e6aba 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -1442,7 +1442,6 @@ saveRegisters (iCode * lic) int i; iCode *ic; bitVect *rsave; - sym_link *detype; /* look for call */ for (ic = lic; ic; ic = ic->next) @@ -1494,10 +1493,8 @@ saveRegisters (iCode * lic) if (bitVectBitValue (rsave, i)) emitcode ("push", "%s", mcs51_regWithIdx (i)->dname); } - - detype = getSpec (operandType (IC_LEFT (ic))); - } + /*-----------------------------------------------------------------*/ /* unsaveRegisters - pop the pushed registers */ /*-----------------------------------------------------------------*/