]> andersk Git - splint.git/blobdiff - src/exprNode.c
*** empty log message ***
[splint.git] / src / exprNode.c
index f082ecda733ecb445a8eee13cd708d045be97a71..d62c9669c65f0f3ddaa092f38f97d775eebe2beb 100644 (file)
@@ -1011,6 +1011,7 @@ exprNode exprNode_createId (/*@observer@*/ uentry c)
        }
 
       e->guards = guardSet_new ();
+
       e->sets = sRefSet_new ();
       e->msets = sRefSet_new ();
       e->uses = sRefSet_new ();
@@ -1930,9 +1931,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 +2595,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!"));
@@ -5366,10 +5370,14 @@ exprNode_makeOp (/*@keep@*/ exprNode e1, /*@keep@*/ exprNode e2,
 
   if (opid == OR_OP)
     {
+      exprNode_produceGuards (e2); 
       ret->guards = guardSet_or (ret->guards, e2->guards);
     }
   else if (opid == AND_OP)
     {
+      exprNode_produceGuards (e2); /* evans 2003-08-13: need to produce guards for expression */
+      /* Shouldn't this have already happened? */
+      DPRINTF (("Anding guards: %s / %s", guardSet_unparse (ret->guards), guardSet_unparse (e2->guards)));
       ret->guards = guardSet_and (ret->guards, e2->guards);
     }
   else
@@ -5821,12 +5829,24 @@ exprNode_makeOp (/*@keep@*/ exprNode e1, /*@keep@*/ exprNode e2,
            }
          else
            {
-             voptgenerror
-               (FLG_REALCOMPARE,
-                message ("Dangerous comparison involving %s types: %s",
-                         ctype_unparse (rtype),
-                         exprNode_unparse (ret)),
-                ret->loc);
+             if (opid == EQ_OP || opid == NE_OP) 
+               {
+                 voptgenerror
+                   (FLG_REALCOMPARE,
+                    message ("Dangerous equality comparison involving %s types: %s",
+                             ctype_unparse (rtype),
+                             exprNode_unparse (ret)),
+                    ret->loc);
+               }
+             else
+               {
+                 voptgenerror
+                   (FLG_REALRELATECOMPARE,
+                    message ("Possibly dangerous relational comparison involving %s types: %s",
+                             ctype_unparse (rtype),
+                             exprNode_unparse (ret)),
+                    ret->loc);
+               }
            }
        }
       /*@fallthrough@*/
@@ -6452,6 +6472,26 @@ exprNode_cond (/*@keep@*/ exprNode pred, /*@keep@*/ exprNode ifclause,
   return (ret);
 }
 
+exprNode
+exprNode_condIfOmit (/*@keep@*/ exprNode pred, 
+                    /*@keep@*/ exprNode elseclause)
+{
+  exprNode ifclause = exprNode_createPartialCopy (pred);
+
+  if (!context_flagOn (FLG_GNUEXTENSIONS, exprNode_loc (pred)))
+    {
+      (void) llgenhinterror 
+       (FLG_SYNTAX,
+        message ("Conditionals with Omitted Operands is not supported by ISO C99"),
+        message ("Use +gnuextensions to allow compound statement "
+                 "expressions (and other GNU language extensions) "
+                 "without this warning"),
+        exprNode_loc (pred));
+    }
+  
+  return exprNode_cond(pred, ifclause, elseclause);
+}
+
 exprNode
 exprNode_vaArg (/*@only@*/ lltok tok, /*@only@*/ exprNode arg, /*@only@*/ qtype qt)
 {
This page took 0.079722 seconds and 4 git commands to generate.