diff options
| author | Matt Beaumont-Gay <matthewbg@google.com> | 2013-01-17 02:06:08 +0000 |
|---|---|---|
| committer | Matt Beaumont-Gay <matthewbg@google.com> | 2013-01-17 02:06:08 +0000 |
| commit | 978cca9f49a1c0e3a01096017c9a34726866fbf3 (patch) | |
| tree | c513b2ae6119b9ecbee691724a4a93d2479319e2 /clang/test/Preprocessor/pragma_microsoft.c | |
| parent | eaa75a69ad5d7e2279b58d9c2b6fc4aea35b1aa1 (diff) | |
| download | bcm5719-llvm-978cca9f49a1c0e3a01096017c9a34726866fbf3.tar.gz bcm5719-llvm-978cca9f49a1c0e3a01096017c9a34726866fbf3.zip | |
Suppress all -Wunused-value warnings from macro body expansions.
This is inspired by a number of false positives in real code, including
PR14968. I've added test cases reduced from these false positives to
test/Sema/unused-expr.c, as well as corresponding test cases that pass the
offending expressions as arguments to a no-op macro to ensure that we do warn
there.
This also removes my previous tweak from r166522/r166534, so that we warn on
unused cast expressions in macro arguments.
There were several test cases that were using -Wunused-value to test general
diagnostic emission features; I changed those to use other warnings or warn on
a macro argument expression. I stared at the test case for PR14399 for a while
with Richard Smith and we believe the new test case exercises the same
codepaths as before.
llvm-svn: 172696
Diffstat (limited to 'clang/test/Preprocessor/pragma_microsoft.c')
| -rw-r--r-- | clang/test/Preprocessor/pragma_microsoft.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/test/Preprocessor/pragma_microsoft.c b/clang/test/Preprocessor/pragma_microsoft.c index 156d05243b1..c0ddf74340c 100644 --- a/clang/test/Preprocessor/pragma_microsoft.c +++ b/clang/test/Preprocessor/pragma_microsoft.c @@ -26,7 +26,7 @@ __pragma(comment(linker," bar=" BAR)) #define MACRO_WITH__PRAGMA { \ __pragma(warning(push)); \ __pragma(warning(disable: 10000)); \ - 2+2; \ + 1 + (2 > 3) ? 4 : 5; \ __pragma(warning(pop)); \ } @@ -36,7 +36,8 @@ void f() // If we ever actually *support* __pragma(warning(disable: x)), // this warning should go away. - MACRO_WITH__PRAGMA // expected-warning {{expression result unused}} + MACRO_WITH__PRAGMA // expected-warning {{lower precedence}} \ + // expected-note 2 {{place parentheses}} } |

