Skip to content

Commit 2c634e7

Browse files
committed
Change all uses of 'CInt' to 'Int32' in the SDK overlay
1 parent 1d666d1 commit 2c634e7

File tree

7 files changed

+56
-56
lines changed

7 files changed

+56
-56
lines changed

stdlib/public/Platform/MachError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#if os(OSX) || os(iOS) || os(tvOS) || os(watchOS)
22
/// Enumeration describing Mach error codes.
3-
@objc public enum MachError : CInt {
3+
@objc public enum MachError : Int32 {
44
case KERN_SUCCESS = 0
55

66
/// Specified address is not currently valid.

stdlib/public/Platform/POSIXError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#if os(OSX) || os(iOS) || os(tvOS) || os(watchOS)
44
/// Enumeration describing POSIX error codes.
5-
@objc public enum POSIXError : CInt {
5+
@objc public enum POSIXError : Int32 {
66
// FIXME: These are the values for Darwin. We need to get the Linux
77
// values as well.
88
case EPERM = 1 /// Operation not permitted.

stdlib/public/Platform/Platform.swift

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -158,84 +158,84 @@ public var stderr : UnsafeMutablePointer<FILE> {
158158
@_silgen_name("_swift_Platform_open")
159159
func _swift_Platform_open(
160160
_ path: UnsafePointer<CChar>,
161-
_ oflag: CInt,
161+
_ oflag: Int32,
162162
_ mode: mode_t
163-
) -> CInt
163+
) -> Int32
164164

165165
@_silgen_name("_swift_Platform_openat")
166166
func _swift_Platform_openat(
167-
_ fd: CInt,
167+
_ fd: Int32,
168168
_ path: UnsafePointer<CChar>,
169-
_ oflag: CInt,
169+
_ oflag: Int32,
170170
_ mode: mode_t
171-
) -> CInt
171+
) -> Int32
172172

173173
public func open(
174174
_ path: UnsafePointer<CChar>,
175-
_ oflag: CInt
176-
) -> CInt {
175+
_ oflag: Int32
176+
) -> Int32 {
177177
return _swift_Platform_open(path, oflag, 0)
178178
}
179179

180180
public func open(
181181
_ path: UnsafePointer<CChar>,
182-
_ oflag: CInt,
182+
_ oflag: Int32,
183183
_ mode: mode_t
184-
) -> CInt {
184+
) -> Int32 {
185185
return _swift_Platform_open(path, oflag, mode)
186186
}
187187

188188
public func openat(
189-
_ fd: CInt,
189+
_ fd: Int32,
190190
_ path: UnsafePointer<CChar>,
191-
_ oflag: CInt
192-
) -> CInt {
191+
_ oflag: Int32
192+
) -> Int32 {
193193
return _swift_Platform_openat(fd, path, oflag, 0)
194194
}
195195

196196
public func openat(
197-
_ fd: CInt,
197+
_ fd: Int32,
198198
_ path: UnsafePointer<CChar>,
199-
_ oflag: CInt,
199+
_ oflag: Int32,
200200
_ mode: mode_t
201-
) -> CInt {
201+
) -> Int32 {
202202
return _swift_Platform_openat(fd, path, oflag, mode)
203203
}
204204

205205
@_silgen_name("_swift_Platform_fcntl")
206206
internal func _swift_Platform_fcntl(
207-
_ fd: CInt,
208-
_ cmd: CInt,
209-
_ value: CInt
210-
) -> CInt
207+
_ fd: Int32,
208+
_ cmd: Int32,
209+
_ value: Int32
210+
) -> Int32
211211

212212
@_silgen_name("_swift_Platform_fcntlPtr")
213213
internal func _swift_Platform_fcntlPtr(
214-
_ fd: CInt,
215-
_ cmd: CInt,
214+
_ fd: Int32,
215+
_ cmd: Int32,
216216
_ ptr: UnsafeMutablePointer<Void>
217-
) -> CInt
217+
) -> Int32
218218

219219
public func fcntl(
220-
_ fd: CInt,
221-
_ cmd: CInt
222-
) -> CInt {
220+
_ fd: Int32,
221+
_ cmd: Int32
222+
) -> Int32 {
223223
return _swift_Platform_fcntl(fd, cmd, 0)
224224
}
225225

226226
public func fcntl(
227-
_ fd: CInt,
228-
_ cmd: CInt,
229-
_ value: CInt
230-
) -> CInt {
227+
_ fd: Int32,
228+
_ cmd: Int32,
229+
_ value: Int32
230+
) -> Int32 {
231231
return _swift_Platform_fcntl(fd, cmd, value)
232232
}
233233

234234
public func fcntl(
235-
_ fd: CInt,
236-
_ cmd: CInt,
235+
_ fd: Int32,
236+
_ cmd: Int32,
237237
_ ptr: UnsafeMutablePointer<Void>
238-
) -> CInt {
238+
) -> Int32 {
239239
return _swift_Platform_fcntlPtr(fd, cmd, ptr)
240240
}
241241

@@ -345,27 +345,27 @@ public var SEM_FAILED: UnsafeMutablePointer<sem_t>? {
345345
@_silgen_name("_swift_Platform_sem_open2")
346346
internal func _swift_Platform_sem_open2(
347347
_ name: UnsafePointer<CChar>,
348-
_ oflag: CInt
348+
_ oflag: Int32
349349
) -> UnsafeMutablePointer<sem_t>?
350350

351351
@_silgen_name("_swift_Platform_sem_open4")
352352
internal func _swift_Platform_sem_open4(
353353
_ name: UnsafePointer<CChar>,
354-
_ oflag: CInt,
354+
_ oflag: Int32,
355355
_ mode: mode_t,
356356
_ value: CUnsignedInt
357357
) -> UnsafeMutablePointer<sem_t>?
358358

359359
public func sem_open(
360360
_ name: UnsafePointer<CChar>,
361-
_ oflag: CInt
361+
_ oflag: Int32
362362
) -> UnsafeMutablePointer<sem_t>? {
363363
return _swift_Platform_sem_open2(name, oflag)
364364
}
365365

366366
public func sem_open(
367367
_ name: UnsafePointer<CChar>,
368-
_ oflag: CInt,
368+
_ oflag: Int32,
369369
_ mode: mode_t,
370370
_ value: CUnsignedInt
371371
) -> UnsafeMutablePointer<sem_t>? {

stdlib/public/Platform/tgmath.swift.gyb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public func modf(_ value: ${T}) -> (${T}, ${T}) {
211211
% for T, CT, f in AllFloatTypes():
212212
@_transparent
213213
public func ldexp(_ x: ${T}, _ n: Int) -> ${T} {
214-
return ${T}(ldexp${f}(${CT}(x), CInt(n)))
214+
return ${T}(ldexp${f}(${CT}(x), Int32(n)))
215215
}
216216

217217
% end
@@ -220,7 +220,7 @@ public func ldexp(_ x: ${T}, _ n: Int) -> ${T} {
220220
% for T, CT, f in AllFloatTypes():
221221
@_transparent
222222
public func frexp(_ value: ${T}) -> (${T}, Int) {
223-
var exp = CInt(0)
223+
var exp = Int32(0)
224224
let frac = frexp${f}(${CT}(value), &exp)
225225
return (${T}(frac), Int(exp))
226226
}
@@ -231,7 +231,7 @@ public func frexp(_ value: ${T}) -> (${T}, Int) {
231231
% for T, CT, f in AllFloatTypes():
232232
@_transparent
233233
public func ilogb(_ x: ${T}) -> Int {
234-
return Int(ilogb${f}(${CT}(x)) as CInt)
234+
return Int(ilogb${f}(${CT}(x)) as Int32)
235235
}
236236

237237
% end
@@ -240,7 +240,7 @@ public func ilogb(_ x: ${T}) -> Int {
240240
% for T, CT, f in AllFloatTypes():
241241
@_transparent
242242
public func scalbn(_ x: ${T}, _ n: Int) -> ${T} {
243-
return ${T}(scalbn${f}(${CT}(x), CInt(n)))
243+
return ${T}(scalbn${f}(${CT}(x), Int32(n)))
244244
}
245245

246246
% end
@@ -250,7 +250,7 @@ public func scalbn(_ x: ${T}, _ n: Int) -> ${T} {
250250
#if os(Linux) || os(FreeBSD) || os(Android) || os(Windows)
251251
@_transparent
252252
public func lgamma(_ x: ${T}) -> (${T}, Int) {
253-
var sign = CInt(0)
253+
var sign = Int32(0)
254254
let value = lgamma${f}_r(${CT}(x), &sign)
255255
return (${T}(value), Int(sign))
256256
}
@@ -260,13 +260,13 @@ public func lgamma(_ x: ${T}) -> (${T}, Int) {
260260
@_versioned
261261
@_silgen_name("_swift_Darwin_lgamma${f}_r")
262262
func _swift_Darwin_lgamma${f}_r(_: ${CT},
263-
_: UnsafeMutablePointer<CInt>) -> ${CT}
263+
_: UnsafeMutablePointer<Int32>) -> ${CT}
264264

265265
@_transparent
266266
public func lgamma(_ x: ${T}) -> (${T}, Int) {
267-
var sign = CInt(0)
267+
var sign = Int32(0)
268268
let value = withUnsafeMutablePointer(&sign) {
269-
(signp: UnsafeMutablePointer<CInt>) -> ${CT} in
269+
(signp: UnsafeMutablePointer<Int32>) -> ${CT} in
270270
return _swift_Darwin_lgamma${f}_r(${CT}(x), signp)
271271
}
272272
return (${T}(value), Int(sign))
@@ -279,7 +279,7 @@ public func lgamma(_ x: ${T}) -> (${T}, Int) {
279279
% for T, CT, f in AllFloatTypes():
280280
@_transparent
281281
public func remquo(_ x: ${T}, _ y: ${T}) -> (${T}, Int) {
282-
var quo = CInt(0)
282+
var quo = Int32(0)
283283
let rem = remquo${f}(${CT}(x), ${CT}(y), &quo)
284284
return (${T}(rem), Int(quo))
285285
}
@@ -305,12 +305,12 @@ public func fma(_ x: ${T}, _ y: ${T}, _ z: ${T}) -> ${T} {
305305
% # These C functions only support double. The overlay fixes the Int parameter.
306306
@_transparent
307307
public func jn(_ n: Int, _ x: Double) -> Double {
308-
return jn(CInt(n), x)
308+
return jn(Int32(n), x)
309309
}
310310

311311
@_transparent
312312
public func yn(_ n: Int, _ x: Double) -> Double {
313-
return yn(CInt(n), x)
313+
return yn(Int32(n), x)
314314
}
315315

316316
% end

stdlib/public/core/Process.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ public enum Process {
3333
}
3434

3535
@_versioned
36-
internal static var _argc: CInt = CInt()
36+
internal static var _argc: Int32 = Int32()
3737

3838
@_versioned
3939
internal static var _unsafeArgv:
4040
UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>?
4141
= nil
4242

4343
/// Access to the raw argc value from C.
44-
public static var argc: CInt {
44+
public static var argc: Int32 {
4545
return _argc
4646
}
4747

@@ -82,6 +82,6 @@ func _stdlib_didEnterMain(
8282
) {
8383
// Initialize the Process.argc and Process.unsafeArgv variables with the
8484
// values that were passed in to main.
85-
Process._argc = CInt(argc)
85+
Process._argc = Int32(argc)
8686
Process._unsafeArgv = argv
8787
}

stdlib/public/core/VarArgs.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public func _encodeBitsAsWords<T : CVarArg>(_ x: T) -> [Int] {
121121
}
122122

123123
// CVarArg conformances for the integer types. Everything smaller
124-
// than a CInt must be promoted to CInt or CUnsignedInt before
124+
// than an Int32 must be promoted to Int32 or CUnsignedInt before
125125
// encoding.
126126

127127
// Signed types
@@ -160,15 +160,15 @@ extension Int16 : CVarArg {
160160
/// Transform `self` into a series of machine words that can be
161161
/// appropriately interpreted by C varargs.
162162
public var _cVarArgEncoding: [Int] {
163-
return _encodeBitsAsWords(CInt(self))
163+
return _encodeBitsAsWords(Int32(self))
164164
}
165165
}
166166

167167
extension Int8 : CVarArg {
168168
/// Transform `self` into a series of machine words that can be
169169
/// appropriately interpreted by C varargs.
170170
public var _cVarArgEncoding: [Int] {
171-
return _encodeBitsAsWords(CInt(self))
171+
return _encodeBitsAsWords(Int32(self))
172172
}
173173
}
174174

test/IDE/print_stdlib.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// CHECK-UNDERSCORED-PROT: public protocol _SignedInteger
2323
// CHECK-UNDERSCORED-PROT-NOT: protocol _
2424

25-
// CHECK-ARGC: static var argc: CInt { get }
25+
// CHECK-ARGC: static var argc: Int32 { get }
2626

2727
// CHECK-NOT: @rethrows
2828
// CHECK-NOT: {{^}}import

0 commit comments

Comments
 (0)