From ed8762862e12c52897ed29fd1a7c4600865490a9 Mon Sep 17 00:00:00 2001 From: Allan Shortlidge Date: Fri, 18 Aug 2023 10:17:14 -0700 Subject: [PATCH 1/2] NFC: Refactor testImmediateMode() to avoid requiring Swift 5.9. --- Tests/SwiftDriverTests/SwiftDriverTests.swift | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Tests/SwiftDriverTests/SwiftDriverTests.swift b/Tests/SwiftDriverTests/SwiftDriverTests.swift index 2da48bc67..d920b12b9 100644 --- a/Tests/SwiftDriverTests/SwiftDriverTests.swift +++ b/Tests/SwiftDriverTests/SwiftDriverTests.swift @@ -3552,12 +3552,11 @@ final class SwiftDriverTests: XCTestCase { if driver.targetTriple.isMacOSX { let sdkIdx = try XCTUnwrap(job.commandLine.firstIndex(of: .flag("-sdk"))) - let sdkPathOpt: VirtualPath? = switch job.commandLine[sdkIdx + 1] { - case .path(let path): path - default: nil + if case .path(let path) = job.commandLine[sdkIdx + 1] { + XCTAssertTrue(path.name.contains("MacOSX.platform")) + } else { + XCTFail("Missing SDK path") } - let sdkPath = try XCTUnwrap(sdkPathOpt) - XCTAssertTrue(sdkPath.name.contains("MacOSX.platform")) } XCTAssertFalse(job.commandLine.contains(.flag("--"))) From 640c8d14b400efbb1f50114513ca9d017aac2a69 Mon Sep 17 00:00:00 2001 From: Allan Shortlidge Date: Fri, 18 Aug 2023 10:19:11 -0700 Subject: [PATCH 2/2] Deprecate the -warn-on-potentially-unavailable-enum-case option. When `-warn-on-potentially-unavailable-enum-case` was introduced, the build system was required to invoke `swift-frontend` at artificially low deployment targets when emitting `.swiftinterface` files for legacy architectures. Because the deployment target was low, some availability diagnostics needed to be de-fanged in order to allow module interface emission to succeed. Today, the build system is able to use the correct deployment target when emitting module interfaces and the `-warn-on-potentially-unavailable-enum-case` is superfluous, so deprecate it. Resolves rdar://114092047 --- Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift | 9 --------- Sources/SwiftOptions/Options.swift | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift b/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift index 4fe14b919..9b74181e2 100644 --- a/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift +++ b/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift @@ -107,15 +107,6 @@ extension Driver { commandLine.appendFlag("-aarch64-use-tbi") } - // Potentially unavailable enum cases are downgraded to a warning when building a - // swiftmodule, to allow building a module (or module interface) for an older - // deployment target than the framework itself. - if isFrontendArgSupported(.warnOnPotentiallyUnavailableEnumCase) { - if compilerOutputType == .swiftModule { - commandLine.appendFlag(.warnOnPotentiallyUnavailableEnumCase) - } - } - // Enable or disable ObjC interop appropriately for the platform if targetTriple.isDarwin { commandLine.appendFlag(.enableObjcInterop) diff --git a/Sources/SwiftOptions/Options.swift b/Sources/SwiftOptions/Options.swift index c5027cdae..c38b93afd 100644 --- a/Sources/SwiftOptions/Options.swift +++ b/Sources/SwiftOptions/Options.swift @@ -789,7 +789,7 @@ extension Option { public static let warnLongFunctionBodiesEQ: Option = Option("-warn-long-function-bodies=", .joined, alias: Option.warnLongFunctionBodies, attributes: [.helpHidden, .frontend, .noDriver]) public static let warnLongFunctionBodies: Option = Option("-warn-long-function-bodies", .separate, attributes: [.helpHidden, .frontend, .noDriver], metaVar: "", helpText: "Warns when type-checking a function takes longer than ms") public static let warnOnEditorPlaceholder: Option = Option("-warn-on-editor-placeholder", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Downgrade the editor placeholder error to a warning") - public static let warnOnPotentiallyUnavailableEnumCase: Option = Option("-warn-on-potentially-unavailable-enum-case", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Downgrade potential unavailability of enum case to a warning") + public static let warnOnPotentiallyUnavailableEnumCase: Option = Option("-warn-on-potentially-unavailable-enum-case", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Deprecated, has no effect") public static let warnRedundantRequirements: Option = Option("-warn-redundant-requirements", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Emit warnings for redundant requirements in generic signatures") public static let warnSwift3ObjcInferenceComplete: Option = Option("-warn-swift3-objc-inference-complete", .flag, attributes: [.frontend, .doesNotAffectIncrementalBuild], helpText: "Warn about deprecated @objc inference in Swift 3 for every declaration that will no longer be inferred as @objc in Swift 4") public static let warnSwift3ObjcInferenceMinimal: Option = Option("-warn-swift3-objc-inference-minimal", .flag, attributes: [.frontend, .doesNotAffectIncrementalBuild], helpText: "Warn about deprecated @objc inference in Swift 3 based on direct uses of the Objective-C entrypoint")