Files
ghostty/pkg/apple-sdk/include/math.h
Mitchell Hashimoto 1c861e3c47 pkg/apple-sdk: support Xcode 27 SDK headers
Xcode 27's math.h uses the __need_infinity_nan protocol provided by
matching Clang resource headers. Zig 0.16's bundled float.h predates
that protocol, causing the bundled libc++ compilation to fail.

Overlay the SDK math.h through the Apple SDK libc include path and
provide the missing infinity and NaN definitions. The compatibility
header can be removed once Zig's bundled Clang headers support the
protocol.
2026-07-22 12:58:19 -07:00

22 lines
693 B
C

#ifndef GHOSTTY_APPLE_SDK_MATH_H
#define GHOSTTY_APPLE_SDK_MATH_H
// Resume the header search after this compatibility directory so we include
// the selected Xcode SDK's math.h. A regular #include <math.h> would find this
// wrapper again and loop forever. This is a Clang extension but Zig uses
// Clang so we good.
#include_next <math.h>
// Xcode 27's math.h expects Clang's float.h to define these when requested
// with __need_infinity_nan. Zig 0.16's bundled float.h predates that protocol;
// remove these fallbacks once Zig's bundled Clang headers implement it.
#ifndef INFINITY
#define INFINITY (__builtin_inff())
#endif
#ifndef NAN
#define NAN (__builtin_nanf(""))
#endif
#endif