Fixed mixed type compares and conversions
authorjtvolpe <jtvolpe@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 20 Apr 2001 02:49:24 +0000 (02:49 +0000)
committerjtvolpe <jtvolpe@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 20 Apr 2001 02:49:24 +0000 (02:49 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@748 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/pic/gen.c
src/pic/genarith.c
src/pic/glue.c
src/pic/ralloc.c

index 0c8d2825a42487c7467903567fe6791e23ac6484..e42fc0b0d6875ed52da2242e8d16783d254ed33b 100644 (file)
 #include "SDCCglobl.h"
 #include "newalloc.h"
 
-#if defined(_MSC_VER)
-#define __FUNCTION__           __FILE__
-#endif
-
 #ifdef HAVE_SYS_ISA_DEFS_H
 #include <sys/isa_defs.h>
 #else
@@ -468,9 +464,9 @@ static asmop *aopForRemat (symbol *sym)
     DEBUGpic14_emitcode(";","%s %d",__FUNCTION__,__LINE__);
     for (;;) {
        if (ic->op == '+')
-           val += operandLitValue(IC_RIGHT(ic));
+           val += (int) operandLitValue(IC_RIGHT(ic));
        else if (ic->op == '-')
-           val -= operandLitValue(IC_RIGHT(ic));
+           val -= (int) operandLitValue(IC_RIGHT(ic));
        else
            break;
        
@@ -681,7 +677,7 @@ void aopOp (operand *op, iCode *ic, bool result)
        }
 
         if (sym->ruonly ) {
-            int i;
+            unsigned i;
             aop = op->aop = sym->aop = newAsmop(AOP_STR);
             aop->size = getSize(sym->type);
             for ( i = 0 ; i < fReturnSizePic ; i++ )
@@ -7032,7 +7028,7 @@ static void genDataPointerSet(operand *right,
            sprintf(buffer,"%s",l);
 
        if (AOP_TYPE(right) == AOP_LIT) {
-         unsigned int lit = floatFromVal (AOP(IC_RIGHT(ic))->aopu.aop_lit);
+         unsigned int lit = (unsigned int) floatFromVal (AOP(IC_RIGHT(ic))->aopu.aop_lit);
          lit = lit >> (8*offset);
          if(lit&0xff) {
            pic14_emitcode("movlw","%d",lit);
@@ -7131,7 +7127,7 @@ static void genNearPointerSet (operand *right,
             } else {
 
              if (AOP_TYPE(right) == AOP_LIT) {
-               unsigned int lit = floatFromVal (AOP(IC_RIGHT(ic))->aopu.aop_lit);
+               unsigned int lit = (unsigned int) floatFromVal (AOP(IC_RIGHT(ic))->aopu.aop_lit);
                if(lit) {
                  pic14_emitcode("movlw","%s",l);
                  pic14_emitcode("movwf","indf ;2");
index 8aadcda27129ed677afba00aaf186829a11ca2f8..d056e5cca7395f56b85a6883a6c805111ad5d9f1 100644 (file)
 #include "pcode.h"
 #include "gen.h"
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 /*-----------------------------------------------------------------*/
 /* genPlusIncr :- does addition with increment if possible         */
 /*-----------------------------------------------------------------*/
@@ -97,7 +82,7 @@ bool genPlusIncr (iCode *ic)
     DEBUGpic14_emitcode ("; ","%s  %d",__FUNCTION__,__LINE__);
     /* if the literal value of the right hand side
        is greater than 1 then it is faster to add */
-    if ((icount =  floatFromVal (AOP(IC_RIGHT(ic))->aopu.aop_lit)) > 2)
+    if ((icount = (unsigned int) floatFromVal (AOP(IC_RIGHT(ic))->aopu.aop_lit)) > 2)
         return FALSE ;
     
     /* if increment 16 bits in register */
@@ -383,7 +368,7 @@ void genPlus (iCode *ic)
     if(AOP(IC_RIGHT(ic))->type == AOP_LIT) {
       /* Add a literal to something else */
       bool know_W=0;
-      unsigned lit = floatFromVal(AOP(IC_RIGHT(ic))->aopu.aop_lit);
+      unsigned lit = (unsigned) floatFromVal(AOP(IC_RIGHT(ic))->aopu.aop_lit);
       unsigned l1=0;
 
       offset = 0;
index 32f86b4e5ce2b776f7cc41295617e041f8b225f8..8ede432fa9a1e107b6366d971eebd355c2410baf 100644 (file)
@@ -105,7 +105,7 @@ int pic14aopLiteral (value *val, int offset)
   /* 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);
     return ( (v >> (offset * 8)) & 0xff);
index e3b92273b04474590f9a3975dac2e204d4634e8e..47f44544a40ba9a9e07ec2192384fb6af06f33c8 100644 (file)
 #include "pcode.h"
 #include "gen.h"
 
-#if defined(_MSC_VER)
-#define __FUNCTION__ __FILE__
-#endif
-
 /*-----------------------------------------------------------------*/
 /* At this point we start getting processor specific although      */
 /* some routines are non-processor specific & can be reused when   */
@@ -1580,7 +1576,7 @@ serialRegAssign (eBBlock ** ebbs, int count)
              /* if we need ptr regs for the right side
                 then mark it */
              if (POINTER_GET (ic) && getSize (OP_SYMBOL (IC_LEFT (ic))->type)
-                 <= PTRSIZE)
+                 <= (unsigned) PTRSIZE)
                {
                  pic14_ptrRegReq++;
                  ptrRegSet = 1;