Skip to content

Commit e752560

Browse files
authored
Remove non-inclusive language (#2954)
rdar://problem/69396992
1 parent 6b43447 commit e752560

File tree

9 files changed

+41
-41
lines changed

9 files changed

+41
-41
lines changed

Sources/PackageLoading/Target+PkgConfig.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ public func pkgConfigArgs(for target: SystemLibraryTarget, diagnostics: Diagnost
7272
fileSystem: fileSystem,
7373
brewPrefix: brewPrefix)
7474

75-
// Run the whitelist checker.
76-
let filtered = whitelist(pcFile: pkgConfigName, flags: (pkgConfig.cFlags, pkgConfig.libs))
75+
// Run the allow list checker.
76+
let filtered = allowlist(pcFile: pkgConfigName, flags: (pkgConfig.cFlags, pkgConfig.libs))
7777

7878
// Remove any default flags which compiler adds automatically.
7979
let (cFlags, libs) = removeDefaultFlags(cFlags: filtered.cFlags, libs: filtered.libs)
8080

8181
// Set the error if there are any unallowed flags.
8282
var error: Swift.Error?
8383
if !filtered.unallowed.isEmpty {
84-
error = PkgConfigError.nonWhitelistedFlags(filtered.unallowed.joined(separator: ", "))
84+
error = PkgConfigError.prohibitedFlags(filtered.unallowed.joined(separator: ", "))
8585
}
8686

8787
return PkgConfigResult(
@@ -170,7 +170,7 @@ extension SystemPackageProviderDescription {
170170
/// compiler/linker. List of allowed flags:
171171
/// cFlags: -I, -F
172172
/// libs: -L, -l, -F, -framework, -w
173-
public func whitelist(
173+
public func allowlist(
174174
pcFile: String,
175175
flags: (cFlags: [String], libs: [String])
176176
) -> (cFlags: [String], libs: [String], unallowed: [String]) {

Tests/PackageLoadingTests/Inputs/Bar.pc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ Name: Foo
77
URL: http://127.0.0.1/
88
Description: The one and only SystemModule
99
Version: 1.10.0
10-
Cflags: -I${includedir} -I/path/to/inc -DBlackListed
10+
Cflags: -I${includedir} -I/path/to/inc -DDenyListed
1111
Libs: -L${libdir} -L/usr/da/lib -lSystemModule -lok

Tests/PackageLoadingTests/PkgConfigTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class PkgConfigTests: XCTestCase {
8181
XCTAssertFalse(result.couldNotFindConfigFile)
8282
}
8383

84-
// Pc file with non whitelisted flags.
84+
// Pc file with prohibited flags.
8585
try withCustomEnv(["PKG_CONFIG_PATH": inputsDir.pathString]) {
8686
let result = pkgConfigArgs(for: SystemLibraryTarget(pkgConfig: "Bar"), diagnostics: diagnostics)!
8787
XCTAssertEqual(result.pkgConfigName, "Bar")
@@ -90,8 +90,8 @@ class PkgConfigTests: XCTestCase {
9090
XCTAssertNil(result.provider)
9191
XCTAssertFalse(result.couldNotFindConfigFile)
9292
switch result.error {
93-
case PkgConfigError.nonWhitelistedFlags(let desc)?:
94-
XCTAssertEqual(desc, "-DBlackListed")
93+
case PkgConfigError.prohibitedFlags(let desc)?:
94+
XCTAssertEqual(desc, "-DDenyListed")
9595
default:
9696
XCTFail("unexpected error \(result.error.debugDescription)")
9797
}

Tests/PackageLoadingTests/WhitelistTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@
1111
import PackageLoading
1212
import XCTest
1313

14-
final class PkgConfigWhitelistTests: XCTestCase {
14+
final class PkgConfigAllowlistTests: XCTestCase {
1515
func testSimpleFlags() {
1616
let cFlags = ["-I/usr/local/Cellar/gtk+3/3.18.9/include/gtk-3.0"]
1717
let libs = ["-L/usr/local/Cellar/gtk+3/3.18.9/lib", "-lgtk-3", "-w"]
18-
XCTAssertTrue(whitelist(pcFile: "dummy", flags: (cFlags, libs)).unallowed.isEmpty)
18+
XCTAssertTrue(allowlist(pcFile: "dummy", flags: (cFlags, libs)).unallowed.isEmpty)
1919
}
2020

2121
func testFlagsWithInvalidFlags() {
2222
let cFlags = ["-I/usr/local/Cellar/gtk+3/3.18.9/include/gtk-3.0", "-L/hello"]
2323
let libs = ["-L/usr/local/Cellar/gtk+3/3.18.9/lib", "-lgtk-3", "-module-name", "name", "-werror"]
24-
let unallowed = whitelist(pcFile: "dummy", flags: (cFlags, libs)).unallowed
24+
let unallowed = allowlist(pcFile: "dummy", flags: (cFlags, libs)).unallowed
2525
XCTAssertEqual(unallowed, ["-L/hello", "-module-name", "name", "-werror"])
2626
}
2727

2828
func testFlagsWithValueInNextFlag() {
2929
let cFlags = ["-I/usr/local", "-I", "/usr/local/Cellar/gtk+3/3.18.9/include/gtk-3.0", "-L/hello"]
3030
let libs = ["-L", "/usr/lib", "-L/usr/local/Cellar/gtk+3/3.18.9/lib", "-lgtk-3", "-module-name", "-lcool", "ok", "name"]
31-
let unallowed = whitelist(pcFile: "dummy", flags: (cFlags, libs)).unallowed
31+
let unallowed = allowlist(pcFile: "dummy", flags: (cFlags, libs)).unallowed
3232
XCTAssertEqual(unallowed, ["-L/hello", "-module-name", "ok", "name"])
3333
}
3434

swift-tools-support-core/Sources/TSCBasic/StringConversions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/// - codeUnit: The code unit to be checked.
1515
///
1616
/// - Returns: True if shell escaping is not needed.
17-
private func inShellWhitelist(_ codeUnit: UInt8) -> Bool {
17+
private func inShellAllowlist(_ codeUnit: UInt8) -> Bool {
1818
#if os(Windows)
1919
if codeUnit == UInt8(ascii: "\\") {
2020
return true
@@ -49,8 +49,8 @@ extension String {
4949
/// - Returns: Shell escaped string.
5050
public func spm_shellEscaped() -> String {
5151

52-
// If all the characters in the string are in whitelist then no need to escape.
53-
guard let pos = utf8.firstIndex(where: { !inShellWhitelist($0) }) else {
52+
// If all the characters in the string are in the allow list then no need to escape.
53+
guard let pos = utf8.firstIndex(where: { !inShellAllowlist($0) }) else {
5454
return self
5555
}
5656

swift-tools-support-core/Sources/TSCTestSupport/PseudoTerminal.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,43 @@ import TSCLibc
1414
#if os(Windows)
1515
#else
1616
public final class PseudoTerminal {
17-
let master: Int32
18-
let slave: Int32
17+
let primary: Int32
18+
let secondary: Int32
1919
public var outStream: LocalFileOutputByteStream
2020

2121
public init?(){
22-
var master: Int32 = 0
23-
var slave: Int32 = 0
24-
if openpty(&master, &slave, nil, nil, nil) != 0 {
22+
var primary: Int32 = 0
23+
var secondary: Int32 = 0
24+
if openpty(&primary, &secondary, nil, nil, nil) != 0 {
2525
return nil
2626
}
27-
guard let outStream = try? LocalFileOutputByteStream(filePointer: fdopen(slave, "w"), closeOnDeinit: false) else {
27+
guard let outStream = try? LocalFileOutputByteStream(filePointer: fdopen(secondary, "w"), closeOnDeinit: false) else {
2828
return nil
2929
}
3030
self.outStream = outStream
31-
self.master = master
32-
self.slave = slave
31+
self.primary = primary
32+
self.secondary = secondary
3333
}
3434

35-
public func readMaster(maxChars n: Int = 1000) -> String? {
35+
public func readPrimary(maxChars n: Int = 1000) -> String? {
3636
var buf: [CChar] = [CChar](repeating: 0, count: n)
37-
if read(master, &buf, n) <= 0 {
37+
if read(primary, &buf, n) <= 0 {
3838
return nil
3939
}
4040
return String(cString: buf)
4141
}
4242

43-
public func closeSlave() {
44-
_ = TSCLibc.close(slave)
43+
public func closeSecondary() {
44+
_ = TSCLibc.close(secondary)
4545
}
4646

47-
public func closeMaster() {
48-
_ = TSCLibc.close(master)
47+
public func closePrimary() {
48+
_ = TSCLibc.close(primary)
4949
}
5050

5151
public func close() {
52-
closeSlave()
53-
closeMaster()
52+
closeSecondary()
53+
closePrimary()
5454
}
5555
}
5656
#endif

swift-tools-support-core/Sources/TSCUtility/PkgConfig.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ import Foundation
1414
public enum PkgConfigError: Swift.Error, CustomStringConvertible {
1515
case couldNotFindConfigFile(name: String)
1616
case parsingError(String)
17-
case nonWhitelistedFlags(String)
17+
case prohibitedFlags(String)
1818

1919
public var description: String {
2020
switch self {
2121
case .couldNotFindConfigFile(let name):
2222
return "couldn't find pc file for \(name)"
2323
case .parsingError(let error):
2424
return "parsing error(s): \(error)"
25-
case .nonWhitelistedFlags(let flags):
26-
return "non whitelisted flag(s): \(flags)"
25+
case .prohibitedFlags(let flags):
26+
return "prohibited flag(s): \(flags)"
2727
}
2828
}
2929
}

swift-tools-support-core/Tests/TSCBasicTests/TerminalControllerTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ final class TerminalControllerTests: XCTestCase {
2323

2424
// Test red color.
2525
term.write("hello", inColor: .red)
26-
XCTAssertEqual(pty.readMaster(), "\u{1B}[31mhello\u{1B}[0m")
26+
XCTAssertEqual(pty.readPrimary(), "\u{1B}[31mhello\u{1B}[0m")
2727

2828
// Test clearLine.
2929
term.clearLine()
30-
XCTAssertEqual(pty.readMaster(), "\u{1B}[2K\r")
30+
XCTAssertEqual(pty.readPrimary(), "\u{1B}[2K\r")
3131

3232
// Test endline.
3333
term.endLine()
34-
XCTAssertEqual(pty.readMaster(), "\r\n")
34+
XCTAssertEqual(pty.readPrimary(), "\r\n")
3535

3636
// Test move cursor.
3737
term.moveCursor(up: 3)
38-
XCTAssertEqual(pty.readMaster(), "\u{1B}[3A")
38+
XCTAssertEqual(pty.readPrimary(), "\u{1B}[3A")
3939

4040
// Test color wrapping.
4141
var wrapped = term.wrap("hello", inColor: .noColor)

swift-tools-support-core/Tests/TSCUtilityTests/ProgressAnimationTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,18 @@ final class ProgressAnimationTests: XCTestCase {
108108

109109
var output = ""
110110
let thread = Thread {
111-
while let out = terminal.readMaster() {
111+
while let out = terminal.readPrimary() {
112112
output += out
113113
}
114114
}
115115

116116
thread.start()
117117
closure(terminal)
118-
terminal.closeSlave()
118+
terminal.closeSecondary()
119119

120120
// Make sure to read the complete output before checking it.
121121
thread.join()
122-
terminal.closeMaster()
122+
terminal.closePrimary()
123123

124124
return output
125125
}

0 commit comments

Comments
 (0)