summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/array-struct-region.c
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2012-04-05 00:16:44 +0000
committerDavid Blaikie <dblaikie@gmail.com>2012-04-05 00:16:44 +0000
commit09ffc9b47385f7965bbd2d6bcc646221ab1ff704 (patch)
tree04e05de38dcfc4834b500550d59a77f0dfacef6f /clang/test/Analysis/array-struct-region.c
parenta658226ac03f1fce39c61e310bae030b7c9ec9fe (diff)
downloadbcm5719-llvm-09ffc9b47385f7965bbd2d6bcc646221ab1ff704.tar.gz
bcm5719-llvm-09ffc9b47385f7965bbd2d6bcc646221ab1ff704.zip
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;"). llvm-svn: 154068
Diffstat (limited to 'clang/test/Analysis/array-struct-region.c')
-rw-r--r--clang/test/Analysis/array-struct-region.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/test/Analysis/array-struct-region.c b/clang/test/Analysis/array-struct-region.c
index 1284933db09..4b085c8d700 100644
--- a/clang/test/Analysis/array-struct-region.c
+++ b/clang/test/Analysis/array-struct-region.c
@@ -25,8 +25,8 @@ int string_literal_init() {
}
void nested_compound_literals(int rad) {
- int vec[6][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169},
- {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
+ int vec[6][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, // expected-warning 6 {{implicit conversion turns literal floating-point number into integer}}
+ {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; // expected-warning 6 {{implicit conversion turns literal floating-point number into integer}}
int a;
for (a = 0; a < 6; ++a) {
OpenPOWER on IntegriCloud