blob: 4e3bda7609bb10d740bebb28a268914ce2bd3ce2 [file] [log] [blame]
Fariborz Jahanianf85f3382012-08-17 21:44:55 +00001// RUN: %clang_cc1 -verify -fsyntax-only -Wno-private-extern %s
Daniel Dunbarfee07a02009-02-13 19:23:53 +00002
Aaron Ballman88fe3222013-12-26 17:30:44 +00003extern int l0 __attribute__((used)); // expected-warning {{'used' attribute ignored}}
4__private_extern__ int l1 __attribute__((used)); // expected-warning {{'used' attribute ignored}}
Daniel Dunbar311bf292009-02-13 22:48:56 +00005
John McCall4bb48362011-01-25 03:51:08 +00006struct __attribute__((used)) s { // expected-warning {{'used' attribute only applies to variables and functions}}
Daniel Dunbarfee07a02009-02-13 19:23:53 +00007 int x;
8};
9
10int a __attribute__((used));
11
12static void __attribute__((used)) f0(void) {
13}
14
15void f1() {
Aaron Ballman88fe3222013-12-26 17:30:44 +000016 static int a __attribute__((used));
17 int b __attribute__((used)); // expected-warning {{'used' attribute ignored}}
Daniel Dunbarfee07a02009-02-13 19:23:53 +000018}
19
Rafael Espindola53192e72012-11-23 13:54:40 +000020static void __attribute__((used)) f0(void);