]> andersk Git - splint.git/blobdiff - src/exprNode.c
*** empty log message ***
[splint.git] / src / exprNode.c
index dca9548f46e4e2a13587fa788639c142107c8e29..d62c9669c65f0f3ddaa092f38f97d775eebe2beb 100644 (file)
@@ -5829,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@*/
@@ -6460,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.032604 seconds and 4 git commands to generate.