r251832 - watchOS & tvOS: add a few more tests.

Tim Northover via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 2 13:14:49 PST 2015


Author: tnorthover
Date: Mon Nov  2 15:14:48 2015
New Revision: 251832

URL: http://llvm.org/viewvc/llvm-project?rev=251832&view=rev
Log:
watchOS & tvOS: add a few more tests.

Modified:
    cfe/trunk/test/Driver/darwin-version.c
    cfe/trunk/test/Driver/implicit-function-as-error.c
    cfe/trunk/test/Sema/attr-availability-app-extensions.c
    cfe/trunk/test/Sema/attr-availability-tvos.c
    cfe/trunk/test/Sema/attr-availability-watchos.c

Modified: cfe/trunk/test/Driver/darwin-version.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-version.c?rev=251832&r1=251831&r2=251832&view=diff
==============================================================================
--- cfe/trunk/test/Driver/darwin-version.c (original)
+++ cfe/trunk/test/Driver/darwin-version.c Mon Nov  2 15:14:48 2015
@@ -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

Modified: cfe/trunk/test/Driver/implicit-function-as-error.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/implicit-function-as-error.c?rev=251832&r1=251831&r2=251832&view=diff
==============================================================================
--- cfe/trunk/test/Driver/implicit-function-as-error.c (original)
+++ cfe/trunk/test/Driver/implicit-function-as-error.c Mon Nov  2 15:14:48 2015
@@ -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.

Modified: cfe/trunk/test/Sema/attr-availability-app-extensions.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-availability-app-extensions.c?rev=251832&r1=251831&r2=251832&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-availability-app-extensions.c (original)
+++ cfe/trunk/test/Sema/attr-availability-app-extensions.c Mon Nov  2 15:14:48 2015
@@ -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() {

Modified: cfe/trunk/test/Sema/attr-availability-tvos.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-availability-tvos.c?rev=251832&r1=251831&r2=251832&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-availability-tvos.c (original)
+++ cfe/trunk/test/Sema/attr-availability-tvos.c Mon Nov  2 15:14:48 2015
@@ -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}}
+}

Modified: cfe/trunk/test/Sema/attr-availability-watchos.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-availability-watchos.c?rev=251832&r1=251831&r2=251832&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-availability-watchos.c (original)
+++ cfe/trunk/test/Sema/attr-availability-watchos.c Mon Nov  2 15:14:48 2015
@@ -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}}
 }




More information about the cfe-commits mailing list