Skip to content

Commit e39832f

Browse files
committed
Turn on the inclusive language soundness check
1 parent 7cd307d commit e39832f

File tree

16 files changed

+49
-51
lines changed

16 files changed

+49
-51
lines changed

.github/workflows/pull_request.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,4 @@ jobs:
6666
with:
6767
license_header_check_project_name: "Swift"
6868
api_breakage_check_enabled: false
69-
unacceptable_language_check_enabled: false
7069
format_check_enabled: false

Plugins/cmake-smoke-test/cmake-smoke-test.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ extension Process {
191191
Diagnostics.progress("Using process spawning workaround")
192192
// Linux workaround for https://github.com/swiftlang/swift-corelibs-foundation/issues/4772
193193
// Foundation.Process on Linux seems to inherit the Process.run()-calling thread's signal mask, creating processes that even have SIGTERM blocked
194-
// This manifests as CMake hanging when invoking 'uname' with incorrectly configured signal handlers.
194+
// This manifests as CMake getting stuck when invoking 'uname' with incorrectly configured signal handlers.
195195
var fileActions = posix_spawn_file_actions_t()
196196
defer { posix_spawn_file_actions_destroy(&fileActions) }
197197
var attrs: posix_spawnattr_t = posix_spawnattr_t()

Sources/SWBCore/Settings/Settings.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5066,7 +5066,7 @@ private class SettingsBuilder {
50665066
return []
50675067
}
50685068

5069-
// For performance, we're only going to check the Resources build phase because that's where xcstrings are expected to hang out.
5069+
// For performance, we're only going to check the Resources build phase because that's where xcstrings are expected to be.
50705070
let buildFiles = standardTarget.resourcesBuildPhase?.buildFiles ?? []
50715071

50725072
let resolver = FilePathResolver(scope: scope)

Sources/SWBCore/SpecImplementations/Tools/SwiftCompiler.swift

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,7 +2132,6 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
21322132

21332133
// Compute the inputs and object output dependency paths.
21342134
// Note that we compute the object file output paths here even if the compilation mode won't produce any, because these paths are used to compute the paths to other generated files.
2135-
// FIXME: If we want to match what Xcode did, then when using non-parallel WMO, we should include $(TARGET_NAME)-master.o as an output file, but not include the per-input-file object files as output files.
21362135
let outputObjectExtension: String
21372136
switch cbc.scope.evaluate(BuiltinMacros.SWIFT_LTO) {
21382137
case .yes, .yesThin:
@@ -2161,11 +2160,11 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
21612160

21622161
// Add const metadata outputs to extra compilation outputs
21632162
if await supportConstSupplementaryMetadata(cbc, delegate, compilationMode: compilationMode) {
2164-
// If using whole module optimization then we use the -master.swiftconstvalues file from the sole compilation task.
2163+
// If using whole module optimization then we use the -primary.swiftconstvalues file from the sole compilation task.
21652164
if isUsingWholeModuleOptimization {
21662165
if let outputPath = objectOutputPaths.first {
2167-
let masterSwiftBaseName = cbc.scope.evaluate(BuiltinMacros.TARGET_NAME) + compilationMode.moduleBaseNameSuffix + "-master"
2168-
let supplementaryConstMetadataOutputPath = outputPath.dirname.join(masterSwiftBaseName + ".swiftconstvalues")
2166+
let primarySwiftBaseName = cbc.scope.evaluate(BuiltinMacros.TARGET_NAME) + compilationMode.moduleBaseNameSuffix + "-primary"
2167+
let supplementaryConstMetadataOutputPath = outputPath.dirname.join(primarySwiftBaseName + ".swiftconstvalues")
21692168
extraOutputPaths.append(supplementaryConstMetadataOutputPath)
21702169
delegate.declareGeneratedSwiftConstMetadataFile(supplementaryConstMetadataOutputPath, architecture: arch)
21712170
}
@@ -2232,11 +2231,11 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
22322231
//
22332232
// FIXME: Can we simplify this to not require the full macro scope?
22342233
//
2235-
// If using whole module optimization then we use the -master.d file as the dependency file.
2234+
// If using whole module optimization then we use the -primary.d file as the dependency file.
22362235
if let outputPath = objectOutputPaths.first {
22372236
if Self.shouldUseWholeModuleOptimization(for: cbc.scope).result {
2238-
let masterSwiftBaseName = cbc.scope.evaluate(BuiltinMacros.TARGET_NAME) + compilationMode.moduleBaseNameSuffix + "-master"
2239-
let dependenciesFilePath = outputPath.dirname.join(masterSwiftBaseName + ".d")
2237+
let primarySwiftBaseName = cbc.scope.evaluate(BuiltinMacros.TARGET_NAME) + compilationMode.moduleBaseNameSuffix + "-primary"
2238+
let dependenciesFilePath = outputPath.dirname.join(primarySwiftBaseName + ".d")
22402239
return dependenciesFilePath
22412240
} else {
22422241
// if not using WMO, we use the first .d file as all are the same
@@ -2348,8 +2347,8 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
23482347
let dependencyData: DependencyDataStyle?
23492348
if await shouldEmitMakeStyleDependencies(cbc.producer, cbc.scope, delegate: delegate) {
23502349
// FIXME: Duplication with `SwiftCompilerSpec.computeOutputFileMapContents`
2351-
let masterSwiftBaseName = cbc.scope.evaluate(BuiltinMacros.TARGET_NAME) + compilationMode.moduleBaseNameSuffix + "-master"
2352-
let emitModuleDependenciesFilePath = objectFileDir.join(masterSwiftBaseName + "-emit-module.d")
2350+
let primarySwiftBaseName = cbc.scope.evaluate(BuiltinMacros.TARGET_NAME) + compilationMode.moduleBaseNameSuffix + "-primary"
2351+
let emitModuleDependenciesFilePath = objectFileDir.join(primarySwiftBaseName + "-emit-module.d")
23532352
dependencyData = eagerCompilationEnabled ? .makefileIgnoringSubsequentOutputs(emitModuleDependenciesFilePath) : dependencyInfoPath.map(DependencyDataStyle.makefileIgnoringSubsequentOutputs)
23542353
} else {
23552354
dependencyData = nil
@@ -2755,7 +2754,7 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
27552754
moduleDirPath = scope.evaluate(BuiltinMacros.BUILT_PRODUCTS_DIR).join(moduleName + ".swiftmodule")
27562755
}
27572756
if isProject {
2758-
// Copy this content to the Project subdir so we could master them out when installing.
2757+
// Copy this content to the Project subdir so we can exclude them by filename pattern when installing.
27592758
return moduleDirPath.join("Project")
27602759
}
27612760
return moduleDirPath
@@ -3047,7 +3046,7 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
30473046

30483047
// Compute strings that will be used at various points when building the map.
30493048
let moduleBaseNameSuffix = compilationMode.moduleBaseNameSuffix
3050-
let masterSwiftBaseName = cbc.scope.evaluate(BuiltinMacros.TARGET_NAME) + moduleBaseNameSuffix + "-master"
3049+
let primarySwiftBaseName = cbc.scope.evaluate(BuiltinMacros.TARGET_NAME) + moduleBaseNameSuffix + "-primary"
30513050
let emitConstSideCarValues = await supportConstSupplementaryMetadata(cbc, delegate, compilationMode: compilationMode)
30523051

30533052
func createCommonFileEntry(input: FileToBuild) -> (objectFilePath: Path, fileMapEntry: SwiftOutputFileMap.Entry) {
@@ -3110,25 +3109,25 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
31103109
var fileMapEntry = SwiftOutputFileMap.Entry()
31113110

31123111
// The file used by Swift to manage intermodule dependencies.
3113-
let globalSwiftDependenciesFilePath = objectFileDir.join(masterSwiftBaseName + ".swiftdeps")
3112+
let globalSwiftDependenciesFilePath = objectFileDir.join(primarySwiftBaseName + ".swiftdeps")
31143113
fileMapEntry.swiftDependencies = globalSwiftDependenciesFilePath.str
31153114

31163115
// The diagnostics file.
3117-
let diagnosticsFilePath = objectFileDir.join(masterSwiftBaseName + ".dia")
3116+
let diagnosticsFilePath = objectFileDir.join(primarySwiftBaseName + ".dia")
31183117
fileMapEntry.diagnostics = diagnosticsFilePath.str
31193118

31203119
// The diagnostics file for emit-module jobs.
3121-
let emitModuleDiagnosticsFilePath = objectFileDir.join(masterSwiftBaseName + "-emit-module.dia")
3120+
let emitModuleDiagnosticsFilePath = objectFileDir.join(primarySwiftBaseName + "-emit-module.dia")
31223121
fileMapEntry.emitModuleDiagnostics = emitModuleDiagnosticsFilePath.str
31233122

31243123
if await shouldEmitMakeStyleDependencies(cbc.producer, cbc.scope, delegate: delegate) {
31253124
// The dependency file for emit-module jobs.
3126-
let emitModuleDependenciesFilePath = objectFileDir.join(masterSwiftBaseName + "-emit-module.d")
3125+
let emitModuleDependenciesFilePath = objectFileDir.join(primarySwiftBaseName + "-emit-module.d")
31273126
fileMapEntry.emitModuleDependencies = emitModuleDependenciesFilePath.str
31283127
}
31293128

31303129
// The PCH file path for generatePCH job.
3131-
let bridgingHeaderPCHPath = objectFileDir.join(masterSwiftBaseName + "-Bridging-header.pch")
3130+
let bridgingHeaderPCHPath = objectFileDir.join(primarySwiftBaseName + "-Bridging-header.pch")
31323131
fileMapEntry.pch = bridgingHeaderPCHPath.str
31333132

31343133
// Add the global entry to the map.
@@ -3146,35 +3145,35 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
31463145
var fileMapEntry = SwiftOutputFileMap.Entry()
31473146

31483147
// The diagnostics file.
3149-
let diagnosticsFilePath = objectFileDir.join(masterSwiftBaseName + ".dia")
3148+
let diagnosticsFilePath = objectFileDir.join(primarySwiftBaseName + ".dia")
31503149
fileMapEntry.diagnostics = diagnosticsFilePath.str
31513150

31523151
// The diagnostics file for emit-module jobs.
3153-
let emitModuleDiagnosticsFilePath = objectFileDir.join(masterSwiftBaseName + "-emit-module.dia")
3152+
let emitModuleDiagnosticsFilePath = objectFileDir.join(primarySwiftBaseName + "-emit-module.dia")
31543153
fileMapEntry.emitModuleDiagnostics = emitModuleDiagnosticsFilePath.str
31553154

31563155
if await shouldEmitMakeStyleDependencies(cbc.producer, cbc.scope, delegate: delegate) {
31573156
// The dependency file for emit-module jobs.
3158-
let emitModuleDependenciesFilePath = objectFileDir.join(masterSwiftBaseName + "-emit-module.d")
3157+
let emitModuleDependenciesFilePath = objectFileDir.join(primarySwiftBaseName + "-emit-module.d")
31593158
fileMapEntry.emitModuleDependencies = emitModuleDependenciesFilePath.str
31603159

31613160

31623161
// The dependencies file, used to discover implicit dependencies. This file will be in Makefile format.
3163-
let dependenciesFilePath = objectFileDir.join(masterSwiftBaseName + ".d")
3162+
let dependenciesFilePath = objectFileDir.join(primarySwiftBaseName + ".d")
31643163
fileMapEntry.dependencies = dependenciesFilePath.str
31653164
}
31663165

31673166
// The file used by Swift to manage intermodule dependencies.
3168-
let swiftDependenciesFilePath = objectFileDir.join(masterSwiftBaseName + ".swiftdeps")
3167+
let swiftDependenciesFilePath = objectFileDir.join(primarySwiftBaseName + ".swiftdeps")
31693168
fileMapEntry.swiftDependencies = swiftDependenciesFilePath.str
31703169

31713170
// The requested compile-time values
31723171
if emitConstSideCarValues && compilationMode.compileSources {
3173-
fileMapEntry.constValues = objectFileDir.join(masterSwiftBaseName + ".swiftconstvalues").str
3172+
fileMapEntry.constValues = objectFileDir.join(primarySwiftBaseName + ".swiftconstvalues").str
31743173
}
31753174

31763175
// The PCH file path for generatePCH job.
3177-
let bridgingHeaderPCHPath = objectFileDir.join(masterSwiftBaseName + "-Bridging-header.pch")
3176+
let bridgingHeaderPCHPath = objectFileDir.join(primarySwiftBaseName + "-Bridging-header.pch")
31783177
fileMapEntry.pch = bridgingHeaderPCHPath.str
31793178

31803179
// Add the global entry to the map.

Sources/SWBUtil/Debugger.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public enum Debugger: Sendable {
6464
if isXcodeAutoAttachEnabled {
6565
try await waitForAttachment() {
6666
// Exit if parent process died while waiting for debugger
67-
if kill(getppid(), 0) != 0 {
67+
if kill(getppid(), 0) != 0 { // ignore-unacceptable-language; POSIX API
6868
throw StubError.error("Parent process exited while waiting for debugger")
6969
}
7070
return true

Sources/SWBUtil/PbxCp.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ public func pbxcp(_ argv: [String], cwd: Path) async -> (success: Bool, output:
612612
}
613613
}
614614

615-
// Do some sanity-checking.
615+
// Do some correctness-checking.
616616
if srcPath.isRoot {
617617
outStream <<< "error: Invalid source path: '\(srcPath.str)'\n"
618618
return (false, outStream.bytes.asString)

Sources/SwiftBuild/SWBBuildServiceConnection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ fileprivate final class OutOfProcessConnection: ConnectionTransport {
950950
// If IBAutoAttach is enabled, send the message so Xcode will attach to the inferior.
951951
try Debugger.requestXcodeAutoAttachIfEnabled(task.processIdentifier)
952952
} catch {
953-
// Terminate the subprocess if start() is going to throw, so that close() will not hang
953+
// Terminate the subprocess if start() is going to throw, so that close() will not get stuck.
954954
task.terminate()
955955
}
956956
#endif

Sources/SwiftBuild/SWBBuildServiceSession.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ extension SWBBuildServiceSession {
630630
throw StubError.error("Unexpected message: \(msgOpt.map(String.init(describing:)) ?? "<nil>")")
631631
}
632632

633-
// NOTE: If any GetProvisioningTaskInputsRequest/ExternalToolExecutionRequest messages are received, cancellation may result in them never receiving a reply, which could result in background operations hanging. We should find a way to handle that better.
633+
// NOTE: If any GetProvisioningTaskInputsRequest/ExternalToolExecutionRequest messages are received, cancellation may result in them never receiving a reply, which could result in background operations getting stuck. We should find a way to handle that better.
634634

635635
// nil indicates Task cancellation (we broke out of the loop)
636636
return nil

Tests/SWBBuildSystemTests/BuildTaskBehaviorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ fileprivate struct BuildTaskBehaviorTests: CoreBasedTests {
368368
try await withTaskCancellationHandler {
369369
switch await operation.build() {
370370
case .cancelled, .failed:
371-
// If the build already failed, cancel the task that waits for the script so the test doesn't hang forever.
371+
// If the build already failed, cancel the task that waits for the script so the test doesn't get stuck forever.
372372
task.cancel()
373373
case .succeeded:
374374
break

Tests/SWBTaskConstructionTests/CodeSignTaskConstructionTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,21 +627,21 @@ fileprivate struct CodeSignTaskConstructionTests: CoreBasedTests {
627627
}
628628

629629
// Check that flags without a dedicated build setting are passed through as expected.
630-
await tester.checkBuild(BuildParameters(action: .install, configuration: "Release", overrides: ["ENABLE_LIBRARY_VALIDATION": "YES", "ENABLE_HARDENED_RUNTIME": "YES", "CODE_SIGN_RESTRICT": "YES", "OTHER_CODE_SIGN_FLAGS": "--options kill,hard,host,expires,linker-signed"]), runDestination: .macOS) { results in
630+
await tester.checkBuild(BuildParameters(action: .install, configuration: "Release", overrides: ["ENABLE_LIBRARY_VALIDATION": "YES", "ENABLE_HARDENED_RUNTIME": "YES", "CODE_SIGN_RESTRICT": "YES", "OTHER_CODE_SIGN_FLAGS": "--options kill,hard,host,expires,linker-signed"]), runDestination: .macOS) { results in // ignore-unacceptable-language; codesign tool option
631631
results.checkTarget("macOSFramework") { target in
632632
results.checkTask(.matchTarget(target), .matchRuleType("CodeSign")) { task in
633-
task.checkCommandLineMatches(["/usr/bin/codesign", "--force", "--sign", "-", "--options", "expires,hard,host,kill,library,linker-signed,restrict,runtime", "--entitlements", .suffix("macOSFramework.framework.xcent"), "--generate-entitlement-der", "/tmp/aProject.dst/Library/Frameworks/macOSFramework.framework/Versions/A"])
633+
task.checkCommandLineMatches(["/usr/bin/codesign", "--force", "--sign", "-", "--options", "expires,hard,host,kill,library,linker-signed,restrict,runtime", "--entitlements", .suffix("macOSFramework.framework.xcent"), "--generate-entitlement-der", "/tmp/aProject.dst/Library/Frameworks/macOSFramework.framework/Versions/A"]) // ignore-unacceptable-language; codesign tool option
634634
}
635635
}
636636

637637
results.checkNoDiagnostics()
638638
}
639639

640640
// Check that flags without a dedicated build setting are passed through as expected, in conjunction with DISABLE_FREEFORM_CODE_SIGN_OPTION_FLAGS removing disabled, known ones.
641-
await tester.checkBuild(BuildParameters(action: .install, configuration: "Release", overrides: ["ENABLE_LIBRARY_VALIDATION": "NO", "ENABLE_HARDENED_RUNTIME": "NO", "CODE_SIGN_RESTRICT": "YES", "OTHER_CODE_SIGN_FLAGS": "--options kill,hard,host,expires,linker-signed"]), runDestination: .macOS) { results in
641+
await tester.checkBuild(BuildParameters(action: .install, configuration: "Release", overrides: ["ENABLE_LIBRARY_VALIDATION": "NO", "ENABLE_HARDENED_RUNTIME": "NO", "CODE_SIGN_RESTRICT": "YES", "OTHER_CODE_SIGN_FLAGS": "--options kill,hard,host,expires,linker-signed"]), runDestination: .macOS) { results in // ignore-unacceptable-language; codesign tool option
642642
results.checkTarget("macOSFramework") { target in
643643
results.checkTask(.matchTarget(target), .matchRuleType("CodeSign")) { task in
644-
task.checkCommandLineMatches(["/usr/bin/codesign", "--force", "--sign", "-", "--options", "expires,hard,host,kill,linker-signed,restrict", "--entitlements", .suffix("macOSFramework.framework.xcent"), "--generate-entitlement-der", "/tmp/aProject.dst/Library/Frameworks/macOSFramework.framework/Versions/A"])
644+
task.checkCommandLineMatches(["/usr/bin/codesign", "--force", "--sign", "-", "--options", "expires,hard,host,kill,linker-signed,restrict", "--entitlements", .suffix("macOSFramework.framework.xcent"), "--generate-entitlement-der", "/tmp/aProject.dst/Library/Frameworks/macOSFramework.framework/Versions/A"]) // ignore-unacceptable-language; codesign tool option
645645
}
646646
}
647647

0 commit comments

Comments
 (0)