Re: dtoa, etc, and changes in that area (and PR lib/56937)
While you are working in this area, and before you forget everything you have discovered, could you take a look at PR lib/56937 and see if you can find the cause &/or a fix ? Thanks, kre
CVS commit: src/sbin/mount_portal
Module Name:src Committed By: rillig Date: Tue Apr 4 20:39:36 UTC 2023 Modified Files: src/sbin/mount_portal: puffs_portal.c Log Message: mount_portal: fix lint warnings about extern and empty declarations To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sbin/mount_portal/puffs_portal.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/mount_portal/puffs_portal.c diff -u src/sbin/mount_portal/puffs_portal.c:1.10 src/sbin/mount_portal/puffs_portal.c:1.11 --- src/sbin/mount_portal/puffs_portal.c:1.10 Thu May 23 11:13:17 2019 +++ src/sbin/mount_portal/puffs_portal.c Tue Apr 4 20:39:36 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: puffs_portal.c,v 1.10 2019/05/23 11:13:17 kre Exp $ */ +/* $NetBSD: puffs_portal.c,v 1.11 2023/04/04 20:39:36 rillig Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include #ifndef lint -__RCSID("$NetBSD: puffs_portal.c,v 1.10 2019/05/23 11:13:17 kre Exp $"); +__RCSID("$NetBSD: puffs_portal.c,v 1.11 2023/04/04 20:39:36 rillig Exp $"); #endif /* !lint */ #include @@ -57,7 +57,7 @@ struct portal_node { __dead static void usage(void); -PUFFSOP_PROTOS(portal); +PUFFSOP_PROTOS(portal) #define PORTAL_ROOT NULL #define METADATASIZE (sizeof(int) + sizeof(size_t)) @@ -396,8 +396,6 @@ provide(struct puffs_usermount *pu, stru int main(int argc, char *argv[]) { - extern char *optarg; - extern int optind; struct puffs_usermount *pu; struct puffs_ops *pops; mntoptparse_t mp;
CVS commit: src/sbin/mount_portal
Module Name:src Committed By: rillig Date: Tue Apr 4 20:39:36 UTC 2023 Modified Files: src/sbin/mount_portal: puffs_portal.c Log Message: mount_portal: fix lint warnings about extern and empty declarations To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sbin/mount_portal/puffs_portal.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/mmcformat
Module Name:src Committed By: rillig Date: Tue Apr 4 20:28:01 UTC 2023 Modified Files: src/usr.sbin/mmcformat: mmcformat.c Log Message: mmcformat: KNF Remove trailing whitespace, sort headers, add RCS ID, unexport global variable. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/mmcformat/mmcformat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/mmcformat/mmcformat.c diff -u src/usr.sbin/mmcformat/mmcformat.c:1.8 src/usr.sbin/mmcformat/mmcformat.c:1.9 --- src/usr.sbin/mmcformat/mmcformat.c:1.8 Tue Apr 4 20:17:01 2023 +++ src/usr.sbin/mmcformat/mmcformat.c Tue Apr 4 20:28:01 2023 @@ -1,9 +1,9 @@ -/* $NetBSD: mmcformat.c,v 1.8 2023/04/04 20:17:01 rillig Exp $ */ +/* $NetBSD: mmcformat.c,v 1.9 2023/04/04 20:28:01 rillig Exp $ */ /* * Copyright (c) 2006, 2008 Reinoud Zandijk * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -12,7 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in the *documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. @@ -23,27 +23,30 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * */ -#include +#include +__RCSID("$NetBSD: mmcformat.c,v 1.9 2023/04/04 20:28:01 rillig Exp $"); + +#include +#include +#include +#include #include -#include +#include +#include +#include #include -#include #include #include -#include -#include -#include -#include -#include +#include #include "uscsilib.h" /* globals */ -struct uscsi_dev dev; +static struct uscsi_dev dev; extern int scsilib_verbose; /* #define DEBUG(a) {a;} */ @@ -313,7 +316,7 @@ get_format_capabilities(struct uscsi_dev static void print_format(int format_tp, uint32_t num_blks, uint32_t param, - int dscr_type, int verbose, int *supported) + int dscr_type, int verbose, int *supported) { char const *format_str, *nblks_str, *param_str, *user_spec; @@ -474,7 +477,7 @@ process_format_caps(uint8_t *buf, int li bzero(allow, 255); bzero(blks, 255*4); bzero(params, 255*4); - + fcd = buf + 4; list_length -= 4; /* strip header */ @@ -569,7 +572,7 @@ uscsi_format_cdrw_mode7(struct uscsi_dev static int uscsi_format_disc(struct uscsi_dev *mydev, int immed, int format_type, - uint32_t blocks, uint32_t param, int certification, int cmplist) + uint32_t blocks, uint32_t param, int certification, int cmplist) { scsicmd cmd; struct uscsi_sense sense; @@ -1075,4 +1078,3 @@ main(int argc, char *argv[]) return error; } -
CVS commit: src/usr.sbin/mmcformat
Module Name:src Committed By: rillig Date: Tue Apr 4 20:28:01 UTC 2023 Modified Files: src/usr.sbin/mmcformat: mmcformat.c Log Message: mmcformat: KNF Remove trailing whitespace, sort headers, add RCS ID, unexport global variable. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/mmcformat/mmcformat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/mmcformat
Module Name:src Committed By: rillig Date: Tue Apr 4 20:17:01 UTC 2023 Modified Files: src/usr.sbin/mmcformat: mmcformat.c Log Message: mmcformat: remove redundant extern declarations No binary change. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/mmcformat/mmcformat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/mmcformat/mmcformat.c diff -u src/usr.sbin/mmcformat/mmcformat.c:1.7 src/usr.sbin/mmcformat/mmcformat.c:1.8 --- src/usr.sbin/mmcformat/mmcformat.c:1.7 Sun May 22 11:27:37 2022 +++ src/usr.sbin/mmcformat/mmcformat.c Tue Apr 4 20:17:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: mmcformat.c,v 1.7 2022/05/22 11:27:37 andvar Exp $ */ +/* $NetBSD: mmcformat.c,v 1.8 2023/04/04 20:17:01 rillig Exp $ */ /* * Copyright (c) 2006, 2008 Reinoud Zandijk @@ -682,11 +682,6 @@ usage(char *program) } -extern char *optarg; -extern int optind; -extern int optreset; - - int main(int argc, char *argv[]) {
CVS commit: src/usr.sbin/mmcformat
Module Name:src Committed By: rillig Date: Tue Apr 4 20:17:01 UTC 2023 Modified Files: src/usr.sbin/mmcformat: mmcformat.c Log Message: mmcformat: remove redundant extern declarations No binary change. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/mmcformat/mmcformat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/misc
Module Name:src Committed By: jschauma Date: Tue Apr 4 20:13:02 UTC 2023 Modified Files: src/share/misc: acronyms.comp Log Message: +RBL, DNSBL reputation block list real-time blackhole list DNS block list To generate a diff of this commit: cvs rdiff -u -r1.350 -r1.351 src/share/misc/acronyms.comp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/misc/acronyms.comp diff -u src/share/misc/acronyms.comp:1.350 src/share/misc/acronyms.comp:1.351 --- src/share/misc/acronyms.comp:1.350 Sat Apr 1 00:59:10 2023 +++ src/share/misc/acronyms.comp Tue Apr 4 20:13:02 2023 @@ -1,4 +1,4 @@ -$NetBSD: acronyms.comp,v 1.350 2023/04/01 00:59:10 jschauma Exp $ +$NetBSD: acronyms.comp,v 1.351 2023/04/04 20:13:02 jschauma Exp $ 3WHS three-way handshake 8VSB 8-state vestigial side band modulation AA anti-aliasing @@ -433,6 +433,7 @@ DNARD Digital network appliance referenc DND drag and drop DNLC directory name lookup cache DNS Domain Name System +DNSBL Domain Name System Block List DNSSEC DNS Security Extensions DOE distributed object environment DOF data over fibre @@ -1345,6 +1346,8 @@ RAS remote access service RAS restartable atomic sequence RAS row address strobe RBF radial basis function +RBL reputation block list +RBL real-time blackhole list RBNF routing backus-naur form RBT red-black tree RC release candidate
CVS commit: src/share/misc
Module Name:src Committed By: jschauma Date: Tue Apr 4 20:13:02 UTC 2023 Modified Files: src/share/misc: acronyms.comp Log Message: +RBL, DNSBL reputation block list real-time blackhole list DNS block list To generate a diff of this commit: cvs rdiff -u -r1.350 -r1.351 src/share/misc/acronyms.comp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/lib/libc/stdio
Module Name:src Committed By: he Date: Tue Apr 4 19:39:38 UTC 2023 Modified Files: src/tests/lib/libc/stdio: t_printf.c Log Message: Fix the test for "inf" output, also include newline in printf format... To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libc/stdio/t_printf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/stdio/t_printf.c diff -u src/tests/lib/libc/stdio/t_printf.c:1.9 src/tests/lib/libc/stdio/t_printf.c:1.10 --- src/tests/lib/libc/stdio/t_printf.c:1.9 Tue Apr 4 19:30:11 2023 +++ src/tests/lib/libc/stdio/t_printf.c Tue Apr 4 19:39:38 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: t_printf.c,v 1.9 2023/04/04 19:30:11 christos Exp $ */ +/* $NetBSD: t_printf.c,v 1.10 2023/04/04 19:39:38 he Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -219,7 +219,7 @@ ATF_TC_BODY(pr57250_fix, tc) ld = (double)ld; ATF_CHECK(isfinite(ld) == 0); snprintf(buf, sizeof buf, "%Lf\n", ld); - ATF_REQUIRE_STREQ(buf, "inf"); + ATF_REQUIRE_STREQ(buf, "inf\n"); } #endif
CVS commit: src/tests/lib/libc/stdio
Module Name:src Committed By: he Date: Tue Apr 4 19:39:38 UTC 2023 Modified Files: src/tests/lib/libc/stdio: t_printf.c Log Message: Fix the test for "inf" output, also include newline in printf format... To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/lib/libc/stdio/t_printf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/lib/libc/stdio
Module Name:src Committed By: christos Date: Tue Apr 4 19:30:11 UTC 2023 Modified Files: src/tests/lib/libc/stdio: t_printf.c Log Message: Add a test for PR/57250 from Havard Eidnes To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libc/stdio/t_printf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/stdio/t_printf.c diff -u src/tests/lib/libc/stdio/t_printf.c:1.8 src/tests/lib/libc/stdio/t_printf.c:1.9 --- src/tests/lib/libc/stdio/t_printf.c:1.8 Wed Apr 11 12:21:42 2012 +++ src/tests/lib/libc/stdio/t_printf.c Tue Apr 4 15:30:11 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: t_printf.c,v 1.8 2012/04/11 16:21:42 jruoho Exp $ */ +/* $NetBSD: t_printf.c,v 1.9 2023/04/04 19:30:11 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -35,6 +35,7 @@ #include #include #include +#include ATF_TC(snprintf_c99); ATF_TC_HEAD(snprintf_c99, tc) @@ -179,6 +180,50 @@ ATF_TC_BODY(sprintf_zeropad, tc) #endif } +ATF_TC(snprintf_double_a); +ATF_TC_HEAD(snprintf_double_a, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test printf a format"); +} + +ATF_TC_BODY(snprintf_double_a, tc) +{ + char buf[1000]; + + snprintf(buf, sizeof buf, "%.3a", (double)10.6); + ATF_REQUIRE_STREQ("0x1.533p+3", buf); +} + +/* is "long double" and "double" different? */ +#if (__LDBL_MANT_DIG__ != __DBL_MANT_DIG__) || \ +(__LDBL_MAX_EXP__ != __DBL_MAX_EXP__) +#define WIDE_DOUBLE +#endif + +#ifndef WIDE_DOUBLE +ATF_TC(pr57250_fix); +ATF_TC_HEAD(pr57250_fix, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test for PR57250"); +} + +ATF_TC_BODY(pr57250_fix, tc) +{ + char *eptr; + char buf[1000]; + long double ld; + + errno = 0; + ld = strtold("1e309", ); + ATF_CHECK(errno != 0); + ld = (double)ld; + ATF_CHECK(isfinite(ld) == 0); + snprintf(buf, sizeof buf, "%Lf\n", ld); + ATF_REQUIRE_STREQ(buf, "inf"); +} +#endif + + ATF_TP_ADD_TCS(tp) { @@ -189,6 +234,10 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, snprintf_posarg_error); ATF_TP_ADD_TC(tp, snprintf_float); ATF_TP_ADD_TC(tp, sprintf_zeropad); + ATF_TP_ADD_TC(tp, snprintf_double_a); +#ifndef WIDE_DOUBLE + ATF_TP_ADD_TC(tp, pr57250_fix); +#endif return atf_no_error(); }
CVS commit: src/tests/lib/libc/stdio
Module Name:src Committed By: christos Date: Tue Apr 4 19:30:11 UTC 2023 Modified Files: src/tests/lib/libc/stdio: t_printf.c Log Message: Add a test for PR/57250 from Havard Eidnes To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libc/stdio/t_printf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc
Module Name:src Committed By: christos Date: Tue Apr 4 19:26:06 UTC 2023 Modified Files: src/lib/libc/include: extern.h src/lib/libc/stdio: Makefile.inc vfwprintf.c Log Message: PR/57250: Martin Husemann: dtoa mishandles infinite doubles on 32bit big endian machines. When long double support was added, the old code was kept for the regular double code. This code was never used because WIDE_DOUBLE was always defined in the Makefile. Remove that old code, and conditionalize the WIDE_DOUBLE code based on if long doubles are different than doubles on the specific platform. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/lib/libc/include/extern.h cvs rdiff -u -r1.47 -r1.48 src/lib/libc/stdio/Makefile.inc cvs rdiff -u -r1.39 -r1.40 src/lib/libc/stdio/vfwprintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/include/extern.h diff -u src/lib/libc/include/extern.h:1.26 src/lib/libc/include/extern.h:1.27 --- src/lib/libc/include/extern.h:1.26 Fri May 15 10:37:21 2020 +++ src/lib/libc/include/extern.h Tue Apr 4 15:26:06 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.26 2020/05/15 14:37:21 joerg Exp $ */ +/* $NetBSD: extern.h,v 1.27 2023/04/04 19:26:06 christos Exp $ */ /* * Copyright (c) 1997 Christos Zoulas. All rights reserved. @@ -49,11 +49,17 @@ struct sigaction; int __sigaction_sigtramp(int, const struct sigaction *, struct sigaction *, const void *, int); +/* is "long double" and "double" different? */ +#if (__LDBL_MANT_DIG__ != __DBL_MANT_DIG__) || \ +(__LDBL_MAX_EXP__ != __DBL_MAX_EXP__) +#define WIDE_DOUBLE +#endif + #ifdef WIDE_DOUBLE -char *__hdtoa(double, const char *, int, int *, int *, char **); char *__hldtoa(long double, const char *, int, int *, int *, char **); char *__ldtoa(long double *, int, int, int *, int *, char **); #endif +char *__hdtoa(double, const char *, int, int *, int *, char **); #ifndef __LIBC12_SOURCE__ struct syslog_data; Index: src/lib/libc/stdio/Makefile.inc diff -u src/lib/libc/stdio/Makefile.inc:1.47 src/lib/libc/stdio/Makefile.inc:1.48 --- src/lib/libc/stdio/Makefile.inc:1.47 Tue Dec 29 12:55:23 2015 +++ src/lib/libc/stdio/Makefile.inc Tue Apr 4 15:26:06 2023 @@ -1,11 +1,9 @@ # from: @(#)Makefile.inc 5.7 (Berkeley) 6/27/91 -# $NetBSD: Makefile.inc,v 1.47 2015/12/29 17:55:23 christos Exp $ +# $NetBSD: Makefile.inc,v 1.48 2023/04/04 19:26:06 christos Exp $ # stdio sources .PATH: ${.CURDIR}/stdio -CPPFLAGS+=-DWIDE_DOUBLE - SRCS+= clrerr.c dprintf.c fclose.c fdopen.c feof.c ferror.c \ fflush.c fgetc.c fgetln.c fgetpos.c fgets.c fgetstr.c fgetwc.c \ fgetwln.c fgetws.c fileno.c findfp.c flags.c flockfile.c fopen.c \ Index: src/lib/libc/stdio/vfwprintf.c diff -u src/lib/libc/stdio/vfwprintf.c:1.39 src/lib/libc/stdio/vfwprintf.c:1.40 --- src/lib/libc/stdio/vfwprintf.c:1.39 Tue Apr 19 16:32:16 2022 +++ src/lib/libc/stdio/vfwprintf.c Tue Apr 4 15:26:06 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: vfwprintf.c,v 1.39 2022/04/19 20:32:16 rillig Exp $ */ +/* $NetBSD: vfwprintf.c,v 1.40 2023/04/04 19:26:06 christos Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93"; __FBSDID("$FreeBSD: src/lib/libc/stdio/vfwprintf.c,v 1.27 2007/01/09 00:28:08 imp Exp $"); #else -__RCSID("$NetBSD: vfwprintf.c,v 1.39 2022/04/19 20:32:16 rillig Exp $"); +__RCSID("$NetBSD: vfwprintf.c,v 1.40 2023/04/04 19:26:06 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -581,9 +581,6 @@ WDECL(vf,printf_l)(FILE * __restrict fp, #define DEFPREC 6 static int exponent(CHAR_T *, int, int); -#ifndef WIDE_DOUBLE -static char *cvt(double, int, int, char *, int *, int, int *); -#endif #endif /* !NO_FLOATING_POINT */ @@ -649,17 +646,14 @@ WDECL(__vf,printf_unlocked_l)(FILE *fp, * F: at least two digits for decimal, at least one digit for hex */ char *decimal_point; /* locale specific decimal point */ -#ifdef WIDE_DOUBLE int signflag; /* true if float is negative */ union { /* floating point arguments %[aAeEfFgG] */ double dbl; +#ifdef WIDE_DOUBLE long double ldbl; +#endif } fparg; char *dtoaend; /* pointer to end of converted digits */ -#else - double _double; /* double precision arguments %[eEfgG] */ - char softsign; /* temporary negative sign for floats */ -#endif char *dtoaresult; /* buffer allocated by dtoa */ int expt; /* integer value of exponent */ char expchar; /* exponent character: [eEpP\0] */ @@ -1058,7 +1052,6 @@ reswitch: switch (ch) { base = 10; goto number; #ifndef NO_FLOATING_POINT -#ifdef WIDE_DOUBLE case 'a': case 'A': if (ch == 'a') { @@ -1072,12 +1065,15 @@ reswitch: switch (ch) { } if (prec >= 0) prec++; +#ifdef WIDE_DOUBLE if (flags & LONGDBL) { fparg.ldbl = GETARG(long double); dtoaresult = __hldtoa(fparg.ldbl, xdigs, prec,
CVS commit: src/lib/libc
Module Name:src Committed By: christos Date: Tue Apr 4 19:26:06 UTC 2023 Modified Files: src/lib/libc/include: extern.h src/lib/libc/stdio: Makefile.inc vfwprintf.c Log Message: PR/57250: Martin Husemann: dtoa mishandles infinite doubles on 32bit big endian machines. When long double support was added, the old code was kept for the regular double code. This code was never used because WIDE_DOUBLE was always defined in the Makefile. Remove that old code, and conditionalize the WIDE_DOUBLE code based on if long doubles are different than doubles on the specific platform. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/lib/libc/include/extern.h cvs rdiff -u -r1.47 -r1.48 src/lib/libc/stdio/Makefile.inc cvs rdiff -u -r1.39 -r1.40 src/lib/libc/stdio/vfwprintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.