CVS commit: src/tools

2024-02-22 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Feb 23 05:34:41 UTC 2024

Modified Files:
src/tools: Makefile
Added Files:
src/tools/isl: Makefile

Log Message:
build isl tool for GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/tools/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/isl/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tools/Makefile
diff -u src/tools/Makefile:1.215 src/tools/Makefile:1.216
--- src/tools/Makefile:1.215	Thu Nov 30 06:29:33 2023
+++ src/tools/Makefile	Fri Feb 23 05:34:41 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.215 2023/11/30 06:29:33 rin Exp $
+#	$NetBSD: Makefile,v 1.216 2024/02/23 05:34:41 mrg Exp $
 
 .include 
 .include 
@@ -31,6 +31,9 @@ TOOLCHAIN_BITS+= gmake .WAIT
 TOOLCHAIN_BITS+= gmp .WAIT
 TOOLCHAIN_BITS+= mpfr .WAIT
 TOOLCHAIN_BITS+= mpc .WAIT
+.  if (defined(HAVE_GCC) && ${HAVE_GCC} >= 12)
+TOOLCHAIN_BITS+= isl .WAIT
+.  endif
 . endif
 
 TOOLCHAIN_BITS+= binutils .WAIT

Added files:

Index: src/tools/isl/Makefile
diff -u /dev/null src/tools/isl/Makefile:1.1
--- /dev/null	Fri Feb 23 05:34:41 2024
+++ src/tools/isl/Makefile	Fri Feb 23 05:34:41 2024
@@ -0,0 +1,16 @@
+#	$NetBSD: Makefile,v 1.1 2024/02/23 05:34:41 mrg Exp $
+
+GNUHOSTDIST=	${.CURDIR}/../../external/mit/isl/dist
+
+CONFIGURE_ARGS+=	--with-gmp-prefix=${TOOLDIR:Q} \
+			--disable-shared
+
+.include "${.CURDIR}/../Makefile.gmakehost"
+
+CONFIGURE_ENV+= MAKE=${TOOL_GMAKE}
+
+# XXX this gets lost some how.  Not portable.
+HOST_CXXFLAGS+=	-std=gnu++17
+
+# Force avoiding possibly non-executable install-sh.
+#CONFIGURE_ENV+= ac_cv_path_mkdir="${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install -d"



CVS commit: src/tools

2024-02-22 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Feb 23 05:34:41 UTC 2024

Modified Files:
src/tools: Makefile
Added Files:
src/tools/isl: Makefile

Log Message:
build isl tool for GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/tools/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/isl/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/mit/isl

2024-02-22 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Feb 23 05:33:04 UTC 2024

Added Files:
src/external/mit/isl/include: Makefile gitversion.h isl_config.h
src/external/mit/isl/include/isl: Makefile stdint.h
src/external/mit/isl/lib/libisl: Makefile

Log Message:
build infrastructure for isl.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/mit/isl/include/Makefile \
src/external/mit/isl/include/gitversion.h \
src/external/mit/isl/include/isl_config.h
cvs rdiff -u -r0 -r1.1 src/external/mit/isl/include/isl/Makefile \
src/external/mit/isl/include/isl/stdint.h
cvs rdiff -u -r0 -r1.1 src/external/mit/isl/lib/libisl/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/external/mit/isl/include/Makefile
diff -u /dev/null src/external/mit/isl/include/Makefile:1.1
--- /dev/null	Fri Feb 23 05:33:04 2024
+++ src/external/mit/isl/include/Makefile	Fri Feb 23 05:33:03 2024
@@ -0,0 +1,18 @@
+#	$NetBSD: Makefile,v 1.1 2024/02/23 05:33:03 mrg Exp $
+
+.include 
+
+# We don't install isl, just provide it for GCC.
+LIBISPRIVATE?= yes
+
+.if ${LIBISPRIVATE} != "yes"
+
+INCS=		gitversion.h isl_config.h
+INCSDIR=	/usr/include
+
+.include 
+.endif
+
+SUBDIR=		isl
+
+.include 
Index: src/external/mit/isl/include/gitversion.h
diff -u /dev/null src/external/mit/isl/include/gitversion.h:1.1
--- /dev/null	Fri Feb 23 05:33:04 2024
+++ src/external/mit/isl/include/gitversion.h	Fri Feb 23 05:33:03 2024
@@ -0,0 +1 @@
+#define GIT_HEAD_ID "isl-0.26"
Index: src/external/mit/isl/include/isl_config.h
diff -u /dev/null src/external/mit/isl/include/isl_config.h:1.1
--- /dev/null	Fri Feb 23 05:33:04 2024
+++ src/external/mit/isl/include/isl_config.h	Fri Feb 23 05:33:04 2024
@@ -0,0 +1,145 @@
+/* isl_config.h.  Generated from isl_config.h.in by configure.  */
+/* isl_config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* most gcc compilers know a function __attribute__((__warn_unused_result__))
+   */
+#define GCC_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
+
+/* define if the compiler supports basic C++11 syntax */
+#define HAVE_CXX11 1
+
+/* define if the compiler supports basic C++17 syntax */
+#define HAVE_CXX17 1
+
+/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
+#define HAVE_DECL_FFS 1
+
+/* Define to 1 if you have the declaration of `mp_get_memory_functions', and
+   to 0 if you don't. */
+#define HAVE_DECL_MP_GET_MEMORY_FUNCTIONS 1
+
+/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
+   don't. */
+#define HAVE_DECL_SNPRINTF 1
+
+/* Define to 1 if you have the declaration of `strcasecmp', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRCASECMP 1
+
+/* Define to 1 if you have the declaration of `strncasecmp', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRNCASECMP 1
+
+/* Define to 1 if you have the declaration of `_BitScanForward', and to 0 if
+   you don't. */
+#define HAVE_DECL__BITSCANFORWARD 0
+
+/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you
+   don't. */
+#define HAVE_DECL__SNPRINTF 0
+
+/* Define to 1 if you have the declaration of `_stricmp', and to 0 if you
+   don't. */
+#define HAVE_DECL__STRICMP 0
+
+/* Define to 1 if you have the declaration of `_strnicmp', and to 0 if you
+   don't. */
+#define HAVE_DECL__STRNICMP 0
+
+/* Define to 1 if you have the declaration of `__builtin_ffs', and to 0 if you
+   don't. */
+#define HAVE_DECL___BUILTIN_FFS 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `gmp' library (-lgmp). */
+#define HAVE_LIBGMP 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_STDIO_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the  header file. */
+#define HAVE_UNISTD_H 1
+
+/* define if your compiler has __attribute__ */
+#define HAVE___ATTRIBUTE__ 1
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "isl"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "isl-developm...@googlegroups.com"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "isl"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "isl 0.26"
+
+/* Define to the one

CVS commit: src/external/mit/isl

2024-02-22 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Feb 23 05:33:04 UTC 2024

Added Files:
src/external/mit/isl/include: Makefile gitversion.h isl_config.h
src/external/mit/isl/include/isl: Makefile stdint.h
src/external/mit/isl/lib/libisl: Makefile

Log Message:
build infrastructure for isl.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/mit/isl/include/Makefile \
src/external/mit/isl/include/gitversion.h \
src/external/mit/isl/include/isl_config.h
cvs rdiff -u -r0 -r1.1 src/external/mit/isl/include/isl/Makefile \
src/external/mit/isl/include/isl/stdint.h
cvs rdiff -u -r0 -r1.1 src/external/mit/isl/lib/libisl/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/evbarm

2024-02-22 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Feb 22 23:16:10 UTC 2024

Modified Files:
src/sys/arch/evbarm/kobo: kobo_usb.c
src/sys/arch/evbarm/netwalker: netwalker_usb.c

Log Message:
sc_init_md_hook expects two params since interface change in imxusbvar.h rev 1.7
thus adjust kobo_usb_init() and netwalker_usb_init() functions accordingly.

Fixes build for KOBO and NETWALKER(_MD) kernel configs.
Needs pullup to netbsd-10.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/kobo/kobo_usb.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/netwalker/netwalker_usb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/evbarm

2024-02-22 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Feb 22 23:16:10 UTC 2024

Modified Files:
src/sys/arch/evbarm/kobo: kobo_usb.c
src/sys/arch/evbarm/netwalker: netwalker_usb.c

Log Message:
sc_init_md_hook expects two params since interface change in imxusbvar.h rev 1.7
thus adjust kobo_usb_init() and netwalker_usb_init() functions accordingly.

Fixes build for KOBO and NETWALKER(_MD) kernel configs.
Needs pullup to netbsd-10.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/kobo/kobo_usb.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/netwalker/netwalker_usb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/kobo/kobo_usb.c
diff -u src/sys/arch/evbarm/kobo/kobo_usb.c:1.3 src/sys/arch/evbarm/kobo/kobo_usb.c:1.4
--- src/sys/arch/evbarm/kobo/kobo_usb.c:1.3	Wed Jul 24 11:20:55 2019
+++ src/sys/arch/evbarm/kobo/kobo_usb.c	Thu Feb 22 23:16:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: kobo_usb.c,v 1.3 2019/07/24 11:20:55 hkenken Exp $	*/
+/*	$NetBSD: kobo_usb.c,v 1.4 2024/02/22 23:16:10 andvar Exp $	*/
 
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kobo_usb.c,v 1.3 2019/07/24 11:20:55 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kobo_usb.c,v 1.4 2024/02/22 23:16:10 andvar Exp $");
 
 #include "opt_imx.h"
 
@@ -64,7 +64,7 @@ struct kobo_usbc_softc {
 
 static int	imxusbc_match(device_t, cfdata_t, void *);
 static void	imxusbc_attach(device_t, device_t, void *);
-static void	kobo_usb_init(struct imxehci_softc *);
+static void	kobo_usb_init(struct imxehci_softc *, uintptr_t);
 
 static void	init_otg(struct imxehci_softc *);
 static void	init_h1(struct imxehci_softc *);
@@ -105,7 +105,7 @@ imxusbc_attach(device_t parent, device_t
 }
 
 static void
-kobo_usb_init(struct imxehci_softc *sc)
+kobo_usb_init(struct imxehci_softc *sc, uintptr_t data)
 {
 	switch (sc->sc_unit) {
 	case 0:	/* OTG controller */

Index: src/sys/arch/evbarm/netwalker/netwalker_usb.c
diff -u src/sys/arch/evbarm/netwalker/netwalker_usb.c:1.8 src/sys/arch/evbarm/netwalker/netwalker_usb.c:1.9
--- src/sys/arch/evbarm/netwalker/netwalker_usb.c:1.8	Wed Jan 15 10:25:47 2020
+++ src/sys/arch/evbarm/netwalker/netwalker_usb.c	Thu Feb 22 23:16:10 2024
@@ -25,7 +25,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netwalker_usb.c,v 1.8 2020/01/15 10:25:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netwalker_usb.c,v 1.9 2024/02/22 23:16:10 andvar Exp $");
 
 #include "locators.h"
 
@@ -61,7 +61,7 @@ struct netwalker_usbc_softc {
 
 static int	imxusbc_match(device_t, cfdata_t, void *);
 static void	imxusbc_attach(device_t, device_t, void *);
-static void	netwalker_usb_init(struct imxehci_softc *);
+static void	netwalker_usb_init(struct imxehci_softc *, uintptr_t);
 
 static void	init_otg(struct imxehci_softc *);
 static void	init_h1(struct imxehci_softc *);
@@ -103,7 +103,7 @@ imxusbc_attach(device_t parent, device_t
 }
 
 static void
-netwalker_usb_init(struct imxehci_softc *sc)
+netwalker_usb_init(struct imxehci_softc *sc, uintptr_t data)
 {
 	switch (sc->sc_unit) {
 	case 0:	/* OTG controller */



CVS commit: src

2024-02-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb 22 21:04:24 UTC 2024

Modified Files:
src/common/lib/libutil: snprintb.c
src/lib/libutil: snprintb.3
src/tests/lib/libutil: t_snprintb.c

Log Message:
snprintb: always null-terminate output

Always null-terminate the output in the buffer, even in error cases. The
wording in the manual page has been promising this since 2008. For
snprintb_m, ensure that the output is terminated with two null
characters, to gracefully handle situations in which the caller does not
check whether snprintb returned an error.

If the buffer size is zero, allow the buffer to be a null pointer,
analogous to snprintf.

Fix an out-of-bounds memory read if the bitfmt ends with a '*' directive
(since today).

In the tests, merge the helper functions for snprintb, snprintb_m, as
they were similar enough.

Fix a few 'line_max exceeded' tests, ensuring that they output a '#'
marker, and that the 'complete' tests don't.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/common/lib/libutil/snprintb.c
cvs rdiff -u -r1.34 -r1.35 src/lib/libutil/snprintb.3
cvs rdiff -u -r1.26 -r1.27 src/tests/lib/libutil/t_snprintb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libutil/snprintb.c
diff -u src/common/lib/libutil/snprintb.c:1.38 src/common/lib/libutil/snprintb.c:1.39
--- src/common/lib/libutil/snprintb.c:1.38	Thu Feb 22 18:26:15 2024
+++ src/common/lib/libutil/snprintb.c	Thu Feb 22 21:04:23 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: snprintb.c,v 1.38 2024/02/22 18:26:15 rillig Exp $	*/
+/*	$NetBSD: snprintb.c,v 1.39 2024/02/22 21:04:23 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #  include 
 #  if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: snprintb.c,v 1.38 2024/02/22 18:26:15 rillig Exp $");
+__RCSID("$NetBSD: snprintb.c,v 1.39 2024/02/22 21:04:23 rillig Exp $");
 #  endif
 
 #  include 
@@ -51,7 +51,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.38 2024
 #  include 
 # else /* ! _KERNEL */
 #  include 
-__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.38 2024/02/22 18:26:15 rillig Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.39 2024/02/22 21:04:23 rillig Exp $");
 #  include 
 #  include 
 #  include 
@@ -219,7 +219,7 @@ new_style(state *s)
 			if (store_num(s, s->bitfmt, field) < 0)
 return -1;
 			wrap_if_necessary(s, prev_bitfmt);
-			/*FALLTHROUGH*/
+			goto skip_description;
 		default:
 			s->bitfmt += 2;
 		skip_description:
@@ -231,6 +231,19 @@ new_style(state *s)
 	return 0;
 }
 
+static void
+finish_buffer(state *s)
+{
+	if (s->line_max > 0) {
+		put_eol(s);
+		if (s->bufsize >= 2 && s->total_len > s->bufsize - 2)
+			s->buf[s->bufsize - 2] = '\0';
+	}
+	store(s, '\0');
+	if (s->bufsize >= 1 && s->total_len > s->bufsize - 1)
+		s->buf[s->bufsize - 1] = '\0';
+}
+
 int
 snprintb_m(char *buf, size_t bufsize, const char *bitfmt, uint64_t val,
 	   size_t line_max)
@@ -240,10 +253,10 @@ snprintb_m(char *buf, size_t bufsize, co
 	 * For safety; no other *s*printf() do this, but in the kernel
 	 * we don't usually check the return value
 	 */
-	(void)memset(buf, 0, bufsize);
+	if (bufsize > 0)
+		(void)memset(buf, 0, bufsize);
 #endif /* _KERNEL */
 
-
 	int old = *bitfmt != '\177';
 	if (!old)
 		bitfmt++;
@@ -260,13 +273,9 @@ snprintb_m(char *buf, size_t bufsize, co
 		num_fmt = "%#jx";
 		break;
 	default:
-		goto internal;
+		num_fmt = NULL;
 	}
 
-	int val_len = snprintf(buf, bufsize, num_fmt, (uintmax_t)val);
-	if (val_len < 0)
-		goto internal;
-
 	state s = {
 		.buf = buf,
 		.bufsize = bufsize,
@@ -275,28 +284,26 @@ snprintb_m(char *buf, size_t bufsize, co
 		.line_max = line_max,
 
 		.num_fmt = num_fmt,
-		.total_len = val_len,
 		.sep = '<',
 	};
+	if (num_fmt == NULL)
+		goto internal;
+
+	store_num(&s, num_fmt, val);
 
 	if ((old ? old_style(&s) : new_style(&s)) < 0)
 		goto internal;
 
 	if (s.sep != '<')
 		store(&s, '>');
-	if (s.line_max > 0) {
-		put_eol(&s);
-		if (s.bufsize >= 2 && s.total_len > s.bufsize - 2)
-			s.buf[s.bufsize - 2] = '\0';
-	}
-	store(&s, '\0');
-	if (s.bufsize >= 1 && s.total_len > s.bufsize - 1)
-		s.buf[s.bufsize - 1] = '\0';
+	finish_buffer(&s);
 	return (int)(s.total_len - 1);
 internal:
 #ifndef _KERNEL
 	errno = EINVAL;
 #endif
+	store(&s, '#');
+	finish_buffer(&s);
 	return -1;
 }
 

Index: src/lib/libutil/snprintb.3
diff -u src/lib/libutil/snprintb.3:1.34 src/lib/libutil/snprintb.3:1.35
--- src/lib/libutil/snprintb.3:1.34	Thu Feb 22 18:26:16 2024
+++ src/lib/libutil/snprintb.3	Thu Feb 22 21:04:24 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: snprintb.3,v 1.34 2024/02/22 18:26:16 rillig Exp $
+.\" $NetBSD: snprintb.3,v 1.35 2024/02/22 21:04:24 rillig Exp $
 .\"
 .\" Copyright (c) 1998, 2024 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -55,8 +55,7 @@ into the buffer
 .Fa buf ,
 of size
 .Fa bufsize ,
-using a specified r

CVS commit: src

2024-02-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb 22 21:04:24 UTC 2024

Modified Files:
src/common/lib/libutil: snprintb.c
src/lib/libutil: snprintb.3
src/tests/lib/libutil: t_snprintb.c

Log Message:
snprintb: always null-terminate output

Always null-terminate the output in the buffer, even in error cases. The
wording in the manual page has been promising this since 2008. For
snprintb_m, ensure that the output is terminated with two null
characters, to gracefully handle situations in which the caller does not
check whether snprintb returned an error.

If the buffer size is zero, allow the buffer to be a null pointer,
analogous to snprintf.

Fix an out-of-bounds memory read if the bitfmt ends with a '*' directive
(since today).

In the tests, merge the helper functions for snprintb, snprintb_m, as
they were similar enough.

Fix a few 'line_max exceeded' tests, ensuring that they output a '#'
marker, and that the 'complete' tests don't.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/common/lib/libutil/snprintb.c
cvs rdiff -u -r1.34 -r1.35 src/lib/libutil/snprintb.3
cvs rdiff -u -r1.26 -r1.27 src/tests/lib/libutil/t_snprintb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2024-02-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb 22 18:26:16 UTC 2024

Modified Files:
src/common/lib/libutil: snprintb.c
src/lib/libutil: snprintb.3
src/tests/lib/libutil: t_snprintb.c

Log Message:
snprintb: error out on out-of-bounds bit shifts

Previously, these invoked undefined behavior, now they lead to an early
return. An example of out-of-bounds bit number is in SCZ_PCICTRL_BITS.
Bit fields that extend beyond the msb are still allowed.

Allow 'f' and 'F' to have fields that are 64 bits wide. This only makes
sense when the field starts at bit 0.

Remove the unused 'val_len', it was only needed before snprintb.c 1.20.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/common/lib/libutil/snprintb.c
cvs rdiff -u -r1.33 -r1.34 src/lib/libutil/snprintb.3
cvs rdiff -u -r1.25 -r1.26 src/tests/lib/libutil/t_snprintb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libutil/snprintb.c
diff -u src/common/lib/libutil/snprintb.c:1.37 src/common/lib/libutil/snprintb.c:1.38
--- src/common/lib/libutil/snprintb.c:1.37	Tue Feb 20 20:31:56 2024
+++ src/common/lib/libutil/snprintb.c	Thu Feb 22 18:26:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: snprintb.c,v 1.37 2024/02/20 20:31:56 rillig Exp $	*/
+/*	$NetBSD: snprintb.c,v 1.38 2024/02/22 18:26:15 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #  include 
 #  if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: snprintb.c,v 1.37 2024/02/20 20:31:56 rillig Exp $");
+__RCSID("$NetBSD: snprintb.c,v 1.38 2024/02/22 18:26:15 rillig Exp $");
 #  endif
 
 #  include 
@@ -51,7 +51,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.37 2024
 #  include 
 # else /* ! _KERNEL */
 #  include 
-__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.37 2024/02/20 20:31:56 rillig Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.38 2024/02/22 18:26:15 rillig Exp $");
 #  include 
 #  include 
 #  include 
@@ -67,7 +67,6 @@ typedef struct {
 	size_t const line_max;
 
 	const char *const num_fmt;
-	unsigned const val_len;
 	unsigned total_len;
 	unsigned line_pos;
 	unsigned comma_pos;
@@ -161,12 +160,15 @@ new_style(state *s)
 	const char *prev_bitfmt = s->bitfmt;
 	while (*s->bitfmt != '\0') {
 		const char *cur_bitfmt = s->bitfmt;
-		uint8_t kind = *s->bitfmt++;
-		uint8_t bit = *s->bitfmt++;
+		uint8_t kind = cur_bitfmt[0];
 		switch (kind) {
 		case 'b':
 			prev_bitfmt = cur_bitfmt;
-			if (((s->val >> bit) & 1) == 0)
+			uint8_t b_bit = cur_bitfmt[1];
+			if (b_bit >= 64)
+return -1;
+			s->bitfmt += 2;
+			if (((s->val >> b_bit) & 1) == 0)
 goto skip_description;
 			put_sep(s);
 			while (*s->bitfmt++ != '\0')
@@ -177,8 +179,16 @@ new_style(state *s)
 		case 'F':
 			prev_bitfmt = cur_bitfmt;
 			matched = 0;
-			field = (s->val >> bit) &
-			(((uint64_t)1 << (uint8_t)*s->bitfmt++) - 1);
+			uint8_t f_lsb = cur_bitfmt[1];
+			if (f_lsb >= 64)
+return -1;
+			uint8_t f_width = cur_bitfmt[2];
+			if (f_width > 64)
+return -1;
+			field = s->val >> f_lsb;
+			if (f_width < 64)
+field &= ((uint64_t) 1 << f_width) - 1;
+			s->bitfmt += 3;
 			put_sep(s);
 			if (kind == 'F')
 goto skip_description;
@@ -190,8 +200,9 @@ new_style(state *s)
 			break;
 		case '=':
 		case ':':
-			/* Here "bit" is actually a value instead. */
-			if (field != bit)
+			s->bitfmt += 2;
+			uint8_t cmp = cur_bitfmt[1];
+			if (field != cmp)
 goto skip_description;
 			matched = 1;
 			if (kind == '=')
@@ -201,7 +212,7 @@ new_style(state *s)
 			wrap_if_necessary(s, prev_bitfmt);
 			break;
 		case '*':
-			s->bitfmt--;
+			s->bitfmt++;
 			if (matched)
 goto skip_description;
 			matched = 1;
@@ -210,6 +221,7 @@ new_style(state *s)
 			wrap_if_necessary(s, prev_bitfmt);
 			/*FALLTHROUGH*/
 		default:
+			s->bitfmt += 2;
 		skip_description:
 			while (*s->bitfmt++ != '\0')
 continue;
@@ -263,9 +275,7 @@ snprintb_m(char *buf, size_t bufsize, co
 		.line_max = line_max,
 
 		.num_fmt = num_fmt,
-		.val_len = val_len,
 		.total_len = val_len,
-
 		.sep = '<',
 	};
 

Index: src/lib/libutil/snprintb.3
diff -u src/lib/libutil/snprintb.3:1.33 src/lib/libutil/snprintb.3:1.34
--- src/lib/libutil/snprintb.3:1.33	Tue Feb 20 20:38:54 2024
+++ src/lib/libutil/snprintb.3	Thu Feb 22 18:26:16 2024
@@ -1,6 +1,6 @@
-.\" $NetBSD: snprintb.3,v 1.33 2024/02/20 20:38:54 rillig Exp $
+.\" $NetBSD: snprintb.3,v 1.34 2024/02/22 18:26:16 rillig Exp $
 .\"
-.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
+.\" Copyright (c) 1998, 2024 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 20, 2024
+.Dd February 22, 2024
 .Dt SNPRINTB 3
 .Os
 .Sh NAME
@@ -395,6 +395,9 @@

CVS commit: src

2024-02-22 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Feb 22 18:26:16 UTC 2024

Modified Files:
src/common/lib/libutil: snprintb.c
src/lib/libutil: snprintb.3
src/tests/lib/libutil: t_snprintb.c

Log Message:
snprintb: error out on out-of-bounds bit shifts

Previously, these invoked undefined behavior, now they lead to an early
return. An example of out-of-bounds bit number is in SCZ_PCICTRL_BITS.
Bit fields that extend beyond the msb are still allowed.

Allow 'f' and 'F' to have fields that are 64 bits wide. This only makes
sense when the field starts at bit 0.

Remove the unused 'val_len', it was only needed before snprintb.c 1.20.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/common/lib/libutil/snprintb.c
cvs rdiff -u -r1.33 -r1.34 src/lib/libutil/snprintb.3
cvs rdiff -u -r1.25 -r1.26 src/tests/lib/libutil/t_snprintb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/tools/gcc

2024-02-22 Thread Ryo ONODERA
Hi,

"matthew green"  writes:

> Module Name:  src
> Committed By: mrg
> Date: Thu Feb 22 02:47:27 UTC 2024
>
> Modified Files:
>   src/tools/gcc: Makefile
>
> Log Message:
> enable isl support for GCC 12.

I have HAVE_GCC=12 in my /etc/mk.conf.

I have gotten the following error.
Maybe something for isl library is missing in the src tree.

Could you take a look at my problem?
Thank you.


checking for objdir... .libs [463/94127]
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... yes
checking for the correct version of the gmp/mpfr/mpc libraries... yes
checking for isl 0.15 or later... no
required isl version is 0.15 or later
configure: error: Unable to find a usable isl.  See config.log for details.

*** Failed target: .configure_done
*** Failed commands:
@mkdir build 2>/dev/null || true
@(cd build && ${CONFIGURE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure ${CON
FIGURE_ARGS})
=> @(cd build && gcc_cv_libc_provides_ssp=yes  gcc_cv_as_sparc_gotdata_o
p=no AR=ar  AWK=/usr/world/10.99/amd64/tools/bin/nbawk  CC=cc  CFLAGS=-O  CONFIG
_SHELL=/bin/sh  CPPFLAGS=  CXX=c++  CXXFLAGS=-O  INSTALL=/usr/world/10.99/amd64/
tools/bin/x86_64--netbsd-install\ -c\ -p\ -r  LDFLAGS=  LEX=/usr/world/10.99/amd
64/tools/bin/nblex  FLEX=/usr/world/10.99/amd64/tools/bin/nblex  M4=/usr/world/1
0.99/amd64/tools/bin/nbm4  MAKE=/usr/world/10.99/amd64/tools/bin/nbgmake  PATH="
/usr/world/10.99/amd64/tools/bin:$PATH"  RANLIB=ranlib  YACC=/usr/world/10.99/am
d64/tools/bin/nbyacc /bin/sh /usr/src/tools/gcc/../../external/gpl3/gcc/dist/con
figure --target=x86_64--netbsd  --enable-long-long  --enable-threads  --with-bug
url=http://www.NetBSD.org/support/send-pr.html  --with-pkgversion="NetBSD nb1 20
230729"  --with-system-zlib  --enable-__cxa_atexit  --enable-libstdcxx-time=rt
--enable-libstdcxx-threads  --with-diagnostics-color=auto-if-env --with-tune=noc
ona --with-default-libstdcxx-abi=new --with-sysroot=/usr/world/10.99/amd64/dest
 --with-mpc=/usr/world/10.99/amd64/tools  --with-mpfr=/usr/world/10.99/amd64/too
ls  --with-gmp=/usr/world/10.99/amd64/tools  --with-isl=/usr/world/10.99/amd64/t
ools  --disable-nls  --enable-multilib--program-transform-name="s,^,x86_64--
netbsd-,"  --enable-languages="c c++ objc" --prefix=/usr/world/10.99/amd64/tools
)
@echo ${BUILD_PLATFORM} > $@
=> @echo NetBSD-10.99.10-amd64 > .configure_done
*** [.configure_done] Error code 1

nbmake[4]: stopped in /usr/src/tools/gcc
nbmake[4]: 1 error

nbmake[4]: stopped in /usr/src/tools/gcc


>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.110 -r1.111 src/tools/gcc/Makefile
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
>
> Modified files:
>
> Index: src/tools/gcc/Makefile
> diff -u src/tools/gcc/Makefile:1.110 src/tools/gcc/Makefile:1.111
> --- src/tools/gcc/Makefile:1.110  Thu Feb 22 02:40:21 2024
> +++ src/tools/gcc/MakefileThu Feb 22 02:47:26 2024
> @@ -1,4 +1,4 @@
> -#$NetBSD: Makefile,v 1.110 2024/02/22 02:40:21 mrg Exp $
> +#$NetBSD: Makefile,v 1.111 2024/02/22 02:47:26 mrg Exp $
>  
>  .include 
>  
> @@ -35,7 +35,6 @@ COMMON_CONFIGURE_ARGS=  --target=${MACHIN
>   
> --with-bugurl=http://www.NetBSD.org/support/send-pr.html \
>   --with-pkgversion="NetBSD ${NETBSD_GCC_VERSION}" \
>   --with-system-zlib \
> - --without-isl \
>   --enable-__cxa_atexit \
>   --enable-libstdcxx-time=rt \
>   --enable-libstdcxx-threads \
> @@ -58,12 +57,21 @@ COMMON_CONFIGURE_ARGS+=   --enable-fix-cor
>  COMMON_CONFIGURE_ARGS+=  --with-default-libstdcxx-abi=new
>  .endif
>  
> +# We nabled isl support for GCC 12.  Move into normal segment when
> +# removing GCC 10.
> +.if ${HAVE_GCC} < 12
> +ISL_CONFIGURE_ARGS+= --without-isl
> +.else
> +ISL_CONFIGURE_ARGS+= --with-isl=${TOOLDIR}
> +.endif
> +
>  CONFIGURE_ARGS=  ${COMMON_CONFIGURE_ARGS}
>  CONFIGURE_ARGS+= \
>   --with-sysroot=${DESTDIR} \
>   --with-mpc=${TOOLDIR} \
>   --with-mpfr=${TOOLDIR} \
>   --with-gmp=${TOOLDIR} \
> + ${ISL_CONFIGURE_ARGS} \
>   --disable-nls \
>   ${MULTILIB_ARGS} \
>   ${SOFTFLOAT_ARGS} \
>

-- 
Ryo ONODERA // r...@tetera.org
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


CVS commit: src/sbin/newfs_ext2fs

2024-02-22 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Feb 22 14:11:52 UTC 2024

Modified Files:
src/sbin/newfs_ext2fs: mke2fs.c

Log Message:
Pull a change of newfs/mkfs.c rev 1.136:

> if the window size works but is 0, assume it didn't work and use 80.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sbin/newfs_ext2fs/mke2fs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin/newfs_ext2fs

2024-02-22 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Feb 22 14:11:52 UTC 2024

Modified Files:
src/sbin/newfs_ext2fs: mke2fs.c

Log Message:
Pull a change of newfs/mkfs.c rev 1.136:

> if the window size works but is 0, assume it didn't work and use 80.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sbin/newfs_ext2fs/mke2fs.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/newfs_ext2fs/mke2fs.c
diff -u src/sbin/newfs_ext2fs/mke2fs.c:1.26 src/sbin/newfs_ext2fs/mke2fs.c:1.27
--- src/sbin/newfs_ext2fs/mke2fs.c:1.26	Wed May 17 09:54:59 2023
+++ src/sbin/newfs_ext2fs/mke2fs.c	Thu Feb 22 14:11:52 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mke2fs.c,v 1.26 2023/05/17 09:54:59 tsutsui Exp $	*/
+/*	$NetBSD: mke2fs.c,v 1.27 2024/02/22 14:11:52 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2007 Izumi Tsutsui.  All rights reserved.
@@ -100,7 +100,7 @@
 #if 0
 static char sccsid[] = "@(#)mkfs.c	8.11 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: mke2fs.c,v 1.26 2023/05/17 09:54:59 tsutsui Exp $");
+__RCSID("$NetBSD: mke2fs.c,v 1.27 2024/02/22 14:11:52 tsutsui Exp $");
 #endif
 #endif /* not lint */
 
@@ -594,7 +594,8 @@ mke2fs(const char *fsys, int fi, int fo)
 	fld_width = verbosity < 4 ? 1 : snprintf(NULL, 0, "%" PRIu64,
 	(uint64_t)cgbase(&sblock, ncg - 1));
 	/* Get terminal width */
-	if (ioctl(fileno(stdout), TIOCGWINSZ, &winsize) == 0)
+	if (ioctl(fileno(stdout), TIOCGWINSZ, &winsize) == 0 &&
+	winsize.ws_col != 0)
 		max_cols = winsize.ws_col;
 	else
 		max_cols = 80;



CVS commit: src/external/mpl/bind/dist/lib/isc/include/isc

2024-02-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 22 12:43:10 UTC 2024

Modified Files:
src/external/mpl/bind/dist/lib/isc/include/isc: types.h

Log Message:
Use 32 bit counters on non _LP64 machines because they don't have 64 bit
atomics.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/external/mpl/bind/dist/lib/isc/include/isc/types.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mpl/bind/dist/lib/isc/include/isc/types.h
diff -u src/external/mpl/bind/dist/lib/isc/include/isc/types.h:1.11 src/external/mpl/bind/dist/lib/isc/include/isc/types.h:1.12
--- src/external/mpl/bind/dist/lib/isc/include/isc/types.h:1.11	Wed Feb 21 17:52:31 2024
+++ src/external/mpl/bind/dist/lib/isc/include/isc/types.h	Thu Feb 22 07:43:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.11 2024/02/21 22:52:31 christos Exp $	*/
+/*	$NetBSD: types.h,v 1.12 2024/02/22 12:43:10 christos Exp $	*/
 
 /*
  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
@@ -78,8 +78,13 @@ typedef struct isc_sockaddr	 isc_sockadd
 typedef ISC_LIST(isc_sockaddr_t) isc_sockaddrlist_t;  /*%< Socket Address List
 		   * */
 typedef struct isc_statsisc_stats_t;	  /*%< Statistics */
+#ifdef _LP64
 typedef int_fast64_t	isc_statscounter_t;
 typedef atomic_int_fast64_t isc_atomic_statscounter_t;
+#else
+typedef int_fast32_t	isc_statscounter_t;
+typedef atomic_int_fast32_t isc_atomic_statscounter_t;
+#endif
 typedef struct isc_symtab   isc_symtab_t;	/*%< Symbol Table */
 typedef struct isc_task	isc_task_t;		/*%< Task */
 typedef ISC_LIST(isc_task_t) isc_tasklist_t;	/*%< Task List */



CVS commit: src/external/mpl/bind/dist/lib/isc/include/isc

2024-02-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 22 12:43:10 UTC 2024

Modified Files:
src/external/mpl/bind/dist/lib/isc/include/isc: types.h

Log Message:
Use 32 bit counters on non _LP64 machines because they don't have 64 bit
atomics.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/external/mpl/bind/dist/lib/isc/include/isc/types.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.