[PATCH] D103623: [Clang] Test case for -Wunused-but-set-variable, warn for volatile.

Michael Benfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 11 14:16:40 PDT 2021


mbenfield updated this revision to Diff 351563.
mbenfield added a comment.

rebase and rerun builds


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103623/new/

https://reviews.llvm.org/D103623

Files:
  clang/test/Sema/warn-unused-but-set-variables.c


Index: clang/test/Sema/warn-unused-but-set-variables.c
===================================================================
--- clang/test/Sema/warn-unused-but-set-variables.c
+++ clang/test/Sema/warn-unused-but-set-variables.c
@@ -23,6 +23,10 @@
   int a;
   w = (a = 0);
 
+  // Following gcc, warn for a volatile variable.
+  volatile int b; // expected-warning{{variable 'b' set but not used}}
+  b = 0;
+
   int x;
   x = 0;
   return x;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103623.351563.patch
Type: text/x-patch
Size: 442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210611/cc9b47e1/attachment.bin>


More information about the cfe-commits mailing list