summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/null_in_arithmetic_ops.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2011-08-11 22:38:21 +0000
committerRichard Trieu <rtrieu@google.com>2011-08-11 22:38:21 +0000
commitaee9e76722d03a8a196d1c9b51243d1e618dd12c (patch)
tree4fddbe631f9916592410652ed6f5b55f1379652e /clang/test/SemaCXX/null_in_arithmetic_ops.cpp
parentaa07cb6a98b3f63e1afe7b241227ce5b6aa66177 (diff)
downloadbcm5719-llvm-aee9e76722d03a8a196d1c9b51243d1e618dd12c.tar.gz
bcm5719-llvm-aee9e76722d03a8a196d1c9b51243d1e618dd12c.zip
The current warning in -Wnull-arithmetic for comparisons between NULL and non-pointers is not very helpful. This patch will update the wording to be more helpful to users.
Old warning: warning: use of NULL in arithmetic operation [-Wnull-arithmetic] return 10 <= NULL; ^ ~~~~ New warning: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic] return 10 <= NULL; ~~ ^ ~~~~ llvm-svn: 137377
Diffstat (limited to 'clang/test/SemaCXX/null_in_arithmetic_ops.cpp')
-rw-r--r--clang/test/SemaCXX/null_in_arithmetic_ops.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/test/SemaCXX/null_in_arithmetic_ops.cpp b/clang/test/SemaCXX/null_in_arithmetic_ops.cpp
index fab6f10ab78..24590ce633f 100644
--- a/clang/test/SemaCXX/null_in_arithmetic_ops.cpp
+++ b/clang/test/SemaCXX/null_in_arithmetic_ops.cpp
@@ -64,12 +64,12 @@ void f() {
a |= NULL; // expected-warning{{use of NULL in arithmetic operation}}
a ^= NULL; // expected-warning{{use of NULL in arithmetic operation}}
- b = a < NULL || NULL < a; // expected-warning 2{{use of NULL in arithmetic operation}}
- b = a > NULL || NULL > a; // expected-warning 2{{use of NULL in arithmetic operation}}
- b = a <= NULL || NULL <= a; // expected-warning 2{{use of NULL in arithmetic operation}}
- b = a >= NULL || NULL >= a; // expected-warning 2{{use of NULL in arithmetic operation}}
- b = a == NULL || NULL == a; // expected-warning 2{{use of NULL in arithmetic operation}}
- b = a != NULL || NULL != a; // expected-warning 2{{use of NULL in arithmetic operation}}
+ b = a < NULL || a > NULL; // expected-warning 2{{comparison between NULL and non-pointer ('int' and NULL)}}
+ b = NULL < a || NULL > a; // expected-warning 2{{comparison between NULL and non-pointer (NULL and 'int')}}
+ b = a <= NULL || a >= NULL; // expected-warning 2{{comparison between NULL and non-pointer ('int' and NULL)}}
+ b = NULL <= a || NULL >= a; // expected-warning 2{{comparison between NULL and non-pointer (NULL and 'int')}}
+ b = a == NULL || a != NULL; // expected-warning 2{{comparison between NULL and non-pointer ('int' and NULL)}}
+ b = NULL == a || NULL != a; // expected-warning 2{{comparison between NULL and non-pointer (NULL and 'int')}}
b = &a < NULL || NULL < &a || &a > NULL || NULL > &a;
b = &a <= NULL || NULL <= &a || &a >= NULL || NULL >= &a;
@@ -82,7 +82,7 @@ void f() {
b = NULL <= NULL || NULL >= NULL;
b = NULL == NULL || NULL != NULL;
- b = ((NULL)) != a; // expected-warning{{use of NULL in arithmetic operation}}
+ b = ((NULL)) != a; // expected-warning{{comparison between NULL and non-pointer (NULL and 'int')}}
// Check that even non-standard pointers don't warn.
b = c == NULL || NULL == c || c != NULL || NULL != c;
OpenPOWER on IntegriCloud