Open tokyovigilante opened 1 year ago
That's very weird: I can't entirely work out why this change would have happened, as I'd expect it to be a libc change. Still this is an easy enough tweak to make.
@Lukasa @tokyovigilante I tried to make an PR for suggestion but failed - not sure how to suggest code. The suggestions are quite small though and they work on my computer (I use Linux 6.5.9-arch2-1 - Glibc 2.38):
Here's the text changed: // fclose has an non optional file pointer for linux glibc version 2.38
internal typealias SYSFILEPointer = FILEPointer
internal typealias SYSFILEPointer = Optional
and here's the code replaced for the return type for fclose: private let sysFclose: @convention(c) (SYSFILEPointer) -> CInt = fclose
Importation of
fclose
on Linux appears to have changed with Swift 5.9 (Swift version 5.9-dev (LLVM 6665c55e557222b, Swift b370e7dbea9ca19)
) andinternal typealias FILEPointer = UnsafeMutablePointer<FILE>
inNIOSSL/PosixPort.swift
fails to compile./home/ryan/Projects/Develop/Tsunami/.build/checkouts/swift-nio-ssl/Sources/NIOSSL/PosixPort.swift:42:64: error: cannot convert value of type '(UnsafeMutablePointer<FILE>) -> Int32' (aka '(UnsafeMutablePointer<_IO_FILE>) -> Int32') to specified type '@convention(c) (FILEPointer?) -> CInt' (aka '@convention(c) (Optional<UnsafeMutablePointer<_IO_FILE>>) -> Int32') private let sysFclose: @convention(c) (FILEPointer?) -> CInt = fclose
Changing the
sysFclose
definition toprivate let sysFclose: @convention(c) (FILEPointer) -> CInt = fclose
by putting making FILEPointer non-optional matches the expected method signature and allows compilation to succeed, but there may be a better way to solve this (or wrapping this in a Swift 5.9 conditional).