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 | 006ae38a494d6b2389b7c67728705dc8da996754 (patch) | |
tree | 6d2c2aee8cbf0ec19d8e9612a10c76e54bd323ed /test/SemaCXX/warn-assignment-condition.cpp | |
parent | cf1620a0ef7f6dc71f4fad5c46fbb0a2de6c6308 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124695 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/warn-assignment-condition.cpp')
-rw-r--r-- | test/SemaCXX/warn-assignment-condition.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/SemaCXX/warn-assignment-condition.cpp b/test/SemaCXX/warn-assignment-condition.cpp index 7596bb26ae..ab9d2ad4a5 100644 --- a/test/SemaCXX/warn-assignment-condition.cpp +++ b/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; +} + |