diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 13:54:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 13:54:38 +0000 |
commit | 8c1ab65c0f548d20b7f177bdb736daaf603340e1 (patch) | |
tree | df55b7e75bf43f2bf500845b105afe3ac3a5157e /libc-top-half/headers/private/printscan.h | |
parent | Initial commit. (diff) | |
download | wasi-libc-upstream/0.0_git20221206.8b7148f.tar.xz wasi-libc-upstream/0.0_git20221206.8b7148f.zip |
Adding upstream version 0.0~git20221206.8b7148f.upstream/0.0_git20221206.8b7148f
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libc-top-half/headers/private/printscan.h')
-rw-r--r-- | libc-top-half/headers/private/printscan.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/libc-top-half/headers/private/printscan.h b/libc-top-half/headers/private/printscan.h new file mode 100644 index 0000000..7c21f99 --- /dev/null +++ b/libc-top-half/headers/private/printscan.h @@ -0,0 +1,59 @@ +#if defined(__wasilibc_printscan_no_floating_point) + +#include <stdio.h> + +__attribute__((__cold__, __noreturn__)) +static void floating_point_not_supported(void) { + void abort(void) __attribute__((__noreturn__)); + fputs("Support for floating-point formatting is currently disabled.\n" + "To enable it, " __wasilibc_printscan_floating_point_support_option ".\n", stderr); + abort(); +} + +#elif defined(__wasilibc_printscan_no_long_double) + +#include <stdio.h> + +typedef double long_double; +#undef LDBL_TRUE_MIN +#define LDBL_TRUE_MIN DBL_DENORM_MIN +#undef LDBL_MIN +#define LDBL_MIN DBL_MIN +#undef LDBL_MAX +#define LDBL_MAX DBL_MAX +#undef LDBL_EPSILON +#define LDBL_EPSILON DBL_EPSILON +#undef LDBL_MANT_DIG +#define LDBL_MANT_DIG DBL_MANT_DIG +#undef LDBL_MIN_EXP +#define LDBL_MIN_EXP DBL_MIN_EXP +#undef LDBL_MAX_EXP +#define LDBL_MAX_EXP DBL_MAX_EXP +#undef LDBL_DIG +#define LDBL_DIG DBL_DIG +#undef LDBL_MIN_10_EXP +#define LDBL_MIN_10_EXP DBL_MIN_10_EXP +#undef LDBL_MAX_10_EXP +#define LDBL_MAX_10_EXP DBL_MAX_10_EXP +#undef frexpl +#define frexpl(x, exp) frexp(x, exp) +#undef copysignl +#define copysignl(x, y) copysign(x, y) +#undef fmodl +#define fmodl(x, y) fmod(x, y) +#undef scalbnl +#define scalbnl(arg, exp) scalbn(arg, exp) +__attribute__((__cold__, __noreturn__)) +static void long_double_not_supported(void) { + void abort(void) __attribute__((__noreturn__)); + fputs("Support for formatting long double values is currently disabled.\n" + "To enable it, " __wasilibc_printscan_full_support_option ".\n", &__stderr_FILE); + abort(); +} + +#else + +// Full long double support. +typedef long double long_double; + +#endif |