annotate clang/test/Sema/attr-availability-macosx.c @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 "-triple" "x86_64-apple-darwin9.0.0" -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 #if !__has_feature(attribute_availability_with_strict)
anatofuz
parents:
diff changeset
4 #error "Missing __has_feature"
anatofuz
parents:
diff changeset
5 #endif
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 void f0(int) __attribute__((availability(macosx,introduced=10.4,deprecated=10.6)));
anatofuz
parents:
diff changeset
8 void f1(int) __attribute__((availability(macosx,introduced=10.5)));
anatofuz
parents:
diff changeset
9 void f2(int) __attribute__((availability(macosx,introduced=10.4,deprecated=10.5))); // expected-note {{'f2' has been explicitly marked deprecated here}}
anatofuz
parents:
diff changeset
10 void f3(int) __attribute__((availability(macosx,introduced=10.6)));
anatofuz
parents:
diff changeset
11 void f4(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(ios,introduced=2.0,deprecated=3.0))); // expected-note{{explicitly marked unavailable}}
anatofuz
parents:
diff changeset
12 void f5(int) __attribute__((availability(ios,introduced=3.2), availability(macosx,unavailable))); // expected-note{{'f5' has been explicitly marked unavailable here}}
anatofuz
parents:
diff changeset
13 void f6(int) __attribute__((availability(macOS,strict,introduced=10.6))); //expected-note{{'f6' has been explicitly marked unavailable here}}
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 void test() {
anatofuz
parents:
diff changeset
16 f0(0);
anatofuz
parents:
diff changeset
17 f1(0);
anatofuz
parents:
diff changeset
18 f2(0); // expected-warning{{'f2' is deprecated: first deprecated in macOS 10.5}}
anatofuz
parents:
diff changeset
19 f3(0);
anatofuz
parents:
diff changeset
20 f4(0); // expected-error{{f4' is unavailable: obsoleted in macOS 10.5}}
anatofuz
parents:
diff changeset
21 f5(0); // expected-error{{'f5' is unavailable: not available on macOS}}
anatofuz
parents:
diff changeset
22 f6(0); // expected-error{{'f6' is unavailable: introduced in macOS 10.6}}
anatofuz
parents:
diff changeset
23 }
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 struct __attribute__((availability(macosx,strict,introduced=10.6)))
anatofuz
parents:
diff changeset
26 not_yet_introduced_struct; // \
anatofuz
parents:
diff changeset
27 expected-note{{'not_yet_introduced_struct' has been explicitly marked unavailable here}}
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 void uses_not_introduced_struct(struct not_yet_introduced_struct *); // \
anatofuz
parents:
diff changeset
30 expected-error{{'not_yet_introduced_struct' is unavailable: introduced in macOS 10.6}}
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 __attribute__((availability(macosx,strict,introduced=10.6)))
anatofuz
parents:
diff changeset
33 void uses_not_introduced_struct_same_availability(struct not_yet_introduced_struct *);
anatofuz
parents:
diff changeset
34
anatofuz
parents:
diff changeset
35 // rdar://10535640
anatofuz
parents:
diff changeset
36
anatofuz
parents:
diff changeset
37 enum {
anatofuz
parents:
diff changeset
38 foo __attribute__((availability(macosx,introduced=8.0,deprecated=9.0)))
anatofuz
parents:
diff changeset
39 };
anatofuz
parents:
diff changeset
40
anatofuz
parents:
diff changeset
41 enum {
anatofuz
parents:
diff changeset
42 bar __attribute__((availability(macosx,introduced=8.0,deprecated=9.0))) = foo
anatofuz
parents:
diff changeset
43 };
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 enum __attribute__((availability(macosx,introduced=8.0,deprecated=9.0))) {
anatofuz
parents:
diff changeset
46 bar1 = foo
anatofuz
parents:
diff changeset
47 };
anatofuz
parents:
diff changeset
48
anatofuz
parents:
diff changeset
49 // Make sure the note is on the declaration with the actual availability attributes.
anatofuz
parents:
diff changeset
50 struct __attribute__((availability(macOS,strict,introduced=10.9))) type_info // \
anatofuz
parents:
diff changeset
51 expected-note{{'type_info' has been explicitly marked unavailable here}}
anatofuz
parents:
diff changeset
52 {
anatofuz
parents:
diff changeset
53 };
anatofuz
parents:
diff changeset
54 struct type_info;
anatofuz
parents:
diff changeset
55 int test2() {
anatofuz
parents:
diff changeset
56 struct type_info *t; // expected-error{{'type_info' is unavailable: introduced in macOS 10.9}}
anatofuz
parents:
diff changeset
57 return 0;
anatofuz
parents:
diff changeset
58 }