Skip to content
Snippets Groups Projects
Commit 70105b0a authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

disable floating point support in *printf and *scanf

This would require pulling in libm, for which we aren't ready yet.
parent de998640
No related branches found
No related tags found
No related merge requests found
libc :=
libc += internal/floatscan.o
#libc += internal/floatscan.o
libc += internal/intscan.o
libc += internal/libc.o
libc += internal/__lock.o
......
......@@ -200,6 +200,7 @@ static char *fmt_u(uintmax_t x, char *s)
return s;
}
#ifdef HAVE_FLOAT_SUPPORT
static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t)
{
uint32_t big[(LDBL_MAX_EXP+LDBL_MANT_DIG)/9+1];
......@@ -430,6 +431,7 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t)
return MAX(w, pl+l);
}
#endif /* HAVE_FLOAT_SUPPORT */
static int getint(char **s) {
int i;
......@@ -618,10 +620,12 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
pad(f, ' ', w, p, fl^LEFT_ADJ);
l = w>p ? w : p;
continue;
#ifdef HAVE_FLOAT_SUPPORT
case 'e': case 'f': case 'g': case 'a':
case 'E': case 'F': case 'G': case 'A':
l = fmt_fp(f, arg.f, w, p, fl, t);
continue;
#endif
}
if (p < z-a) p = z-a;
......
......@@ -85,7 +85,9 @@ int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap)
int invert;
int matches=0;
unsigned long long x;
#ifdef HAVE_FLOAT_SUPPORT
long double y;
#endif
off_t pos = 0;
FLOCK(f);
......@@ -284,6 +286,7 @@ int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap)
if (t=='p' && dest) *(void **)dest = (void *)(uintptr_t)x;
else store_int(dest, size, x);
break;
#ifdef HAVE_FLOAT_SUPPORT
case 'a': case 'A':
case 'e': case 'E':
case 'f': case 'F':
......@@ -302,6 +305,7 @@ int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap)
break;
}
break;
#endif
case 'S':
wcs = dest;
st = (mbstate_t){ 0 };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment