]> andersk Git - splint.git/blobdiff - src/exprNode.c
Fixed problem with global struct assignments.
[splint.git] / src / exprNode.c
index 9df0718fc68b9b5120ce88d85a61414cc7753b2c..7af8f10720673667cff5194eda0aaf1dec27b751 100644 (file)
@@ -2925,7 +2925,7 @@ checkGlobMods (/*@notnull@*/ /*@dependent@*/ exprNode f,
                      uentry_unparse (le)));
       
       params = ctype_argsFunction (ct);
-      return; /*@32 ! remove this? */
+      return; /* No checking for non-function */
     }
 
   /*
@@ -3133,7 +3133,7 @@ checkGlobMods (/*@notnull@*/ /*@dependent@*/ exprNode f,
 
              if (sRef_isObserver (b))
                {
-                 exprNode e = exprNodeList_nth (args, usymId_toInt (sRef_getParam (rb)));
+                 exprNode e = exprNodeList_nth (args, sRef_getParam (rb));
                  
                  if (optgenerror 
                      (FLG_MODOBSERVER,
@@ -5009,8 +5009,8 @@ exprNode_cast (/*@only@*/ lltok tok, /*@only@*/ exprNode e, /*@only@*/ qtype q)
   ret->edata = exprData_makeCast (tok, e, q);
 
   ret->sref = sRef_copy (e->sref);
-  
-  DPRINTF (("Cast 2: -> %s", sRef_unparseFull (ret->sref)));
+
+  DPRINTF (("Cast: -> %s", sRef_unparseFull (ret->sref)));
 
   if (!sRef_isConst (e->sref))
     {
@@ -9888,11 +9888,11 @@ exprNode_matchLiteral (ctype expected, exprNode e)
            }
          else if (multiVal_isChar (m))
            {
-             char val = multiVal_forceChar (m);          
+             /*signed? */ char val = multiVal_forceChar (m);      
              
              if (ctype_isChar (expected))
                {
-                 if (ctype_isUnsigned (expected) && ((int)val) < 0)
+                 if (ctype_isUnsigned (expected) && ((int) val) < 0)
                    {
                      return FALSE;
                    }
@@ -10679,8 +10679,20 @@ static ctype
          DPRINTF (("No error: [%s] %s / [%s]  %s",
                    exprNode_unparse (e1), ctype_unparse (tr1),
                    exprNode_unparse (e2), ctype_unparse (tr2)));
+         
+         /*
+         ** evans 2003-06-15: changed this so if either type is a literal,
+         **    the other type is used.
+         **    (Need to look at the ISO C99 rules on this...)
+         */
 
-         ret = ctype_biggerType (tr1, tr2);
+         if (exprNode_isNumLiteral (e1)) {
+           ret = tr2;
+         } else if (exprNode_isNumLiteral (e2)) {
+           ret = tr1;
+         } else {
+           ret = ctype_biggerType (tr1, tr2);
+         }
        }
       else
        {
@@ -11438,31 +11450,22 @@ static void checkUniqueParams (exprNode fcn,
     } end_exprNodeList_elements;
 }
 
-long exprNode_getLongValue (exprNode e) {
+long exprNode_getLongValue (exprNode e) 
+{
   long value;
-
-  if (exprNode_hasValue (e) 
-      && multiVal_isInt (exprNode_getValue (e)))
+  
+  if (exprNode_hasValue (e) && multiVal_isInt (exprNode_getValue (e)))
     {
       value = multiVal_forceInt (exprNode_getValue (e));
     }
   else
     {
-      /*@!! BADBRANCH;*/
-      value = 0;
+      value = 0; /* Unknown value */
     }
   
   return value;
 }
 
-/*@observer@*/ fileloc exprNode_getfileloc (exprNode p_e)
-{
-  if (exprNode_isDefined (p_e) )
-    return ( p_e->loc );
-  else
-    return fileloc_undefined;
-}
-
 /*@only@*/ fileloc exprNode_getNextSequencePoint (exprNode e)
 {
   /*
This page took 0.039036 seconds and 4 git commands to generate.