1 // RUN: %clang_cc1 -fsyntax-only -Wunused -std=c2x -verify %s
2 
3 struct [[maybe_unused]] S1 { // ok
4   int a [[maybe_unused]];
5 };
6 
7 enum [[maybe_unused]] E1 {
8   EnumVal [[maybe_unused]]
9 };
10 
unused_func(int parm)11 [[maybe_unused]] void unused_func([[maybe_unused]] int parm) {
12   typedef int maybe_unused_int [[maybe_unused]];
13   [[maybe_unused]] int I;
14 }
15 
f1(void)16 void f1(void) {
17   int x; // expected-warning {{unused variable}}
18   typedef int I; // expected-warning {{unused typedef 'I'}}
19 
20   // Should not warn about these due to not being used.
21   [[maybe_unused]] int y;
22   typedef int maybe_unused_int [[maybe_unused]];
23 
24   // Should not warn about these uses.
25   struct S1 s;
26   maybe_unused_int test;
27   y = 12;
28 }
29 
30 void f2(void);
31 [[maybe_unused]] void f2(void);
32 
f2(void)33 void f2(void) {
34 }
35 
36