From e31b8fb25b458f00e31dcd657c0840e5238e0f05 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Thu, 5 Apr 2012 00:16:44 +0000 Subject: Enable warn_impcast_literal_float_to_integer by default. This diagnostic seems to be production ready, it's just an oversight that it wasn't turned on by default. The test changes are a bit of a mixed bag. Some tests that seemed like they clearly didn't need to use this behavior have been modified not to use it. Others that I couldn't be sure about, I added the necessary expected-warnings to. It's possible the diagnostic message could be improved to make it clearer that this warning can be suppressed by using a value that won't lose precision when converted to the target type (but can still be a floating point literal, such as "bool b = 1.0;"). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154068 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Sema/array-init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test/Sema/array-init.c') diff --git a/test/Sema/array-init.c b/test/Sema/array-init.c index a979fb9e57..26c0b24182 100644 --- a/test/Sema/array-init.c +++ b/test/Sema/array-init.c @@ -48,7 +48,9 @@ void func() { extern int blockScopeExtern[3] = { 1, 3, 5 }; // expected-error{{'extern' variable cannot have an initializer}} - static long x2[3] = { 1.0, "abc" , 5.8 }; // expected-warning{{incompatible pointer to integer conversion initializing 'long' with an expression of type 'char [4]'}} + static long x2[3] = { 1.0, + "abc", // expected-warning{{incompatible pointer to integer conversion initializing 'long' with an expression of type 'char [4]'}} + 5.8 }; // expected-warning {{implicit conversion turns literal floating-point number into integer}} } void test() { -- cgit v1.2.3-70-g09d2