Unified the per port Makefiles
[fw/sdcc] / src / SDCCglue.c
index 733c0e6a563fe88c3d701d0e143d18f14d61f1a8..3ef90f226a734238ceadc7a7d8f5b5b4018a7832 100644 (file)
@@ -48,7 +48,7 @@ set *publics = NULL;          /* public variables */
 set *externs = NULL;           /* Varibles that are declared as extern */
 
 /* TODO: this should be configurable (DS803C90 uses more than 6) */
-int maxInterrupts = 6;
+unsigned maxInterrupts = 6;
 int allocInfo = 1;
 symbol *mainf;
 extern char *VersionString;
@@ -112,7 +112,7 @@ aopLiteralLong (value * val, int offset, int size)
        /* if it is a float then it gets tricky */
        /* otherwise it is fairly simple */
        if (!IS_FLOAT (val->type)) {
-               unsigned long v = floatFromVal (val);
+               unsigned long v = (unsigned long) floatFromVal (val);
 
                v >>= (offset * 8);
                switch (size) {
@@ -692,8 +692,13 @@ printIvalArray (symbol * sym, sym_link * type, initList * ilist,
 
       /* no of elements given and we    */
       /* have generated for all of them */
-      if (!--lcnt)
+      if (!--lcnt) {
+       /* if initializers left */
+       if (iloop) {
+         werror (W_EXESS_ARRAY_INITIALIZERS, sym->name, sym->lineDef);
+       }
        break;
+      }
     }
 
   /* if we have not been given a size  */
@@ -1029,6 +1034,7 @@ emitStaticSeg (memmap * map, FILE * out)
 void 
 emitMaps ()
 {
+  inInitMode++;
   /* no special considerations for the following
      data, idata & bit & xdata */
   emitRegularMap (data, TRUE, TRUE);
@@ -1041,6 +1047,7 @@ emitMaps ()
   emitRegularMap (code, TRUE, FALSE);
 
   emitStaticSeg (statsg, code->oFile);
+  inInitMode--;
 }
 
 /*-----------------------------------------------------------------*/
@@ -1060,7 +1067,7 @@ flushStatics (void)
 void 
 createInterruptVect (FILE * vFile)
 {
-  int i = 0;
+  unsigned i = 0;
   mainf = newSymbol ("main", 0);
   mainf->block = 0;
 
@@ -1300,17 +1307,17 @@ glue ()
 
   if (!options.c1mode)
     {
-      sprintf (buffer, srcFileName);
-      strcat (buffer, port->assembler.file_ext);
+      sprintf (scratchFileName, srcFileName);
+      strcat (scratchFileName, port->assembler.file_ext);
     }
   else
     {
-      strcpy (buffer, options.out_name);
+      strcpy (scratchFileName, options.out_name);
     }
 
-  if (!(asmFile = fopen (buffer, "w")))
+  if (!(asmFile = fopen (scratchFileName, "w")))
     {
-      werror (E_FILE_OPEN_ERR, buffer);
+      werror (E_FILE_OPEN_ERR, scratchFileName);
       exit (1);
     }