Skip to content

Commit cd8f845

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

File tree

16 files changed

+50
-51
lines changed

16 files changed

+50
-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: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,7 +2132,7 @@ 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.
2135+
// FIXME: If we want to match what Xcode did, then when using non-parallel WMO, we should include $(TARGET_NAME)-primary.o as an output file, but not include the per-input-file object files as output files.
21362136
let outputObjectExtension: String
21372137
switch cbc.scope.evaluate(BuiltinMacros.SWIFT_LTO) {
21382138
case .yes, .yesThin:
@@ -2161,11 +2161,11 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
21612161

21622162
// Add const metadata outputs to extra compilation outputs
21632163
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.
2164+
// If using whole module optimization then we use the -primary.swiftconstvalues file from the sole compilation task.
21652165
if isUsingWholeModuleOptimization {
21662166
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")
2167+
let primarySwiftBaseName = cbc.scope.evaluate(BuiltinMacros.TARGET_NAME) + compilationMode.moduleBaseNameSuffix + "-primary"
2168+
let supplementaryConstMetadataOutputPath = outputPath.dirname.join(primarySwiftBaseName + ".swiftconstvalues")
21692169
extraOutputPaths.append(supplementaryConstMetadataOutputPath)
21702170
delegate.declareGeneratedSwiftConstMetadataFile(supplementaryConstMetadataOutputPath, architecture: arch)
21712171
}
@@ -2232,11 +2232,11 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
22322232
//
22332233
// FIXME: Can we simplify this to not require the full macro scope?
22342234
//
2235-
// If using whole module optimization then we use the -master.d file as the dependency file.
2235+
// If using whole module optimization then we use the -primary.d file as the dependency file.
22362236
if let outputPath = objectOutputPaths.first {
22372237
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")
2238+
let primarySwiftBaseName = cbc.scope.evaluate(BuiltinMacros.TARGET_NAME) + compilationMode.moduleBaseNameSuffix + "-primary"
2239+
let dependenciesFilePath = outputPath.dirname.join(primarySwiftBaseName + ".d")
22402240
return dependenciesFilePath
22412241
} else {
22422242
// if not using WMO, we use the first .d file as all are the same
@@ -2348,8 +2348,8 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
23482348
let dependencyData: DependencyDataStyle?
23492349
if await shouldEmitMakeStyleDependencies(cbc.producer, cbc.scope, delegate: delegate) {
23502350
// 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")
2351+
let primarySwiftBaseName = cbc.scope.evaluate(BuiltinMacros.TARGET_NAME) + compilationMode.moduleBaseNameSuffix + "-primary"
2352+
let emitModuleDependenciesFilePath = objectFileDir.join(primarySwiftBaseName + "-emit-module.d")
23532353
dependencyData = eagerCompilationEnabled ? .makefileIgnoringSubsequentOutputs(emitModuleDependenciesFilePath) : dependencyInfoPath.map(DependencyDataStyle.makefileIgnoringSubsequentOutputs)
23542354
} else {
23552355
dependencyData = nil
@@ -2755,7 +2755,7 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
27552755
moduleDirPath = scope.evaluate(BuiltinMacros.BUILT_PRODUCTS_DIR).join(moduleName + ".swiftmodule")
27562756
}
27572757
if isProject {
2758-
// Copy this content to the Project subdir so we could master them out when installing.
2758+
// Copy this content to the Project subdir so we can exclude them when installing.
27592759
return moduleDirPath.join("Project")
27602760
}
27612761
return moduleDirPath
@@ -3047,7 +3047,7 @@ public final class SwiftCompilerSpec : CompilerSpec, SpecIdentifierType, SwiftDi
30473047

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

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

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

31163116
// The diagnostics file.
3117-
let diagnosticsFilePath = objectFileDir.join(masterSwiftBaseName + ".dia")
3117+
let diagnosticsFilePath = objectFileDir.join(primarySwiftBaseName + ".dia")
31183118
fileMapEntry.diagnostics = diagnosticsFilePath.str
31193119

31203120
// The diagnostics file for emit-module jobs.
3121-
let emitModuleDiagnosticsFilePath = objectFileDir.join(masterSwiftBaseName + "-emit-module.dia")
3121+
let emitModuleDiagnosticsFilePath = objectFileDir.join(primarySwiftBaseName + "-emit-module.dia")
31223122
fileMapEntry.emitModuleDiagnostics = emitModuleDiagnosticsFilePath.str
31233123

31243124
if await shouldEmitMakeStyleDependencies(cbc.producer, cbc.scope, delegate: delegate) {
31253125
// The dependency file for emit-module jobs.
3126-
let emitModuleDependenciesFilePath = objectFileDir.join(masterSwiftBaseName + "-emit-module.d")
3126+
let emitModuleDependenciesFilePath = objectFileDir.join(primarySwiftBaseName + "-emit-module.d")
31273127
fileMapEntry.emitModuleDependencies = emitModuleDependenciesFilePath.str
31283128
}
31293129

31303130
// The PCH file path for generatePCH job.
3131-
let bridgingHeaderPCHPath = objectFileDir.join(masterSwiftBaseName + "-Bridging-header.pch")
3131+
let bridgingHeaderPCHPath = objectFileDir.join(primarySwiftBaseName + "-Bridging-header.pch")
31323132
fileMapEntry.pch = bridgingHeaderPCHPath.str
31333133

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

31483148
// The diagnostics file.
3149-
let diagnosticsFilePath = objectFileDir.join(masterSwiftBaseName + ".dia")
3149+
let diagnosticsFilePath = objectFileDir.join(primarySwiftBaseName + ".dia")
31503150
fileMapEntry.diagnostics = diagnosticsFilePath.str
31513151

31523152
// The diagnostics file for emit-module jobs.
3153-
let emitModuleDiagnosticsFilePath = objectFileDir.join(masterSwiftBaseName + "-emit-module.dia")
3153+
let emitModuleDiagnosticsFilePath = objectFileDir.join(primarySwiftBaseName + "-emit-module.dia")
31543154
fileMapEntry.emitModuleDiagnostics = emitModuleDiagnosticsFilePath.str
31553155

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

31613161

31623162
// The dependencies file, used to discover implicit dependencies. This file will be in Makefile format.
3163-
let dependenciesFilePath = objectFileDir.join(masterSwiftBaseName + ".d")
3163+
let dependenciesFilePath = objectFileDir.join(primarySwiftBaseName + ".d")
31643164
fileMapEntry.dependencies = dependenciesFilePath.str
31653165
}
31663166

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

31713171
// The requested compile-time values
31723172
if emitConstSideCarValues && compilationMode.compileSources {
3173-
fileMapEntry.constValues = objectFileDir.join(masterSwiftBaseName + ".swiftconstvalues").str
3173+
fileMapEntry.constValues = objectFileDir.join(primarySwiftBaseName + ".swiftconstvalues").str
31743174
}
31753175

31763176
// The PCH file path for generatePCH job.
3177-
let bridgingHeaderPCHPath = objectFileDir.join(masterSwiftBaseName + "-Bridging-header.pch")
3177+
let bridgingHeaderPCHPath = objectFileDir.join(primarySwiftBaseName + "-Bridging-header.pch")
31783178
fileMapEntry.pch = bridgingHeaderPCHPath.str
31793179

31803180
// 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)