File tree Expand file tree Collapse file tree 11 files changed +45
-34
lines changed Expand file tree Collapse file tree 11 files changed +45
-34
lines changed Original file line number Diff line number Diff line change @@ -17,24 +17,25 @@ import SwiftShims
17
17
// printing to not need to heap allocate).
18
18
19
19
@_silgen_name ( " putchar " )
20
- func putchar( _: UInt8 )
20
+ @discardableResult
21
+ func putchar( _: CInt ) -> CInt
21
22
22
23
public func print( _ string: StaticString , terminator: StaticString = " \n" ) {
23
24
var p = string.utf8Start
24
25
while p.pointee != 0 {
25
- putchar ( p. pointee)
26
+ putchar(CInt( p.pointee) )
26
27
p += 1
27
28
}
28
29
p = terminator.utf8Start
29
30
while p.pointee != 0 {
30
- putchar ( p. pointee)
31
+ putchar(CInt( p.pointee) )
31
32
p += 1
32
33
}
33
34
}
34
35
35
36
func printCharacters(_ buf: UnsafeRawBufferPointer) {
36
37
for c in buf {
37
- putchar ( c )
38
+ putchar(CInt(c) )
38
39
}
39
40
}
40
41
Original file line number Diff line number Diff line change 10
10
// REQUIRES: OS=macosx || OS=linux-gnu
11
11
12
12
@_silgen_name ( " putchar " )
13
- func putchar( _: UInt8 )
13
+ @discardableResult
14
+ func putchar( _: CInt ) -> CInt
14
15
15
16
public func print( _ s: StaticString , terminator: StaticString = " \n" ) {
16
17
var p = s.utf8Start
17
18
while p.pointee != 0 {
18
- putchar ( p. pointee)
19
+ putchar(CInt( p.pointee) )
19
20
p += 1
20
21
}
21
22
p = terminator.utf8Start
22
23
while p.pointee != 0 {
23
- putchar ( p. pointee)
24
+ putchar(CInt( p.pointee) )
24
25
p += 1
25
26
}
26
27
}
Original file line number Diff line number Diff line change 10
10
// REQUIRES: OS=macosx || OS=linux-gnu
11
11
12
12
@_silgen_name ( " putchar " )
13
- func putchar( _: UInt8 )
13
+ @discardableResult
14
+ func putchar( _: CInt ) -> CInt
14
15
15
16
public func print( _ s: StaticString , terminator: StaticString = " \n" ) {
16
17
var p = s.utf8Start
17
18
while p.pointee != 0 {
18
- putchar ( p. pointee)
19
+ putchar(CInt( p.pointee) )
19
20
p += 1
20
21
}
21
22
p = terminator.utf8Start
22
23
while p.pointee != 0 {
23
- putchar ( p. pointee)
24
+ putchar(CInt( p.pointee) )
24
25
p += 1
25
26
}
26
27
}
Original file line number Diff line number Diff line change 10
10
// REQUIRES: OS=macosx || OS=linux-gnu
11
11
12
12
@_silgen_name ( " putchar " )
13
- func putchar( _: UInt8 )
13
+ @discardableResult
14
+ func putchar( _: CInt ) -> CInt
14
15
15
16
public func print( _ s: StaticString , terminator: StaticString = " \n" ) {
16
17
var p = s.utf8Start
17
18
while p.pointee != 0 {
18
- putchar ( p. pointee)
19
+ putchar(CInt( p.pointee) )
19
20
p += 1
20
21
}
21
22
p = terminator.utf8Start
22
23
while p.pointee != 0 {
23
- putchar ( p. pointee)
24
+ putchar(CInt( p.pointee) )
24
25
p += 1
25
26
}
26
27
}
Original file line number Diff line number Diff line change 8
8
// REQUIRES: OS=macosx || OS=linux-gnu
9
9
10
10
@_silgen_name ( " putchar " )
11
- func putchar( _: UInt8 )
11
+ @discardableResult
12
+ func putchar( _: CInt ) -> CInt
12
13
13
14
public func print( _ s: StaticString , terminator: StaticString = " \n" ) {
14
15
var p = s.utf8Start
15
16
while p.pointee != 0 {
16
- putchar ( p. pointee)
17
+ putchar(CInt( p.pointee) )
17
18
p += 1
18
19
}
19
20
p = terminator.utf8Start
20
21
while p.pointee != 0 {
21
- putchar ( p. pointee)
22
+ putchar(CInt( p.pointee) )
22
23
p += 1
23
24
}
24
25
}
Original file line number Diff line number Diff line change 29
29
// UNSUPPORTED: OS=linux-gnu && CPU=aarch64
30
30
31
31
@_silgen_name ( " putchar " )
32
- func putchar( _: UInt8 )
32
+ @discardableResult
33
+ func putchar( _: CInt ) -> CInt
33
34
34
35
public func print( _ s: StaticString , terminator: StaticString = " \n" ) {
35
36
var p = s.utf8Start
36
37
while p.pointee != 0 {
37
- putchar ( p. pointee)
38
+ putchar(CInt( p.pointee) )
38
39
p += 1
39
40
}
40
41
p = terminator.utf8Start
41
42
while p.pointee != 0 {
42
- putchar ( p. pointee)
43
+ putchar(CInt( p.pointee) )
43
44
p += 1
44
45
}
45
46
}
Original file line number Diff line number Diff line change @@ -22,12 +22,13 @@ extension StaticString {
22
22
}
23
23
24
24
@_silgen_name ( " putchar " )
25
- func putchar( _: UInt8 )
25
+ @discardableResult
26
+ func putchar( _: CInt ) -> CInt
26
27
27
28
extension Array< UInt8 > {
28
29
func print( ) {
29
30
for byte in self {
30
- putchar ( byte)
31
+ putchar ( CInt ( byte) )
31
32
}
32
33
putchar ( 10 )
33
34
}
Original file line number Diff line number Diff line change 13
13
// REQUIRES: no_asan
14
14
15
15
@_silgen_name ( " putchar " )
16
- func putchar( _: UInt8 )
16
+ @discardableResult
17
+ func putchar( _: CInt ) -> CInt
17
18
18
19
public func print( _ s: StaticString , terminator: StaticString = " \n" ) {
19
20
var p = s.utf8Start
20
21
while p.pointee != 0 {
21
- putchar ( p. pointee)
22
+ putchar(CInt( p.pointee) )
22
23
p += 1
23
24
}
24
25
p = terminator.utf8Start
25
26
while p.pointee != 0 {
26
- putchar ( p. pointee)
27
+ putchar(CInt( p.pointee) )
27
28
p += 1
28
29
}
29
30
}
Original file line number Diff line number Diff line change @@ -25,17 +25,18 @@ public func foo() {
25
25
import MyModule
26
26
27
27
@_silgen_name ( " putchar " )
28
- func putchar( _: UInt8 )
28
+ @discardableResult
29
+ func putchar( _: CInt ) -> CInt
29
30
30
31
public func print( _ s: StaticString , terminator: StaticString = " \n" ) {
31
32
var p = s.utf8Start
32
33
while p.pointee != 0 {
33
- putchar ( p. pointee)
34
+ putchar(CInt( p.pointee) )
34
35
p += 1
35
36
}
36
37
p = terminator.utf8Start
37
38
while p.pointee != 0 {
38
- putchar ( p. pointee)
39
+ putchar(CInt( p.pointee) )
39
40
p += 1
40
41
}
41
42
}
Original file line number Diff line number Diff line change 14
14
// BEGIN MyModule.swift
15
15
16
16
@_silgen_name ( " putchar " )
17
- func putchar( _: UInt8 )
17
+ @discardableResult
18
+ func putchar( _: CInt ) -> CInt
18
19
19
- public func print( _ s: StaticString , terminator: StaticString ) {
20
+ public func print( _ s: StaticString , terminator: StaticString = " \n " ) {
20
21
var p = s.utf8Start
21
22
while p.pointee != 0 {
22
- putchar ( p. pointee)
23
+ putchar(CInt( p.pointee) )
23
24
p += 1
24
25
}
25
26
p = terminator.utf8Start
26
27
while p.pointee != 0 {
27
- putchar ( p. pointee)
28
+ putchar(CInt( p.pointee) )
28
29
p += 1
29
30
}
30
31
}
You can’t perform that action at this time.
0 commit comments