]> andersk Git - splint.git/blobdiff - src/exprNode.c
Updated build to use automake files created by Tim Van Holder.
[splint.git] / src / exprNode.c
index b03bf2a050c018d787603f757e211603b0b0ea40..4df0d3374a024ab365e2ecde682d78610aba4990 100644 (file)
@@ -5222,6 +5222,7 @@ exprNode_makeOp (/*@keep@*/ exprNode e1, /*@keep@*/ exprNode e2,
 
   tret = ctype_unknown;
   te1 = exprNode_getType (e1);
+
   DPRINTF (("te1 = %s / %s", exprNode_unparse (e1), ctype_unparse (te1)));
 
   te2 = exprNode_getType (e2);
@@ -5569,6 +5570,10 @@ exprNode_makeOp (/*@keep@*/ exprNode e1, /*@keep@*/ exprNode e2,
        case NE_OP:
        case TLT:               /* comparisons                           */
        case TGT:               /*    numeric, numeric -> bool           */
+
+         DPRINTF (("Here we go: %s / %s",
+                   ctype_unparse (tr1), ctype_unparse (tr2)));
+
          if ((ctype_isReal (tr1) && !ctype_isInt (tr1))
              || (ctype_isReal (tr2) && !ctype_isInt (tr2)))
            {
@@ -5637,6 +5642,9 @@ exprNode_makeOp (/*@keep@*/ exprNode e1, /*@keep@*/ exprNode e2,
          ** Types should match.
          */
 
+         DPRINTF (("Match types: %s / %s", exprNode_unparse (e1),
+                   exprNode_unparse (e2)));
+
          if (!exprNode_matchTypes (e1, e2))
            {
              hasError = gentypeerror 
@@ -9370,7 +9378,22 @@ exprNode_matchLiteral (ctype expected, exprNode e)
                }
              else if (ctype_isArrayPtr (expected))
                {
-                 return (val == 0);
+                 /* 
+                 ** evans 2001-10-14: We allow 0 to match any pointer, but only if the type matches or is void *.
+                 */
+
+                 if (val == 0)
+                   {
+                     if (ctype_match (exprNode_getType (e), expected)
+                         || ctype_isVoidPointer (exprNode_getType (e)))
+                       {
+                         return TRUE;
+                       }
+                   }
+                 else
+                   {
+                     return FALSE;
+                   }
                }
              else if (ctype_isAnyFloat (expected))
                {
@@ -9453,6 +9476,10 @@ exprNode_matchTypes (exprNode e1, exprNode e2)
       return TRUE;
     }
 
+  DPRINTF (("Matching literal! %s %s %s %s",
+           ctype_unparse (t1), exprNode_unparse (e2),
+           ctype_unparse (t2), exprNode_unparse (e1)));
+
   return (exprNode_matchLiteral (t1, e2) || exprNode_matchLiteral (t2, e1));
 }
 
@@ -10166,7 +10193,9 @@ static ctype
       if ((ctype_isRealInt (tr1) || ctype_isReal (tr1)) &&
          (ctype_isRealInt (tr2) || ctype_isReal (tr2)))
        {
-         ;
+         DPRINTF (("No error: [%s] %s / [%s]  %s",
+                   exprNode_unparse (e1), ctype_unparse (tr1),
+                   exprNode_unparse (e2), ctype_unparse (tr2)));
        }
       else
        {
This page took 0.055721 seconds and 4 git commands to generate.