Skip to content

Commit 590c3be

Browse files
ikesyoparkera
authored andcommitted
[gardening] Prefer macOS over OSX (swiftlang#1500)
1 parent d1272be commit 590c3be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+115
-118
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Please remember to include platform information with your report. If the bug is
1717

1818
Before embarking on a large amount of work to implement missing functionality, please double-check with the community on the [swift-corelibs-dev](https://lists.swift.org/mailman/listinfo/swift-corelibs-dev) mailing list. Someone may already be working in this area, and we want to avoid duplication of work.
1919

20-
If your request includes functionality changes, please be sure to test your code on Linux as well as OS X. Differences in the compiler and runtime on each platform means that code that compiles and runs correctly on Darwin (where the Objective-C runtime is present) may not compile at all on Linux.
20+
If your request includes functionality changes, please be sure to test your code on Linux as well as macOS. Differences in the compiler and runtime on each platform means that code that compiles and runs correctly on Darwin (where the Objective-C runtime is present) may not compile at all on Linux.
2121

2222
##### Review
2323

Docs/Archiving.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Archiving Notes
22

3-
There is a preliminary implementation of NSKeyedArchiver and NSKeyedUnarchiver which should be compatible with the OS X version.
3+
There is a preliminary implementation of NSKeyedArchiver and NSKeyedUnarchiver which should be compatible with the macOS version.
44

5-
* NSKeyedUnarchiver reads the entire plist into memory before constructing the object graph, it should construct it incrementally as does Foundation on OS X
5+
* NSKeyedUnarchiver reads the entire plist into memory before constructing the object graph, it should construct it incrementally as does Foundation on macOS
66

77
* Paths that raise errors vs. calling _fatalError() need to be reviewed carefully
88

Docs/Design.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
## Portability
55

6-
This version of Foundation is designed to support the same API as the Foundation that ships with Apple operating systems. A key difference is that the distribution of Swift open source does not include the Objective-C runtime. This means that the source code of Foundation from OS X and iOS could not be simply reused on other platforms. However, we believe that the vast majority of the core API concepts presented in Foundation are themselves portable and are useful on all platforms.
6+
This version of Foundation is designed to support the same API as the Foundation that ships with Apple operating systems. A key difference is that the distribution of Swift open source does not include the Objective-C runtime. This means that the source code of Foundation from macOS and iOS could not be simply reused on other platforms. However, we believe that the vast majority of the core API concepts presented in Foundation are themselves portable and are useful on all platforms.
77

88
It is not a goal of this project to create new API that extends beyond the API provided on Apple operating systems, as that would hamper the goal of portability.
99

@@ -85,7 +85,7 @@ When different logic is required for the Swift runtime in CF, use the following
8585

8686
In Swift, the OS-check macro is also available:
8787
```swift
88-
#if os(OSX) || os(iOS)
88+
#if os(macOS) || os(iOS)
8989
import Darwin
9090
#elseif os(Linux)
9191
import Glibc
@@ -113,7 +113,7 @@ One of the main challenges of developing and maintaining a widely used library i
113113

114114
## Keeping Organized
115115

116-
Parts of the CoreFoundation and Foundation libraries are as old as OS X (or older). In order to support long-term maintainability, it is important to keep our source code organized.
116+
Parts of the CoreFoundation and Foundation libraries are as old as macOS (or older). In order to support long-term maintainability, it is important to keep our source code organized.
117117

118118
* If it helps keep an effective separation of concerns, feel free to split up functionality of one class over several files.
119119
* If appropriate, use `// MARK - Topic` to split up sections of a file.

Docs/GettingStarted.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Getting Started
22

3-
## On OS X
3+
## On macOS
44

5-
Although OS X is not a deployment platform for Swift Foundation, it is useful for development and test purposes.
5+
Although macOS is not a deployment platform for Swift Foundation, it is useful for development and test purposes.
66

7-
In order to build on OS X, you will need:
7+
In order to build on macOS, you will need:
88

99
* The latest version of Xcode
1010
* The latest version of the macOS SDK (at this time: 10.13.2)
@@ -81,4 +81,3 @@ When new source files or flags are added to the `build.py` script, the project w
8181
% ninja reconfigure
8282
% ninja
8383
```
84-

Foundation/AffineTransform.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
88
//
99

10-
#if os(OSX) || os(iOS)
10+
#if os(macOS) || os(iOS)
1111
import Darwin
1212
#elseif os(Linux) || CYGWIN
1313
import Glibc

Foundation/Data.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#if DEPLOYMENT_RUNTIME_SWIFT
1414

15-
#if os(OSX) || os(iOS)
15+
#if os(macOS) || os(iOS)
1616
import Darwin
1717
#elseif os(Linux)
1818
import Glibc
@@ -1391,7 +1391,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
13911391

13921392
// Avoid a crash that happens on OS X 10.11.x and iOS 9.x or before when writing a bridged Data non-atomically with Foundation's standard write() implementation.
13931393
if !options.contains(.atomic) {
1394-
#if os(OSX)
1394+
#if os(macOS)
13951395
return NSFoundationVersionNumber <= Double(NSFoundationVersionNumber10_11_Max)
13961396
#else
13971397
return NSFoundationVersionNumber <= Double(NSFoundationVersionNumber_iOS_9_x_Max)

Foundation/DateFormatter.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ open class DateFormatter : Formatter {
1414
private var __cfObject: CFType?
1515
private var _cfObject: CFType {
1616
guard let obj = __cfObject else {
17-
#if os(OSX) || os(iOS)
17+
#if os(macOS) || os(iOS)
1818
let dateStyle = CFDateFormatterStyle(rawValue: CFIndex(self.dateStyle.rawValue))!
1919
let timeStyle = CFDateFormatterStyle(rawValue: CFIndex(self.timeStyle.rawValue))!
2020
#else

Foundation/FileHandle.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import CoreFoundation
1111

12-
#if os(OSX) || os(iOS)
12+
#if os(macOS) || os(iOS)
1313
import Darwin
1414
#elseif os(Linux) || CYGWIN
1515
import Glibc

Foundation/FileManager.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
88
//
99

10-
#if os(OSX) || os(iOS)
10+
#if os(macOS) || os(iOS)
1111
import Darwin
1212
#elseif os(Linux) || CYGWIN
1313
import Glibc
@@ -127,7 +127,7 @@ open class FileManager : NSObject {
127127
guard let number = attributes[attribute] as? NSNumber else {
128128
fatalError("Can't set file permissions to \(attributes[attribute] as Any?)")
129129
}
130-
#if os(OSX) || os(iOS)
130+
#if os(macOS) || os(iOS)
131131
let modeT = number.uint16Value
132132
#elseif os(Linux) || os(Android) || CYGWIN
133133
let modeT = number.uint32Value
@@ -261,7 +261,7 @@ open class FileManager : NSObject {
261261
var result = [FileAttributeKey : Any]()
262262
result[.size] = NSNumber(value: UInt64(s.st_size))
263263

264-
#if os(OSX) || os(iOS)
264+
#if os(macOS) || os(iOS)
265265
let ti = (TimeInterval(s.st_mtimespec.tv_sec) - kCFAbsoluteTimeIntervalSince1970) + (1.0e-9 * TimeInterval(s.st_mtimespec.tv_nsec))
266266
#elseif os(Android)
267267
let ti = (TimeInterval(s.st_mtime) - kCFAbsoluteTimeIntervalSince1970) + (1.0e-9 * TimeInterval(s.st_mtime_nsec))
@@ -301,7 +301,7 @@ open class FileManager : NSObject {
301301
result[.deviceIdentifier] = NSNumber(value: UInt64(s.st_rdev))
302302
}
303303

304-
#if os(OSX) || os(iOS)
304+
#if os(macOS) || os(iOS)
305305
if (s.st_flags & UInt32(UF_IMMUTABLE | SF_IMMUTABLE)) != 0 {
306306
result[.immutable] = NSNumber(value: true)
307307
}
@@ -324,7 +324,7 @@ open class FileManager : NSObject {
324324
NSUnimplemented()
325325
#else
326326
// statvfs(2) doesn't support 64bit inode on Darwin (apfs), fallback to statfs(2)
327-
#if os(OSX) || os(iOS)
327+
#if os(macOS) || os(iOS)
328328
var s = statfs()
329329
guard statfs(path, &s) == 0 else {
330330
throw _NSErrorWithErrno(errno, reading: true, path: path)
@@ -338,7 +338,7 @@ open class FileManager : NSObject {
338338

339339

340340
var result = [FileAttributeKey : Any]()
341-
#if os(OSX) || os(iOS)
341+
#if os(macOS) || os(iOS)
342342
let blockSize = UInt64(s.f_bsize)
343343
result[.systemNumber] = NSNumber(value: UInt64(s.f_fsid.val.0))
344344
#else

Foundation/FoundationErrors.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public var NSCoderReadCorruptError: Int { return CocoaError
164164

165165
public var NSCoderValueNotFoundError: Int { return CocoaError.Code.coderValueNotFound.rawValue }
166166

167-
#if os(OSX) || os(iOS)
167+
#if os(macOS) || os(iOS)
168168
import Darwin
169169
#elseif os(Linux) || CYGWIN
170170
import Glibc

Foundation/Host.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//
99

1010

11-
#if os(OSX) || os(iOS)
11+
#if os(macOS) || os(iOS)
1212
import Darwin
1313
#elseif os(Linux) || CYGWIN
1414
import Glibc
@@ -117,7 +117,7 @@ open class Host: NSObject {
117117
}
118118
var hints = addrinfo()
119119
hints.ai_family = PF_UNSPEC
120-
#if os(OSX) || os(iOS) || os(Android)
120+
#if os(macOS) || os(iOS) || os(Android)
121121
hints.ai_socktype = SOCK_STREAM
122122
#else
123123
hints.ai_socktype = Int32(SOCK_STREAM.rawValue)

Foundation/ISO8601DateFormatter.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ open class ISO8601DateFormatter : Formatter, NSSecureCoding {
5252
private var __cfObject: CFType?
5353
private var _cfObject: CFType {
5454
guard let obj = __cfObject else {
55-
#if os(OSX) || os(iOS)
55+
#if os(macOS) || os(iOS)
5656
let format = CFISO8601DateFormatOptions(rawValue: formatOptions.rawValue)
5757
#else
5858
let format = CFISO8601DateFormatOptions(self.formatOptions.rawValue)
@@ -100,7 +100,7 @@ open class ISO8601DateFormatter : Formatter, NSSecureCoding {
100100

101101
open class func string(from date: Date, timeZone: TimeZone, formatOptions: ISO8601DateFormatter.Options = []) -> String {
102102

103-
#if os(OSX) || os(iOS)
103+
#if os(macOS) || os(iOS)
104104
let format = CFISO8601DateFormatOptions(rawValue: formatOptions.rawValue)
105105
#else
106106
let format = CFISO8601DateFormatOptions(formatOptions.rawValue)

Foundation/JSONSerialization.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import CoreFoundation
1111

12-
#if os(OSX) || os(iOS)
12+
#if os(macOS) || os(iOS)
1313
import Darwin
1414
#elseif os(Linux) || CYGWIN
1515
import Glibc

Foundation/NSCalendar.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import CoreFoundation
1111

12-
#if os(OSX) || os(iOS)
12+
#if os(macOS) || os(iOS)
1313
internal let kCFCalendarUnitEra = CFCalendarUnit.era.rawValue
1414
internal let kCFCalendarUnitYear = CFCalendarUnit.year.rawValue
1515
internal let kCFCalendarUnitMonth = CFCalendarUnit.month.rawValue
@@ -89,7 +89,7 @@ extension NSCalendar {
8989
public static let timeZone = Unit(rawValue: UInt(1 << 21))
9090

9191
internal var _cfValue: CFCalendarUnit {
92-
#if os(OSX) || os(iOS)
92+
#if os(macOS) || os(iOS)
9393
return CFCalendarUnit(rawValue: self.rawValue)
9494
#else
9595
return CFCalendarUnit(self.rawValue)

Foundation/NSCharacterSet.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import CoreFoundation
1212

13-
#if os(OSX) || os(iOS)
13+
#if os(macOS) || os(iOS)
1414
let kCFCharacterSetControl = CFCharacterSetPredefinedSet.control
1515
let kCFCharacterSetWhitespace = CFCharacterSetPredefinedSet.whitespace
1616
let kCFCharacterSetWhitespaceAndNewline = CFCharacterSetPredefinedSet.whitespaceAndNewline

Foundation/NSConcreteValue.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import CoreFoundation
1111

12-
#if os(OSX) || os(iOS)
12+
#if os(macOS) || os(iOS)
1313
import Darwin
1414
#elseif os(Linux) || CYGWIN
1515
import Glibc

Foundation/NSData.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import CoreFoundation
1111

12-
#if os(OSX) || os(iOS)
12+
#if os(macOS) || os(iOS)
1313
import Darwin
1414
#elseif os(Linux) || CYGWIN
1515
import Glibc
@@ -507,7 +507,7 @@ open class NSData : NSObject, NSCopying, NSMutableCopying, NSSecureCoding {
507507
while bytesRemaining > 0 {
508508
var bytesWritten : Int
509509
repeat {
510-
#if os(OSX) || os(iOS)
510+
#if os(macOS) || os(iOS)
511511
bytesWritten = Darwin.write(fd, buf.advanced(by: length - bytesRemaining), bytesRemaining)
512512
#elseif os(Linux) || os(Android) || CYGWIN
513513
bytesWritten = Glibc.write(fd, buf.advanced(by: length - bytesRemaining), bytesRemaining)

Foundation/NSDate.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import CoreFoundation
1111

12-
#if os(OSX) || os(iOS)
12+
#if os(macOS) || os(iOS)
1313
import Darwin
1414
#elseif os(Linux) || CYGWIN
1515
import Glibc

Foundation/NSGeometry.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
88
//
99

10-
#if os(OSX) || os(iOS)
10+
#if os(macOS) || os(iOS)
1111
import Darwin
1212
#elseif os(Linux) || CYGWIN
1313
import Glibc

Foundation/NSLocale.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ open class NSLocale: NSObject, NSCopying, NSSecureCoding {
1616
private var _identifier: UnsafeMutableRawPointer? = nil
1717
private var _cache: UnsafeMutableRawPointer? = nil
1818
private var _prefs: UnsafeMutableRawPointer? = nil
19-
#if os(OSX) || os(iOS)
19+
#if os(macOS) || os(iOS)
2020
private var _lock = pthread_mutex_t()
2121
#elseif os(Linux) || os(Android) || CYGWIN
2222
private var _lock = Int32(0)
@@ -179,7 +179,7 @@ extension NSLocale {
179179

180180
open class func characterDirection(forLanguage isoLangCode: String) -> NSLocale.LanguageDirection {
181181
let dir = CFLocaleGetLanguageCharacterDirection(isoLangCode._cfObject)
182-
#if os(OSX) || os(iOS)
182+
#if os(macOS) || os(iOS)
183183
return NSLocale.LanguageDirection(rawValue: UInt(dir.rawValue))!
184184
#else
185185
return NSLocale.LanguageDirection(rawValue: UInt(dir))!
@@ -188,7 +188,7 @@ extension NSLocale {
188188

189189
open class func lineDirection(forLanguage isoLangCode: String) -> NSLocale.LanguageDirection {
190190
let dir = CFLocaleGetLanguageLineDirection(isoLangCode._cfObject)
191-
#if os(OSX) || os(iOS)
191+
#if os(macOS) || os(iOS)
192192
return NSLocale.LanguageDirection(rawValue: UInt(dir.rawValue))!
193193
#else
194194
return NSLocale.LanguageDirection(rawValue: UInt(dir))!

0 commit comments

Comments
 (0)