[PATCH] D103938: Diagnose -Wunused-value in constant evaluation context

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 17 09:27:11 PDT 2021


aaron.ballman added a comment.

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.)



================
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}}
 }
----------------
Why did we lose this diagnostic?


================
Comment at: clang/test/Sema/exprs.c:19
   if (0) {
-    0 / (0 ? 1 : 0); // expected-warning {{expression result unused}}
   }
----------------
Why did we lose this diagnostic (and the above comment about not changing the test)?


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