diff options
Diffstat (limited to 'libc/stdio/printf.c')
-rw-r--r-- | libc/stdio/printf.c | 52 |
1 files changed, 26 insertions, 26 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 |