diff options
Diffstat (limited to 'libc/stdio')
-rw-r--r-- | libc/stdio/printf.c | 52 | ||||
-rw-r--r-- | libc/stdio/scanf.c | 16 |
2 files changed, 34 insertions, 34 deletions
diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c index 245a78519..0d918d698 100644 --- a/libc/stdio/printf.c +++ b/libc/stdio/printf.c @@ -86,10 +86,10 @@ * and about 275 for both to the base code size of 1163 on i386. */ -/* These are now set in the Makefile based on Config. */ +/* These are now set in uClibc_config.h based on Config. */ /* -#define __UCLIBC_HAS_LONG_LONG__ 0 -#define __UCLIBC_HAS_FLOATS__ 0 +#define __UCLIBC_HAS_LONG_LONG__ 1 +#define __UCLIBC_HAS_FLOATS__ 1 */ /* 2) An error message is inserted into the stream, an arg of the @@ -317,21 +317,21 @@ enum { /* layout 01234 */ static const char spec[] = "+-#0 "; -#if __UCLIBC_HAS_LONG_LONG__ || WANT_LONG_LONG_ERROR +#if defined(__UCLIBC_HAS_LONG_LONG__) || WANT_LONG_LONG_ERROR static const char qual[] = "hlLq"; #else static const char qual[] = "hl"; #endif -#if !__UCLIBC_HAS_LONG_LONG__ && WANT_LONG_LONG_ERROR +#if !defined(__UCLIBC_HAS_LONG_LONG__) && WANT_LONG_LONG_ERROR static const char ll_err[] = "<LONG-LONG>"; #endif -#if !__UCLIBC_HAS_FLOATS__ && WANT_FLOAT_ERROR +#if !defined(__UCLIBC_HAS_FLOATS__) && WANT_FLOAT_ERROR static const char dbl_err[] = "<DOUBLE>"; #endif -#if __UCLIBC_HAS_FLOATS__ || WANT_FLOAT_ERROR +#if defined(__UCLIBC_HAS_FLOATS__) || WANT_FLOAT_ERROR /* layout 012345678901234567 */ static const char u_spec[] = "%nbopxXudicsfgGeEaA"; #else @@ -352,7 +352,7 @@ int vfnprintf(FILE * op, size_t max_size, const char *fmt, va_list ap) int preci, width; #define upcase i int radix, dpoint /*, upcase*/; -#if __UCLIBC_HAS_LONG_LONG__ +#if defined(__UCLIBC_HAS_LONG_LONG__) char tmp[65]; #else char tmp[33]; @@ -435,12 +435,12 @@ int vfnprintf(FILE * op, size_t max_size, const char *fmt, va_list ap) if (*p == *fmt) { lval = p - qual; ++fmt; -#if __UCLIBC_HAS_LONG_LONG__ || WANT_LONG_LONG_ERROR +#if defined(__UCLIBC_HAS_LONG_LONG__) || WANT_LONG_LONG_ERROR if ((*p == 'l') && (*fmt == *p)) { ++lval; ++fmt; } -#endif /* __UCLIBC_HAS_LONG_LONG__ || WANT_LONG_LONG_ERROR */ +#endif /* defined(__UCLIBC_HAS_LONG_LONG__) || WANT_LONG_LONG_ERROR */ } } @@ -470,18 +470,18 @@ int vfnprintf(FILE * op, size_t max_size, const char *fmt, va_list ap) lval = (sizeof(char *) == sizeof(long)); upcase = 0; } -#if __UCLIBC_HAS_LONG_LONG__ || WANT_LONG_LONG_ERROR +#if defined(__UCLIBC_HAS_LONG_LONG__) || WANT_LONG_LONG_ERROR if (lval >= 2) { -#if __UCLIBC_HAS_LONG_LONG__ +#if defined(__UCLIBC_HAS_LONG_LONG__) p = __ulltostr(tmp + sizeof(tmp) - 1, va_arg(ap, unsigned long long), radix, upcase); #else (void) va_arg(ap, unsigned long long); /* cary on */ p = (char *) ll_err; -#endif /* __UCLIBC_HAS_LONG_LONG__ */ +#endif /* defined(__UCLIBC_HAS_LONG_LONG__) */ } else { -#endif /* __UCLIBC_HAS_LONG_LONG__ || WANT_LONG_LONG_ERROR */ +#endif /* defined(__UCLIBC_HAS_LONG_LONG__) || WANT_LONG_LONG_ERROR */ #if UINT_MAX != ULONG_MAX /* sizeof(unsigned int) != sizeof(unsigned long) */ p = __ultostr(tmp + sizeof(tmp) - 1, (unsigned long) @@ -495,9 +495,9 @@ int vfnprintf(FILE * op, size_t max_size, const char *fmt, va_list ap) va_arg(ap, unsigned long), radix, upcase); #endif -#if __UCLIBC_HAS_LONG_LONG__ || WANT_LONG_LONG_ERROR +#if defined(__UCLIBC_HAS_LONG_LONG__) || WANT_LONG_LONG_ERROR } -#endif /* __UCLIBC_HAS_LONG_LONG__ || WANT_LONG_LONG_ERROR */ +#endif /* defined(__UCLIBC_HAS_LONG_LONG__) || WANT_LONG_LONG_ERROR */ flag[FLAG_PLUS] = '\0'; /* meaningless for unsigned */ if (flag[FLAG_HASH] && (*p != '0')) { /* non-zero */ if (radix == 8) { @@ -514,17 +514,17 @@ int vfnprintf(FILE * op, size_t max_size, const char *fmt, va_list ap) } } } else if (p-u_spec < 10) { /* signed conversion */ -#if __UCLIBC_HAS_LONG_LONG__ || WANT_LONG_LONG_ERROR +#if defined(__UCLIBC_HAS_LONG_LONG__) || WANT_LONG_LONG_ERROR if (lval >= 2) { -#if __UCLIBC_HAS_LONG_LONG__ +#if defined(__UCLIBC_HAS_LONG_LONG__) p = __lltostr(tmp + sizeof(tmp) - 1, va_arg(ap, long long), 10, 0); #else (void) va_arg(ap, long long); /* carry on */ p = (char *) ll_err; -#endif /* __UCLIBC_HAS_LONG_LONG__ */ +#endif /* defined(__UCLIBC_HAS_LONG_LONG__) */ } else { -#endif /* __UCLIBC_HAS_LONG_LONG__ || WANT_LONG_LONG_ERROR */ +#endif /* defined(__UCLIBC_HAS_LONG_LONG__) || WANT_LONG_LONG_ERROR */ #if INT_MAX != LONG_MAX /* sizeof(int) != sizeof(long) */ p = __ltostr(tmp + sizeof(tmp) - 1, (long) @@ -536,9 +536,9 @@ int vfnprintf(FILE * op, size_t max_size, const char *fmt, va_list ap) p = __ltostr(tmp + sizeof(tmp) - 1, (long) va_arg(ap, long), 10, 0); #endif -#if __UCLIBC_HAS_LONG_LONG__ || WANT_LONG_LONG_ERROR +#if defined(__UCLIBC_HAS_LONG_LONG__) || WANT_LONG_LONG_ERROR } -#endif /* __UCLIBC_HAS_LONG_LONG__ || WANT_LONG_LONG_ERROR */ +#endif /* defined(__UCLIBC_HAS_LONG_LONG__) || WANT_LONG_LONG_ERROR */ } else if (p-u_spec < 12) { /* character or string */ flag[FLAG_PLUS] = '\0'; flag[FLAG_0_PAD] = ' '; @@ -551,10 +551,10 @@ int vfnprintf(FILE * op, size_t max_size, const char *fmt, va_list ap) p = "(null)"; } } -#if __UCLIBC_HAS_FLOATS__ || WANT_FLOAT_ERROR +#if defined(__UCLIBC_HAS_FLOATS__) || WANT_FLOAT_ERROR } else if (p-u_spec < 27) { /* floating point */ -#endif /* __UCLIBC_HAS_FLOATS__ || WANT_FLOAT_ERROR */ -#if __UCLIBC_HAS_FLOATS__ +#endif /* defined(__UCLIBC_HAS_FLOATS__) || WANT_FLOAT_ERROR */ +#if defined(__UCLIBC_HAS_FLOATS__) if (preci < 0) { preci = 6; } @@ -569,7 +569,7 @@ int vfnprintf(FILE * op, size_t max_size, const char *fmt, va_list ap) (void) ((lval > 1) ? va_arg(ap, long double) : va_arg(ap, double)); /* carry on */ p = (char *) dbl_err; -#endif /* __UCLIBC_HAS_FLOATS__ */ +#endif /* defined(__UCLIBC_HAS_FLOATS__) */ } #if WANT_GNU_ERRNO diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c index 6fd802c73..0f1843a4d 100644 --- a/libc/stdio/scanf.c +++ b/libc/stdio/scanf.c @@ -143,7 +143,7 @@ struct scan_cookie { int ungot_flag; }; -#if __UCLIBC_HAS_LONG_LONG__ +#ifdef __UCLIBC_HAS_LONG_LONG__ static const char qual[] = "hl" /* "jtz" */ "Lq"; /* char = -2, short = -1, int = 0, long = 1, long long = 2 */ static const char qsz[] = { -1, 1, 2, 2 }; @@ -152,7 +152,7 @@ static const char qual[] = "hl" /* "jtz" */; static const char qsz[] = { -1, 1, }; #endif -#if __UCLIBC_HAS_FLOATS__ +#ifdef __UCLIBC_HAS_FLOATS__ static int __strtold(long double *ld, struct scan_cookie *sc); /*01234567890123456 */ static const char spec[] = "%n[csoupxXidfeEgG"; @@ -225,7 +225,7 @@ FILE *fp; const char *format; va_list ap; { -#if __UCLIBC_HAS_LONG_LONG__ +#ifdef __UCLIBC_HAS_LONG_LONG__ #define STRTO_L_(s,e,b,u) _strto_ll(s,e,b,u) #define MAX_DIGITS 64 #define UV_TYPE unsigned long long @@ -236,7 +236,7 @@ va_list ap; #define UV_TYPE unsigned long #define V_TYPE long #endif -#if __UCLIBC_HAS_FLOATS__ +#ifdef __UCLIBC_HAS_FLOATS__ long double ld; #endif UV_TYPE uv; @@ -426,7 +426,7 @@ va_list ap; vp = va_arg(ap, void *); switch (lval) { case 2: /* If no long long, treat as long . */ -#if __UCLIBC_HAS_LONG_LONG__ +#ifdef __UCLIBC_HAS_LONG_LONG__ *((unsigned long long *)vp) = uv; break; #endif @@ -434,7 +434,7 @@ va_list ap; #if ULONG_MAX == UINT_MAX case 0: /* int and long int are the same */ #endif -#if __UCLIBC_HAS_LONG_LONG__ +#ifdef __UCLIBC_HAS_LONG_LONG__ if (usflag) { if (uv > ULONG_MAX) { uv = ULONG_MAX; @@ -492,7 +492,7 @@ va_list ap; } goto nextfmt; } -#if __UCLIBC_HAS_FLOATS__ +#ifdef __UCLIBC_HAS_FLOATS__ else { /* floating point */ if (sc.width <= 0) { goto done; @@ -552,7 +552,7 @@ va_list ap; } /*****************************************************************************/ -#if __UCLIBC_HAS_FLOATS__ +#ifdef __UCLIBC_HAS_FLOATS__ #include <float.h> |