From 9808229661396adafad260b2422767536a6828ac Mon Sep 17 00:00:00 2001 From: sandeep Date: Sun, 6 Feb 2000 09:01:35 +0000 Subject: [PATCH] Fixed several problems 1) Enum problems 2) parmBytes not set correctly 3) copyiCode git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@68 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCicode.c | 8 ++++---- src/SDCCmain.c | 4 ++-- src/SDCCmem.c | 18 +++++++++--------- src/SDCCsymt.c | 9 +++++++-- src/SDCCsymt.h | 1 - 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/SDCCicode.c b/src/SDCCicode.c index d4465790..bdee802c 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -564,8 +564,8 @@ iCode *copyiCode (iCode *ic) switch (ic->op) { case IFX: IC_COND(nic) = operandFromOperand(IC_COND(ic)); - IC_TRUE(nic) = operandFromOperand(IC_TRUE(ic)); - IC_FALSE(nic)= operandFromOperand(IC_FALSE(ic)); + IC_TRUE(nic) = IC_TRUE(ic); + IC_FALSE(nic)= IC_FALSE(ic); break; case JUMPTABLE: @@ -2380,12 +2380,12 @@ static void geniCodeParms ( ast *parms , int *stack, link *fetype) geniCodeAssign(top,pval,1); } else { - + link *p = operandType(pval); /* push */ ic = newiCode(IPUSH,pval,NULL); ic->parmPush = 1; /* update the stack adjustment */ - *stack += getSize(operandType(pval)); + *stack += getSize(IS_AGGREGATE(p)? aggrToPtr(p,FALSE):p); ADDTOCHAIN(ic); } } diff --git a/src/SDCCmain.c b/src/SDCCmain.c index cdcccb8e..fbf69c0a 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -852,9 +852,9 @@ int parseCmdLine ( int argc, char **argv ) /* assembler options */ if (argv[i][2] == 'a') { if (argv[i][3]) - parseWithComma(asmOptions,&argv[i][3]); + parseWithComma((char **)asmOptions,&argv[i][3]); else - parseWithComma(asmOptions,argv[++i]); + parseWithComma((char **)asmOptions,argv[++i]); } else { werror(W_UNKNOWN_OPTION,argv[i]); diff --git a/src/SDCCmem.c b/src/SDCCmem.c index 74ff1f7f..812026c0 100644 --- a/src/SDCCmem.c +++ b/src/SDCCmem.c @@ -333,21 +333,21 @@ void allocParms ( value *val ) for ( lval = val ; lval ; lval = lval->next, pNum++ ) { - /* if this is a literal e.g. enumerated type */ - if (IS_LITERAL(lval->etype)) { - SPEC_OCLS(lval->etype) = SPEC_OCLS(lval->sym->etype) = - ( options.model ? xdata : data ); - continue; - } + /* check the declaration */ + checkDecl (lval->sym); + + // /* if this is a literal e.g. enumerated type */ + // if (IS_LITERAL(lval->etype)) { + // SPEC_OCLS(lval->etype) = SPEC_OCLS(lval->sym->etype) = + // ( options.model ? xdata : data ); + // continue; + //} /* if this a register parm then allocate it as a local variable by adding it to the first block we see in the body */ if (IS_REGPARM(lval->etype)) continue ; - /* check the declaration */ - checkDecl (lval->sym); - /* mark it as my parameter */ lval->sym->ismyparm = 1; lval->sym->localof = currFunc; diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index 009cd4a5..e34bad43 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -898,8 +898,13 @@ int compStructSize (int su, structdef *sdef ) /*------------------------------------------------------------------*/ /* checkSClass - check the storage class specification */ /*------------------------------------------------------------------*/ -void checkSClass ( symbol *sym ) +static void checkSClass ( symbol *sym ) { + /* type is literal can happen foe enums change + to auto */ + if (SPEC_SCLS(sym->etype) == S_LITERAL && !SPEC_ENUM(sym->etype)) + SPEC_SCLS(sym->etype) = S_AUTO; + /* if sfr or sbit then must also be */ /* volatile the initial value will be xlated */ /* to an absolute address */ @@ -958,7 +963,7 @@ void checkSClass ( symbol *sym ) ( SPEC_SCLS(sym->etype) != S_AUTO && SPEC_SCLS(sym->etype) != S_FIXED && SPEC_SCLS(sym->etype) != S_REGISTER && - SPEC_SCLS(sym->etype) != S_CONSTANT )) { + SPEC_SCLS(sym->etype) != S_CONSTANT )) { werror(E_AUTO_ASSUMED,sym->name) ; SPEC_SCLS(sym->etype) = S_AUTO ; diff --git a/src/SDCCsymt.h b/src/SDCCsymt.h index eff25e9f..1b38daa5 100644 --- a/src/SDCCsymt.h +++ b/src/SDCCsymt.h @@ -381,7 +381,6 @@ char *genSymName ( int ); int compStructSize ( int ,structdef * ); link *copyLinkChain ( link * ); int checkDecl ( symbol * ); -void checkSClass ( symbol * ); void checkBasic ( link *, link * ); value *checkPointerIval ( link *, value * ); value *checkStructIval ( symbol *, value * ); -- 2.30.2