Skip to content

Commit 51829c1

Browse files
committed
@_extern is an experimental feature.
Mark it as such. rdar://132013078
1 parent 42c43e6 commit 51829c1

19 files changed

+32
-29
lines changed

include/swift/Basic/Features.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ BASELINE_LANGUAGE_FEATURE(RetroactiveAttribute, 364, "@retroactive")
185185
BASELINE_LANGUAGE_FEATURE(ExtensionMacroAttr, 0, "@attached(extension)")
186186
BASELINE_LANGUAGE_FEATURE(TypedThrows, 413, "Typed throws")
187187
BASELINE_LANGUAGE_FEATURE(OptionalIsolatedParameters, 420, "Optional isolated parameters")
188-
BASELINE_LANGUAGE_FEATURE(Extern, 0, "@_extern")
189188
BASELINE_LANGUAGE_FEATURE(ExpressionMacroDefaultArguments, 422, "Expression macro as caller-side default argument")
190189
BASELINE_LANGUAGE_FEATURE(BuiltinStoreRaw, 0, "Builtin.storeRaw")
191190
BASELINE_LANGUAGE_FEATURE(BuiltinCreateTask, 0, "Builtin.createTask and Builtin.createDiscardingTask")
@@ -395,6 +394,8 @@ EXPERIMENTAL_FEATURE(ReinitializeConsumeInMultiBlockDefer, false)
395394

396395
EXPERIMENTAL_FEATURE(SE427NoInferenceOnExtension, false)
397396

397+
EXPERIMENTAL_FEATURE(Extern, true)
398+
398399
#undef EXPERIMENTAL_FEATURE_EXCLUDED_FROM_MODULE_INTERFACE
399400
#undef EXPERIMENTAL_FEATURE
400401
#undef UPCOMING_FEATURE

lib/AST/FeatureSet.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ static bool usesFeatureSendingArgsAndResults(Decl *decl) {
188188
UNINTERESTING_FEATURE(DynamicActorIsolation)
189189
UNINTERESTING_FEATURE(NonfrozenEnumExhaustivity)
190190
UNINTERESTING_FEATURE(ClosureIsolation)
191+
UNINTERESTING_FEATURE(Extern)
191192

192193
static bool usesFeatureBitwiseCopyable2(Decl *decl) {
193194
if (!decl->getModuleContext()->isStdlibModule()) {

lib/Sema/TypeCheckAttr.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2333,7 +2333,8 @@ static bool isCCompatibleFuncDecl(FuncDecl *FD) {
23332333
}
23342334

23352335
void AttributeChecker::visitExternAttr(ExternAttr *attr) {
2336-
if (!Ctx.LangOpts.hasFeature(Feature::Extern)) {
2336+
if (!Ctx.LangOpts.hasFeature(Feature::Extern)
2337+
&& !D->getModuleContext()->isStdlibModule()) {
23372338
diagnoseAndRemoveAttr(attr, diag::attr_extern_experimental);
23382339
return;
23392340
}

test/SIL/modules-extern.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %{python} %utils/split_file.py -o %t %s
33

4-
// RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -parse-as-library
5-
// RUN: %target-swift-frontend -c -I %t %t/Main.swift -o %t/a.o
4+
// RUN: %target-swift-frontend -enable-experimental-feature Extern -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -parse-as-library
5+
// RUN: %target-swift-frontend -enable-experimental-feature Extern -c -I %t %t/Main.swift -o %t/a.o
66

77
// BEGIN MyModule.swift
88

test/embedded/array-to-pointer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend %s -enable-experimental-feature Embedded -c -o %t/main.o
2+
// RUN: %target-swift-frontend %s -enable-experimental-feature Extern -enable-experimental-feature Embedded -c -o %t/main.o
33
// RUN: %target-clang -x c -c %S/Inputs/print.c -o %t/print.o
44
// RUN: %target-clang %t/main.o %t/print.o -o %t/a.out -dead_strip
55
// RUN: %target-run %t/a.out | %FileCheck %s

test/embedded/arrays.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend %s -enable-experimental-feature Embedded -c -o %t/main.o
2+
// RUN: %target-swift-frontend -enable-experimental-feature Extern %s -enable-experimental-feature Embedded -c -o %t/main.o
33
// RUN: %target-clang -x c -c %S/Inputs/print.c -o %t/print.o
44
// RUN: %target-clang %t/main.o %t/print.o -o %t/a.out -dead_strip
55
// RUN: %target-run %t/a.out | %FileCheck %s

test/embedded/collection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -enable-experimental-feature Embedded -enforce-exclusivity=none %s -c -o %t/a.o
2+
// RUN: %target-swift-frontend -enable-experimental-feature Extern -enable-experimental-feature Embedded -enforce-exclusivity=none %s -c -o %t/a.o
33
// RUN: %target-clang -x c -c %S/Inputs/print.c -o %t/print.o
44
// RUN: %target-clang %t/a.o %t/print.o -o %t/a.out
55
// RUN: %target-run %t/a.out | %FileCheck %s

test/embedded/custom-print.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -enable-experimental-feature Embedded -enforce-exclusivity=none %s -c -o %t/a.o
2+
// RUN: %target-swift-frontend -enable-experimental-feature Extern -enable-experimental-feature Embedded -enforce-exclusivity=none %s -c -o %t/a.o
33
// RUN: %target-clang %t/a.o -o %t/a.out
44
// RUN: %target-run %t/a.out | %FileCheck %s
55

test/embedded/dependencies-no-allocations.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -enable-experimental-feature Embedded -no-allocations %s -c -o %t/a.o
2+
// RUN: %target-swift-frontend -enable-experimental-feature Extern -enable-experimental-feature Embedded -no-allocations %s -c -o %t/a.o
33

44
// RUN: grep DEP\: %s | sed 's#// DEP\: ##' | sort > %t/allowed-dependencies.txt
55

test/embedded/dependencies.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -parse-as-library -enable-experimental-feature Embedded %s -c -o %t/a.o
2+
// RUN: %target-swift-frontend -parse-as-library -enable-experimental-feature Extern -enable-experimental-feature Embedded %s -c -o %t/a.o
33

44
// RUN: grep DEP\: %s | sed 's#// DEP\: ##' | sort > %t/allowed-dependencies.txt
55

test/embedded/deserialize-vtables.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
2-
// RUN: %target-run-simple-swift(-O -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
3-
// RUN: %target-run-simple-swift(-Osize -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
1+
// RUN: %target-run-simple-swift(-enable-experimental-feature Extern -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
2+
// RUN: %target-run-simple-swift(-O -enable-experimental-feature Extern -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
3+
// RUN: %target-run-simple-swift(-Osize -enable-experimental-feature Extern -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
44

55
// REQUIRES: swift_in_compiler
66
// REQUIRES: executable_test

test/embedded/lto.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -lto=llvm-full %s -enable-experimental-feature Embedded -emit-bc -o %t/a.o
2+
// RUN: %target-swift-frontend -enable-experimental-feature Extern -lto=llvm-full %s -enable-experimental-feature Embedded -emit-bc -o %t/a.o
33
// RUN: %target-clang %t/a.o -o %t/a.out
44
// RUN: %target-run %t/a.out | %FileCheck %s
55

test/embedded/modules-extern.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %{python} %utils/split_file.py -o %t %s
33

4-
// RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library
5-
// RUN: %target-swift-frontend -c -I %t %t/Main.swift -enable-experimental-feature Embedded -o %t/a.o
4+
// RUN: %target-swift-frontend -enable-experimental-feature Extern -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library
5+
// RUN: %target-swift-frontend -enable-experimental-feature Extern -c -I %t %t/Main.swift -enable-experimental-feature Embedded -o %t/a.o
66

77
// REQUIRES: swift_in_compiler
88
// REQUIRES: OS=macosx || OS=linux-gnu

test/embedded/modules-globals-exec.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %{python} %utils/split_file.py -o %t %s
33

4-
// RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library
5-
// RUN: %target-swift-frontend -c -I %t %t/Main.swift -enable-experimental-feature Embedded -o %t/a.o
4+
// RUN: %target-swift-frontend -enable-experimental-feature Extern -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library
5+
// RUN: %target-swift-frontend -enable-experimental-feature Extern -c -I %t %t/Main.swift -enable-experimental-feature Embedded -o %t/a.o
66
// RUN: %target-clang -x c -c %S/Inputs/print.c -o %t/print.o
77
// RUN: %target-clang %t/a.o %t/print.o -o %t/a.out
88
// RUN: %target-run %t/a.out | %FileCheck %s

test/embedded/modules-print-exec.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %{python} %utils/split_file.py -o %t %s
33

4-
// RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library
5-
// RUN: %target-swift-frontend -c -I %t %t/Main.swift -enable-experimental-feature Embedded -o %t/a.o
4+
// RUN: %target-swift-frontend -enable-experimental-feature Extern -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library
5+
// RUN: %target-swift-frontend -enable-experimental-feature Extern -c -I %t %t/Main.swift -enable-experimental-feature Embedded -o %t/a.o
66
// RUN: %target-clang -x c -c %S/Inputs/print.c -o %t/print.o
77
// RUN: %target-clang %t/a.o %t/print.o -o %t/a.out
88
// RUN: %target-run %t/a.out | %FileCheck %s

test/embedded/runtime.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
2-
// RUN: %target-run-simple-swift(-O -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
3-
// RUN: %target-run-simple-swift(-Osize -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
1+
// RUN: %target-run-simple-swift(-enable-experimental-feature Extern -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
2+
// RUN: %target-run-simple-swift(-enable-experimental-feature Extern -O -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
3+
// RUN: %target-run-simple-swift(-enable-experimental-feature Extern -Osize -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
44

55
// REQUIRES: swift_in_compiler
66
// REQUIRES: executable_test

test/embedded/string-to-pointer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -wmo) | %FileCheck %s
1+
// RUN: %target-run-simple-swift(-enable-experimental-feature Extern -enable-experimental-feature Embedded -wmo) | %FileCheck %s
22

33
// REQUIRES: swift_in_compiler
44
// REQUIRES: executable_test

test/embedded/traps-multiple-preconditions-ir.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// RUN: %target-swift-emit-ir -enable-experimental-feature Embedded -wmo -Xllvm -link-embedded-runtime=0 %s -O | %FileCheck %s --check-prefix=CHECK-NOMESSAGE
2-
// RUN: %target-swift-emit-ir -enable-experimental-feature Embedded -wmo -Xllvm -link-embedded-runtime=0 %s -Osize | %FileCheck %s --check-prefix=CHECK-NOMESSAGE
3-
// RUN: %target-swift-emit-ir -enable-experimental-feature Embedded -wmo -Xllvm -link-embedded-runtime=0 %s -O -assert-config Debug | %FileCheck %s --check-prefix=CHECK-MESSAGE
4-
// RUN: %target-swift-emit-ir -enable-experimental-feature Embedded -wmo -Xllvm -link-embedded-runtime=0 %s -Osize -assert-config Debug | %FileCheck %s --check-prefix=CHECK-MESSAGE
1+
// RUN: %target-swift-emit-ir -enable-experimental-feature Extern -enable-experimental-feature Embedded -wmo -Xllvm -link-embedded-runtime=0 %s -O | %FileCheck %s --check-prefix=CHECK-NOMESSAGE
2+
// RUN: %target-swift-emit-ir -enable-experimental-feature Extern -enable-experimental-feature Embedded -wmo -Xllvm -link-embedded-runtime=0 %s -Osize | %FileCheck %s --check-prefix=CHECK-NOMESSAGE
3+
// RUN: %target-swift-emit-ir -enable-experimental-feature Extern -enable-experimental-feature Embedded -wmo -Xllvm -link-embedded-runtime=0 %s -O -assert-config Debug | %FileCheck %s --check-prefix=CHECK-MESSAGE
4+
// RUN: %target-swift-emit-ir -enable-experimental-feature Extern -enable-experimental-feature Embedded -wmo -Xllvm -link-embedded-runtime=0 %s -Osize -assert-config Debug | %FileCheck %s --check-prefix=CHECK-MESSAGE
55

66
// REQUIRES: swift_in_compiler
77
// REQUIRES: optimized_stdlib

test/embedded/volatile-exec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-parse-as-library -enable-experimental-feature Embedded -wmo -runtime-compatibility-version none) | %FileCheck %s
1+
// RUN: %target-run-simple-swift(-parse-as-library -enable-experimental-feature Extern -enable-experimental-feature Embedded -wmo -runtime-compatibility-version none) | %FileCheck %s
22

33
// REQUIRES: swift_in_compiler
44
// REQUIRES: executable_test

0 commit comments

Comments
 (0)