xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/attr-visibility.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc void test0() __attribute__((visibility("default")));
4*f4a2713aSLionel Sambuc void test1() __attribute__((visibility("hidden")));
5*f4a2713aSLionel Sambuc void test2() __attribute__((visibility("internal")));
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc // rdar://problem/10753392
8*f4a2713aSLionel Sambuc void test3() __attribute__((visibility("protected"))); // expected-warning {{target does not support 'protected' visibility; using 'default'}}
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc struct __attribute__((visibility("hidden"))) test4; // expected-note {{previous attribute is here}}
11*f4a2713aSLionel Sambuc struct test4;
12*f4a2713aSLionel Sambuc struct __attribute__((visibility("default"))) test4; // expected-error {{visibility does not match previous declaration}}
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc struct test5;
15*f4a2713aSLionel Sambuc struct __attribute__((visibility("hidden"))) test5; // expected-note {{previous attribute is here}}
16*f4a2713aSLionel Sambuc struct __attribute__((visibility("default"))) test5; // expected-error {{visibility does not match previous declaration}}
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc void test6() __attribute__((visibility("hidden"), // expected-note {{previous attribute is here}}
19*f4a2713aSLionel Sambuc                             visibility("default"))); // expected-error {{visibility does not match previous declaration}}
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc extern int test7 __attribute__((visibility("default"))); // expected-note {{previous attribute is here}}
22*f4a2713aSLionel Sambuc extern int test7 __attribute__((visibility("hidden"))); // expected-error {{visibility does not match previous declaration}}
23*f4a2713aSLionel Sambuc 
24*f4a2713aSLionel Sambuc typedef int __attribute__((visibility("default"))) bar; // expected-warning {{'visibility' attribute ignored}}
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc int x __attribute__((type_visibility("default"))); // expected-error {{'type_visibility' attribute only applies to types and namespaces}}
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc int PR17105 __attribute__((visibility(hidden))); // expected-error {{'visibility' attribute requires a string}}
29