[PATCH] D103938: Diagnose -Wunused-value in constant evaluation context
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 20 06:47:37 PDT 2021
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
In D103938#3007708 <https://reviews.llvm.org/D103938#3007708>, @ychen wrote:
> In D103938#3006540 <https://reviews.llvm.org/D103938#3006540>, @aaron.ballman wrote:
>
>> There were a few behavioral changes to tests that I had questions about. Also, can you add an additional test case that shows the behavior when the left operand of the comma expression is volatile (or do we already have that covered and I missed it)? e.g.,
>>
>> int func() {
>> volatile int *ip = (volatile int *)0xFEEDFACE;
>> return (*ip, 1);
>> }
>>
>> (In this case, we shouldn't diagnose that the left operand has no effect because reading a volatile variable is an operation with a side effect.)
>
> It seems this is covered by svn157362.
Thanks, LGTM!
================
Comment at: clang/test/CodeCompletion/pragma-macro-token-caching.c:15
Outer(__extension__({ _Pragma(2) })); // expected-error {{_Pragma takes a parenthesized string literal}}
- param; // expected-warning {{expression result unused}}
}
----------------
ychen wrote:
> aaron.ballman wrote:
> > Why did we lose this diagnostic?
> CFG analysis thinks it is unreachable, so it is not diagnosed.
Oh, I see now -- the CFG thinks this is unreachable because of the previous error.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103938/new/
https://reviews.llvm.org/D103938
More information about the cfe-commits
mailing list