Fixed problem when a string constant contains a "\\r\\n" and the output asm file...
[fw/sdcc] / src / SDCCsymt.c
index 668cf777d034174570440f569e6ba5c501034690..1eff67706192a7f57ea258d767fc8a27c892d82f 100644 (file)
@@ -1005,10 +1005,11 @@ reverseLink (sym_link * type)
 /* addSymChain - adds a symbol chain to the symboltable             */
 /*------------------------------------------------------------------*/
 void 
-addSymChain (symbol * symHead)
+addSymChain (symbol ** symHead)
 {
-  symbol *sym = symHead;
+  symbol *sym = *symHead;
   symbol *csym = NULL;
+  symbol **symPtrPtr;
   int error = 0;
 
   for (; sym != NULL; sym = sym->next)
@@ -1086,6 +1087,13 @@ addSymChain (symbol * symHead)
         /* delete current entry */
         deleteSym (SymbolTab, csym, csym->name);
         deleteFromSeg(csym);
+        
+        symPtrPtr = symHead;
+        while (*symPtrPtr && *symPtrPtr != csym)
+          symPtrPtr = &(*symPtrPtr)->next;
+        if (*symPtrPtr == csym)
+          *symPtrPtr = csym->next;
+          
       }
       
       /* add new entry */
@@ -1485,8 +1493,9 @@ checkSClass (symbol * sym, int isProto)
 
   /* if parameter or local variable then change */
   /* the storage class to reflect where the var will go */
-  if (sym->level && SPEC_SCLS (sym->etype) == S_FIXED &&
-      !IS_STATIC(sym->etype))
+  if (sym->level && SPEC_SCLS (sym->etype) == S_FIXED
+   && !IS_STATIC(sym->etype)
+      )
     {
       if (options.stackAuto || (currFunc && IFFUNC_ISREENT (currFunc->type)))
         {
@@ -1894,7 +1903,10 @@ compareType (sym_link * dest, sym_link * src)
           if (IS_PTR (dest) && IS_GENPTR (src) && IS_VOID(src->next)) {
             return -1;
           }
-          if (IS_PTR (src) && IS_GENPTR (dest))
+          if (IS_PTR (src) && 
+              (IS_GENPTR (dest) ||
+               ((DCL_TYPE(src) == POINTER) && (DCL_TYPE(dest) == IPOINTER))
+             ))
             return -1;
           if (IS_PTR (dest) && IS_ARRAY (src)) {
             value *val=aggregateToPointer (valFromType(src));
@@ -2289,6 +2301,12 @@ checkFunction (symbol * sym, symbol *csym)
       }
     }
 
+  if (IFFUNC_ISSHADOWREGS(sym->type) && !FUNC_ISISR (sym->type))
+    {
+      werror (E_SHADOWREGS_NO_ISR, sym->name);
+    }
+
+
   for (argCnt=1, acargs = FUNC_ARGS(sym->type); 
        acargs; 
        acargs=acargs->next, argCnt++) {
@@ -2357,6 +2375,17 @@ checkFunction (symbol * sym, symbol *csym)
       werror (E_PREV_DEF_CONFLICT, csym->name, "reentrant");
     }
 
+  if (IFFUNC_ISWPARAM (csym->type) != IFFUNC_ISWPARAM (sym->type))
+    {
+      werror (E_PREV_DEF_CONFLICT, csym->name, "wparam");
+    }
+
+  if (IFFUNC_ISSHADOWREGS (csym->type) != IFFUNC_ISSHADOWREGS (sym->type))
+    {
+      werror (E_PREV_DEF_CONFLICT, csym->name, "shadowregs");
+    }
+  
+
   /* compare expected args with actual args */
   exargs = FUNC_ARGS(csym->type);
   acargs = FUNC_ARGS(sym->type);
@@ -2546,7 +2575,7 @@ processFuncArgs (symbol * func)
               SPEC_STAT (func->etype);
           }
           #endif
-          addSymChain (val->sym);
+          addSymChain (&val->sym);
 
         }
       else                      /* symbol name given create synth name */