xref: /aosp_15_r20/external/clang/test/Sema/attr-used.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -verify -fsyntax-only -Wno-private-extern %s
2*67e74705SXin Li 
3*67e74705SXin Li extern int l0 __attribute__((used)); // expected-warning {{'used' attribute ignored}}
4*67e74705SXin Li __private_extern__ int l1 __attribute__((used)); // expected-warning {{'used' attribute ignored}}
5*67e74705SXin Li 
6*67e74705SXin Li struct __attribute__((used)) s { // expected-warning {{'used' attribute only applies to variables and functions}}
7*67e74705SXin Li   int x;
8*67e74705SXin Li };
9*67e74705SXin Li 
10*67e74705SXin Li int a __attribute__((used));
11*67e74705SXin Li 
f0(void)12*67e74705SXin Li static void __attribute__((used)) f0(void) {
13*67e74705SXin Li }
14*67e74705SXin Li 
f1()15*67e74705SXin Li void f1() {
16*67e74705SXin Li   static int a __attribute__((used));
17*67e74705SXin Li   int b __attribute__((used)); // expected-warning {{'used' attribute ignored}}
18*67e74705SXin Li }
19*67e74705SXin Li 
20*67e74705SXin Li static void __attribute__((used)) f0(void);
21