From 8c1ab65c0f548d20b7f177bdb736daaf603340e1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 15:54:38 +0200 Subject: Adding upstream version 0.0~git20221206.8b7148f. Signed-off-by: Daniel Baumann --- libc-top-half/headers/private/printscan.h | 59 ++++++++++++++++++++++ .../headers/private/wasi/libc-environ-compat.h | 12 +++++ 2 files changed, 71 insertions(+) create mode 100644 libc-top-half/headers/private/printscan.h create mode 100644 libc-top-half/headers/private/wasi/libc-environ-compat.h (limited to 'libc-top-half/headers') 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 + +__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 + +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 diff --git a/libc-top-half/headers/private/wasi/libc-environ-compat.h b/libc-top-half/headers/private/wasi/libc-environ-compat.h new file mode 100644 index 0000000..fa2747d --- /dev/null +++ b/libc-top-half/headers/private/wasi/libc-environ-compat.h @@ -0,0 +1,12 @@ +// This header file is meant to be included withinin the body of a function +// which uses `__environ`. Code using `__environ` expects it will be initialized +// eagerly. `__wasilibc_environ` is initialized lazily. Provide `__environ` as +// an alias and arrange for the lazy initialization to be performed. + +extern char **__wasilibc_environ; + +__wasilibc_ensure_environ(); + +#ifndef __wasilibc_environ +#define __environ __wasilibc_environ +#endif -- cgit v1.2.3