mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
zig.h: workaround for gcc f128 miscompilations
This commit is contained in:
parent
f45aac4903
commit
0dbaa8d3ae
2 changed files with 24 additions and 12 deletions
18
lib/zig.h
18
lib/zig.h
|
|
@ -61,6 +61,12 @@ typedef char bool;
|
||||||
#define zig_gnuc
|
#define zig_gnuc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(zig_gnuc) && (defined(__i386__) || defined(__x86_64__))
|
||||||
|
#define zig_f128_has_miscompilations 1
|
||||||
|
#else
|
||||||
|
#define zig_f128_has_miscompilations 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if _MSC_VER
|
#if _MSC_VER
|
||||||
#define zig_const_arr
|
#define zig_const_arr
|
||||||
#define zig_callconv(c) __##c
|
#define zig_callconv(c) __##c
|
||||||
|
|
@ -3155,22 +3161,22 @@ typedef zig_u128 zig_f80;
|
||||||
#define zig_has_f128 1
|
#define zig_has_f128 1
|
||||||
#define zig_libc_name_f128(name) name##q
|
#define zig_libc_name_f128(name) name##q
|
||||||
#define zig_init_special_f128(sign, name, arg, repr) zig_make_special_f128(sign, name, arg, repr)
|
#define zig_init_special_f128(sign, name, arg, repr) zig_make_special_f128(sign, name, arg, repr)
|
||||||
#if FLT_MANT_DIG == 113
|
#if !zig_f128_has_miscompilations && FLT_MANT_DIG == 113
|
||||||
typedef float zig_f128;
|
typedef float zig_f128;
|
||||||
#define zig_make_f128(fp, repr) fp##f
|
#define zig_make_f128(fp, repr) fp##f
|
||||||
#elif DBL_MANT_DIG == 113
|
#elif !zig_f128_has_miscompilations && DBL_MANT_DIG == 113
|
||||||
typedef double zig_f128;
|
typedef double zig_f128;
|
||||||
#define zig_make_f128(fp, repr) fp
|
#define zig_make_f128(fp, repr) fp
|
||||||
#elif LDBL_MANT_DIG == 113
|
#elif !zig_f128_has_miscompilations && LDBL_MANT_DIG == 113
|
||||||
typedef long double zig_f128;
|
typedef long double zig_f128;
|
||||||
#define zig_make_f128(fp, repr) fp##l
|
#define zig_make_f128(fp, repr) fp##l
|
||||||
#elif FLT128_MANT_DIG == 113
|
#elif !zig_f128_has_miscompilations && FLT128_MANT_DIG == 113
|
||||||
typedef _Float128 zig_f128;
|
typedef _Float128 zig_f128;
|
||||||
#define zig_make_f128(fp, repr) fp##f128
|
#define zig_make_f128(fp, repr) fp##f128
|
||||||
#elif FLT64X_MANT_DIG == 113
|
#elif !zig_f128_has_miscompilations && FLT64X_MANT_DIG == 113
|
||||||
typedef _Float64x zig_f128;
|
typedef _Float64x zig_f128;
|
||||||
#define zig_make_f128(fp, repr) fp##f64x
|
#define zig_make_f128(fp, repr) fp##f64x
|
||||||
#elif defined(__SIZEOF_FLOAT128__)
|
#elif !zig_f128_has_miscompilations && defined(__SIZEOF_FLOAT128__)
|
||||||
typedef __float128 zig_f128;
|
typedef __float128 zig_f128;
|
||||||
#define zig_make_f128(fp, repr) fp##q
|
#define zig_make_f128(fp, repr) fp##q
|
||||||
#undef zig_make_special_f128
|
#undef zig_make_special_f128
|
||||||
|
|
|
||||||
18
stage1/zig.h
18
stage1/zig.h
|
|
@ -61,6 +61,12 @@ typedef char bool;
|
||||||
#define zig_gnuc
|
#define zig_gnuc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(zig_gnuc) && (defined(__i386__) || defined(__x86_64__))
|
||||||
|
#define zig_f128_has_miscompilations 1
|
||||||
|
#else
|
||||||
|
#define zig_f128_has_miscompilations 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if _MSC_VER
|
#if _MSC_VER
|
||||||
#define zig_const_arr
|
#define zig_const_arr
|
||||||
#define zig_callconv(c) __##c
|
#define zig_callconv(c) __##c
|
||||||
|
|
@ -3155,22 +3161,22 @@ typedef zig_u128 zig_f80;
|
||||||
#define zig_has_f128 1
|
#define zig_has_f128 1
|
||||||
#define zig_libc_name_f128(name) name##q
|
#define zig_libc_name_f128(name) name##q
|
||||||
#define zig_init_special_f128(sign, name, arg, repr) zig_make_special_f128(sign, name, arg, repr)
|
#define zig_init_special_f128(sign, name, arg, repr) zig_make_special_f128(sign, name, arg, repr)
|
||||||
#if FLT_MANT_DIG == 113
|
#if !zig_f128_has_miscompilations && FLT_MANT_DIG == 113
|
||||||
typedef float zig_f128;
|
typedef float zig_f128;
|
||||||
#define zig_make_f128(fp, repr) fp##f
|
#define zig_make_f128(fp, repr) fp##f
|
||||||
#elif DBL_MANT_DIG == 113
|
#elif !zig_f128_has_miscompilations && DBL_MANT_DIG == 113
|
||||||
typedef double zig_f128;
|
typedef double zig_f128;
|
||||||
#define zig_make_f128(fp, repr) fp
|
#define zig_make_f128(fp, repr) fp
|
||||||
#elif LDBL_MANT_DIG == 113
|
#elif !zig_f128_has_miscompilations && LDBL_MANT_DIG == 113
|
||||||
typedef long double zig_f128;
|
typedef long double zig_f128;
|
||||||
#define zig_make_f128(fp, repr) fp##l
|
#define zig_make_f128(fp, repr) fp##l
|
||||||
#elif FLT128_MANT_DIG == 113
|
#elif !zig_f128_has_miscompilations && FLT128_MANT_DIG == 113
|
||||||
typedef _Float128 zig_f128;
|
typedef _Float128 zig_f128;
|
||||||
#define zig_make_f128(fp, repr) fp##f128
|
#define zig_make_f128(fp, repr) fp##f128
|
||||||
#elif FLT64X_MANT_DIG == 113
|
#elif !zig_f128_has_miscompilations && FLT64X_MANT_DIG == 113
|
||||||
typedef _Float64x zig_f128;
|
typedef _Float64x zig_f128;
|
||||||
#define zig_make_f128(fp, repr) fp##f64x
|
#define zig_make_f128(fp, repr) fp##f64x
|
||||||
#elif defined(__SIZEOF_FLOAT128__)
|
#elif !zig_f128_has_miscompilations && defined(__SIZEOF_FLOAT128__)
|
||||||
typedef __float128 zig_f128;
|
typedef __float128 zig_f128;
|
||||||
#define zig_make_f128(fp, repr) fp##q
|
#define zig_make_f128(fp, repr) fp##q
|
||||||
#undef zig_make_special_f128
|
#undef zig_make_special_f128
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue