[cfe-commits] r44425 - /cfe/trunk/test/Sema/floating-point-compare.c

Ted Kremenek kremenek at apple.com
Wed Nov 28 17:00:11 PST 2007


Author: kremenek
Date: Wed Nov 28 19:00:11 2007
New Revision: 44425

URL: http://llvm.org/viewvc/llvm-project?rev=44425&view=rev
Log:
Added test cases for -Wfloat-equal to test comparisons against literals that can be
represented exactly and inexactly by APFloats. For the former, we do not emit a
warning.

Modified:
    cfe/trunk/test/Sema/floating-point-compare.c

Modified: cfe/trunk/test/Sema/floating-point-compare.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/floating-point-compare.c?rev=44425&r1=44424&r2=44425&view=diff

==============================================================================
--- cfe/trunk/test/Sema/floating-point-compare.c (original)
+++ cfe/trunk/test/Sema/floating-point-compare.c Wed Nov 28 19:00:11 2007
@@ -1,21 +1,29 @@
 // RUN: clang -fsyntax-only -Wfloat-equal -verify %s
 
-int foo(float x, float y) {
+int f1(float x, float y) {
   return x == y; // expected-warning {{comparing floating point with ==}}
 } 
 
-int bar(float x, float y) {
+int f2(float x, float y) {
   return x != y; // expected-warning {{comparing floating point with ==}}
 }
 
-int qux(float x) {
+int f3(float x) {
   return x == x; // no-warning
 }
 
-int baz(float x) {
+int f4(float x) {
 	return x == 0.0; // expected-warning {{comparing}}
 }
 
-int taz(float x) {
+int f5(float x) {
 	return x == __builtin_inf(); // no-warning
-}
\ No newline at end of file
+}
+
+int f6(float x) {
+  return x == 0.0; // no-warning
+}
+
+int f7(float x) {
+  return x == 3.14159; // expected-warning {{comparing}}
+}





More information about the cfe-commits mailing list