Skip to content

Compilation fails on Linux with Swift 5.9-dev #429

Open
@tokyovigilante

Description

@tokyovigilante

Importation of fclose on Linux appears to have changed with Swift 5.9 (Swift version 5.9-dev (LLVM 6665c55e557222b, Swift b370e7dbea9ca19)) and internal typealias FILEPointer = UnsafeMutablePointer<FILE> in NIOSSL/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 to private 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions