From 9b62d3a690228e3544a4fd3cacb3f1c7f0b84d33 Mon Sep 17 00:00:00 2001 From: Daniel Boyd Date: Mon, 4 May 2026 13:08:17 -0500 Subject: [PATCH] Add GNUstep Objective-C interop driver option --- Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift | 5 ++++- Sources/SwiftOptions/Options.swift | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift b/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift index 4d38dfacb..9ee6b0ffd 100644 --- a/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift +++ b/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift @@ -138,9 +138,12 @@ extension Driver { // Enable or disable ObjC interop appropriately for the platform if targetTriple.isDarwin && !isEmbeddedEnabled { commandLine.appendFlag(.enableObjcInterop) - } else { + } else if !parsedOptions.hasArgument(.gnustepObjcInterop) { commandLine.appendFlag(.disableObjcInterop) } + if parsedOptions.hasArgument(.gnustepObjcInterop) { + commandLine.appendFlag(.gnustepObjcInterop) + } // Add flags for C++ interop try commandLine.appendLast(.enableExperimentalCxxInterop, from: &parsedOptions) diff --git a/Sources/SwiftOptions/Options.swift b/Sources/SwiftOptions/Options.swift index 0fc5a0d4a..131adb3f0 100644 --- a/Sources/SwiftOptions/Options.swift +++ b/Sources/SwiftOptions/Options.swift @@ -510,6 +510,7 @@ extension Option { public static let enableNskeyedarchiverDiagnostics: Option = Option("-enable-nskeyedarchiver-diagnostics", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Diagnose classes with unstable mangled names adopting NSCoding") public static let enableObjcAttrRequiresFoundationModule: Option = Option("-enable-objc-attr-requires-foundation-module", .flag, attributes: [.helpHidden, .frontend, .noDriver, .moduleInterface], helpText: "Enable requiring uses of @objc to require importing the Foundation module") public static let enableObjcInterop: Option = Option("-enable-objc-interop", .flag, attributes: [.helpHidden, .frontend, .noDriver, .moduleInterface], helpText: "Enable Objective-C interop code generation and config directives") + public static let gnustepObjcInterop: Option = Option("-gnustep-objc-interop", .flag, attributes: [.helpHidden, .frontend, .moduleInterface], helpText: "Enable GNUstep Objective-C interop code generation and config directives") public static let enableObjectiveCProtocolSymbolicReferences: Option = Option("-enable-objective-c-protocol-symbolic-references", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Enable objective-c protocol symbolic references") public static let enableOnlyOneDependencyFile: Option = Option("-enable-only-one-dependency-file", .flag, attributes: [.doesNotAffectIncrementalBuild], helpText: "Enables incremental build optimization that only produces one dependencies file") public static let enableOssaModules: Option = Option("-enable-ossa-modules", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Obsolete. This option is ignored") @@ -1535,6 +1536,7 @@ extension Option { Option.enableNskeyedarchiverDiagnostics, Option.enableObjcAttrRequiresFoundationModule, Option.enableObjcInterop, + Option.gnustepObjcInterop, Option.enableObjectiveCProtocolSymbolicReferences, Option.enableOnlyOneDependencyFile, Option.enableOssaModules,