Fixed several problems
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 6 Feb 2000 09:01:35 +0000 (09:01 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 6 Feb 2000 09:01:35 +0000 (09:01 +0000)
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
src/SDCCmain.c
src/SDCCmem.c
src/SDCCsymt.c
src/SDCCsymt.h

index d44657902f3b5ee2d049b30c55a0dab9d9889a32..bdee802c7e4a71e4a40e00d67a6e16bb914126ee 100644 (file)
@@ -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);
        }
     }
index cdcccb8ea1db706a8258ebdfb12cec4d8f005b5f..fbf69c0ac70884d5f25b0b7ea4d5a13aa724e813 100644 (file)
@@ -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]);                      
index 74ff1f7fd605136109b2c252308baefba937ef67..812026c02ce90148d8b29b830162bb9afa887dc4 100644 (file)
@@ -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;
index 009cd4a51e95269c5f41cfe1c89417cbdec43828..e34bad43b2d1cf0ce34103cc77a7425da8dfb618 100644 (file)
@@ -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   ;
index eff25e9fe72177e9baf40a0f6894bc6a74c862c7..1b38daa5ad5b9cf4acb0600e9b86a115a7f2f328 100644 (file)
@@ -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 *              );