Skip to content

Commit 4800fa0

Browse files
committed
stdlib: define typealias CLongDouble for FreeBSD on i386, x86_64
This fixes a failure compiling the stdlib where the importer cannot find (i.e., refuses to import) functions _stdlib_remainderl and _stdlib_squareRootl.
1 parent 4603c84 commit 4800fa0

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

stdlib/public/core/CTypes.swift

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,35 @@ public typealias CLongDouble = Double
8686
// which we don't yet have in Swift.
8787
#if arch(x86_64) || arch(i386)
8888
public typealias CLongDouble = Float80
89-
#endif
90-
// TODO: Fill in definitions for other OSes.
91-
#if arch(s390x)
89+
#elseif arch(s390x)
9290
// On s390x '-mlong-double-64' option with size of 64-bits makes the
9391
// Long Double type equivalent to Double type.
9492
public typealias CLongDouble = Double
93+
#else
94+
#error("CLongDouble needs to be defined for this Linux architecture")
9595
#endif
9696
#elseif os(Android)
9797
// On Android, long double is Float128 for AAPCS64, which we don't have yet in
9898
// Swift (https://github.com/apple/swift/issues/51573); and Double for ARMv7.
9999
#if arch(arm)
100100
public typealias CLongDouble = Double
101+
#else
102+
#error("CLongDouble needs to be defined for this Android architecture")
101103
#endif
102104
#elseif os(OpenBSD)
105+
#if arch(x86_64)
106+
public typealias CLongDouble = Float80
107+
#else
108+
#error("CLongDouble needs to be defined for this OpenBSD architecture")
109+
#endif
110+
#elseif os(FreeBSD)
111+
#if arch(x86_64) || arch(i386)
103112
public typealias CLongDouble = Float80
113+
#else
114+
#error("CLongDouble needs to be defined for this FreeBSD architecture")
115+
#endif
116+
#else
117+
#error("CLongDouble needs to be defined for this OS")
104118
#endif
105119

106120
// FIXME: Is it actually UTF-32 on Darwin?

0 commit comments

Comments
 (0)