| 1 |
#if defined(__wasilibc_printscan_no_floating_point) |
| 2 |
|
| 3 |
#include <stdio.h> |
| 4 |
|
| 5 |
__attribute__((__cold__, __noreturn__)) |
| 6 |
static void floating_point_not_supported(void) { |
| 7 |
void abort(void) __attribute__((__noreturn__)); |
| 8 |
fputs("Support for floating-point formatting is currently disabled.\n" |
| 9 |
"To enable it, " __wasilibc_printscan_floating_point_support_option ".\n", stderr); |
| 10 |
abort(); |
| 11 |
} |
| 12 |
|
| 13 |
#elif defined(__wasilibc_printscan_no_long_double) |
| 14 |
|
| 15 |
#include <stdio.h> |
| 16 |
|
| 17 |
typedef double long_double; |
| 18 |
#undef LDBL_TRUE_MIN |
| 19 |
#define LDBL_TRUE_MIN DBL_DENORM_MIN |
| 20 |
#undef LDBL_MIN |
| 21 |
#define LDBL_MIN DBL_MIN |
| 22 |
#undef LDBL_MAX |
| 23 |
#define LDBL_MAX DBL_MAX |
| 24 |
#undef LDBL_EPSILON |
| 25 |
#define LDBL_EPSILON DBL_EPSILON |
| 26 |
#undef LDBL_MANT_DIG |
| 27 |
#define LDBL_MANT_DIG DBL_MANT_DIG |
| 28 |
#undef LDBL_MIN_EXP |
| 29 |
#define LDBL_MIN_EXP DBL_MIN_EXP |
| 30 |
#undef LDBL_MAX_EXP |
| 31 |
#define LDBL_MAX_EXP DBL_MAX_EXP |
| 32 |
#undef LDBL_DIG |
| 33 |
#define LDBL_DIG DBL_DIG |
| 34 |
#undef LDBL_MIN_10_EXP |
| 35 |
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP |
| 36 |
#undef LDBL_MAX_10_EXP |
| 37 |
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP |
| 38 |
#undef frexpl |
| 39 |
#define frexpl(x, exp) frexp(x, exp) |
| 40 |
#undef copysignl |
| 41 |
#define copysignl(x, y) copysign(x, y) |
| 42 |
#undef fmodl |
| 43 |
#define fmodl(x, y) fmod(x, y) |
| 44 |
#undef scalbnl |
| 45 |
#define scalbnl(arg, exp) scalbn(arg, exp) |
| 46 |
__attribute__((__cold__, __noreturn__)) |
| 47 |
static void long_double_not_supported(void) { |
| 48 |
void abort(void) __attribute__((__noreturn__)); |
| 49 |
fputs("Support for formatting long double values is currently disabled.\n" |
| 50 |
"To enable it, " __wasilibc_printscan_full_support_option ".\n", &__stderr_FILE); |
| 51 |
abort(); |
| 52 |
} |
| 53 |
|
| 54 |
#else |
| 55 |
|
| 56 |
// Full long double support. |
| 57 |
typedef long double long_double; |
| 58 |
|
| 59 |
#endif |