* src/SDCCicode.c (operandOperation): fixed EQ_OP bug, now same as in valCompare...
[fw/sdcc] / src / SDCCglue.c
index 47584b541fdcdbad0a014a3fdabfcaef069159d7..222b11d23a0d758c7dcbe9258d140d77a11f3a2d 100644 (file)
@@ -294,7 +294,7 @@ emitRegularMap (memmap * map, bool addPublics, bool arFlag)
           else
             DCL_PTR_CONST (newSym->type) = 1;
          SPEC_STAT(newSym->etype)=1;
-         resolveIvalSym(newSym->ival);
+         resolveIvalSym(newSym->ival, newSym->type);
 
          // add it to the "XINIT (CODE)" segment
          addSet(&xinit->syms, newSym);
@@ -304,11 +304,11 @@ emitRegularMap (memmap * map, bool addPublics, bool arFlag)
            ival = initAggregates (sym, sym->ival, NULL);
          } else {
            if (getNelements(sym->type, sym->ival)>1) {
-             werrorfl (filename, sym->lineDef, W_EXCESS_INITIALIZERS, "scalar", 
+             werrorfl (sym->fileDef, sym->lineDef, W_EXCESS_INITIALIZERS, "scalar", 
                      sym->name);
            }
            ival = newNode ('=', newAst_VALUE (symbolVal (sym)),
-                           decorateType (resolveSymbols (list2expr (sym->ival))));
+                           decorateType (resolveSymbols (list2expr (sym->ival)), RESULT_CHECK));
          }
          codeOutFile = statsg->oFile;
 
@@ -351,7 +351,7 @@ emitRegularMap (memmap * map, bool addPublics, bool arFlag)
       else {
        int size = getSize (sym->type);
        if (size==0) {
-         werrorfl (filename, sym->lineDef, E_UNKNOWN_SIZE, sym->name);
+         werrorfl (sym->fileDef, sym->lineDef, E_UNKNOWN_SIZE, sym->name);
        }
        /* allocate space */
        if (options.debug) {
@@ -746,7 +746,7 @@ printIvalStruct (symbol * sym, sym_link * type,
 
        sflds = SPEC_STRUCT (type)->fields;
        if (ilist->type != INIT_DEEP) {
-               werrorfl (filename, sym->lineDef, E_INIT_STRUCT, sym->name);
+               werrorfl (sym->fileDef, sym->lineDef, E_INIT_STRUCT, sym->name);
                return;
        }
 
@@ -760,7 +760,7 @@ printIvalStruct (symbol * sym, sym_link * type,
                }
        }
        if (iloop) {
-         werrorfl (filename, sym->lineDef, W_EXCESS_INITIALIZERS, "struct", sym->name);
+         werrorfl (sym->fileDef, sym->lineDef, W_EXCESS_INITIALIZERS, "struct", sym->name);
        }
        return;
 }
@@ -810,7 +810,7 @@ printIvalArray (symbol * sym, sym_link * type, initList * ilist,
   /* by a string                      */
   if (IS_CHAR (type->next)) {
     if (!IS_LITERAL(list2val(ilist)->etype)) {
-      werrorfl (filename, ilist->lineno, E_CONST_EXPECTED);
+      werrorfl (ilist->filename, ilist->lineno, E_CONST_EXPECTED);
       return;
     }
     if (printIvalChar (type,
@@ -821,7 +821,7 @@ printIvalArray (symbol * sym, sym_link * type, initList * ilist,
   /* not the special case             */
   if (ilist->type != INIT_DEEP)
     {
-      werrorfl (filename, ilist->lineno, E_INIT_STRUCT, sym->name);
+      werrorfl (ilist->filename, ilist->lineno, E_INIT_STRUCT, sym->name);
       return;
     }
 
@@ -830,7 +830,7 @@ printIvalArray (symbol * sym, sym_link * type, initList * ilist,
       printIval (sym, type->next, iloop, oFile);
       
       if (++size > DCL_ELEM(type)) {
-       werrorfl (filename, sym->lineDef, W_EXCESS_INITIALIZERS, "array", sym->name);
+       werrorfl (sym->fileDef, sym->lineDef, W_EXCESS_INITIALIZERS, "array", sym->name);
        break;
       }
     }
@@ -869,7 +869,7 @@ printIvalFuncPtr (sym_link * type, initList * ilist, FILE * oFile)
 
   if (IS_LITERAL(val->etype)) {
     if (compareType(type,val->etype)==0) {
-      werrorfl (filename, ilist->lineno, E_INCOMPAT_TYPES);
+      werrorfl (ilist->filename, ilist->lineno, E_INCOMPAT_TYPES);
       printFromToType (val->type, type);
     }
     printIvalCharPtr (NULL, type, val, oFile);
@@ -980,7 +980,7 @@ printIvalCharPtr (symbol * sym, sym_link * type, value * val, FILE * oFile)
        case 3:
          if (IS_GENPTR(type) && floatFromVal(val)!=0) {
            // non-zero mcs51 generic pointer
-           werrorfl (filename, sym->lineDef, E_LITERAL_GENERIC);
+           werrorfl (sym->fileDef, sym->lineDef, E_LITERAL_GENERIC);
          }
          if (port->little_endian) {
            fprintf (oFile, "\t.byte %s,%s,%s\n",
@@ -997,7 +997,7 @@ printIvalCharPtr (symbol * sym, sym_link * type, value * val, FILE * oFile)
        case 4:
          if (IS_GENPTR(type) && floatFromVal(val)!=0) {
            // non-zero ds390 generic pointer
-           werrorfl (filename, sym->lineDef, E_LITERAL_GENERIC);
+           werrorfl (sym->fileDef, sym->lineDef, E_LITERAL_GENERIC);
          }
          if (port->little_endian) {
            fprintf (oFile, "\t.byte %s,%s,%s,%s\n",
@@ -1055,7 +1055,7 @@ printIvalPtr (symbol * sym, sym_link * type, initList * ilist, FILE * oFile)
 
   /* check the type      */
   if (compareType (type, val->type) == 0) {
-    werrorfl (filename, ilist->lineno, W_INIT_WRONG);
+    werrorfl (ilist->filename, ilist->lineno, W_INIT_WRONG);
     printFromToType (val->type, type);
   }
 
@@ -1143,7 +1143,7 @@ printIval (symbol * sym, sym_link * type, initList * ilist, FILE * oFile)
   if (ilist->type!=INIT_NODE) {
       // or a 1-element list
     if (ilist->init.deep->next) {
-      werrorfl (filename, sym->lineDef, W_EXCESS_INITIALIZERS, "scalar", 
+      werrorfl (sym->fileDef, sym->lineDef, W_EXCESS_INITIALIZERS, "scalar", 
              sym->name);
     } else {
       ilist=ilist->init.deep;
@@ -1160,7 +1160,7 @@ printIval (symbol * sym, sym_link * type, initList * ilist, FILE * oFile)
        IS_PTR(type) && DCL_TYPE(type)==CPOINTER) {
       // no sweat
     } else {
-      werrorfl (filename, ilist->lineno, E_TYPE_MISMATCH, "assignment", " ");
+      werrorfl (ilist->filename, ilist->lineno, E_TYPE_MISMATCH, "assignment", " ");
       printFromToType(itype, type);
     }
   }
@@ -1243,7 +1243,7 @@ emitStaticSeg (memmap * map, FILE * out)
            {
              fprintf (out, "%s:\n", sym->rname);
              noAlloc++;
-             resolveIvalSym (sym->ival);
+             resolveIvalSym (sym->ival, sym->type);
              printIval (sym, sym->type, sym->ival, out);
              noAlloc--;
              /* if sym is a simple string and sym->ival is a string, 
@@ -1259,7 +1259,7 @@ emitStaticSeg (memmap * map, FILE * out)
              int size = getSize (sym->type);
              
              if (size==0) {
-                 werrorfl (filename, sym->lineDef, E_UNKNOWN_SIZE,sym->name);
+                 werrorfl (sym->fileDef, sym->lineDef, E_UNKNOWN_SIZE,sym->name);
              }
              fprintf (out, "%s:\n", sym->rname);
              /* special case for character strings */
@@ -1354,14 +1354,21 @@ createInterruptVect (FILE * vFile)
 
       fprintf (vFile, "\tljmp\t__sdcc_gsinit_startup\n");
 
-
       /* now for the other interrupts */
       for (; i < maxInterrupts; i++)
        {
          if (interrupts[i])
-           fprintf (vFile, "\tljmp\t%s\n\t.ds\t5\n", interrupts[i]->rname);
+           {
+             fprintf (vFile, "\tljmp\t%s\n", interrupts[i]->rname);
+             if ( i != maxInterrupts - 1 )
+               fprintf (vFile, "\t.ds\t5\n");
+           }
          else
-           fprintf (vFile, "\treti\n\t.ds\t7\n");
+           {
+             fprintf (vFile, "\treti\n");
+             if ( i != maxInterrupts - 1 )
+               fprintf (vFile, "\t.ds\t7\n");
+           }
        }
     }
 }
@@ -1508,7 +1515,7 @@ emitOverlay (FILE * afile)
              int size = getSize(sym->type);
 
              if (size==0) {
-                 werrorfl (filename, sym->lineDef, E_UNKNOWN_SIZE);
+                 werrorfl (sym->fileDef, sym->lineDef, E_UNKNOWN_SIZE);
              }       
              if (options.debug)
                  fprintf (afile, "==.\n");