CVS commit: src/usr.bin/xlint/lint1

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Sep 13 05:25:27 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: replace comment in new_style_function with equivalent code

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.238 -r1.239 src/usr.bin/xlint/lint1/decl.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.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.238 src/usr.bin/xlint/lint1/decl.c:1.239
--- src/usr.bin/xlint/lint1/decl.c:1.238	Mon Sep 13 05:21:30 2021
+++ src/usr.bin/xlint/lint1/decl.c	Mon Sep 13 05:25:27 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.238 2021/09/13 05:21:30 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.239 2021/09/13 05:25:27 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.238 2021/09/13 05:21:30 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.239 2021/09/13 05:25:27 rillig Exp $");
 #endif
 
 #include 
@@ -1453,8 +1453,9 @@ new_style_function(sym_t *decl, sym_t *a
 		}
 	}
 
-	/* return NULL if first param is VOID */
-	return args != NULL && args->s_type->t_tspec != VOID ? args : NULL;
+	if (args == NULL || args->s_type->t_tspec == VOID)
+		return NULL;
+	return args;
 }
 
 /*



CVS commit: src/usr.bin/xlint/lint1

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Sep 13 05:25:27 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: replace comment in new_style_function with equivalent code

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.238 -r1.239 src/usr.bin/xlint/lint1/decl.c

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



CVS commit: src/usr.bin/xlint/lint1

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Sep 13 05:21:30 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: eliminate local variable in new_style_function

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.237 -r1.238 src/usr.bin/xlint/lint1/decl.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.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.237 src/usr.bin/xlint/lint1/decl.c:1.238
--- src/usr.bin/xlint/lint1/decl.c:1.237	Sun Sep 12 17:30:53 2021
+++ src/usr.bin/xlint/lint1/decl.c	Mon Sep 13 05:21:30 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.237 2021/09/12 17:30:53 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.238 2021/09/13 05:21:30 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.237 2021/09/12 17:30:53 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.238 2021/09/13 05:21:30 rillig Exp $");
 #endif
 
 #include 
@@ -1431,7 +1431,6 @@ new_style_function(sym_t *decl, sym_t *a
 {
 	sym_t	*arg, *sym;
 	scl_t	sc;
-	int	n;
 
 	/*
 	 * Declarations of structs/unions/enums in param lists are legal,
@@ -1445,16 +1444,13 @@ new_style_function(sym_t *decl, sym_t *a
 		}
 	}
 
-	n = 1;
 	for (arg = args; arg != NULL; arg = arg->s_next) {
-		if (arg->s_type->t_tspec == VOID) {
-			if (n > 1 || arg->s_next != NULL) {
-/* void must be sole parameter */
-error(60);
-arg->s_type = gettyp(INT);
-			}
+		if (arg->s_type->t_tspec == VOID &&
+		!(arg == args && arg->s_next == NULL)) {
+			/* void must be sole parameter */
+			error(60);
+			arg->s_type = gettyp(INT);
 		}
-		n++;
 	}
 
 	/* return NULL if first param is VOID */



CVS commit: src/usr.bin/xlint/lint1

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Sep 13 05:21:30 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: eliminate local variable in new_style_function

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.237 -r1.238 src/usr.bin/xlint/lint1/decl.c

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



CVS commit: src/external/bsd/openldap/lib/libldap

2021-09-12 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Sep 13 01:12:36 UTC 2021

Modified Files:
src/external/bsd/openldap/lib/libldap: Makefile.libldap

Log Message:
Fix broken build with MKKERBEROS=no


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/bsd/openldap/lib/libldap/Makefile.libldap

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

Modified files:

Index: src/external/bsd/openldap/lib/libldap/Makefile.libldap
diff -u src/external/bsd/openldap/lib/libldap/Makefile.libldap:1.12 src/external/bsd/openldap/lib/libldap/Makefile.libldap:1.13
--- src/external/bsd/openldap/lib/libldap/Makefile.libldap:1.12	Sun Aug 15 10:33:58 2021
+++ src/external/bsd/openldap/lib/libldap/Makefile.libldap	Mon Sep 13 01:12:36 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.libldap,v 1.12 2021/08/15 10:33:58 christos Exp $
+#	$NetBSD: Makefile.libldap,v 1.13 2021/09/13 01:12:36 dholland Exp $
 
 .include "../../openldap.mk"
 
@@ -20,7 +20,7 @@ SRCS+=		bind.c open.c result.c error.c c
 
 SRCS+=		tls2.c tls_o.c tls_g.c
 
-CPPFLAGS+=	-DLDAP_LIBRARY -DHAVE_GSSAPI
+CPPFLAGS+=	-DLDAP_LIBRARY
 
 LIBDPLIBS+=	lber	${.CURDIR}/../liblber
 



CVS commit: src/external/bsd/openldap/lib/libldap

2021-09-12 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Sep 13 01:12:36 UTC 2021

Modified Files:
src/external/bsd/openldap/lib/libldap: Makefile.libldap

Log Message:
Fix broken build with MKKERBEROS=no


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/bsd/openldap/lib/libldap/Makefile.libldap

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



CVS commit: [thorpej-i2c-spi-conf2] src/sys

2021-09-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 12 23:13:02 UTC 2021

Modified Files:
src/sys/arch/sparc64/dev [thorpej-i2c-spi-conf2]: pcfiic_ebus.c
src/sys/dev/ic [thorpej-i2c-spi-conf2]: pcf8584.c

Log Message:
- Improve some comments.
- Update pcfiic_i2c_exec() for the channel split (might fix an issue
  spotted by tnn@ in testing).


To generate a diff of this commit:
cvs rdiff -u -r1.7.16.1 -r1.7.16.2 src/sys/arch/sparc64/dev/pcfiic_ebus.c
cvs rdiff -u -r1.19.2.1 -r1.19.2.2 src/sys/dev/ic/pcf8584.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/sparc64/dev/pcfiic_ebus.c
diff -u src/sys/arch/sparc64/dev/pcfiic_ebus.c:1.7.16.1 src/sys/arch/sparc64/dev/pcfiic_ebus.c:1.7.16.2
--- src/sys/arch/sparc64/dev/pcfiic_ebus.c:1.7.16.1	Mon Aug  9 00:30:08 2021
+++ src/sys/arch/sparc64/dev/pcfiic_ebus.c	Sun Sep 12 23:13:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcfiic_ebus.c,v 1.7.16.1 2021/08/09 00:30:08 thorpej Exp $	*/
+/*	$NetBSD: pcfiic_ebus.c,v 1.7.16.2 2021/09/12 23:13:02 thorpej Exp $	*/
 /*	$OpenBSD: pcfiic_ebus.c,v 1.13 2008/06/08 03:07:40 deraadt Exp $ */
 
 /*
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcfiic_ebus.c,v 1.7.16.1 2021/08/09 00:30:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcfiic_ebus.c,v 1.7.16.2 2021/09/12 23:13:02 thorpej Exp $");
 
 /*
  * Device specific driver for the EBus i2c devices found on some sun4u
@@ -167,7 +167,13 @@ bbc_initialize_channels(struct pcfiic_eb
 
 	nchannels = popcount(busmap);
 	if (nchannels == 0) {
-		/* No child devices. */
+		/*
+		 * No child devices in the device tree.  This is fine;
+		 * the generic code will just assume a single channel
+		 * and attach a bus instance, but our MUX will still
+		 * get programmed correctly because we've initialized
+		 * the acquire/release bus funcitons.
+		 */
 		return;
 	}
 

Index: src/sys/dev/ic/pcf8584.c
diff -u src/sys/dev/ic/pcf8584.c:1.19.2.1 src/sys/dev/ic/pcf8584.c:1.19.2.2
--- src/sys/dev/ic/pcf8584.c:1.19.2.1	Mon Aug  9 01:29:52 2021
+++ src/sys/dev/ic/pcf8584.c	Sun Sep 12 23:13:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcf8584.c,v 1.19.2.1 2021/08/09 01:29:52 thorpej Exp $	*/
+/*	$NetBSD: pcf8584.c,v 1.19.2.2 2021/09/12 23:13:02 thorpej Exp $	*/
 /*	$OpenBSD: pcf8584.c,v 1.9 2007/10/20 18:46:21 kettenis Exp $ */
 
 /*
@@ -120,9 +120,17 @@ pcfiic_attach(struct pcfiic_softc *sc, i
 
 	printf("\n");
 
+	/*
+	 * Sun has a clone of this chip that also has an
+	 * associated MUX, which means we treat this as
+	 * a multi-channel controller.  If the front-end
+	 * did not already allocate channels for us, then
+	 * assume we're just a simple single-channel device.
+	 */
+
 	if (sc->sc_channels == NULL) {
 		KASSERT(sc->sc_nchannels == 0);
-		ch = kmem_alloc(sizeof(*sc->sc_channels), KM_SLEEP);
+		ch = kmem_alloc(sizeof(*ch), KM_SLEEP);
 		ch->ch_channel = 0;
 		ch->ch_devhandle = device_handle(sc->sc_dev);
 
@@ -139,6 +147,7 @@ pcfiic_attach(struct pcfiic_softc *sc, i
 		ch->ch_sc = sc;
 		iic_tag_init(>ch_i2c);
 		ch->ch_i2c.ic_cookie = ch;
+		ch->ch_i2c.ic_channel = ch->ch_channel;
 		ch->ch_i2c.ic_exec = pcfiic_i2c_exec;
 		ch->ch_i2c.ic_acquire_bus = sc->sc_acquire_bus;
 		ch->ch_i2c.ic_release_bus = sc->sc_release_bus;
@@ -165,7 +174,8 @@ int
 pcfiic_i2c_exec(void *arg, i2c_op_t op, i2c_addr_t addr,
 const void *cmdbuf, size_t cmdlen, void *buf, size_t len, int flags)
 {
-	struct pcfiic_softc	*sc = arg;
+	struct pcfiic_channel	*ch = arg;
+	struct pcfiic_softc	*sc = ch->ch_sc;
 	int			ret = 0;
 
 #if 0



CVS commit: [thorpej-i2c-spi-conf2] src/sys

2021-09-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 12 23:13:02 UTC 2021

Modified Files:
src/sys/arch/sparc64/dev [thorpej-i2c-spi-conf2]: pcfiic_ebus.c
src/sys/dev/ic [thorpej-i2c-spi-conf2]: pcf8584.c

Log Message:
- Improve some comments.
- Update pcfiic_i2c_exec() for the channel split (might fix an issue
  spotted by tnn@ in testing).


To generate a diff of this commit:
cvs rdiff -u -r1.7.16.1 -r1.7.16.2 src/sys/arch/sparc64/dev/pcfiic_ebus.c
cvs rdiff -u -r1.19.2.1 -r1.19.2.2 src/sys/dev/ic/pcf8584.c

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



CVS commit: [thorpej-i2c-spi-conf2] src/sys/dev/i2c

2021-09-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 12 22:02:19 UTC 2021

Modified Files:
src/sys/dev/i2c [thorpej-i2c-spi-conf2]: i2c.c

Log Message:
iic_devslot_remove(): remove an errant "return false;" (the result of
a paste-o).


To generate a diff of this commit:
cvs rdiff -u -r1.80.2.6 -r1.80.2.7 src/sys/dev/i2c/i2c.c

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



CVS commit: [thorpej-i2c-spi-conf2] src/sys/dev/i2c

2021-09-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 12 22:02:19 UTC 2021

Modified Files:
src/sys/dev/i2c [thorpej-i2c-spi-conf2]: i2c.c

Log Message:
iic_devslot_remove(): remove an errant "return false;" (the result of
a paste-o).


To generate a diff of this commit:
cvs rdiff -u -r1.80.2.6 -r1.80.2.7 src/sys/dev/i2c/i2c.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/dev/i2c/i2c.c
diff -u src/sys/dev/i2c/i2c.c:1.80.2.6 src/sys/dev/i2c/i2c.c:1.80.2.7
--- src/sys/dev/i2c/i2c.c:1.80.2.6	Sat Sep 11 01:03:18 2021
+++ src/sys/dev/i2c/i2c.c	Sun Sep 12 22:02:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2c.c,v 1.80.2.6 2021/09/11 01:03:18 thorpej Exp $	*/
+/*	$NetBSD: i2c.c,v 1.80.2.7 2021/09/12 22:02:19 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.80.2.6 2021/09/11 01:03:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.80.2.7 2021/09/12 22:02:19 thorpej Exp $");
 
 #include 
 #include 
@@ -274,7 +274,6 @@ iic_devslot_remove(struct iic_softc *sc,
 
 	if (link != NULL) {
 		kmem_free(link, sizeof(*link));
-		return false;
 	}
 	return rv;
 }



CVS commit: [thorpej-i2c-spi-conf2] src/sys/arch/sparc64/sparc64

2021-09-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 12 19:23:27 UTC 2021

Modified Files:
src/sys/arch/sparc64/sparc64 [thorpej-i2c-spi-conf2]: ofw_patch.c

Log Message:
- add_i2c_devices(): because we're matching on phandle path, we can be
  visited multiple times for the same phandle (once for the controller,
  once for the "iic" bus instances, which inherit's the controller's
  phandle).  Detect this and avoid allocating a redundant i2c_fixup_container.
- sparc64_device_tree_fixup(): this is called before machine_model[] is
  initialized, so don't make any permanent decisions until it has been.


To generate a diff of this commit:
cvs rdiff -u -r1.7.14.6 -r1.7.14.7 src/sys/arch/sparc64/sparc64/ofw_patch.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/sparc64/sparc64/ofw_patch.c
diff -u src/sys/arch/sparc64/sparc64/ofw_patch.c:1.7.14.6 src/sys/arch/sparc64/sparc64/ofw_patch.c:1.7.14.7
--- src/sys/arch/sparc64/sparc64/ofw_patch.c:1.7.14.6	Sun Sep 12 18:38:06 2021
+++ src/sys/arch/sparc64/sparc64/ofw_patch.c	Sun Sep 12 19:23:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_patch.c,v 1.7.14.6 2021/09/12 18:38:06 thorpej Exp $ */
+/*	$NetBSD: ofw_patch.c,v 1.7.14.7 2021/09/12 19:23:27 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2020, 2021 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.7.14.6 2021/09/12 18:38:06 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.7.14.7 2021/09/12 19:23:27 thorpej Exp $");
 
 #include 
 #include 
@@ -152,15 +152,26 @@ static void
 add_i2c_devices(device_t dev, const struct i2c_deventry *i2c_adds,
 unsigned int nadds)
 {
+	devhandle_t devhandle = device_handle(dev);
 	struct i2c_fixup_container *fixup;
 
+	/*
+	 * Because we're matching on the phandle's firmware path, it's
+	 * possible to be visited multiple times (once for the controller,
+	 * once for the "iic" bus instance, which inherits the controller's
+	 * phandle).  Detect this condition, and avoid doing allocating an
+	 * additional i2c_fixup_container (and thus leaking our previously-
+	 * allocated i2c_fixup_container).
+	 */
+	if (devhandle.impl->lookup_device_call == i2c_fixup_lookup_device_call)
+		return;
+
 	fixup = kmem_alloc(sizeof(*fixup), KM_SLEEP);
 
 	fixup->i2c_additions = i2c_adds;
 	fixup->i2c_nadditions = nadds;
 
 	/* Stash away the super-class handle. */
-	devhandle_t devhandle = device_handle(dev);
 	fixup->i2c_super_handle = devhandle;
 
 	/* Sub-class it so we can override "i2c-enumerate-devices". */
@@ -736,7 +747,13 @@ sparc64_device_tree_fixup(device_t dev, 
 
 	devhandle = device_handle(dev);
 
-	if (! system_fixup_entry_initialized) {
+	/*
+	 * We can be called before machine_mode[] is set up (it gets
+	 * initialized in mainbus_attach()).  This is not a problem;
+	 * we don't need it until after than anyway.  Just patiently
+	 * wait until it's there for us.
+	 */
+	if (! system_fixup_entry_initialized && machine_model[0] != '\0') {
 		cptab[0] = machine_model;
 		dce = device_compatible_lookup(cptab, 1, system_fixup_table);
 		if (dce != NULL) {



CVS commit: [thorpej-i2c-spi-conf2] src/sys/arch/sparc64/sparc64

2021-09-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 12 19:23:27 UTC 2021

Modified Files:
src/sys/arch/sparc64/sparc64 [thorpej-i2c-spi-conf2]: ofw_patch.c

Log Message:
- add_i2c_devices(): because we're matching on phandle path, we can be
  visited multiple times for the same phandle (once for the controller,
  once for the "iic" bus instances, which inherit's the controller's
  phandle).  Detect this and avoid allocating a redundant i2c_fixup_container.
- sparc64_device_tree_fixup(): this is called before machine_model[] is
  initialized, so don't make any permanent decisions until it has been.


To generate a diff of this commit:
cvs rdiff -u -r1.7.14.6 -r1.7.14.7 src/sys/arch/sparc64/sparc64/ofw_patch.c

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



CVS commit: [thorpej-i2c-spi-conf2] src/sys/arch/sparc64/sparc64

2021-09-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 12 18:38:07 UTC 2021

Modified Files:
src/sys/arch/sparc64/sparc64 [thorpej-i2c-spi-conf2]: ofw_patch.c

Log Message:
Fix dum-dum pointer mistake.


To generate a diff of this commit:
cvs rdiff -u -r1.7.14.5 -r1.7.14.6 src/sys/arch/sparc64/sparc64/ofw_patch.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/sparc64/sparc64/ofw_patch.c
diff -u src/sys/arch/sparc64/sparc64/ofw_patch.c:1.7.14.5 src/sys/arch/sparc64/sparc64/ofw_patch.c:1.7.14.6
--- src/sys/arch/sparc64/sparc64/ofw_patch.c:1.7.14.5	Sat Sep 11 17:22:36 2021
+++ src/sys/arch/sparc64/sparc64/ofw_patch.c	Sun Sep 12 18:38:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_patch.c,v 1.7.14.5 2021/09/11 17:22:36 thorpej Exp $ */
+/*	$NetBSD: ofw_patch.c,v 1.7.14.6 2021/09/12 18:38:06 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2020, 2021 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.7.14.5 2021/09/11 17:22:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.7.14.6 2021/09/12 18:38:06 thorpej Exp $");
 
 #include 
 #include 
@@ -732,12 +732,13 @@ sparc64_device_tree_fixup(device_t dev, 
 	const struct device_compatible_entry *dce;
 	void (*fn)(device_t, void *);
 	devhandle_t devhandle;
+	const char *cptab[1];
 
 	devhandle = device_handle(dev);
 
 	if (! system_fixup_entry_initialized) {
-		dce = device_compatible_lookup((const char **)_model, 1,
-		system_fixup_table);
+		cptab[0] = machine_model;
+		dce = device_compatible_lookup(cptab, 1, system_fixup_table);
 		if (dce != NULL) {
 			system_fixup_entry = dce->data;
 		}
@@ -762,8 +763,8 @@ sparc64_device_tree_fixup(device_t dev, 
 		MAX_PACKAGE_PATH);
 		package_path[MAX_PACKAGE_PATH - 1] = '\0'; /* sanity */
 		if (path_size > 0) {
-			const char *ccp = package_path;
-			dce = device_compatible_lookup(, 1,
+			cptab[0] = package_path;
+			dce = device_compatible_lookup(cptab, 1,
 			system_fixup_entry->dtnode_fixups);
 			if (dce != NULL && (fn = dce->data) != NULL) {
 (*fn)(dev, aux);



CVS commit: [thorpej-i2c-spi-conf2] src/sys/arch/sparc64/sparc64

2021-09-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 12 18:38:07 UTC 2021

Modified Files:
src/sys/arch/sparc64/sparc64 [thorpej-i2c-spi-conf2]: ofw_patch.c

Log Message:
Fix dum-dum pointer mistake.


To generate a diff of this commit:
cvs rdiff -u -r1.7.14.5 -r1.7.14.6 src/sys/arch/sparc64/sparc64/ofw_patch.c

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



CVS commit: src

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 17:30:53 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_347.c msg_347.exp
src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: track down wrong function type in abstract type


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_347.c \
src/tests/usr.bin/xlint/lint1/msg_347.exp
cvs rdiff -u -r1.236 -r1.237 src/usr.bin/xlint/lint1/decl.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/usr.bin/xlint/lint1/msg_347.c
diff -u src/tests/usr.bin/xlint/lint1/msg_347.c:1.1 src/tests/usr.bin/xlint/lint1/msg_347.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_347.c:1.1	Sun Sep 12 16:28:45 2021
+++ src/tests/usr.bin/xlint/lint1/msg_347.c	Sun Sep 12 17:30:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_347.c,v 1.1 2021/09/12 16:28:45 rillig Exp $	*/
+/*	$NetBSD: msg_347.c,v 1.2 2021/09/12 17:30:53 rillig Exp $	*/
 # 3 "msg_347.c"
 
 // Test for message: redeclaration of '%s' with type '%s', expected '%s' [347]
@@ -27,3 +27,17 @@
 void function_parameter(void *, double *(void *, int));
 /* expect+1: error: redeclaration of 'function_parameter' with type 'function(pointer to void, pointer to function(pointer to void, int) returning pointer to double) returning void', expected 'function(pointer to void, int) returning void' [347] */
 void function_parameter(void *fs, double *func(void *, int));
+
+
+/* expect+1: warning: struct last_arg never defined [233] */
+struct last_arg;
+/*
+ * FIXME: The following error is completely wrong.
+ * There is no argument that has 'struct last_arg', there are only pointers
+ * to it.
+ */
+/* expect+2: error: '' has incomplete type 'incomplete struct last_arg' [31] */
+/* expect+1: previous declaration of last_arg_struct [260] */
+void last_arg_struct(double, double *(struct last_arg *));
+/* expect+1: error: redeclaration of 'last_arg_struct' with type 'function(double, pointer to function(pointer to incomplete struct last_arg) returning pointer to double) returning void', expected 'function(double, incomplete struct last_arg) returning void' [347] */
+void last_arg_struct(double d, double *fn(struct last_arg *));
Index: src/tests/usr.bin/xlint/lint1/msg_347.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_347.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_347.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_347.exp:1.1	Sun Sep 12 16:28:45 2021
+++ src/tests/usr.bin/xlint/lint1/msg_347.exp	Sun Sep 12 17:30:53 2021
@@ -1,2 +1,6 @@
 msg_347.c(29): error: redeclaration of 'function_parameter' with type 'function(pointer to void, pointer to function(pointer to void, int) returning pointer to double) returning void', expected 'function(pointer to void, int) returning void' [347]
 msg_347.c(27): previous declaration of function_parameter [260]
+msg_347.c(41): error: '' has incomplete type 'incomplete struct last_arg' [31]
+msg_347.c(43): error: redeclaration of 'last_arg_struct' with type 'function(double, pointer to function(pointer to incomplete struct last_arg) returning pointer to double) returning void', expected 'function(double, incomplete struct last_arg) returning void' [347]
+msg_347.c(41): previous declaration of last_arg_struct [260]
+msg_347.c(33): warning: struct last_arg never defined [233]

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.236 src/usr.bin/xlint/lint1/decl.c:1.237
--- src/usr.bin/xlint/lint1/decl.c:1.236	Sun Sep 12 16:28:45 2021
+++ src/usr.bin/xlint/lint1/decl.c	Sun Sep 12 17:30:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.236 2021/09/12 16:28:45 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.237 2021/09/12 17:30:53 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.236 2021/09/12 16:28:45 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.237 2021/09/12 17:30:53 rillig Exp $");
 #endif
 
 #include 
@@ -1398,11 +1398,19 @@ add_function(sym_t *decl, sym_t *args)
 		dcs->d_next->d_func_args = args;
 	}
 
+	/*
+	 * XXX: What is this code doing on a semantic level, and why?
+	 * Returning decl leads to the wrong function types in msg_347.
+	 */
 	tpp = >s_type;
 	while (*tpp != NULL && *tpp != dcs->d_next->d_type)
+		/*
+		 * XXX: accessing INT->t_subt feels strange, even though it
+		 * may even be guaranteed to be NULL.
+		 */
 		tpp = &(*tpp)->t_subt;
 	if (*tpp == NULL)
-	return decl;
+	return decl;	/* see msg_347 */
 
 	*tpp = tp = getblk(sizeof(*tp));
 	tp->t_tspec = FUNC;



CVS commit: src

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 17:30:53 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_347.c msg_347.exp
src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: track down wrong function type in abstract type


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_347.c \
src/tests/usr.bin/xlint/lint1/msg_347.exp
cvs rdiff -u -r1.236 -r1.237 src/usr.bin/xlint/lint1/decl.c

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



CVS commit: src

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 16:28:45 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile msg_027.c msg_027.exp
src/usr.bin/xlint/lint1: decl.c err.c
Added Files:
src/tests/usr.bin/xlint/lint1: msg_347.c msg_347.exp

Log Message:
lint: add more details to error about redeclaration

Message 27 is triggered by several conditions.  The one triggered by
register_vget in sbin/fsck_lfs/vnode.c needs more details than the
others.


To generate a diff of this commit:
cvs rdiff -u -r1.1123 -r1.1124 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.110 -r1.111 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_027.c \
src/tests/usr.bin/xlint/lint1/msg_027.exp
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/msg_347.c \
src/tests/usr.bin/xlint/lint1/msg_347.exp
cvs rdiff -u -r1.235 -r1.236 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.144 -r1.145 src/usr.bin/xlint/lint1/err.c

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1123 src/distrib/sets/lists/tests/mi:1.1124
--- src/distrib/sets/lists/tests/mi:1.1123	Fri Sep 10 19:40:18 2021
+++ src/distrib/sets/lists/tests/mi	Sun Sep 12 16:28:44 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1123 2021/09/10 19:40:18 rillig Exp $
+# $NetBSD: mi,v 1.1124 2021/09/12 16:28:44 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -7028,6 +7028,8 @@
 ./usr/tests/usr.bin/xlint/lint1/msg_345.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_346.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_346.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_347.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_347.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/op_colon.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/op_colon.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.c			tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.110 src/tests/usr.bin/xlint/lint1/Makefile:1.111
--- src/tests/usr.bin/xlint/lint1/Makefile:1.110	Fri Sep 10 19:40:18 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Sun Sep 12 16:28:45 2021
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.110 2021/09/10 19:40:18 rillig Exp $
+# $NetBSD: Makefile,v 1.111 2021/09/12 16:28:45 rillig Exp $
 
 NOMAN=		# defined
-MAX_MESSAGE=	346		# see lint1/err.c
+MAX_MESSAGE=	347		# see lint1/err.c
 
 .include 
 

Index: src/tests/usr.bin/xlint/lint1/msg_027.c
diff -u src/tests/usr.bin/xlint/lint1/msg_027.c:1.4 src/tests/usr.bin/xlint/lint1/msg_027.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_027.c:1.4	Sun Sep 12 16:08:14 2021
+++ src/tests/usr.bin/xlint/lint1/msg_027.c	Sun Sep 12 16:28:45 2021
@@ -1,24 +1,9 @@
-/*	$NetBSD: msg_027.c,v 1.4 2021/09/12 16:08:14 rillig Exp $	*/
+/*	$NetBSD: msg_027.c,v 1.5 2021/09/12 16:28:45 rillig Exp $	*/
 # 3 "msg_027.c"
 
 // Test for message: redeclaration of %s [27]
 
 extern int identifier(void);
 
-extern double identifier(void);		/* expect: 27 */
-
-/*
- * As of 2021-09-12, lint complains about mismatched types.
- * GCC and Clang accept this.
- *
- * Above:
- * function(pointer to void, int) returning void
- *
- * Below: function(
- * pointer to void,
- * pointer to function(pointer to void, int) returning pointer to double
- * ) returning void
- */
-void function_parameter(void *, double *(void *, int));
-/* expect+1: error: redeclaration of function_parameter [27] */
-void function_parameter(void *fs, double *func(void *, int));
+/* expect+1: error: redeclaration of 'identifier' with type 'function(void) returning double', expected 'function(void) returning int' [347] */
+extern double identifier(void);
Index: src/tests/usr.bin/xlint/lint1/msg_027.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_027.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_027.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_027.exp:1.4	Sun Sep 12 16:08:14 2021
+++ src/tests/usr.bin/xlint/lint1/msg_027.exp	Sun Sep 12 16:28:45 2021
@@ -1,2 +1 @@
-msg_027.c(8): error: redeclaration of identifier [27]
-msg_027.c(24): error: redeclaration of function_parameter [27]
+msg_027.c(9): error: redeclaration of 'identifier' with type 'function(void) returning double', expected 'function(void) returning int' [347]

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.235 src/usr.bin/xlint/lint1/decl.c:1.236
--- src/usr.bin/xlint/lint1/decl.c:1.235	Sun Sep  5 16:15:05 2021
+++ src/usr.bin/xlint/lint1/decl.c	Sun Sep 12 16:28:45 2021
@@ -1,4 +1,4 

CVS commit: src

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 16:28:45 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile msg_027.c msg_027.exp
src/usr.bin/xlint/lint1: decl.c err.c
Added Files:
src/tests/usr.bin/xlint/lint1: msg_347.c msg_347.exp

Log Message:
lint: add more details to error about redeclaration

Message 27 is triggered by several conditions.  The one triggered by
register_vget in sbin/fsck_lfs/vnode.c needs more details than the
others.


To generate a diff of this commit:
cvs rdiff -u -r1.1123 -r1.1124 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.110 -r1.111 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_027.c \
src/tests/usr.bin/xlint/lint1/msg_027.exp
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/msg_347.c \
src/tests/usr.bin/xlint/lint1/msg_347.exp
cvs rdiff -u -r1.235 -r1.236 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.144 -r1.145 src/usr.bin/xlint/lint1/err.c

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



CVS commit: src/tests/usr.bin/xlint/lint1

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 16:08:14 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_027.c msg_027.exp

Log Message:
tests/lint: demonstrate parse error for function-type parameters

Seen in sbin/fsck_lfs/vnode.c(104), where lint wrongly complains:

error: redeclaration of register_vget [27]


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_027.c \
src/tests/usr.bin/xlint/lint1/msg_027.exp

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



CVS commit: src/tests/usr.bin/xlint/lint1

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 16:08:14 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_027.c msg_027.exp

Log Message:
tests/lint: demonstrate parse error for function-type parameters

Seen in sbin/fsck_lfs/vnode.c(104), where lint wrongly complains:

error: redeclaration of register_vget [27]


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_027.c \
src/tests/usr.bin/xlint/lint1/msg_027.exp

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_027.c
diff -u src/tests/usr.bin/xlint/lint1/msg_027.c:1.3 src/tests/usr.bin/xlint/lint1/msg_027.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_027.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_027.c	Sun Sep 12 16:08:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_027.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_027.c,v 1.4 2021/09/12 16:08:14 rillig Exp $	*/
 # 3 "msg_027.c"
 
 // Test for message: redeclaration of %s [27]
@@ -6,3 +6,19 @@
 extern int identifier(void);
 
 extern double identifier(void);		/* expect: 27 */
+
+/*
+ * As of 2021-09-12, lint complains about mismatched types.
+ * GCC and Clang accept this.
+ *
+ * Above:
+ * function(pointer to void, int) returning void
+ *
+ * Below: function(
+ * pointer to void,
+ * pointer to function(pointer to void, int) returning pointer to double
+ * ) returning void
+ */
+void function_parameter(void *, double *(void *, int));
+/* expect+1: error: redeclaration of function_parameter [27] */
+void function_parameter(void *fs, double *func(void *, int));
Index: src/tests/usr.bin/xlint/lint1/msg_027.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_027.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_027.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_027.exp:1.3	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_027.exp	Sun Sep 12 16:08:14 2021
@@ -1 +1,2 @@
 msg_027.c(8): error: redeclaration of identifier [27]
+msg_027.c(24): error: redeclaration of function_parameter [27]



CVS commit: src/tests/usr.bin/xlint/lint2

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 16:07:16 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint2: msg_000.ln

Log Message:
tests/lint: make documentation for lint2/msg_000 less ambiguous


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint2/msg_000.ln

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



CVS commit: src/tests/usr.bin/xlint/lint2

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 16:07:16 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint2: msg_000.ln

Log Message:
tests/lint: make documentation for lint2/msg_000 less ambiguous


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint2/msg_000.ln

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

Modified files:

Index: src/tests/usr.bin/xlint/lint2/msg_000.ln
diff -u src/tests/usr.bin/xlint/lint2/msg_000.ln:1.2 src/tests/usr.bin/xlint/lint2/msg_000.ln:1.3
--- src/tests/usr.bin/xlint/lint2/msg_000.ln:1.2	Tue Aug 24 23:38:51 2021
+++ src/tests/usr.bin/xlint/lint2/msg_000.ln	Sun Sep 12 16:07:16 2021
@@ -1,4 +1,4 @@
-# $NetBSD: msg_000.ln,v 1.2 2021/08/24 23:38:51 rillig Exp $
+# $NetBSD: msg_000.ln,v 1.3 2021/09/12 16:07:16 rillig Exp $
 #
 # Test data for message 0 of lint2:
 #	%s used( %s ), but not defined
@@ -14,14 +14,14 @@ S msg_000.c
 # but not used, generated by this code:
 #	1:	# 2 "msg_000.c"
 #	2:	defined_not_used() {
-#	3:		used_not_defined(1, 0.0);
+#	3:		used_not_defined(12345, 0.0);
 #	4:	}
 #
 # The function call in line 3 generates this entry:
 #	'3'	logical line 3 in the main .c source
 #	'c'	function call
 #	'0.3'	file 0, logical line 3 in the currently included file
-#	'p1'	the first argument is a positive constant
+#	'p1'	argument 1 is a positive constant
 #	'i'	the return value of the function call is ignored
 #	'16...'	the name of the called function
 #	'f2'	it's a function with 2 arguments



CVS commit: src/sys/sys

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 15:22:05 UTC 2021

Modified Files:
src/sys/sys: bitops.h

Log Message:
sys/bitops.h: fix __BITMAP_ZERO for non-GCC compilers

Running 'make -C sbin/cgdconfig lint' failed with:

cgdconfig.c(1253): error: left operand of '->' must be pointer to struct
or union, not 'struct ' [104]


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/sys/bitops.h

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

Modified files:

Index: src/sys/sys/bitops.h
diff -u src/sys/sys/bitops.h:1.14 src/sys/sys/bitops.h:1.15
--- src/sys/sys/bitops.h:1.14	Thu Mar  8 20:32:32 2018
+++ src/sys/sys/bitops.h	Sun Sep 12 15:22:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bitops.h,v 1.14 2018/03/08 20:32:32 christos Exp $	*/
+/*	$NetBSD: bitops.h,v 1.15 2021/09/12 15:22:05 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2010 The NetBSD Foundation, Inc.
@@ -321,7 +321,7 @@ fast_remainder32(uint32_t _v, uint32_t _
 #else
 #define __BITMAP_ZERO(__v) do {		\
 	size_t __i;			\
-	for (__i = 0; __i < __arraycount(__v->_b); __i++)		\
+	for (__i = 0; __i < __arraycount((__v)->_b); __i++)		\
 		(__v)->_b[__i] = 0;	\
 	} while (/* CONSTCOND */ 0)
 #endif /* GCC 2.95 */



CVS commit: src/sys/sys

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 15:22:05 UTC 2021

Modified Files:
src/sys/sys: bitops.h

Log Message:
sys/bitops.h: fix __BITMAP_ZERO for non-GCC compilers

Running 'make -C sbin/cgdconfig lint' failed with:

cgdconfig.c(1253): error: left operand of '->' must be pointer to struct
or union, not 'struct ' [104]


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/sys/bitops.h

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



CVS commit: src/usr.bin/make

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 10:28:40 UTC 2021

Modified Files:
src/usr.bin/make: test-variants.sh

Log Message:
tests/make: allow to only test selected variants

Testing all variants takes several minutes, so make it possible to test
a single or a few test variants separately.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/test-variants.sh

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



CVS commit: src/usr.bin/make

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 10:28:40 UTC 2021

Modified Files:
src/usr.bin/make: test-variants.sh

Log Message:
tests/make: allow to only test selected variants

Testing all variants takes several minutes, so make it possible to test
a single or a few test variants separately.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/test-variants.sh

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

Modified files:

Index: src/usr.bin/make/test-variants.sh
diff -u src/usr.bin/make/test-variants.sh:1.11 src/usr.bin/make/test-variants.sh:1.12
--- src/usr.bin/make/test-variants.sh:1.11	Sun Sep 12 09:51:14 2021
+++ src/usr.bin/make/test-variants.sh	Sun Sep 12 10:28:40 2021
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: test-variants.sh,v 1.11 2021/09/12 09:51:14 rillig Exp $
+# $NetBSD: test-variants.sh,v 1.12 2021/09/12 10:28:40 rillig Exp $
 #
 # Build several variants of make and run the tests on them.
 #
@@ -10,6 +10,7 @@
 set -eu
 
 failed="no"
+filter="${1-}"
 
 fail() {
 	echo "failed"
@@ -17,6 +18,11 @@ fail() {
 }
 
 testcase() {
+	case "$*" in
+	*"$filter"*) ;;
+	*) return;;
+	esac
+
 	echo "===> Running $*"
 
 	env -i PATH="$PATH" USETOOLS="no" "$@" \
@@ -31,7 +37,7 @@ testcase() {
 }
 
 
-testcase # just the plain default options
+testcase DESCR="just the plain default options"
 
 # Try a different compiler, with slightly different warnings and error
 # messages.  One feature that is missing from GCC is a little stricter



CVS commit: src/usr.bin/make/unit-tests

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 10:26:49 UTC 2021

Modified Files:
src/usr.bin/make/unit-tests: job-output-null.exp job-output-null.mk

Log Message:
tests/make: make output of test job-output-null clearer

Having 5 times the word 'hello' in the output doesn't help at
understanding the test and how the output was produced.

Bash 5 sometimes makes this test fail by adding '2b' and '2c' to the
output.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/job-output-null.exp \
src/usr.bin/make/unit-tests/job-output-null.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/job-output-null.exp
diff -u src/usr.bin/make/unit-tests/job-output-null.exp:1.2 src/usr.bin/make/unit-tests/job-output-null.exp:1.3
--- src/usr.bin/make/unit-tests/job-output-null.exp:1.2	Sat Jul  3 22:39:40 2021
+++ src/usr.bin/make/unit-tests/job-output-null.exp	Sun Sep 12 10:26:49 2021
@@ -1,4 +1,4 @@
-hello
-hello
-hello without   newline, hello without   newline.
+1
+2a
+3a without   newline, 3b without   newline.
 exit status 0
Index: src/usr.bin/make/unit-tests/job-output-null.mk
diff -u src/usr.bin/make/unit-tests/job-output-null.mk:1.2 src/usr.bin/make/unit-tests/job-output-null.mk:1.3
--- src/usr.bin/make/unit-tests/job-output-null.mk:1.2	Sat Jul  3 22:39:40 2021
+++ src/usr.bin/make/unit-tests/job-output-null.mk	Sun Sep 12 10:26:49 2021
@@ -1,4 +1,4 @@
-# $NetBSD: job-output-null.mk,v 1.2 2021/07/03 22:39:40 rillig Exp $
+# $NetBSD: job-output-null.mk,v 1.3 2021/09/12 10:26:49 rillig Exp $
 #
 # Test how null bytes in the output of a command are handled.  Make processes
 # them using null-terminated strings, which may cut off some of the output.
@@ -26,14 +26,14 @@ all: .PHONY
 	# The null byte from the command output is kept as-is.
 	# See CollectOutput, which looks like it intended to replace these
 	# null bytes with simple spaces.
-	@printf 'hello\0world\n'
+	@printf '1\0trailing\n'
 
 	# Give the parent process a chance to see the above output, but not
 	# yet the output from the next printf command.
 	@sleep 1
 
 	# All null bytes from the command output are kept as-is.
-	@printf 'hello\0world\n''hello\0world\n''hello\0world\n'
+	@printf '2a\0trailing\n''2b\0trailing\n''2c\0trailing\n'
 
 	@sleep 1
 
@@ -42,4 +42,4 @@ all: .PHONY
 	#
 	# The three null bytes in a row test whether this output is
 	# compressed to a single space like in DebugFailedTarget.  It isn't.
-	@printf 'hello\0without\0\0\0newline, hello\0without\0\0\0newline.'
+	@printf '3a\0without\0\0\0newline, 3b\0without\0\0\0newline.'



CVS commit: src/usr.bin/make/unit-tests

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 10:26:49 UTC 2021

Modified Files:
src/usr.bin/make/unit-tests: job-output-null.exp job-output-null.mk

Log Message:
tests/make: make output of test job-output-null clearer

Having 5 times the word 'hello' in the output doesn't help at
understanding the test and how the output was produced.

Bash 5 sometimes makes this test fail by adding '2b' and '2c' to the
output.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/job-output-null.exp \
src/usr.bin/make/unit-tests/job-output-null.mk

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



CVS commit: src/usr.bin/xlint/lint1

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 10:06:03 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: emit1.c tree.c

Log Message:
lint: un-abbreviate rvused and rvdisc

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.380 -r1.381 src/usr.bin/xlint/lint1/tree.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.bin/xlint/lint1/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.58 src/usr.bin/xlint/lint1/emit1.c:1.59
--- src/usr.bin/xlint/lint1/emit1.c:1.58	Sat Sep  4 18:58:57 2021
+++ src/usr.bin/xlint/lint1/emit1.c	Sun Sep 12 10:06:03 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.58 2021/09/04 18:58:57 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.59 2021/09/12 10:06:03 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit1.c,v 1.58 2021/09/04 18:58:57 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.59 2021/09/12 10:06:03 rillig Exp $");
 #endif
 
 #include "lint1.h"
@@ -342,12 +342,12 @@ outfdef(const sym_t *fsym, const pos_t *
  * write out all information necessary for lint2 to check function
  * calls
  *
- * rvused is set if the return value is used (assigned to a variable)
- * rvdisc is set if the return value is not used and not ignored
- * (casted to void)
+ * retval_used is set if the return value is used (assigned to a variable)
+ * retval_discarded is set if the return value is neither used nor ignored
+ * (that is, cast to void)
  */
 void
-outcall(const tnode_t *tn, bool rvused, bool rvdisc)
+outcall(const tnode_t *tn, bool retval_used, bool retval_discarded)
 {
 	tnode_t	*args, *arg;
 	int	narg, n, i;
@@ -411,7 +411,7 @@ outcall(const tnode_t *tn, bool rvused, 
 
 	}
 	/* return value discarded/used/ignored */
-	outchar((char)(rvdisc ? 'd' : (rvused ? 'u' : 'i')));
+	outchar((char)(retval_discarded ? 'd' : (retval_used ? 'u' : 'i')));
 
 	/* name of the called function */
 	outname(tn->tn_left->tn_left->tn_sym->s_name);

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.380 src/usr.bin/xlint/lint1/tree.c:1.381
--- src/usr.bin/xlint/lint1/tree.c:1.380	Sun Sep  5 18:34:50 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sun Sep 12 10:06:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.380 2021/09/05 18:34:50 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.381 2021/09/12 10:06:03 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.380 2021/09/05 18:34:50 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.381 2021/09/12 10:06:03 rillig Exp $");
 #endif
 
 #include 
@@ -3977,19 +3977,19 @@ check_expr_assign(const tnode_t *ln, boo
 
 static void
 check_expr_call(const tnode_t *tn, const tnode_t *ln,
-		bool szof, bool vctx, bool tctx, bool rvdisc)
+		bool szof, bool vctx, bool tctx, bool retval_discarded)
 {
 	lint_assert(ln->tn_op == ADDR);
 	lint_assert(ln->tn_left->tn_op == NAME);
 	if (!szof &&
 	!is_compiler_builtin(ln->tn_left->tn_sym->s_name))
-		outcall(tn, vctx || tctx, rvdisc);
+		outcall(tn, vctx || tctx, retval_discarded);
 }
 
 static bool
 check_expr_op(const tnode_t *tn, op_t op, const tnode_t *ln,
-	  bool szof, bool fcall, bool vctx, bool tctx, bool rvdisc,
-	  bool eqwarn)
+	  bool szof, bool fcall, bool vctx, bool tctx,
+	  bool retval_discarded, bool eqwarn)
 {
 	switch (op) {
 	case ADDR:
@@ -4021,7 +4021,7 @@ check_expr_op(const tnode_t *tn, op_t op
 		check_expr_assign(ln, szof);
 		break;
 	case CALL:
-		check_expr_call(tn, ln, szof, vctx, tctx, rvdisc);
+		check_expr_call(tn, ln, szof, vctx, tctx, retval_discarded);
 		break;
 	case EQ:
 		if (hflag && eqwarn)
@@ -4078,7 +4078,7 @@ check_expr_op(const tnode_t *tn, op_t op
 /* ARGSUSED */
 void
 check_expr_misc(const tnode_t *tn, bool vctx, bool tctx,
-		bool eqwarn, bool fcall, bool rvdisc, bool szof)
+		bool eqwarn, bool fcall, bool retval_discarded, bool szof)
 {
 	tnode_t	*ln, *rn;
 	const mod_t *mp;
@@ -4092,7 +4092,7 @@ check_expr_misc(const tnode_t *tn, bool 
 	mp = [op = tn->tn_op];
 
 	if (!check_expr_op(tn, op, ln,
-	szof, fcall, vctx, tctx, rvdisc, eqwarn))
+	szof, fcall, vctx, tctx, retval_discarded, eqwarn))
 		return;
 
 	bool cvctx = mp->m_left_value_context;



CVS commit: src/usr.bin/xlint/lint1

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 10:06:03 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: emit1.c tree.c

Log Message:
lint: un-abbreviate rvused and rvdisc

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.380 -r1.381 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src/usr.bin/make

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 09:51:14 UTC 2021

Modified Files:
src/usr.bin/make: make.h test-variants.sh

Log Message:
make: error out if a pre-C99 platform defines bool in some cases

On NetBSD/amd64 9.99.88, when compiling make in C90 mode, make.h defined
its own boolean type as an alias for unsigned int.  Not plain int since
that would make the value of bit-fields -1 instead of 1.

This worked fine for all files except main.c, which includes
, which in turn includes  unconditionally, even
in C90 mode.  This meant that in main.c, sizeof(bool) was 1, while in
all other files it was 4.

This in turn led to a segmentation fault when ParseDependencySourceMain
tried to access opts.create.  Since parse.c assumed sizeof(bool) == 4,
it computed an offset outside of struct CmdOpts, which was defined in
main.c with sizeof(bool) == 1.

Rather than risking these segmentation faults, prevent building make on
platforms like these and suggest a proper workaround.


To generate a diff of this commit:
cvs rdiff -u -r1.264 -r1.265 src/usr.bin/make/make.h
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/test-variants.sh

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

Modified files:

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.264 src/usr.bin/make/make.h:1.265
--- src/usr.bin/make/make.h:1.264	Sat Jul 31 09:30:17 2021
+++ src/usr.bin/make/make.h	Sun Sep 12 09:51:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.264 2021/07/31 09:30:17 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.265 2021/09/12 09:51:14 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -142,18 +142,25 @@
 
 #if __STDC_VERSION__ >= 199901L || defined(lint) || defined(USE_C99_BOOLEAN)
 #include 
+#elif defined(__bool_true_false_are_defined)
+/*
+ * All files of make must be compiled with the same definition of bool.
+ * Since one of the files includes , that means the header is
+ * available on this platform.  Recompile everything with -DUSE_C99_BOOLEAN.
+ */
+#error " is included in pre-C99 mode"
+#elif defined(bool) || defined(true) || defined(false)
+/*
+ * In pre-C99 mode, make does not expect that bool is already defined.
+ * You need to ensure that all translation units use the same definition for
+ * bool.
+ */
+#error "bool/true/false is defined in pre-C99 mode"
 #else
-#ifndef bool
-typedef unsigned int Boolean;
-#define bool	Boolean
-#endif
-#ifndef true
+typedef unsigned char bool;
 #define true	1
-#endif
-#ifndef false
 #define false	0
 #endif
-#endif
 
 #include "lst.h"
 #include "enum.h"

Index: src/usr.bin/make/test-variants.sh
diff -u src/usr.bin/make/test-variants.sh:1.10 src/usr.bin/make/test-variants.sh:1.11
--- src/usr.bin/make/test-variants.sh:1.10	Sat Apr  3 11:08:40 2021
+++ src/usr.bin/make/test-variants.sh	Sun Sep 12 09:51:14 2021
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: test-variants.sh,v 1.10 2021/04/03 11:08:40 rillig Exp $
+# $NetBSD: test-variants.sh,v 1.11 2021/09/12 09:51:14 rillig Exp $
 #
 # Build several variants of make and run the tests on them.
 #
@@ -22,7 +22,7 @@ testcase() {
 	env -i PATH="$PATH" USETOOLS="no" "$@" \
 		sh -ce "make -s cleandir" \
 	&& env -i PATH="$PATH" USETOOLS="no" "$@" \
-		sh -ce "make -ks all" \
+		sh -ce "make -ks -j6 dependall" \
 	&& size *.o make \
 	&& env -i PATH="$PATH" USETOOLS="no" MALLOC_OPTIONS="JA" \
 		_MKMSG_TEST=":" "$@" \
@@ -120,10 +120,16 @@ testcase USER_CFLAGS="-O0 -ggdb"
 # Ensure that every inline function is declared as MAKE_ATTR_UNUSED.
 testcase USER_CPPFLAGS="-Dinline="
 
+# Is expected to fail with " is included in pre-C99 mode".
 testcase USER_CFLAGS="-std=c90" USER_CPPFLAGS="-Dinline="
 
+# This workaround is necessary on NetBSD 9.99 since main.c includes
+# , which includes  even in pre-C99 mode.
+testcase USER_CFLAGS="-std=c90" USER_CPPFLAGS="-Dinline= -DUSE_C99_BOOLEAN"
+
 #testcase USER_CFLAGS="-std=c90 -pedantic" USER_CPPFLAGS="-Dinline="
 
+# Is expected to fail with " is included in pre-C99 mode".
 testcase USER_CFLAGS="-ansi" USER_CPPFLAGS="-Dinline="
 
 # config.h does not allow overriding these features



CVS commit: src/usr.bin/make

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 09:51:14 UTC 2021

Modified Files:
src/usr.bin/make: make.h test-variants.sh

Log Message:
make: error out if a pre-C99 platform defines bool in some cases

On NetBSD/amd64 9.99.88, when compiling make in C90 mode, make.h defined
its own boolean type as an alias for unsigned int.  Not plain int since
that would make the value of bit-fields -1 instead of 1.

This worked fine for all files except main.c, which includes
, which in turn includes  unconditionally, even
in C90 mode.  This meant that in main.c, sizeof(bool) was 1, while in
all other files it was 4.

This in turn led to a segmentation fault when ParseDependencySourceMain
tried to access opts.create.  Since parse.c assumed sizeof(bool) == 4,
it computed an offset outside of struct CmdOpts, which was defined in
main.c with sizeof(bool) == 1.

Rather than risking these segmentation faults, prevent building make on
platforms like these and suggest a proper workaround.


To generate a diff of this commit:
cvs rdiff -u -r1.264 -r1.265 src/usr.bin/make/make.h
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/test-variants.sh

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



CVS commit: src/sys/uvm/pmap

2021-09-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 12 09:05:01 UTC 2021

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
comment whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/uvm/pmap/pmap_tlb.c

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



CVS commit: src/sys/uvm/pmap

2021-09-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 12 09:05:01 UTC 2021

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
comment whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/uvm/pmap/pmap_tlb.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/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.44 src/sys/uvm/pmap/pmap_tlb.c:1.45
--- src/sys/uvm/pmap/pmap_tlb.c:1.44	Tue May  4 09:05:34 2021
+++ src/sys/uvm/pmap/pmap_tlb.c	Sun Sep 12 09:05:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.44 2021/05/04 09:05:34 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.45 2021/09/12 09:05:01 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.44 2021/05/04 09:05:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.45 2021/09/12 09:05:01 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -73,7 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v
  * "current ASID" field, e.g. the ASID field of the COP 0 register EntryHi for
  * MIPS, or the ASID field of TTBR0 for AA64.  The bit number used in these
  * bitmaps comes from the CPU's cpu_index().  Even though these bitmaps contain
- * the bits for all CPUs, the bits that  correspond to the bits belonging to
+ * the bits for all CPUs, the bits that correspond to the bits belonging to
  * the CPUs sharing a TLB can only be manipulated while holding that TLB's
  * lock.  Atomic ops must be used to update them since multiple CPUs may be
  * changing different sets of bits at same time but these sets never overlap.



CVS commit: src/usr.bin/make

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 08:36:15 UTC 2021

Modified Files:
src/usr.bin/make: hash.c

Log Message:
make: fix build for DEBUG_HASH_LOOKUP


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/make/hash.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.bin/make/hash.c
diff -u src/usr.bin/make/hash.c:1.64 src/usr.bin/make/hash.c:1.65
--- src/usr.bin/make/hash.c:1.64	Sun Apr 11 12:46:54 2021
+++ src/usr.bin/make/hash.c	Sun Sep 12 08:36:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.c,v 1.64 2021/04/11 12:46:54 rillig Exp $	*/
+/*	$NetBSD: hash.c,v 1.65 2021/09/12 08:36:14 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -74,7 +74,7 @@
 #include "make.h"
 
 /*	"@(#)hash.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: hash.c,v 1.64 2021/04/11 12:46:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: hash.c,v 1.65 2021/09/12 08:36:14 rillig Exp $");
 
 /*
  * The ratio of # entries to # buckets at which we rebuild the table to
@@ -152,7 +152,7 @@ HashTable_FindEntryBySubstring(HashTable
 	unsigned int chainlen = 0;
 
 #ifdef DEBUG_HASH_LOOKUP
-	DEBUG4(HASH, "%s: %p h=%08x key=%.*s\n", __func__, t, h,
+	DEBUG5(HASH, "%s: %p h=%08x key=%.*s\n", __func__, t, h,
 	(int)Substring_Length(key), key.start);
 #endif
 



CVS commit: src/usr.bin/make

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 08:36:15 UTC 2021

Modified Files:
src/usr.bin/make: hash.c

Log Message:
make: fix build for DEBUG_HASH_LOOKUP


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/make/hash.c

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



CVS commit: src/usr.bin/make

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 08:32:23 UTC 2021

Modified Files:
src/usr.bin/make: targ.c

Log Message:
make: reduce number of relocations in Targ_PrintType

On x86_64, this saves 120 bytes of .text.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/usr.bin/make/targ.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.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.171 src/usr.bin/make/targ.c:1.172
--- src/usr.bin/make/targ.c:1.171	Sun Sep 12 08:03:48 2021
+++ src/usr.bin/make/targ.c	Sun Sep 12 08:32:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.171 2021/09/12 08:03:48 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.172 2021/09/12 08:32:23 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -113,7 +113,7 @@
 #include "dir.h"
 
 /*	"@(#)targ.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: targ.c,v 1.171 2021/09/12 08:03:48 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.172 2021/09/12 08:32:23 rillig Exp $");
 
 /*
  * All target nodes that appeared on the left-hand side of one of the
@@ -421,7 +421,7 @@ Targ_PrintType(GNodeType type)
 	static const struct {
 		GNodeType bit;
 		bool internal;
-		const char *name;
+		const char name[10];
 	} names[] = {
 		{ OP_MEMBER,	true,	"MEMBER"	},
 		{ OP_LIB,	true,	"LIB"		},



CVS commit: src/usr.bin/make

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 08:32:23 UTC 2021

Modified Files:
src/usr.bin/make: targ.c

Log Message:
make: reduce number of relocations in Targ_PrintType

On x86_64, this saves 120 bytes of .text.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/usr.bin/make/targ.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/aarch64/aarch64

2021-09-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 12 08:23:57 UTC 2021

Modified Files:
src/sys/arch/aarch64/aarch64: pmap.c

Log Message:
pmap_page_remove: simply and reduce the code size slightly.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/aarch64/aarch64/pmap.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/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.110 src/sys/arch/aarch64/aarch64/pmap.c:1.111
--- src/sys/arch/aarch64/aarch64/pmap.c:1.110	Thu Sep  9 08:12:27 2021
+++ src/sys/arch/aarch64/aarch64/pmap.c	Sun Sep 12 08:23:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.110 2021/09/09 08:12:27 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.111 2021/09/12 08:23:57 skrll Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.110 2021/09/09 08:12:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.111 2021/09/12 08:23:57 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -2213,19 +2213,19 @@ pmap_page_remove(struct pmap_page *pp, v
 			continue;
 		}
 		opte = atomic_swap_64(pv->pv_ptep, 0);
+		const vaddr_t va = trunc_page(pv->pv_va);
 		if (lxpde_valid(opte)) {
-			_pmap_pdp_delref(pv->pv_pmap,
+			_pmap_pdp_delref(pm,
 			AARCH64_KVA_TO_PA(trunc_page(
 			(vaddr_t)pv->pv_ptep)), false);
-			AARCH64_TLBI_BY_ASID_VA(pv->pv_pmap->pm_asid,
-			trunc_page(pv->pv_va), true);
+			AARCH64_TLBI_BY_ASID_VA(pm->pm_asid, va, true);
 
 			if ((opte & LX_BLKPAG_OS_WIRED) != 0) {
-_pmap_adj_wired_count(pv->pv_pmap, -1);
+_pmap_adj_wired_count(pm, -1);
 			}
-			_pmap_adj_resident_count(pv->pv_pmap, -1);
+			_pmap_adj_resident_count(pm, -1);
 		}
-		pvtmp = _pmap_remove_pv(pp, pm, trunc_page(pv->pv_va), opte);
+		pvtmp = _pmap_remove_pv(pp, pm, va, opte);
 		if (pvtmp == NULL) {
 			KASSERT(pv == >pp_pv);
 		} else {



CVS commit: src/sys/arch/aarch64/aarch64

2021-09-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 12 08:23:57 UTC 2021

Modified Files:
src/sys/arch/aarch64/aarch64: pmap.c

Log Message:
pmap_page_remove: simply and reduce the code size slightly.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/aarch64/aarch64/pmap.c

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



CVS commit: src/usr.bin/make

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 08:03:49 UTC 2021

Modified Files:
src/usr.bin/make: nonints.h targ.c

Log Message:
make: fix lint warnings for strict bool mode

In strict bool mode, lint does not consider 'x & y' as having type bool,
if x and y have integer type, it only allows this for enums.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.214 -r1.215 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.170 -r1.171 src/usr.bin/make/targ.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.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.214 src/usr.bin/make/nonints.h:1.215
--- src/usr.bin/make/nonints.h:1.214	Sat Aug 14 13:32:12 2021
+++ src/usr.bin/make/nonints.h	Sun Sep 12 08:03:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.214 2021/08/14 13:32:12 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.215 2021/09/12 08:03:48 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -203,7 +203,7 @@ void Targ_PrintCmds(GNode *);
 void Targ_PrintNode(GNode *, int);
 void Targ_PrintNodes(GNodeList *, int);
 const char *Targ_FmtTime(time_t);
-void Targ_PrintType(int);
+void Targ_PrintType(GNodeType);
 void Targ_PrintGraph(int);
 void Targ_Propagate(void);
 const char *GNodeMade_Name(GNodeMade);

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.170 src/usr.bin/make/targ.c:1.171
--- src/usr.bin/make/targ.c:1.170	Sun Sep 12 07:52:21 2021
+++ src/usr.bin/make/targ.c	Sun Sep 12 08:03:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.170 2021/09/12 07:52:21 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.171 2021/09/12 08:03:48 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -113,7 +113,7 @@
 #include "dir.h"
 
 /*	"@(#)targ.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: targ.c,v 1.170 2021/09/12 07:52:21 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.171 2021/09/12 08:03:48 rillig Exp $");
 
 /*
  * All target nodes that appeared on the left-hand side of one of the
@@ -416,7 +416,7 @@ Targ_FmtTime(time_t tm)
 
 /* Print out a type field giving only those attributes the user can set. */
 void
-Targ_PrintType(int type)
+Targ_PrintType(GNodeType type)
 {
 	static const struct {
 		GNodeType bit;



CVS commit: src/usr.bin/make

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 08:03:49 UTC 2021

Modified Files:
src/usr.bin/make: nonints.h targ.c

Log Message:
make: fix lint warnings for strict bool mode

In strict bool mode, lint does not consider 'x & y' as having type bool,
if x and y have integer type, it only allows this for enums.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.214 -r1.215 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.170 -r1.171 src/usr.bin/make/targ.c

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



CVS commit: src/usr.bin/make

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 07:52:21 UTC 2021

Modified Files:
src/usr.bin/make: targ.c

Log Message:
make: fix Targ_PrintType for pre-C99 compilers


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/usr.bin/make/targ.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.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.169 src/usr.bin/make/targ.c:1.170
--- src/usr.bin/make/targ.c:1.169	Sun Sep 12 07:50:45 2021
+++ src/usr.bin/make/targ.c	Sun Sep 12 07:52:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.169 2021/09/12 07:50:45 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.170 2021/09/12 07:52:21 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -113,7 +113,7 @@
 #include "dir.h"
 
 /*	"@(#)targ.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: targ.c,v 1.169 2021/09/12 07:50:45 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.170 2021/09/12 07:52:21 rillig Exp $");
 
 /*
  * All target nodes that appeared on the left-hand side of one of the
@@ -439,8 +439,9 @@ Targ_PrintType(int type)
 		{ OP_USE,	false,	"USE"		},
 		{ OP_OPTIONAL,	false,	"OPTIONAL"	},
 	};
+	size_t i;
 
-	for (size_t i = 0; i < sizeof(names) / sizeof(names[0]); i++) {
+	for (i = 0; i < sizeof(names) / sizeof(names[0]); i++) {
 		if (type & names[i].bit) {
 			if (names[i].internal)
 DEBUG1(TARG, " .%s", names[i].name);



CVS commit: src/usr.bin/make

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 07:52:21 UTC 2021

Modified Files:
src/usr.bin/make: targ.c

Log Message:
make: fix Targ_PrintType for pre-C99 compilers


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/usr.bin/make/targ.c

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



CVS commit: src/usr.bin/make

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 07:50:45 UTC 2021

Modified Files:
src/usr.bin/make: targ.c

Log Message:
make: make Targ_PrintType simpler

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/usr.bin/make/targ.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.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.168 src/usr.bin/make/targ.c:1.169
--- src/usr.bin/make/targ.c:1.168	Sat Apr  3 12:01:00 2021
+++ src/usr.bin/make/targ.c	Sun Sep 12 07:50:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.168 2021/04/03 12:01:00 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.169 2021/09/12 07:50:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -113,7 +113,7 @@
 #include "dir.h"
 
 /*	"@(#)targ.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: targ.c,v 1.168 2021/04/03 12:01:00 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.169 2021/09/12 07:50:45 rillig Exp $");
 
 /*
  * All target nodes that appeared on the left-hand side of one of the
@@ -418,34 +418,34 @@ Targ_FmtTime(time_t tm)
 void
 Targ_PrintType(int type)
 {
-	int tbit;
-
-	type &= ~OP_OPMASK;
-
-	while (type != 0) {
-		tbit = 1 << (ffs(type) - 1);
-		type &= ~tbit;
-
-		switch (tbit) {
-#define PRINTBIT(bit, attr) case bit: debug_printf(" " attr); break
-#define PRINTDBIT(bit, attr) case bit: DEBUG0(TARG, " " attr); break
-		PRINTBIT(OP_OPTIONAL, ".OPTIONAL");
-		PRINTBIT(OP_USE, ".USE");
-		PRINTBIT(OP_EXEC, ".EXEC");
-		PRINTBIT(OP_IGNORE, ".IGNORE");
-		PRINTBIT(OP_PRECIOUS, ".PRECIOUS");
-		PRINTBIT(OP_SILENT, ".SILENT");
-		PRINTBIT(OP_MAKE, ".MAKE");
-		PRINTBIT(OP_JOIN, ".JOIN");
-		PRINTBIT(OP_INVISIBLE, ".INVISIBLE");
-		PRINTBIT(OP_NOTMAIN, ".NOTMAIN");
-		PRINTDBIT(OP_LIB, ".LIB");
-		PRINTDBIT(OP_MEMBER, ".MEMBER");
-		PRINTDBIT(OP_ARCHV, ".ARCHV");
-		PRINTDBIT(OP_MADE, ".MADE");
-		PRINTDBIT(OP_PHONY, ".PHONY");
-#undef PRINTBIT
-#undef PRINTDBIT
+	static const struct {
+		GNodeType bit;
+		bool internal;
+		const char *name;
+	} names[] = {
+		{ OP_MEMBER,	true,	"MEMBER"	},
+		{ OP_LIB,	true,	"LIB"		},
+		{ OP_ARCHV,	true,	"ARCHV"		},
+		{ OP_PHONY,	true,	"PHONY"		},
+		{ OP_NOTMAIN,	false,	"NOTMAIN"	},
+		{ OP_INVISIBLE,	false,	"INVISIBLE"	},
+		{ OP_MADE,	true,	"MADE"		},
+		{ OP_JOIN,	false,	"JOIN"		},
+		{ OP_MAKE,	false,	"MAKE"		},
+		{ OP_SILENT,	false,	"SILENT"	},
+		{ OP_PRECIOUS,	false,	"PRECIOUS"	},
+		{ OP_IGNORE,	false,	"IGNORE"	},
+		{ OP_EXEC,	false,	"EXEC"		},
+		{ OP_USE,	false,	"USE"		},
+		{ OP_OPTIONAL,	false,	"OPTIONAL"	},
+	};
+
+	for (size_t i = 0; i < sizeof(names) / sizeof(names[0]); i++) {
+		if (type & names[i].bit) {
+			if (names[i].internal)
+DEBUG1(TARG, " .%s", names[i].name);
+			else
+debug_printf(" .%s", names[i].name);
 		}
 	}
 }



CVS commit: src/usr.bin/make

2021-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 12 07:50:45 UTC 2021

Modified Files:
src/usr.bin/make: targ.c

Log Message:
make: make Targ_PrintType simpler

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/usr.bin/make/targ.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/arm/arm

2021-09-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 12 07:14:50 UTC 2021

Modified Files:
src/sys/arch/arm/arm: armv6_start.S

Log Message:
More debug.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/arm/armv6_start.S

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/arm/arm/armv6_start.S
diff -u src/sys/arch/arm/arm/armv6_start.S:1.35 src/sys/arch/arm/arm/armv6_start.S:1.36
--- src/sys/arch/arm/arm/armv6_start.S:1.35	Mon Aug  2 12:56:22 2021
+++ src/sys/arch/arm/arm/armv6_start.S	Sun Sep 12 07:14:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: armv6_start.S,v 1.35 2021/08/02 12:56:22 andvar Exp $	*/
+/*	$NetBSD: armv6_start.S,v 1.36 2021/09/12 07:14:50 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2017, 2018 The NetBSD Foundation, Inc.
@@ -473,6 +473,14 @@ generic_vstartv7:
 
 	VPRINTF("virtual\n\r")
 
+	VPRINTF("prrr  : ")
+	mrc	p15, 0, r0, c10, c2, 0	// Primary Region Remap Register (PRRR)
+	VPRINTX(r0)
+	VPRINTF("\n\rnmrr  : ")
+	mrc	p15, 0, r0, c10, c2, 1	// Normal Memory Remap Register (NMRR)
+	VPRINTX(r0)
+	VPRINTF("\n\r")
+
 #if defined(KASAN)
 	ldr	r0, =start_stacks_bottom
 	bl	_C_LABEL(kasan_early_init)



CVS commit: src/sys/arch/arm/arm

2021-09-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 12 07:14:50 UTC 2021

Modified Files:
src/sys/arch/arm/arm: armv6_start.S

Log Message:
More debug.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/arm/armv6_start.S

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



CVS commit: src/bin/sh

2021-09-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Sep 12 06:53:08 UTC 2021

Modified Files:
src/bin/sh: sh.1

Log Message:
Mark up NULL with Dv.


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.232 src/bin/sh/sh.1:1.233
--- src/bin/sh/sh.1:1.232	Sun Sep 12 02:20:36 2021
+++ src/bin/sh/sh.1	Sun Sep 12 06:53:08 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.232 2021/09/12 02:20:36 kre Exp $
+.\"	$NetBSD: sh.1,v 1.233 2021/09/12 06:53:08 wiz Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -3032,7 +3032,9 @@ If
 .Ar title
 is omitted or a null string,
 .Xr setproctitle 3
-is called with a NULL format.
+is called with a
+.Dv NULL
+format.
 .Pp
 These options are mutually exclusive, the last specified is used.
 .Pp



CVS commit: src/bin/sh

2021-09-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Sep 12 06:53:08 UTC 2021

Modified Files:
src/bin/sh: sh.1

Log Message:
Mark up NULL with Dv.


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/bin/sh/sh.1

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