From: Tim Northover Date: Mon, 2 Nov 2015 21:14:48 +0000 (+0000) Subject: watchOS & tvOS: add a few more tests. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aa52573f9181bd1f23284e98a7360c9dfec7a0d6;p=clang watchOS & tvOS: add a few more tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251832 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Driver/darwin-version.c b/test/Driver/darwin-version.c index 96b4a6cf78..009f8483a0 100644 --- a/test/Driver/darwin-version.c +++ b/test/Driver/darwin-version.c @@ -41,6 +41,8 @@ // RUN: %clang -target i386-apple-darwin -mtvos-simulator-version-min=8.3 -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-TVSIM83 %s // CHECK-VERSION-TVSIM83: "i386-apple-tvos8.3.0" +// RUN: %clang -target armv7k-apple-darwin -mwatchos-version-min=2.0 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHOS20 %s // CHECK-VERSION-WATCHOS20: "thumbv7k-apple-watchos2.0.0" // RUN: %clang -target i386-apple-darwin -mwatchos-simulator-version-min=2.0 -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHSIM20 %s diff --git a/test/Driver/implicit-function-as-error.c b/test/Driver/implicit-function-as-error.c index 356078a3f4..d6309963ff 100644 --- a/test/Driver/implicit-function-as-error.c +++ b/test/Driver/implicit-function-as-error.c @@ -1,5 +1,6 @@ // RUN: %clang -target x86_64-apple-darwin -mios-simulator-version-min=7 -fsyntax-only %s -Xclang -verify // RUN: %clang -target x86_64-apple-darwin -arch arm64 -target x86_64-apple-darwin -mios-version-min=7 -fsyntax-only %s -Xclang -verify +// RUN: %clang -target armv7k-apple-watchos -arch armv7k -target armv7k-apple-watchos -fsyntax-only %s -Xclang -verify // For 64-bit iOS, automatically promote -Wimplicit-function-declaration // to an error. diff --git a/test/Sema/attr-availability-app-extensions.c b/test/Sema/attr-availability-app-extensions.c index a847092819..8f9dcbc763 100644 --- a/test/Sema/attr-availability-app-extensions.c +++ b/test/Sema/attr-availability-app-extensions.c @@ -1,14 +1,24 @@ // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -fsyntax-only -fapplication-extension %s -verify // RUN: %clang_cc1 -triple armv7-apple-ios9.0 -fsyntax-only -fapplication-extension %s -verify +// RUN: %clang_cc1 -triple arm64-apple-tvos3.0 -fsyntax-only -fapplication-extension -DTVOS=1 -verify %s +// RUN: %clang_cc1 -triple arm64-apple-tvos3.0 -fsyntax-only -fapplication-extension -verify %s #if __has_feature(attribute_availability_app_extension) __attribute__((availability(macosx_app_extension,unavailable))) +#ifndef TVOS __attribute__((availability(ios_app_extension,unavailable))) +#else + __attribute__((availability(tvos_app_extension,unavailable))) +#endif #endif void f0(int); // expected-note {{'f0' has been explicitly marked unavailable here}} __attribute__((availability(macosx,unavailable))) +#ifndef TVOS __attribute__((availability(ios,unavailable))) +#else + __attribute__((availability(tvos,unavailable))) +#endif void f1(int); // expected-note {{'f1' has been explicitly marked unavailable here}} void test() { diff --git a/test/Sema/attr-availability-tvos.c b/test/Sema/attr-availability-tvos.c index e78b533d9b..b60fdb0d19 100644 --- a/test/Sema/attr-availability-tvos.c +++ b/test/Sema/attr-availability-tvos.c @@ -19,3 +19,41 @@ void test() { f5(0); // expected-warning{{'f5' is deprecated: first deprecated in tvOS 3.0}} f6(0); // expected-warning{{'f6' is deprecated: first deprecated in tvOS 3.0}} } + +// Anything iOS later than 8 does not apply to tvOS. +void f9(int) __attribute__((availability(ios,introduced=2.0,deprecated=9.0))); + +void test_transcribed_availability() { + f9(0); +} + +// Test tvOS specific attributes. +void f0_tvos(int) __attribute__((availability(tvos,introduced=2.0,deprecated=2.1))); // expected-note {{'f0_tvos' has been explicitly marked deprecated here}} +void f1_tvos(int) __attribute__((availability(tvos,introduced=2.1))); +void f2_tvos(int) __attribute__((availability(tvos,introduced=2.0,deprecated=3.0))); // expected-note {{'f2_tvos' has been explicitly marked deprecated here}} +void f3_tvos(int) __attribute__((availability(tvos,introduced=3.0))); +void f4_tvos(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(tvos,introduced=2.0,deprecated=2.1,obsoleted=3.0))); // expected-note{{explicitly marked unavailable}} +void f5_tvos(int) __attribute__((availability(tvos,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0))); +void f5_attr_reversed_tvos(int) __attribute__((availability(ios, deprecated=3.0))) __attribute__((availability(tvos,introduced=2.0))); +void f5b_tvos(int) __attribute__((availability(tvos,introduced=2.0))) __attribute__((availability(tvos,deprecated=3.0))); // expected-note {{'f5b_tvos' has been explicitly marked deprecated here}} +void f5c_tvos(int) __attribute__((availability(ios,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0))); // expected-note {{'f5c_tvos' has been explicitly marked deprecated here}} +void f6_tvos(int) __attribute__((availability(tvos,deprecated=3.0))); +void f6_tvos(int) __attribute__((availability(tvos,introduced=2.0))); // expected-note {{'f6_tvos' has been explicitly marked deprecated here}} + +void test_tvos() { + f0_tvos(0); // expected-warning{{'f0_tvos' is deprecated: first deprecated in tvOS 2.1}} + f1_tvos(0); + f2_tvos(0); // expected-warning{{'f2_tvos' is deprecated: first deprecated in tvOS 3.0}} + f3_tvos(0); + f4_tvos(0); // expected-error{{'f4_tvos' is unavailable: obsoleted in tvOS 3.0}} + // We get no warning here because any explicit 'tvos' availability causes + // the ios availablity to not implicitly become 'tvos' availability. Otherwise we'd get + // a deprecated warning. + f5_tvos(0); // no-warning + f5_attr_reversed_tvos(0); // no-warning + // We get a deprecated warning here because both attributes are explicitly 'tvos'. + f5b_tvos(0); // expected-warning {{'f5b_tvos' is deprecated: first deprecated in tvOS 3.0}} + // We get a deprecated warning here because both attributes are 'ios' (both get mapped to 'tvos'). + f5c_tvos(0); // expected-warning {{'f5c_tvos' is deprecated: first deprecated in tvOS 3.0}} + f6_tvos(0); // expected-warning{{'f6_tvos' is deprecated: first deprecated in tvOS 3.0}} +} diff --git a/test/Sema/attr-availability-watchos.c b/test/Sema/attr-availability-watchos.c index b15cc583dd..cb9f968bd6 100644 --- a/test/Sema/attr-availability-watchos.c +++ b/test/Sema/attr-availability-watchos.c @@ -1,21 +1,54 @@ -// RUN: %clang_cc1 "-triple" "x86_64-apple-watchos3.0" -fsyntax-only -verify %s +// RUN: %clang_cc1 "-triple" "arm64-apple-watchos3.0" -fsyntax-only -verify %s -void f0(int) __attribute__((availability(watchos,introduced=2.0,deprecated=2.1))); // expected-note {{'f0' has been explicitly marked deprecated here}} -void f1(int) __attribute__((availability(watchos,introduced=2.1))); -void f2(int) __attribute__((availability(watchos,introduced=2.0,deprecated=3.0))); // expected-note {{'f2' has been explicitly marked deprecated here}} -void f3(int) __attribute__((availability(watchos,introduced=3.0))); -void f4(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}} - -void f5(int) __attribute__((availability(watchos,introduced=2.0))) __attribute__((availability(watchos,deprecated=3.0))); // expected-note {{'f5' has been explicitly marked deprecated here}} -void f6(int) __attribute__((availability(watchos,deprecated=3.0))); -void f6(int) __attribute__((availability(watchos,introduced=2.0))); // expected-note {{'f6' has been explicitly marked deprecated here}} +void f0(int) __attribute__((availability(ios,introduced=2.0,deprecated=2.1))); // expected-note {{'f0' has been explicitly marked deprecated here}} +void f1(int) __attribute__((availability(ios,introduced=2.1))); +void f2(int) __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{'f2' has been explicitly marked deprecated here}} +void f3(int) __attribute__((availability(ios,introduced=3.0))); +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}} +void f5(int) __attribute__((availability(ios,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0))); // expected-note {{'f5' has been explicitly marked deprecated here}} +void f6(int) __attribute__((availability(ios,deprecated=12.1))); // OK - not deprecated for watchOS +void f7(int) __attribute__((availability(ios,deprecated=8.3))); // expected-note {{'f7' has been explicitly marked deprecated here}} +void f8(int) __attribute__((availability(ios,introduced=2.0,obsoleted=10.0))); // expected-note {{explicitly marked unavailable}} void test() { - f0(0); // expected-warning{{'f0' is deprecated: first deprecated in watchOS 2.1}} + f0(0); // expected-warning{{'f0' is deprecated: first deprecated in watchOS 2.0}} f1(0); - f2(0); // expected-warning{{'f2' is deprecated: first deprecated in watchOS 3.0}} + f2(0); // expected-warning{{'f2' is deprecated: first deprecated in watchOS 2.0}} f3(0); - f4(0); // expected-error{{f4' is unavailable: obsoleted in watchOS 3.0}} - f5(0); // expected-warning{{'f5' is deprecated: first deprecated in watchOS 3.0}} - f6(0); // expected-warning{{'f6' is deprecated: first deprecated in watchOS 3.0}} + f4(0); // expected-error {{f4' is unavailable: obsoleted in watchOS 2.0}} + f5(0); // expected-warning {{'f5' is deprecated: first deprecated in watchOS 2.0}} + f6(0); + f7(0); // expected-warning {{'f7' is deprecated: first deprecated in watchOS 2.0}} + f8(0); // expected-error {{'f8' is unavailable: obsoleted in watchOS 3.0}} +} + +// Test watchOS specific attributes. +void f0_watchos(int) __attribute__((availability(watchos,introduced=2.0,deprecated=2.1))); // expected-note {{'f0_watchos' has been explicitly marked deprecated here}} +void f1_watchos(int) __attribute__((availability(watchos,introduced=2.1))); +void f2_watchos(int) __attribute__((availability(watchos,introduced=2.0,deprecated=3.0))); // expected-note {{'f2_watchos' has been explicitly marked deprecated here}} +void f3_watchos(int) __attribute__((availability(watchos,introduced=3.0))); +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}} +void f5_watchos(int) __attribute__((availability(watchos,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0))); +void f5_attr_reversed_watchos(int) __attribute__((availability(ios, deprecated=3.0))) __attribute__((availability(watchos,introduced=2.0))); +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}} +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}} +void f6_watchos(int) __attribute__((availability(watchos,deprecated=3.0))); +void f6_watchos(int) __attribute__((availability(watchos,introduced=2.0))); // expected-note {{'f6_watchos' has been explicitly marked deprecated here}} + +void test_watchos() { + f0_watchos(0); // expected-warning{{'f0_watchos' is deprecated: first deprecated in watchOS 2.1}} + f1_watchos(0); + f2_watchos(0); // expected-warning{{'f2_watchos' is deprecated: first deprecated in watchOS 3.0}} + f3_watchos(0); + f4_watchos(0); // expected-error{{'f4_watchos' is unavailable: obsoleted in watchOS 3.0}} + // We get no warning here because any explicit 'watchos' availability causes + // the ios availablity to not implicitly become 'watchos' availability. Otherwise we'd get + // a deprecated warning. + f5_watchos(0); // no-warning + f5_attr_reversed_watchos(0); // no-warning + // We get a deprecated warning here because both attributes are explicitly 'watchos'. + f5b_watchos(0); // expected-warning {{'f5b_watchos' is deprecated: first deprecated in watchOS 3.0}} + // We get a deprecated warning here because both attributes are 'ios' (both get mapped to 'watchos'). + f5c_watchos(0); // expected-warning {{'f5c_watchos' is deprecated: first deprecated in watchOS 2.0}} + f6_watchos(0); // expected-warning {{'f6_watchos' is deprecated: first deprecated in watchOS 3.0}} }