[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
       
    Thu Jun  3 08:54:21 PDT 2021
    
    
  
mbenfield created this revision.
mbenfield added a reviewer: sberg.
mbenfield requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This was requested by sberg.
Repository:
  rG LLVM Github Monorepo
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.349567.patch
Type: text/x-patch
Size: 442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210603/334d1c4f/attachment.bin>
    
    
More information about the cfe-commits
mailing list