This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] annotate warning() with OPT_Wfloat_equal


On Monday 23 January 2006 15:16, Gabriel Dos Reis wrote:

> OK with Andreas' comment?

Of course. My guess was that the warn_xxx is still used in some places in case 
the check for the warning is expensive. But two simple comparisons probably 
don't hurt in a noticeable way. 

Updated patch in testing, OK if it passes?

2006-01-23  Dirk Mueller  <dmueller@suse.de>

        * typeck.c (build_binary_op): Annotate -Wopt-float-equal warning
        as such.

--- typeck.c	(revision 110088)
+++ typeck.c	(working copy)
@@ -3087,8 +3087,9 @@ build_binary_op (enum tree_code code, tr
 
     case EQ_EXPR:
     case NE_EXPR:
-      if (warn_float_equal && (code0 == REAL_TYPE || code1 == REAL_TYPE))
-	warning (0, "comparing floating point with == or != is unsafe");
+      if (code0 == REAL_TYPE || code1 == REAL_TYPE)
+	warning (OPT_Wfloat_equal, "comparing floating point with == or != "
+                 "is unsafe");
       if ((TREE_CODE (orig_op0) == STRING_CST && !integer_zerop (op1))
 	  || (TREE_CODE (orig_op1) == STRING_CST && !integer_zerop (op0)))
 	warning (OPT_Wstring_literal_comparison,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]