summaryrefslogtreecommitdiffstats
path: root/libc-top-half/headers/private/printscan.h
blob: 7c21f99d8378cc270cd4173a97f380d306781c9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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