| ... | @@ -1,5 +1,8 @@ | ... | @@ -1,5 +1,8 @@ |
| 1 | #undef linux | 1 | #undef linux |
| 2 | | 2 | |
| | 3 | #include <stdarg.h> |
| | 4 | #include <stddef.h> |
| | 5 | |
| 3 | #if defined(_MSC_VER) | 6 | #if defined(_MSC_VER) |
| 4 | #define zig_msvc | 7 | #define zig_msvc |
| 5 | #elif defined(__clang__) | 8 | #elif defined(__clang__) |
| ... | @@ -68,38 +71,23 @@ | ... | @@ -68,38 +71,23 @@ |
| 68 | #define zig_x86 | 71 | #define zig_x86 |
| 69 | #endif | 72 | #endif |
| 70 | | 73 | |
| 71 | #if defined(__has_include) | 74 | #if defined(zig_msvc) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
| 72 | #define zig_has_include(include) __has_include(include) | 75 | #define zig_little_endian 1 |
| | 76 | #define zig_big_endian 0 |
| 73 | #else | 77 | #else |
| 74 | #define zig_has_include(include) 0 | 78 | #define zig_little_endian 0 |
| 75 | #endif | 79 | #define zig_big_endian 1 |
| 76 | | | |
| 77 | #ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ | | |
| 78 | #define __STDC_WANT_IEC_60559_TYPES_EXT__ | | |
| 79 | #endif | 80 | #endif |
| 80 | | 81 | |
| 81 | #include <float.h> | 82 | #define zig_concat(lhs, rhs) lhs##rhs |
| 82 | #include <limits.h> | 83 | #define zig_expand_concat(lhs, rhs) zig_concat(lhs, rhs) |
| 83 | #include <stdarg.h> | | |
| 84 | #include <stddef.h> | | |
| 85 | | | |
| 86 | #if defined(zig_msvc) | | |
| 87 | #include <intrin.h> | | |
| 88 | #endif | | |
| 89 | | 84 | |
| 90 | #if __STDC_VERSION__ >= 202311L | 85 | #if defined(__has_include) |
| 91 | /* bool, true, and false are provided by the language. */ | 86 | #define zig_has_include(include) __has_include(include) |
| 92 | #elif __STDC_VERSION__ >= 199901L || zig_has_include(<stdbool.h>) | | |
| 93 | #include <stdbool.h> | | |
| 94 | #else | 87 | #else |
| 95 | typedef char bool; | 88 | #define zig_has_include(include) 0 |
| 96 | #define false 0 | | |
| 97 | #define true 1 | | |
| 98 | #endif | 89 | #endif |
| 99 | | 90 | |
| 100 | #define zig_concat(lhs, rhs) lhs##rhs | | |
| 101 | #define zig_expand_concat(lhs, rhs) zig_concat(lhs, rhs) | | |
| 102 | | | |
| 103 | #if defined(__has_builtin) | 91 | #if defined(__has_builtin) |
| 104 | #define zig_has_builtin(builtin) __has_builtin(__builtin_##builtin) | 92 | #define zig_has_builtin(builtin) __has_builtin(__builtin_##builtin) |
| 105 | #else | 93 | #else |
| ... | @@ -113,14 +101,6 @@ typedef char bool; | ... | @@ -113,14 +101,6 @@ typedef char bool; |
| 113 | #define zig_has_attribute(attribute) 0 | 101 | #define zig_has_attribute(attribute) 0 |
| 114 | #endif | 102 | #endif |
| 115 | | 103 | |
| 116 | #if defined(zig_msvc) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | | |
| 117 | #define zig_little_endian 1 | | |
| 118 | #define zig_big_endian 0 | | |
| 119 | #else | | |
| 120 | #define zig_little_endian 0 | | |
| 121 | #define zig_big_endian 1 | | |
| 122 | #endif | | |
| 123 | | | |
| 124 | #if __STDC_VERSION__ >= 202311L | 104 | #if __STDC_VERSION__ >= 202311L |
| 125 | #define zig_threadlocal thread_local | 105 | #define zig_threadlocal thread_local |
| 126 | #elif __STDC_VERSION__ >= 201112L | 106 | #elif __STDC_VERSION__ >= 201112L |
| ... | @@ -133,12 +113,6 @@ typedef char bool; | ... | @@ -133,12 +113,6 @@ typedef char bool; |
| 133 | #define zig_threadlocal zig_threadlocal_unavailable | 113 | #define zig_threadlocal zig_threadlocal_unavailable |
| 134 | #endif | 114 | #endif |
| 135 | | 115 | |
| 136 | #if !defined(zig_clang) && defined(zig_gnuc) && defined(zig_x86) | | |
| 137 | #define zig_f128_has_miscompilations 1 | | |
| 138 | #else | | |
| 139 | #define zig_f128_has_miscompilations 0 | | |
| 140 | #endif | | |
| 141 | | | |
| 142 | #if defined(zig_msvc) | 116 | #if defined(zig_msvc) |
| 143 | #define zig_const_arr | 117 | #define zig_const_arr |
| 144 | #define zig_callconv(c) __##c | 118 | #define zig_callconv(c) __##c |
| ... | @@ -416,8 +390,6 @@ typedef char bool; | ... | @@ -416,8 +390,6 @@ typedef char bool; |
| 416 | #define zig_noreturn | 390 | #define zig_noreturn |
| 417 | #endif | 391 | #endif |
| 418 | | 392 | |
| 419 | #define zig_bitSizeOf(T) (CHAR_BIT * sizeof(T)) | | |
| 420 | | | |
| 421 | #define zig_compiler_rt_abbrev_uint32_t si | 393 | #define zig_compiler_rt_abbrev_uint32_t si |
| 422 | #define zig_compiler_rt_abbrev_int32_t si | 394 | #define zig_compiler_rt_abbrev_int32_t si |
| 423 | #define zig_compiler_rt_abbrev_uint64_t di | 395 | #define zig_compiler_rt_abbrev_uint64_t di |
| ... | @@ -433,12 +405,25 @@ typedef char bool; | ... | @@ -433,12 +405,25 @@ typedef char bool; |
| 433 | zig_extern void *memcpy (void *zig_restrict, void const *zig_restrict, size_t); | 405 | zig_extern void *memcpy (void *zig_restrict, void const *zig_restrict, size_t); |
| 434 | zig_extern void *memset (void *, int, size_t); | 406 | zig_extern void *memset (void *, int, size_t); |
| 435 | | 407 | |
| 436 | /* ===================== 8/16/32/64-bit Integer Support ===================== */ | 408 | /* ================ Bool and 8/16/32/64-bit Integer Support ================= */ |
| | 409 | |
| | 410 | #include <limits.h> |
| | 411 | |
| | 412 | #define zig_bitSizeOf(T) (CHAR_BIT * sizeof(T)) |
| | 413 | |
| | 414 | #if __STDC_VERSION__ >= 202311L |
| | 415 | /* bool, true, and false are provided by the language. */ |
| | 416 | #elif __STDC_VERSION__ >= 199901L || zig_has_include(<stdbool.h>) |
| | 417 | #include <stdbool.h> |
| | 418 | #else |
| | 419 | typedef char bool; |
| | 420 | #define false 0 |
| | 421 | #define true 1 |
| | 422 | #endif |
| 437 | | 423 | |
| 438 | #if __STDC_VERSION__ >= 199901L || defined(zig_msvc) || zig_has_include(<stdint.h>) | 424 | #if __STDC_VERSION__ >= 199901L || defined(zig_msvc) || zig_has_include(<stdint.h>) |
| 439 | #include <stdint.h> | 425 | #include <stdint.h> |
| 440 | #else | 426 | #else |
| 441 | | | |
| 442 | #if SCHAR_MIN == ~0x7F && SCHAR_MAX == 0x7F && UCHAR_MAX == 0xFF | 427 | #if SCHAR_MIN == ~0x7F && SCHAR_MAX == 0x7F && UCHAR_MAX == 0xFF |
| 443 | typedef unsigned char uint8_t; | 428 | typedef unsigned char uint8_t; |
| 444 | typedef signed char int8_t; | 429 | typedef signed char int8_t; |
| ... | @@ -3096,6 +3081,12 @@ static inline uint16_t zig_popcount_big(const void *val, bool is_signed, uint16_ | ... | @@ -3096,6 +3081,12 @@ static inline uint16_t zig_popcount_big(const void *val, bool is_signed, uint16_ |
| 3096 | | 3081 | |
| 3097 | /* ========================= Floating Point Support ========================= */ | 3082 | /* ========================= Floating Point Support ========================= */ |
| 3098 | | 3083 | |
| | 3084 | #ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ |
| | 3085 | #define __STDC_WANT_IEC_60559_TYPES_EXT__ |
| | 3086 | #endif |
| | 3087 | |
| | 3088 | #include <float.h> |
| | 3089 | |
| 3099 | #if defined(zig_msvc) | 3090 | #if defined(zig_msvc) |
| 3100 | float __cdecl nanf(char const* input); | 3091 | float __cdecl nanf(char const* input); |
| 3101 | double __cdecl nan(char const* input); | 3092 | double __cdecl nan(char const* input); |
| ... | @@ -3263,6 +3254,12 @@ typedef zig_u128 zig_f80; | ... | @@ -3263,6 +3254,12 @@ typedef zig_u128 zig_f80; |
| 3263 | #define zig_init_special_f80(sign, name, arg, repr) repr | 3254 | #define zig_init_special_f80(sign, name, arg, repr) repr |
| 3264 | #endif | 3255 | #endif |
| 3265 | | 3256 | |
| | 3257 | #if !defined(zig_clang) && defined(zig_gnuc) && defined(zig_x86) |
| | 3258 | #define zig_f128_has_miscompilations 1 |
| | 3259 | #else |
| | 3260 | #define zig_f128_has_miscompilations 0 |
| | 3261 | #endif |
| | 3262 | |
| 3266 | #define zig_has_f128 1 | 3263 | #define zig_has_f128 1 |
| 3267 | #define zig_libc_name_f128(name) name##q | 3264 | #define zig_libc_name_f128(name) name##q |
| 3268 | #define zig_init_special_f128(sign, name, arg, repr) zig_make_special_f128(sign, name, arg, repr) | 3265 | #define zig_init_special_f128(sign, name, arg, repr) zig_make_special_f128(sign, name, arg, repr) |
| ... | @@ -4006,6 +4003,10 @@ static inline void zig_msvc_atomic_store_i128(zig_i128 volatile* obj, zig_i128 a | ... | @@ -4006,6 +4003,10 @@ static inline void zig_msvc_atomic_store_i128(zig_i128 volatile* obj, zig_i128 a |
| 4006 | | 4003 | |
| 4007 | /* ======================== Special Case Intrinsics ========================= */ | 4004 | /* ======================== Special Case Intrinsics ========================= */ |
| 4008 | | 4005 | |
| | 4006 | #if defined(zig_msvc) |
| | 4007 | #include <intrin.h> |
| | 4008 | #endif |
| | 4009 | |
| 4009 | #if defined(zig_thumb) | 4010 | #if defined(zig_thumb) |
| 4010 | | 4011 | |
| 4011 | static inline void* zig_thumb_windows_teb(void) { | 4012 | static inline void* zig_thumb_windows_teb(void) { |