]> andersk Git - splint.git/commitdiff
Fixed scanf %x problem.
authorevans1629 <evans1629>
Wed, 13 Aug 2003 01:52:46 +0000 (01:52 +0000)
committerevans1629 <evans1629>
Wed, 13 Aug 2003 01:52:46 +0000 (01:52 +0000)
src/cprim.c
src/exprNode.c
src/llerror.c

index df3b7095016de6db85dde9625cb429ba7f129fb8..b77db8c0758d21537a1093bc4b26d9f19fd1c7d7 100644 (file)
@@ -81,7 +81,7 @@ static bool
 cprim_closeEnoughAux (cprim c1, cprim c2, bool deep)
 {
   if (c1 == c2) return TRUE;
-
+  
   DPRINTF (("cprim close: %s / %s", cprim_unparse (c1), cprim_unparse (c2)));
 
   if (c1 == CTX_ANYINTEGRAL)
@@ -108,8 +108,13 @@ cprim_closeEnoughAux (cprim c1, cprim c2, bool deep)
 
   if (c1 == CTX_UNSIGNEDINTEGRAL)
     {
-      if (context_getFlag (FLG_MATCHANYINTEGRAL)
-         || context_getFlag (FLG_IGNOREQUALS))
+      /* We allow signed ints to match any integral if matchanyintegral is set */
+      if (context_getFlag (FLG_MATCHANYINTEGRAL)) {
+       return (cprim_isAnyInt (c2)
+               || (cprim_isAnyChar (c2) && context_msgCharInt ()));
+      }
+      
+      if (context_getFlag (FLG_IGNOREQUALS))
        {
          if (context_getFlag (FLG_IGNORESIGNS)) 
            {
@@ -134,8 +139,13 @@ cprim_closeEnoughAux (cprim c1, cprim c2, bool deep)
 
   if (c1 == CTX_SIGNEDINTEGRAL)
     {
-      if (context_getFlag (FLG_MATCHANYINTEGRAL)
-         || context_getFlag (FLG_IGNOREQUALS))
+      /* We allow signed ints to match any integral if matchanyintegral is set */
+      if (context_getFlag (FLG_MATCHANYINTEGRAL)) {
+       return (cprim_isAnyInt (c2)
+               || (cprim_isAnyChar (c2) && context_msgCharInt ()));
+      }
+
+      if (context_getFlag (FLG_IGNOREQUALS))
        {
          return (cprim_isAnyInt (c2)
                  || (cprim_isAnyChar (c2) && context_msgCharInt ()));
index f082ecda733ecb445a8eee13cd708d045be97a71..bdd0870ef029ddf4b868601cea9f265439ba4d14 100644 (file)
@@ -1930,9 +1930,12 @@ checkScanfArgs (/*@notnull@*/ /*@dependent@*/ exprNode f, uentry fcn,
                              
                            case 'i': 
                            case 'd':
+                             expecttype = ctype_makePointer (ctype_combine (ctype_int, modtype));
+                             /*@switchbreak@*/ break;
+
                            case 'x':
                            case 'X': /* unsigned int */
-                             expecttype = ctype_makePointer (ctype_combine (ctype_int, modtype));
+                             expecttype = ctype_makePointer (ctype_combine (ctype_uint, modtype));
                              /*@switchbreak@*/ break;
                              
                            case 'e':
@@ -2591,7 +2594,7 @@ static int
                      f->guards = guardSet_union (f->guards, a->guards);
                      
                      DPRINTF (("match arg: %s / %s", ctype_unparse (ct), ctype_unparse (a->typ)));
-
+                     
                      if (!(exprNode_matchArgType (ct, a)))
                        {
                          DPRINTF (("Args mismatch!"));
index fde743bccfa52c79c80917126618745734692b72..3e6978e916e194e1d91d8b8c6ead86b44c426844 100644 (file)
@@ -721,25 +721,27 @@ llgentypeerroraux (char *srcFile, int srcLine,
     }
   else if (ctype_isArbitraryIntegral (ctype_realType (ut1)))
     {
+      DPRINTF (("HERE: %s", ctype_unparse (ctype_realType (ut2))));
+
       if (ctype_isArbitraryIntegral (ctype_realType (ut2)))
        {
          hcode = FLG_MATCHANYINTEGRAL;
        }
-      else if (ctype_match (ut2, ctype_ulint))
+      else if (ctype_equal (ut2, ctype_ulint))
        {
          hcode = FLG_LONGUNSIGNEDINTEGRAL;
        }
-      else if (ctype_match (ut2, ctype_lint))
+      else if (ctype_equal (ut2, ctype_lint))
        {
          hcode = FLG_LONGINTEGRAL;
        }
       else if (ctype_isInt (ut2))
        {
          hcode = FLG_MATCHANYINTEGRAL;
-       }
+       }         
       else
        {
-         ;
+         hcode = FLG_TYPE;
        }
     }
   else if (ctype_isArbitraryIntegral (ctype_realType (ut2)))
This page took 0.067972 seconds and 5 git commands to generate.