diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-12-03 01:05:50 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-12-03 01:05:50 +0000 |
commit | e8efd99b24a9d5ef6dc011854380dbc73cb0de8c (patch) | |
tree | eefc9d77ce2aec6c2da515dbcffd1ce8bd2f3b7d /clang/test/Sema | |
parent | 4a5697e659a29cf258708097d65a9882b2598958 (diff) | |
download | bcm5719-llvm-e8efd99b24a9d5ef6dc011854380dbc73cb0de8c.tar.gz bcm5719-llvm-e8efd99b24a9d5ef6dc011854380dbc73cb0de8c.zip |
PR21706: -Wunsequenced was missing warnings when leaving a sequenced region that contained side effects.
llvm-svn: 223184
Diffstat (limited to 'clang/test/Sema')
-rw-r--r-- | clang/test/Sema/warn-unsequenced.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/test/Sema/warn-unsequenced.c b/clang/test/Sema/warn-unsequenced.c index a14d3281662..10c1ff615c0 100644 --- a/clang/test/Sema/warn-unsequenced.c +++ b/clang/test/Sema/warn-unsequenced.c @@ -29,6 +29,11 @@ void test() { a = f(a++, 0); // ok a = f(++a, a++); // expected-warning {{multiple unsequenced modifications}} + ++a + f(++a, 0); // expected-warning {{multiple unsequenced modifications}} + f(++a, 0) + ++a; // expected-warning {{multiple unsequenced modifications}} + a++ + f(a++, 0); // expected-warning {{multiple unsequenced modifications}} + f(a++, 0) + a++; // expected-warning {{multiple unsequenced modifications}} + a = ++a; // expected-warning {{multiple unsequenced modifications}} a += ++a; // expected-warning {{unsequenced modification and access}} @@ -48,7 +53,7 @@ void test() { (1 ? a : ++a) + a; // ok (xs[5] ? ++a : ++a) + a; // FIXME: warn here - (++a, xs[6] ? ++a : 0) + a; // FIXME: warn here + (++a, xs[6] ? ++a : 0) + a; // expected-warning {{unsequenced modification and access}} // Here, the read of the fourth 'a' might happen before or after the write to // the second 'a'. @@ -84,5 +89,5 @@ void test() { (__builtin_classify_type(++a) ? 1 : 0) + ++a; // ok (__builtin_constant_p(++a) ? 1 : 0) + ++a; // ok - (__builtin_expect(++a, 0) ? 1 : 0) + ++a; // FIXME: warn here + (__builtin_expect(++a, 0) ? 1 : 0) + ++a; // expected-warning {{multiple unsequenced modifications}} } |