diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-02-01 22:36:09 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-02-01 22:36:09 +0000 |
commit | c358d9f3053c06b503bdc0c24783c0338d909a1c (patch) | |
tree | 73469b557608ba976323df456f534386f420e1ca /clang/test/SemaCXX/warn-assignment-condition.cpp | |
parent | 59513209aa95c567a014ed6eaf48722af46c08f2 (diff) | |
download | bcm5719-llvm-c358d9f3053c06b503bdc0c24783c0338d909a1c.tar.gz bcm5719-llvm-c358d9f3053c06b503bdc0c24783c0338d909a1c.zip |
Don't warn about extraneous '()' around a comparison if it occurs within a macro.
Macros frequently contain extra '()' to make instantiation less error prone.
This warning was flagging a ton of times on postgresql because of its use of macros.
llvm-svn: 124695
Diffstat (limited to 'clang/test/SemaCXX/warn-assignment-condition.cpp')
-rw-r--r-- | clang/test/SemaCXX/warn-assignment-condition.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/warn-assignment-condition.cpp b/clang/test/SemaCXX/warn-assignment-condition.cpp index 7596bb26aea..ab9d2ad4a57 100644 --- a/clang/test/SemaCXX/warn-assignment-condition.cpp +++ b/clang/test/SemaCXX/warn-assignment-condition.cpp @@ -124,3 +124,13 @@ void test2() { // expected-note {{remove extraneous parentheses around the comparison to silence this warning}} if ((test2 == fn)) {} } + +// Do not warn about extra '()' used within a macro. This pattern +// occurs frequently. +#define COMPARE(x,y) (x == y) +int test3(int x, int y) { + if (COMPARE(x, y)) // no-warning + return 0; + return 1; +} + |