Tim Northover | 935d79b | 2015-11-02 21:14:48 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 "-triple" "arm64-apple-watchos3.0" -fsyntax-only -verify %s |
Tim Northover | 7a73cc7 | 2015-10-30 16:30:49 +0000 | [diff] [blame] | 2 | |
Tim Northover | 935d79b | 2015-11-02 21:14:48 +0000 | [diff] [blame] | 3 | void f0(int) __attribute__((availability(ios,introduced=2.0,deprecated=2.1))); // expected-note {{'f0' has been explicitly marked deprecated here}} |
| 4 | void f1(int) __attribute__((availability(ios,introduced=2.1))); |
| 5 | void f2(int) __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{'f2' has been explicitly marked deprecated here}} |
| 6 | void f3(int) __attribute__((availability(ios,introduced=3.0))); |
| 7 | void f4(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(ios,introduced=2.0,deprecated=2.1,obsoleted=3.0))); // expected-note{{explicitly marked unavailable}} |
| 8 | void f5(int) __attribute__((availability(ios,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0))); // expected-note {{'f5' has been explicitly marked deprecated here}} |
| 9 | void f6(int) __attribute__((availability(ios,deprecated=12.1))); // OK - not deprecated for watchOS |
| 10 | void f7(int) __attribute__((availability(ios,deprecated=8.3))); // expected-note {{'f7' has been explicitly marked deprecated here}} |
| 11 | void f8(int) __attribute__((availability(ios,introduced=2.0,obsoleted=10.0))); // expected-note {{explicitly marked unavailable}} |
Tim Northover | 7a73cc7 | 2015-10-30 16:30:49 +0000 | [diff] [blame] | 12 | |
| 13 | void test() { |
Tim Northover | 935d79b | 2015-11-02 21:14:48 +0000 | [diff] [blame] | 14 | f0(0); // expected-warning{{'f0' is deprecated: first deprecated in watchOS 2.0}} |
Tim Northover | 7a73cc7 | 2015-10-30 16:30:49 +0000 | [diff] [blame] | 15 | f1(0); |
Tim Northover | 935d79b | 2015-11-02 21:14:48 +0000 | [diff] [blame] | 16 | f2(0); // expected-warning{{'f2' is deprecated: first deprecated in watchOS 2.0}} |
Tim Northover | 7a73cc7 | 2015-10-30 16:30:49 +0000 | [diff] [blame] | 17 | f3(0); |
Tim Northover | 935d79b | 2015-11-02 21:14:48 +0000 | [diff] [blame] | 18 | f4(0); // expected-error {{f4' is unavailable: obsoleted in watchOS 2.0}} |
| 19 | f5(0); // expected-warning {{'f5' is deprecated: first deprecated in watchOS 2.0}} |
| 20 | f6(0); |
| 21 | f7(0); // expected-warning {{'f7' is deprecated: first deprecated in watchOS 2.0}} |
| 22 | f8(0); // expected-error {{'f8' is unavailable: obsoleted in watchOS 3.0}} |
| 23 | } |
| 24 | |
| 25 | // Test watchOS specific attributes. |
| 26 | void f0_watchos(int) __attribute__((availability(watchos,introduced=2.0,deprecated=2.1))); // expected-note {{'f0_watchos' has been explicitly marked deprecated here}} |
| 27 | void f1_watchos(int) __attribute__((availability(watchos,introduced=2.1))); |
| 28 | void f2_watchos(int) __attribute__((availability(watchos,introduced=2.0,deprecated=3.0))); // expected-note {{'f2_watchos' has been explicitly marked deprecated here}} |
| 29 | void f3_watchos(int) __attribute__((availability(watchos,introduced=3.0))); |
| 30 | void f4_watchos(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(watchos,introduced=2.0,deprecated=2.1,obsoleted=3.0))); // expected-note{{explicitly marked unavailable}} |
| 31 | void f5_watchos(int) __attribute__((availability(watchos,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0))); |
| 32 | void f5_attr_reversed_watchos(int) __attribute__((availability(ios, deprecated=3.0))) __attribute__((availability(watchos,introduced=2.0))); |
| 33 | void f5b_watchos(int) __attribute__((availability(watchos,introduced=2.0))) __attribute__((availability(watchos,deprecated=3.0))); // expected-note {{'f5b_watchos' has been explicitly marked deprecated here}} |
| 34 | void f5c_watchos(int) __attribute__((availability(ios,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0))); // expected-note {{'f5c_watchos' has been explicitly marked deprecated here}} |
| 35 | void f6_watchos(int) __attribute__((availability(watchos,deprecated=3.0))); |
| 36 | void f6_watchos(int) __attribute__((availability(watchos,introduced=2.0))); // expected-note {{'f6_watchos' has been explicitly marked deprecated here}} |
| 37 | |
| 38 | void test_watchos() { |
| 39 | f0_watchos(0); // expected-warning{{'f0_watchos' is deprecated: first deprecated in watchOS 2.1}} |
| 40 | f1_watchos(0); |
| 41 | f2_watchos(0); // expected-warning{{'f2_watchos' is deprecated: first deprecated in watchOS 3.0}} |
| 42 | f3_watchos(0); |
| 43 | f4_watchos(0); // expected-error{{'f4_watchos' is unavailable: obsoleted in watchOS 3.0}} |
| 44 | // We get no warning here because any explicit 'watchos' availability causes |
| 45 | // the ios availablity to not implicitly become 'watchos' availability. Otherwise we'd get |
| 46 | // a deprecated warning. |
| 47 | f5_watchos(0); // no-warning |
| 48 | f5_attr_reversed_watchos(0); // no-warning |
| 49 | // We get a deprecated warning here because both attributes are explicitly 'watchos'. |
| 50 | f5b_watchos(0); // expected-warning {{'f5b_watchos' is deprecated: first deprecated in watchOS 3.0}} |
| 51 | // We get a deprecated warning here because both attributes are 'ios' (both get mapped to 'watchos'). |
| 52 | f5c_watchos(0); // expected-warning {{'f5c_watchos' is deprecated: first deprecated in watchOS 2.0}} |
| 53 | f6_watchos(0); // expected-warning {{'f6_watchos' is deprecated: first deprecated in watchOS 3.0}} |
Tim Northover | 7a73cc7 | 2015-10-30 16:30:49 +0000 | [diff] [blame] | 54 | } |