libc: drop NO_FP_LIBC support
NO_FP_LIBC was added in 2004 to save space by disabling FP support in *printf()/*scanf(). The size benefit is negligible on modern systems and conflicts with assumptions made by current base utilities. Remove the option and always build libc with floating-point support. Reported by: Oskar Holmlund <eovholmlund at gmail com> MFC after: 2 weeks
This commit is contained in:
@@ -142,9 +142,6 @@ CFLAGS+= -DYP
|
||||
.if ${MK_HESIOD} != "no"
|
||||
CFLAGS+= -DHESIOD
|
||||
.endif
|
||||
.if ${MK_FP_LIBC} == "no"
|
||||
CFLAGS+= -DNO_FLOATING_POINT
|
||||
.endif
|
||||
.if ${MK_NS_CACHING} != "no"
|
||||
CFLAGS+= -DNS_CACHING
|
||||
.endif
|
||||
|
||||
@@ -55,10 +55,8 @@ enum __e_fmtcheck_types {
|
||||
FMTCHECK_INTMAXTPOINTER,
|
||||
FMTCHECK_PTRDIFFTPOINTER,
|
||||
FMTCHECK_SIZETPOINTER,
|
||||
#ifndef NO_FLOATING_POINT
|
||||
FMTCHECK_DOUBLE,
|
||||
FMTCHECK_LONGDOUBLE,
|
||||
#endif
|
||||
FMTCHECK_STRING,
|
||||
FMTCHECK_WSTRING,
|
||||
FMTCHECK_WIDTH,
|
||||
@@ -185,7 +183,6 @@ get_next_format_from_precision(const char **pf)
|
||||
RETURN(pf,f,FMTCHECK_UNKNOWN);
|
||||
RETURN(pf,f,FMTCHECK_LONG);
|
||||
}
|
||||
#ifndef NO_FLOATING_POINT
|
||||
if (strchr("aAeEfFgG", *f)) {
|
||||
switch (modifier) {
|
||||
case MOD_LONGDOUBLE:
|
||||
@@ -197,7 +194,6 @@ get_next_format_from_precision(const char **pf)
|
||||
RETURN(pf,f,FMTCHECK_UNKNOWN);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (*f == 'c') {
|
||||
switch (modifier) {
|
||||
case MOD_LONG:
|
||||
|
||||
@@ -311,11 +311,9 @@ reswitch: switch (ch) {
|
||||
goto rflag;
|
||||
}
|
||||
goto reswitch;
|
||||
#ifndef NO_FLOATING_POINT
|
||||
case 'L':
|
||||
flags |= LONGDBL;
|
||||
goto rflag;
|
||||
#endif
|
||||
case 'h':
|
||||
if (flags & SHORTINT) {
|
||||
flags &= ~SHORTINT;
|
||||
@@ -359,7 +357,6 @@ reswitch: switch (ch) {
|
||||
if ((error = addsarg(&types, flags)))
|
||||
goto error;
|
||||
break;
|
||||
#ifndef NO_FLOATING_POINT
|
||||
case 'a':
|
||||
case 'A':
|
||||
case 'e':
|
||||
@@ -372,7 +369,6 @@ reswitch: switch (ch) {
|
||||
if (error)
|
||||
goto error;
|
||||
break;
|
||||
#endif /* !NO_FLOATING_POINT */
|
||||
case 'n':
|
||||
if (flags & INTMAXT)
|
||||
error = addtype(&types, TP_INTMAXT);
|
||||
@@ -504,11 +500,9 @@ reswitch: switch (ch) {
|
||||
goto rflag;
|
||||
}
|
||||
goto reswitch;
|
||||
#ifndef NO_FLOATING_POINT
|
||||
case 'L':
|
||||
flags |= LONGDBL;
|
||||
goto rflag;
|
||||
#endif
|
||||
case 'h':
|
||||
if (flags & SHORTINT) {
|
||||
flags &= ~SHORTINT;
|
||||
@@ -552,7 +546,6 @@ reswitch: switch (ch) {
|
||||
if ((error = addsarg(&types, flags)))
|
||||
goto error;
|
||||
break;
|
||||
#ifndef NO_FLOATING_POINT
|
||||
case 'a':
|
||||
case 'A':
|
||||
case 'e':
|
||||
@@ -565,7 +558,6 @@ reswitch: switch (ch) {
|
||||
if (error)
|
||||
goto error;
|
||||
break;
|
||||
#endif /* !NO_FLOATING_POINT */
|
||||
case 'n':
|
||||
if (flags & INTMAXT)
|
||||
error = addtype(&types, TP_INTMAXT);
|
||||
@@ -744,14 +736,10 @@ build_arg_table(struct typetable *types, va_list ap, union arg **argtable)
|
||||
(*argtable) [n].pintmaxarg = va_arg (ap, intmax_t *);
|
||||
break;
|
||||
case T_DOUBLE:
|
||||
#ifndef NO_FLOATING_POINT
|
||||
(*argtable) [n].doublearg = va_arg (ap, double);
|
||||
#endif
|
||||
break;
|
||||
case T_LONG_DOUBLE:
|
||||
#ifndef NO_FLOATING_POINT
|
||||
(*argtable) [n].longdoublearg = va_arg (ap, long double);
|
||||
#endif
|
||||
break;
|
||||
case TP_CHAR:
|
||||
(*argtable) [n].pchararg = va_arg (ap, char *);
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef NO_FLOATING_POINT
|
||||
|
||||
#define dtoa __dtoa
|
||||
#define freedtoa __freedtoa
|
||||
@@ -57,7 +56,6 @@
|
||||
|
||||
static int exponent(CHAR *, int, CHAR);
|
||||
|
||||
#endif /* !NO_FLOATING_POINT */
|
||||
|
||||
static CHAR *__ujtoa(uintmax_t, CHAR *, int, int, const char *);
|
||||
static CHAR *__ultoa(u_long, CHAR *, int, int, const char *);
|
||||
@@ -280,7 +278,6 @@ __ujtoa(uintmax_t val, CHAR *endp, int base, int octzero, const char *xdigs)
|
||||
return (cp);
|
||||
}
|
||||
|
||||
#ifndef NO_FLOATING_POINT
|
||||
|
||||
static int
|
||||
exponent(CHAR *p0, int exp, CHAR fmtch)
|
||||
@@ -318,4 +315,3 @@ exponent(CHAR *p0, int exp, CHAR fmtch)
|
||||
return (p - p0);
|
||||
}
|
||||
|
||||
#endif /* !NO_FLOATING_POINT */
|
||||
|
||||
@@ -82,10 +82,8 @@ union arg {
|
||||
ptrdiff_t *pptrdiffarg;
|
||||
ssize_t *pssizearg;
|
||||
intmax_t *pintmaxarg;
|
||||
#ifndef NO_FLOATING_POINT
|
||||
double doublearg;
|
||||
long double longdoublearg;
|
||||
#endif
|
||||
wint_t wintarg;
|
||||
wchar_t *pwchararg;
|
||||
};
|
||||
|
||||
@@ -314,7 +314,6 @@ __vfprintf(FILE *fp, locale_t locale, int serrno, const char *fmt0, va_list ap)
|
||||
char sign; /* sign prefix (' ', '+', '-', or \0) */
|
||||
struct grouping_state gs; /* thousands' grouping info */
|
||||
|
||||
#ifndef NO_FLOATING_POINT
|
||||
/*
|
||||
* We can decompose the printed representation of floating
|
||||
* point numbers into several parts, some of which may be empty:
|
||||
@@ -343,7 +342,6 @@ __vfprintf(FILE *fp, locale_t locale, int serrno, const char *fmt0, va_list ap)
|
||||
int ndig; /* actual number of digits returned by dtoa */
|
||||
char expstr[MAXEXPDIG+2]; /* buffer for exponent string: e+ZZZ */
|
||||
char *dtoaresult; /* buffer allocated by dtoa */
|
||||
#endif
|
||||
u_long ulval; /* integer arguments %[diouxX] */
|
||||
uintmax_t ujval; /* %j, %ll, %q, %t, %z integers */
|
||||
int base; /* base for [diouxX] conversion */
|
||||
@@ -465,12 +463,10 @@ __vfprintf(FILE *fp, locale_t locale, int serrno, const char *fmt0, va_list ap)
|
||||
va_copy(orgap, ap);
|
||||
io_init(&io, fp);
|
||||
ret = 0;
|
||||
#ifndef NO_FLOATING_POINT
|
||||
dtoaresult = NULL;
|
||||
decimal_point = localeconv_l(locale)->decimal_point;
|
||||
/* The overwhelmingly common case is decpt_len == 1. */
|
||||
decpt_len = (decimal_point[1] == '\0' ? 1 : strlen(decimal_point));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Scan the format for conversions (`%' character).
|
||||
@@ -574,11 +570,9 @@ reswitch: switch (ch) {
|
||||
}
|
||||
width = n;
|
||||
goto reswitch;
|
||||
#ifndef NO_FLOATING_POINT
|
||||
case 'L':
|
||||
flags |= LONGDBL;
|
||||
goto rflag;
|
||||
#endif
|
||||
case 'h':
|
||||
if (flags & SHORTINT) {
|
||||
flags &= ~SHORTINT;
|
||||
@@ -704,7 +698,6 @@ reswitch: switch (ch) {
|
||||
}
|
||||
base = 10;
|
||||
goto number;
|
||||
#ifndef NO_FLOATING_POINT
|
||||
case 'a':
|
||||
case 'A':
|
||||
if (ch == 'a') {
|
||||
@@ -823,7 +816,6 @@ reswitch: switch (ch) {
|
||||
size += grouping_init(&gs, expt, locale);
|
||||
}
|
||||
break;
|
||||
#endif /* !NO_FLOATING_POINT */
|
||||
case 'm':
|
||||
error = __strerror_rl(serrno, errnomsg,
|
||||
sizeof(errnomsg), locale);
|
||||
@@ -1023,9 +1015,7 @@ number: if ((dprec = prec) >= 0)
|
||||
PAD(width - realsz, zeroes);
|
||||
|
||||
/* the string or number proper */
|
||||
#ifndef NO_FLOATING_POINT
|
||||
if ((flags & FPT) == 0) {
|
||||
#endif
|
||||
/* leading zeroes from decimal precision */
|
||||
PAD(dprec - size, zeroes);
|
||||
if (gs.grouping) {
|
||||
@@ -1034,7 +1024,6 @@ number: if ((dprec = prec) >= 0)
|
||||
} else {
|
||||
PRINT(cp, size);
|
||||
}
|
||||
#ifndef NO_FLOATING_POINT
|
||||
} else { /* glue together f_p fragments */
|
||||
if (!expchar) { /* %[fF] or sufficiently short %[gG] */
|
||||
if (expt <= 0) {
|
||||
@@ -1071,7 +1060,6 @@ number: if ((dprec = prec) >= 0)
|
||||
PRINT(expstr, expsize);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* left-adjusting padding (always blank) */
|
||||
if (flags & LADJUST)
|
||||
PAD(width - realsz, blanks);
|
||||
@@ -1085,10 +1073,8 @@ number: if ((dprec = prec) >= 0)
|
||||
FLUSH();
|
||||
error:
|
||||
va_end(orgap);
|
||||
#ifndef NO_FLOATING_POINT
|
||||
if (dtoaresult != NULL)
|
||||
freedtoa(dtoaresult);
|
||||
#endif
|
||||
if (convbuf != NULL)
|
||||
free(convbuf);
|
||||
if (__sferror(fp))
|
||||
|
||||
@@ -56,9 +56,7 @@
|
||||
#include "local.h"
|
||||
#include "xlocale_private.h"
|
||||
|
||||
#ifndef NO_FLOATING_POINT
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
#define BUF 513 /* Maximum length of numeric string. */
|
||||
|
||||
@@ -89,9 +87,7 @@
|
||||
#define CT_FLOAT 4 /* %[efgEFG] conversion */
|
||||
|
||||
static const u_char *__sccl(char *, const u_char *);
|
||||
#ifndef NO_FLOATING_POINT
|
||||
static int parsefloat(FILE *, char *, char *, locale_t);
|
||||
#endif
|
||||
|
||||
__weak_reference(__vfscanf, vfscanf);
|
||||
|
||||
@@ -648,12 +644,10 @@ again: c = *fmt++;
|
||||
base = 16;
|
||||
break;
|
||||
|
||||
#ifndef NO_FLOATING_POINT
|
||||
case 'A': case 'E': case 'F': case 'G':
|
||||
case 'a': case 'e': case 'f': case 'g':
|
||||
c = CT_FLOAT;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 'S':
|
||||
flags |= LONG;
|
||||
@@ -835,7 +829,6 @@ again: c = *fmt++;
|
||||
}
|
||||
break;
|
||||
|
||||
#ifndef NO_FLOATING_POINT
|
||||
case CT_FLOAT:
|
||||
/* scan a floating point number as if by strtod */
|
||||
if (width == 0 || width > sizeof(buf) - 1)
|
||||
@@ -858,7 +851,6 @@ again: c = *fmt++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif /* !NO_FLOATING_POINT */
|
||||
}
|
||||
if (!(flags & SUPPRESS))
|
||||
nassigned++;
|
||||
@@ -984,7 +976,6 @@ __sccl(char *tab, const u_char *fmt)
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
#ifndef NO_FLOATING_POINT
|
||||
static int
|
||||
parsefloat(FILE *fp, char *buf, char *end, locale_t locale)
|
||||
{
|
||||
@@ -1153,4 +1144,3 @@ parsefloat(FILE *fp, char *buf, char *end, locale_t locale)
|
||||
*++commit = '\0';
|
||||
return (commit - buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -389,7 +389,6 @@ __vfwprintf(FILE *fp, locale_t locale, const wchar_t *fmt0, va_list ap)
|
||||
int prec; /* precision from format; <0 for N/A */
|
||||
wchar_t sign; /* sign prefix (' ', '+', '-', or \0) */
|
||||
struct grouping_state gs; /* thousands' grouping info */
|
||||
#ifndef NO_FLOATING_POINT
|
||||
/*
|
||||
* We can decompose the printed representation of floating
|
||||
* point numbers into several parts, some of which may be empty:
|
||||
@@ -417,7 +416,6 @@ __vfwprintf(FILE *fp, locale_t locale, const wchar_t *fmt0, va_list ap)
|
||||
int ndig; /* actual number of digits returned by dtoa */
|
||||
wchar_t expstr[MAXEXPDIG+2]; /* buffer for exponent string: e+ZZZ */
|
||||
char *dtoaresult; /* buffer allocated by dtoa */
|
||||
#endif
|
||||
u_long ulval; /* integer arguments %[diouxX] */
|
||||
uintmax_t ujval; /* %j, %ll, %q, %t, %z integers */
|
||||
int base; /* base for [diouxX] conversion */
|
||||
@@ -537,9 +535,7 @@ __vfwprintf(FILE *fp, locale_t locale, const wchar_t *fmt0, va_list ap)
|
||||
va_copy(orgap, ap);
|
||||
io_init(&io, fp);
|
||||
ret = 0;
|
||||
#ifndef NO_FLOATING_POINT
|
||||
decimal_point = get_decpt(locale);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Scan the format for conversions (`%' character).
|
||||
@@ -643,11 +639,9 @@ reswitch: switch (ch) {
|
||||
}
|
||||
width = n;
|
||||
goto reswitch;
|
||||
#ifndef NO_FLOATING_POINT
|
||||
case 'L':
|
||||
flags |= LONGDBL;
|
||||
goto rflag;
|
||||
#endif
|
||||
case 'h':
|
||||
if (flags & SHORTINT) {
|
||||
flags &= ~SHORTINT;
|
||||
@@ -761,7 +755,6 @@ reswitch: switch (ch) {
|
||||
}
|
||||
base = 10;
|
||||
goto number;
|
||||
#ifndef NO_FLOATING_POINT
|
||||
case 'a':
|
||||
case 'A':
|
||||
if (ch == 'a') {
|
||||
@@ -885,7 +878,6 @@ reswitch: switch (ch) {
|
||||
size += grouping_init(&gs, expt, locale);
|
||||
}
|
||||
break;
|
||||
#endif /* !NO_FLOATING_POINT */
|
||||
case 'n':
|
||||
/*
|
||||
* Assignment-like behavior is specified if the
|
||||
@@ -1080,9 +1072,7 @@ number: if ((dprec = prec) >= 0)
|
||||
PAD(width - realsz, zeroes);
|
||||
|
||||
/* the string or number proper */
|
||||
#ifndef NO_FLOATING_POINT
|
||||
if ((flags & FPT) == 0) {
|
||||
#endif
|
||||
/* leading zeroes from decimal precision */
|
||||
PAD(dprec - size, zeroes);
|
||||
if (gs.grouping) {
|
||||
@@ -1091,7 +1081,6 @@ number: if ((dprec = prec) >= 0)
|
||||
} else {
|
||||
PRINT(cp, size);
|
||||
}
|
||||
#ifndef NO_FLOATING_POINT
|
||||
} else { /* glue together f_p fragments */
|
||||
if (!expchar) { /* %[fF] or sufficiently short %[gG] */
|
||||
if (expt <= 0) {
|
||||
@@ -1129,7 +1118,6 @@ number: if ((dprec = prec) >= 0)
|
||||
PRINT(expstr, expsize);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* left-adjusting padding (always blank) */
|
||||
if (flags & LADJUST)
|
||||
PAD(width - realsz, blanks);
|
||||
|
||||
@@ -84,9 +84,7 @@
|
||||
#define CT_INT 3 /* %[dioupxX] conversion */
|
||||
#define CT_FLOAT 4 /* %[efgEFG] conversion */
|
||||
|
||||
#ifndef NO_FLOATING_POINT
|
||||
static int parsefloat(FILE *, wchar_t *, wchar_t *, locale_t);
|
||||
#endif
|
||||
|
||||
struct ccl {
|
||||
const wchar_t *start; /* character class start */
|
||||
@@ -630,12 +628,10 @@ again: c = *fmt++;
|
||||
base = 16;
|
||||
break;
|
||||
|
||||
#ifndef NO_FLOATING_POINT
|
||||
case 'A': case 'E': case 'F': case 'G':
|
||||
case 'a': case 'e': case 'f': case 'g':
|
||||
c = CT_FLOAT;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 'S':
|
||||
flags |= LONG;
|
||||
@@ -813,7 +809,6 @@ again: c = *fmt++;
|
||||
}
|
||||
break;
|
||||
|
||||
#ifndef NO_FLOATING_POINT
|
||||
case CT_FLOAT:
|
||||
/* scan a floating point number as if by strtod */
|
||||
if (width == 0 || width > sizeof(buf) /
|
||||
@@ -835,7 +830,6 @@ again: c = *fmt++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif /* !NO_FLOATING_POINT */
|
||||
}
|
||||
if (!(flags & SUPPRESS))
|
||||
nassigned++;
|
||||
@@ -848,7 +842,6 @@ again: c = *fmt++;
|
||||
return (nassigned);
|
||||
}
|
||||
|
||||
#ifndef NO_FLOATING_POINT
|
||||
static int
|
||||
parsefloat(FILE *fp, wchar_t *buf, wchar_t *end, locale_t locale)
|
||||
{
|
||||
@@ -1007,4 +1000,3 @@ parsefloat(FILE *fp, wchar_t *buf, wchar_t *end, locale_t locale)
|
||||
*++commit = '\0';
|
||||
return (commit - buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -60,10 +60,8 @@ union arg {
|
||||
int intarg;
|
||||
long longarg;
|
||||
intmax_t intmaxarg;
|
||||
#ifndef NO_FLOATING_POINT
|
||||
double doublearg;
|
||||
long double longdoublearg;
|
||||
#endif
|
||||
wint_t wintarg;
|
||||
char *pchararg;
|
||||
wchar_t *pwchararg;
|
||||
@@ -497,14 +495,10 @@ __v2printf(FILE *fp, const char *fmt0, unsigned pct, va_list ap)
|
||||
args[ch].pwchararg = va_arg (ap, wchar_t *);
|
||||
break;
|
||||
case PA_DOUBLE:
|
||||
#ifndef NO_FLOATING_POINT
|
||||
args[ch].doublearg = va_arg (ap, double);
|
||||
#endif
|
||||
break;
|
||||
case PA_DOUBLE | PA_FLAG_LONG_DOUBLE:
|
||||
#ifndef NO_FLOATING_POINT
|
||||
args[ch].longdoublearg = va_arg (ap, long double);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
errx(1, "argtype = %x (fmt = \"%s\")\n",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
|
||||
.Dd January 12, 2026
|
||||
.Dd January 16, 2026
|
||||
.Dt SRC.CONF 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -761,10 +761,6 @@ when compiling the kernel.
|
||||
Also disables all format checking.
|
||||
.It Va WITHOUT_FORTH
|
||||
Build bootloaders without Forth support.
|
||||
.It Va WITHOUT_FP_LIBC
|
||||
Build
|
||||
.Nm libc
|
||||
without floating-point support.
|
||||
.It Va WITHOUT_FREEBSD_UPDATE
|
||||
Do not build
|
||||
.Xr freebsd-update 8 .
|
||||
|
||||
@@ -99,7 +99,6 @@ __DEFAULT_YES_OPTIONS = \
|
||||
FINGER \
|
||||
FLOPPY \
|
||||
FORTH \
|
||||
FP_LIBC \
|
||||
FREEBSD_UPDATE \
|
||||
FTP \
|
||||
GAMES \
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
Build
|
||||
.Nm libc
|
||||
without floating-point support.
|
||||
Reference in New Issue
Block a user