Fixed up implicit data type conversions
authorjtvolpe <jtvolpe@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 20 May 2001 03:26:07 +0000 (03:26 +0000)
committerjtvolpe <jtvolpe@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 20 May 2001 03:26:07 +0000 (03:26 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@830 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCicode.c
src/SDCCicode.h
src/SDCCloop.c
src/SDCCval.h
src/pic/glue.c
src/port.h

index 29867e0fd6caa001b7d6ac912747f3e1b1dff807..6196ce2254575208a2537cbe7ffd225073a24abc 100644 (file)
@@ -954,7 +954,7 @@ operandOperation (operand * left, operand * right,
       break;
     case RRC:
       {
-       long i = operandLitValue (left);
+       long i = (long) operandLitValue (left);
 
        retval = operandFromLit ((i >> (getSize (operandType (left)) * 8 - 1)) |
                                 (i << 1));
@@ -962,7 +962,7 @@ operandOperation (operand * left, operand * right,
       break;
     case RLC:
       {
-       long i = operandLitValue (left);
+       long i = (long) operandLitValue (left);
 
        retval = operandFromLit ((i << (getSize (operandType (left)) * 8 - 1)) |
                                 (i >> 1));
@@ -1294,7 +1294,7 @@ operandFromLink (sym_link * type)
 /* operandFromLit - makes an operand from a literal value          */
 /*-----------------------------------------------------------------*/
 operand *
-operandFromLit (float i)
+operandFromLit (double i)
 {
   return operandFromValue (valueFromLit (i));
 }
@@ -1407,7 +1407,7 @@ usualUnaryConversions (operand * op)
 {
   if (IS_INTEGRAL (operandType (op)))
     {
-      if (getSize (operandType (op)) < INTSIZE)
+      if (getSize (operandType (op)) < (unsigned int) INTSIZE)
        {
          /* Widen to int. */
          return geniCodeCast (INTTYPE, op, TRUE);
@@ -2393,7 +2393,7 @@ geniCodeLogic (operand * left, operand * right, int op)
   if (IS_INTEGRAL (ltype) && IS_LITERAL (rtype))
     {
       int nbits = bitsForType (ltype);
-      long v = operandLitValue (right);
+      long v = (long) operandLitValue (right);
 
       if (v > ((LONG_LONG) 1 << nbits) && v > 0)
        werror (W_CONST_RANGE, " compare operation ");
@@ -2489,7 +2489,7 @@ geniCodeAssign (operand * left, operand * right, int nosupdate)
   if (IS_INTEGRAL (ltype) && right->type == VALUE && IS_LITERAL (rtype))
     {
       int nbits = bitsForType (ltype);
-      long v = operandLitValue (right);
+      long v = (long) operandLitValue (right);
 
       if (v > ((LONG_LONG) 1 << nbits) && v > 0)
        werror (W_CONST_RANGE, " = operation");
index d8d8e31ee671730b97e20f140f2a8a1825cb78e3..d94c8de517b0dec8e9076df91f7078e26b75dd91 100644 (file)
@@ -282,7 +282,7 @@ iCodeTable *getTableEntry (int);
 int isOperandLiteral (operand *);
 operand *operandOperation (operand *, operand *, int, sym_link *);
 double operandLitValue (operand *);
-operand *operandFromLit (float);
+operand *operandFromLit (double);
 operand *operandFromOperand (operand *);
 int isParameterToCall (value *, operand *);
 iCode *newiCodeLabelGoto (int, symbol *);
index 6a5b239fcb5be9b961f5f1c477a39c79dfef49cd..ca70d4b338eb52bb9bbbee8e7492d54a12002163 100644 (file)
@@ -758,8 +758,8 @@ basicInduction (region * loopReg, eBBlock ** ebbs, int count)
            continue;
 
          aSym = (IS_OP_LITERAL (IC_RIGHT (dic)) ?
-             (litValue = operandLitValue (IC_RIGHT (dic)), IC_LEFT (dic)) :
-             (litValue = operandLitValue (IC_LEFT (dic)), IC_RIGHT (dic)));
+             (litValue = (unsigned long) operandLitValue (IC_RIGHT (dic)), IC_LEFT (dic)) :
+             (litValue = (unsigned long) operandLitValue (IC_LEFT (dic)), IC_RIGHT (dic)));
 
          if (!isOperandEqual (IC_RESULT (ic), aSym) &&
              !isOperandEqual (IC_RIGHT (ic), aSym))
@@ -937,8 +937,8 @@ loopInduction (region * loopReg, eBBlock ** ebbs, int count)
            continue;
 
          aSym = (IS_SYMOP (IC_LEFT (ic)) ?
-         (lr = 1, litVal = operandLitValue (IC_RIGHT (ic)), IC_LEFT (ic)) :
-                 (litVal = operandLitValue (IC_LEFT (ic)), IC_RIGHT (ic)));
+         (lr = 1, litVal = (unsigned long) operandLitValue (IC_RIGHT (ic)), IC_LEFT (ic)) :
+                 (litVal = (unsigned long) operandLitValue (IC_LEFT (ic)), IC_RIGHT (ic)));
 
          ip = NULL;
          /* check if this is an induction variable */
@@ -947,8 +947,8 @@ loopInduction (region * loopReg, eBBlock ** ebbs, int count)
 
          /* ask port for size not worth if native instruction
             exist for multiply & divide */
-         if (getSize (operandType (IC_LEFT (ic))) <= port->muldiv.native_below ||
-         getSize (operandType (IC_RIGHT (ic))) <= port->muldiv.native_below)
+         if (getSize (operandType (IC_LEFT (ic))) <= (unsigned long) port->muldiv.native_below ||
+         getSize (operandType (IC_RIGHT (ic))) <= (unsigned long) port->muldiv.native_below)
            continue;
 
          /* if this is a division then the remainder should be zero
index 0ca0de48047d548d327b5e033631170e7f83a32f..17c4ba4a3df5597857a05dca0383bdc2d0ede3c1 100644 (file)
@@ -89,7 +89,7 @@ value *valCompare (value *, value *, int);
 value *valBitwise (value *, value *, int);
 value *valLogicAndOr (value *, value *, int);
 value *valCastLiteral (sym_link *, double);
-value *valueFromLit (float);
+value *valueFromLit (double);
 initList *newiList (int, void *);
 initList *revinit (initList *);
 initList *copyIlist (initList *);
index 8ede432fa9a1e107b6366d971eebd355c2410baf..767fb3ecc50085e359a3f597887f58e913695cff 100644 (file)
@@ -33,7 +33,7 @@ extern symbol *interrupts[256];
 void printIval (symbol *, sym_link *, initList *, FILE *);
 extern int noAlloc;
 extern set *publics;
-extern int maxInterrupts;
+extern unsigned maxInterrupts;
 extern int maxRegBank;
 extern symbol *mainf;
 extern char *VersionString;
@@ -806,7 +806,7 @@ pic14emitMaps ()
 static void
 pic14createInterruptVect (FILE * vFile)
 {
-  int i = 0;
+  unsigned i = 0;
   mainf = newSymbol ("main", 0);
   mainf->block = 0;
 
index e0470a8f45e42aa6f1784809837ae9a9fe7a383c..0e6459b77aa44c12008ee7b363e6532ebced1c4f 100644 (file)
@@ -148,7 +148,7 @@ typedef struct
        /** One more than the smallest 
            mul/div operation the processor can do nativley 
            Eg if the processor has an 8 bit mul, nativebelow is 2 */
-       int native_below;
+       unsigned native_below;
        /** The mul/div/mod functions will be made to use regparams
            for sizeof(param) < log2(force_reg)
            i.e. Use 2 for WORD and BYTE, 0 for none. */