* src/pic16/glue.c, src/SDCCast.c, src/SDCCast.h, src/SDCCBBlock.c,
[fw/sdcc] / src / pic16 / glue.c
index c8f77a159390ba83611a7f40cea1957d5df3cea4..63ee1c71c37bd65376759e9f348439ddb0ef18f1 100644 (file)
@@ -360,7 +360,7 @@ pic16emitRegularMap (memmap * map, bool addPublics, bool arFlag)
                         }
 
                         if(ival) {
-                                setAstLineno(ival, sym->lineDef);
+                                setAstFileLine (ival, sym->fileDef, sym->lineDef);
                                 codeOutBuf = &statsg->oBuf;
                                 GcurMemmap = statsg;
                                 eBBlockFromiCode (iCodeFromAst (ival));
@@ -520,10 +520,10 @@ void _pic16_printPointerType (const char *name, char ptype, void *p)
 {
   char buf[256];
 
-        sprintf(buf, "LOW(%s)", name);
-        pic16_emitDS(buf, ptype, p);
-        sprintf(buf, "HIGH(%s)", name);
-        pic16_emitDS(buf, ptype, p);
+  sprintf (buf, "LOW(%s)", name);
+  pic16_emitDS (buf, ptype, p);
+  sprintf (buf, "HIGH(%s)", name);
+  pic16_emitDS (buf, ptype, p);
 }
 
 /*-----------------------------------------------------------------*/
@@ -543,28 +543,33 @@ void pic16_printGPointerType (const char *iname, const unsigned int itype,
 {
   char buf[256];
 
-    _pic16_printPointerType (iname, ptype, p);
+  _pic16_printPointerType (iname, ptype, p);
 
-    switch( itype ) {
+  switch (itype)
+    {
+    case CPOINTER:
+    case FUNCTION:
+      sprintf (buf, "UPPER(%s)", iname);
+      pic16_emitDS (buf, ptype, p);
+      break;
+
+    case GPOINTER:
+    case POINTER:
+      sprintf (buf, "0x80");
+      pic16_emitDS (buf, ptype, p);
+      break;
+
+    /*
+     * FPOINTER and IPOINTER are not used in pic16 port
       case FPOINTER:
-      case CPOINTER:
-      case GPOINTER:
-      case FUNCTION:
-        {
-          sprintf(buf, "UPPER(%s)", iname);
-          pic16_emitDS(buf, ptype, p);
-        }; break;
-      case POINTER:
       case IPOINTER:
-        sprintf(buf, "0x80");
-        pic16_emitDS(buf, ptype, p);
-        break;
-      default:
-        debugf("itype = %d\n", itype );
-        assert( 0 );
+     */
+    default:
+      debugf ("itype = %d\n", itype );
+      assert (0);
     }
 
-    //pic16_flushDB(ptype, p); /* might break char* const arr[] = {...}; */
+  //pic16_flushDB(ptype, p); /* might break char* const arr[] = {...}; */
 }
 
 
@@ -596,7 +601,7 @@ pic16_printIvalType (symbol *sym, sym_link * type, initList * ilist, char ptype,
 
   if (!(val = list2val (ilist))) {
     // assuming a warning has been thrown
-    val=constVal("0");
+    val = constCharVal (0);
   }
 
   if (val->type != type) {
@@ -1020,7 +1025,7 @@ void pic16_printIvalFuncPtr (sym_link * type, initList * ilist, char ptype, void
 
   if (!val) {
     // an error has been thrown already
-    val=constVal("0");
+    val = constCharVal (0);
   }
 
   if (IS_LITERAL(val->etype)) {
@@ -1383,7 +1388,7 @@ CODESPACE: %d\tCONST: %d\tPTRCONST: %d\tSPEC_CONST: %d\n", __FUNCTION__,
 
               /* symbol doesn't have absolute address but has initial value */
               dbuf_printf (&code->oBuf, "%s:\n", sym->rname);
-              noAlloc++;
+              ++noAlloc;
               resolveIvalSym (sym->ival, sym->type);
 
               pb = pic16_newpCodeChain(NULL, 'P',pic16_newpCodeCharP("; Starting pCode block for Ival"));
@@ -1400,7 +1405,7 @@ CODESPACE: %d\tCONST: %d\tPTRCONST: %d\tSPEC_CONST: %d\n", __FUNCTION__,
               //fprintf(stderr, "%s:%d [2] generating init for label: %s\n", __FILE__, __LINE__, sym->rname);
               pic16_printIval(sym, sym->type, sym->ival, 'p', (void *)pb);
               pic16_flushDB('p', (void *)pb);
-              noAlloc--;
+              --noAlloc;
             } else {
 
               /* symbol doesn't have absolute address and no initial value */