* as/hc08/lkaomf51.c (OutputName),
[fw/sdcc] / src / SDCCast.c
index f3ae4175283b5039a973591c53ddbcea72da5e21..f57bc1489db9bd8de82c98f483d28b920f2a1b94 100644 (file)
@@ -2123,7 +2123,7 @@ reverseLoop (ast * loop, symbol * sym, ast * init, ast * end)
 /* searchLitOp - search tree (*ops only) for an ast with literal */
 /*-----------------------------------------------------------------*/
 static ast *
-searchLitOp (ast *tree, ast **parent, const unsigned char *ops)
+searchLitOp (ast *tree, ast **parent, const char *ops)
 {
   ast *ret;
 
@@ -3093,7 +3093,7 @@ decorateType (ast * tree, RESULT_TYPE resultType)
       /* rearrange the tree */
       if (IS_LITERAL (RTYPE (tree))
           /* avoid infinite loop */
-          && (TYPE_UDWORD) floatFromVal (tree->right->opval.val) != 1)
+          && (TYPE_TARGET_ULONG) floatFromVal (tree->right->opval.val) != 1)
         {
           ast *parent;
           ast *litTree = searchLitOp (tree, &parent, "/");
@@ -3537,7 +3537,7 @@ decorateType (ast * tree, RESULT_TYPE resultType)
       /* rearrange the tree */
       if (IS_LITERAL (RTYPE (tree))
           /* avoid infinite loop */
-          && (TYPE_UDWORD) floatFromVal (tree->right->opval.val) != 0)
+          && (TYPE_TARGET_ULONG) floatFromVal (tree->right->opval.val) != 0)
         {
           ast *litTree, *litParent;
           litTree = searchLitOp (tree, &litParent, "+-");
@@ -3759,7 +3759,7 @@ decorateType (ast * tree, RESULT_TYPE resultType)
       /* if only the right side is a literal & we are
          shifting more than size of the left operand then zero */
       if (IS_LITERAL (RTYPE (tree)) &&
-          ((TYPE_UDWORD) floatFromVal (valFromType (RETYPE (tree)))) >=
+          ((TYPE_TARGET_ULONG) floatFromVal (valFromType (RETYPE (tree)))) >=
           (getSize (TETYPE (tree)) * 8))
         {
           if (tree->opval.op==LEFT_OP ||
@@ -3866,7 +3866,8 @@ decorateType (ast * tree, RESULT_TYPE resultType)
         unsigned int gptype = 0;
         unsigned int addr = SPEC_ADDR (sym->etype);
 
-        if (IS_GENPTR (LTYPE (tree)) && GPTRSIZE > FPTRSIZE)
+        if (IS_GENPTR (LTYPE (tree)) && ((GPTRSIZE > FPTRSIZE)
+                                        || TARGET_IS_PIC16) )
           {
             switch (SPEC_SCLS (sym->etype))
               {
@@ -3885,6 +3886,9 @@ decorateType (ast * tree, RESULT_TYPE resultType)
                 break;
               default:
                 gptype = 0;
+
+                if(TARGET_IS_PIC16 && (SPEC_SCLS(sym->etype) == S_FIXED))
+                    gptype = GPTYPE_NEAR;
               }
             addr |= gptype << (8*(GPTRSIZE - 1));
           }
@@ -5320,7 +5324,7 @@ isBitAndPow2 (ast * tree)
   if (!IS_AST_LIT_VALUE (tree->right))
     return -1;
 
-  return powof2 ((TYPE_UDWORD)AST_LIT_VALUE (tree->right));
+  return powof2 ((TYPE_TARGET_ULONG)AST_LIT_VALUE (tree->right));
 }
 
 /*-----------------------------------------------------------------*/
@@ -6114,10 +6118,10 @@ void ast_print (ast * tree, FILE *outfile, int indent)
                 if (IS_LITERAL (tree->opval.val->etype)) {
                         fprintf(outfile,"CONSTANT (%p) value = ", tree);
                         if (SPEC_USIGN (tree->opval.val->etype))
-                                fprintf(outfile,"%u", (TYPE_UDWORD) floatFromVal(tree->opval.val));
+                                fprintf(outfile,"%u", (TYPE_TARGET_ULONG) floatFromVal(tree->opval.val));
                         else
-                                fprintf(outfile,"%d", (TYPE_DWORD) floatFromVal(tree->opval.val));
-                        fprintf(outfile,", 0x%x, %f", (TYPE_UDWORD) floatFromVal(tree->opval.val),
+                                fprintf(outfile,"%d", (TYPE_TARGET_LONG) floatFromVal(tree->opval.val));
+                        fprintf(outfile,", 0x%x, %f", (TYPE_TARGET_ULONG) floatFromVal(tree->opval.val),
                                                       floatFromVal(tree->opval.val));
                 } else if (tree->opval.val->sym) {
                         /* if the undefined flag is set then give error message */