Bob Wilson | b111ec9 | 2015-03-02 19:01:14 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -fsyntax-only -fapplication-extension %s -verify |
| 2 | // RUN: %clang_cc1 -triple armv7-apple-ios9.0 -fsyntax-only -fapplication-extension %s -verify |
Tim Northover | 935d79b | 2015-11-02 21:14:48 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -triple arm64-apple-tvos3.0 -fsyntax-only -fapplication-extension -DTVOS=1 -verify %s |
| 4 | // RUN: %clang_cc1 -triple arm64-apple-tvos3.0 -fsyntax-only -fapplication-extension -verify %s |
Bob Wilson | b111ec9 | 2015-03-02 19:01:14 +0000 | [diff] [blame] | 5 | |
| 6 | #if __has_feature(attribute_availability_app_extension) |
| 7 | __attribute__((availability(macosx_app_extension,unavailable))) |
Tim Northover | 935d79b | 2015-11-02 21:14:48 +0000 | [diff] [blame] | 8 | #ifndef TVOS |
Bob Wilson | b111ec9 | 2015-03-02 19:01:14 +0000 | [diff] [blame] | 9 | __attribute__((availability(ios_app_extension,unavailable))) |
Tim Northover | 935d79b | 2015-11-02 21:14:48 +0000 | [diff] [blame] | 10 | #else |
| 11 | __attribute__((availability(tvos_app_extension,unavailable))) |
| 12 | #endif |
Bob Wilson | b111ec9 | 2015-03-02 19:01:14 +0000 | [diff] [blame] | 13 | #endif |
| 14 | void f0(int); // expected-note {{'f0' has been explicitly marked unavailable here}} |
| 15 | |
| 16 | __attribute__((availability(macosx,unavailable))) |
Tim Northover | 935d79b | 2015-11-02 21:14:48 +0000 | [diff] [blame] | 17 | #ifndef TVOS |
Bob Wilson | b111ec9 | 2015-03-02 19:01:14 +0000 | [diff] [blame] | 18 | __attribute__((availability(ios,unavailable))) |
Tim Northover | 935d79b | 2015-11-02 21:14:48 +0000 | [diff] [blame] | 19 | #else |
| 20 | __attribute__((availability(tvos,unavailable))) |
| 21 | #endif |
Bob Wilson | b111ec9 | 2015-03-02 19:01:14 +0000 | [diff] [blame] | 22 | void f1(int); // expected-note {{'f1' has been explicitly marked unavailable here}} |
| 23 | |
Alex Lorenz | 0b1ce8b | 2017-08-15 14:42:01 +0000 | [diff] [blame] | 24 | #if __has_feature(attribute_availability_app_extension) |
| 25 | __attribute__((availability(macOSApplicationExtension,unavailable))) |
| 26 | #ifndef TVOS |
| 27 | __attribute__((availability(iOSApplicationExtension,unavailable))) |
| 28 | #else |
| 29 | __attribute__((availability(tvOSApplicationExtension,unavailable))) |
| 30 | #endif |
| 31 | #endif |
| 32 | void f2(int); // expected-note {{'f2' has been explicitly marked unavailable here}} |
| 33 | |
Bob Wilson | b111ec9 | 2015-03-02 19:01:14 +0000 | [diff] [blame] | 34 | void test() { |
| 35 | f0(1); // expected-error {{'f0' is unavailable: not available on}} |
| 36 | f1(1); // expected-error {{'f1' is unavailable}} |
Alex Lorenz | 0b1ce8b | 2017-08-15 14:42:01 +0000 | [diff] [blame] | 37 | f2(2); // expected-error {{'f2' is unavailable: not available on}} |
Bob Wilson | b111ec9 | 2015-03-02 19:01:14 +0000 | [diff] [blame] | 38 | } |
| 39 | |