CVS commit: [thorpej-cfargs] src/sys/arch/i386/pci

2021-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Mar 26 02:05:02 UTC 2021

Modified Files:
src/sys/arch/i386/pci [thorpej-cfargs]: gscpcib.c

Log Message:
gscpcib_rescan(): "gpiobus" doesn't have locators, so no need to pass any
to config_found().


To generate a diff of this commit:
cvs rdiff -u -r1.18.66.1 -r1.18.66.2 src/sys/arch/i386/pci/gscpcib.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/i386/pci/gscpcib.c
diff -u src/sys/arch/i386/pci/gscpcib.c:1.18.66.1 src/sys/arch/i386/pci/gscpcib.c:1.18.66.2
--- src/sys/arch/i386/pci/gscpcib.c:1.18.66.1	Mon Mar 22 02:00:57 2021
+++ src/sys/arch/i386/pci/gscpcib.c	Fri Mar 26 02:05:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gscpcib.c,v 1.18.66.1 2021/03/22 02:00:57 thorpej Exp $	*/
+/*	$NetBSD: gscpcib.c,v 1.18.66.2 2021/03/26 02:05:02 thorpej Exp $	*/
 /*	$OpenBSD: gscpcib.c,v 1.3 2004/10/05 19:02:33 grange Exp $	*/
 /*
  * Copyright (c) 2004 Alexander Yurchenko 
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gscpcib.c,v 1.18.66.1 2021/03/22 02:00:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gscpcib.c,v 1.18.66.2 2021/03/26 02:05:02 thorpej Exp $");
 
 #include 
 #include 
@@ -101,7 +101,6 @@ gscpcib_rescan(device_t self, const char
 
 		sc->sc_gpiobus = config_found(self, , gpiobus_print,
 		CFARG_IATTR, "gpiobus",
-		CFARG_LOCATORS, loc,
 		CFARG_EOL);
 		return 0;
 	}



CVS commit: [thorpej-cfargs] src/sys/arch/i386/pci

2021-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Mar 26 02:05:02 UTC 2021

Modified Files:
src/sys/arch/i386/pci [thorpej-cfargs]: gscpcib.c

Log Message:
gscpcib_rescan(): "gpiobus" doesn't have locators, so no need to pass any
to config_found().


To generate a diff of this commit:
cvs rdiff -u -r1.18.66.1 -r1.18.66.2 src/sys/arch/i386/pci/gscpcib.c

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



CVS commit: [thorpej-cfargs] src/sys/arch/evbmips/loongson/dev

2021-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Mar 26 02:04:02 UTC 2021

Modified Files:
src/sys/arch/evbmips/loongson/dev [thorpej-cfargs]: pcib.c

Log Message:
pcibrescan(): config_found_ia() -> config_found().  Add a comment why we
are explicit about the interface attribute even though "pcib" itself only
carries one.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.16.1 src/sys/arch/evbmips/loongson/dev/pcib.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/evbmips/loongson/dev/pcib.c
diff -u src/sys/arch/evbmips/loongson/dev/pcib.c:1.2 src/sys/arch/evbmips/loongson/dev/pcib.c:1.2.16.1
--- src/sys/arch/evbmips/loongson/dev/pcib.c:1.2	Thu Mar  8 18:48:25 2018
+++ src/sys/arch/evbmips/loongson/dev/pcib.c	Fri Mar 26 02:04:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcib.c,v 1.2 2018/03/08 18:48:25 martin Exp $	*/
+/*	$NetBSD: pcib.c,v 1.2.16.1 2021/03/26 02:04:02 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.2 2018/03/08 18:48:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.2.16.1 2021/03/26 02:04:02 thorpej Exp $");
 
 #include 
 #include 
@@ -148,6 +148,10 @@ pcibrescan(device_t self, const char *if
 	struct pcib_softc *sc = device_private(self);
 	struct isabus_attach_args iba;
 
+	/*
+	 * pcib only carries "isabus", but this can also be used
+	 * by other drivers that carry additional interface attributes.
+	 */
 	if (ifattr_match(ifattr, "isabus") && sc->sc_isabus == NULL) {
 		/*
 		 * Attach the ISA bus behind this bridge.
@@ -162,7 +166,9 @@ pcibrescan(device_t self, const char *if
 
 		if (iba.iba_ic != NULL) 
 			sc->sc_isabus =
-			config_found_ia(self, "isabus", , isabusprint);
+			config_found(self, , isabusprint,
+	 CFARG_IATTR, "isabus",
+	 CFARG_EOL);
 	}
 	return 0;
 }



CVS commit: [thorpej-cfargs] src/sys/arch/evbmips/loongson/dev

2021-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Mar 26 02:04:02 UTC 2021

Modified Files:
src/sys/arch/evbmips/loongson/dev [thorpej-cfargs]: pcib.c

Log Message:
pcibrescan(): config_found_ia() -> config_found().  Add a comment why we
are explicit about the interface attribute even though "pcib" itself only
carries one.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.16.1 src/sys/arch/evbmips/loongson/dev/pcib.c

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



CVS commit: [thorpej-cfargs] src/sys/arch/arm/omap

2021-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Mar 26 02:02:53 UTC 2021

Modified Files:
src/sys/arch/arm/omap [thorpej-cfargs]: tiotg.c

Log Message:
tiotg_rescan(): properly pass the "matching locators" to config_found(),
and use config_stdsubmatch().


To generate a diff of this commit:
cvs rdiff -u -r1.7.18.2 -r1.7.18.3 src/sys/arch/arm/omap/tiotg.c

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



CVS commit: [thorpej-cfargs] src/sys/arch/arm/omap

2021-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Mar 26 02:02:53 UTC 2021

Modified Files:
src/sys/arch/arm/omap [thorpej-cfargs]: tiotg.c

Log Message:
tiotg_rescan(): properly pass the "matching locators" to config_found(),
and use config_stdsubmatch().


To generate a diff of this commit:
cvs rdiff -u -r1.7.18.2 -r1.7.18.3 src/sys/arch/arm/omap/tiotg.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/arm/omap/tiotg.c
diff -u src/sys/arch/arm/omap/tiotg.c:1.7.18.2 src/sys/arch/arm/omap/tiotg.c:1.7.18.3
--- src/sys/arch/arm/omap/tiotg.c:1.7.18.2	Wed Mar 24 14:21:08 2021
+++ src/sys/arch/arm/omap/tiotg.c	Fri Mar 26 02:02:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tiotg.c,v 1.7.18.2 2021/03/24 14:21:08 thorpej Exp $ */
+/* $NetBSD: tiotg.c,v 1.7.18.3 2021/03/26 02:02:53 thorpej Exp $ */
 /*
  * Copyright (c) 2013 Manuel Bouyer.  All rights reserved.
  *
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tiotg.c,v 1.7.18.2 2021/03/24 14:21:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tiotg.c,v 1.7.18.3 2021/03/26 02:02:53 thorpej Exp $");
 
 #include "opt_omap.h"
 #include "locators.h"
@@ -191,11 +191,15 @@ tiotg_rescan(device_t self, const char *
 {
 	struct tiotg_softc *sc = device_private(self);
 	struct motg_attach_args	aa;
+	int mlocs[TIOTG_PORTCF_NLOCS];
 	int i;
 
 	for (i = 0; i < TI_OTG_NPORTS; i++) {
 		if (sc->sc_motgdev[i] != NULL)
 			continue;
+
+		mlocs[TIOTG_PORTCF_PORT] = i;
+
 		if (bus_space_subregion(sc->sc_iot, sc->sc_ioh,
 		USB_CTRL_OFFSET(i), USB_PORT_SIZE, _ioh) < 0) {
 			aprint_error_dev(self,
@@ -207,7 +211,10 @@ tiotg_rescan(device_t self, const char *
 		aa.aa_port = i;
 		aa.aa_intr = sc->sc_intrbase + 1 + i;
 		sc->sc_motgdev[i] =
-		config_found(self, , ti_motg_print, CFARG_EOL);
+		config_found(self, , ti_motg_print,
+ CFARG_SUBMATCH, config_stdsubmatch,
+ CFARG_LOCATORS, mlocs,
+ CFARG_EOL);
 	}
 	return 0;
 }



CVS commit: src

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 22:53:05 UTC 2021

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

Log Message:
lint: fix initialization for arrays with designators

>From the previous commit, there was an off-by-one error left, which was
due to the interaction between designation_add_subscript and
extend_if_array_of_unknown_size.

The other crucial point was to call initstack_pop_nobrace before
accessing the "current initialization stack element".  Without this
call, in msg_168.c the "current element" would point to the initializer
level for 'const char *' instead of the one for 'array of const char *'.

One more step towards supporting C99.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_168.c \
src/tests/usr.bin/xlint/lint1/msg_168.exp
cvs rdiff -u -r1.132 -r1.133 src/usr.bin/xlint/lint1/init.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_168.c
diff -u src/tests/usr.bin/xlint/lint1/msg_168.c:1.4 src/tests/usr.bin/xlint/lint1/msg_168.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_168.c:1.4	Thu Mar 25 22:15:38 2021
+++ src/tests/usr.bin/xlint/lint1/msg_168.c	Thu Mar 25 22:53:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_168.c,v 1.4 2021/03/25 22:15:38 rillig Exp $	*/
+/*	$NetBSD: msg_168.c,v 1.5 2021/03/25 22:53:05 rillig Exp $	*/
 # 3 "msg_168.c"
 
 // Test for message: array subscript cannot be > %d: %ld [168]
@@ -37,6 +37,6 @@ array_with_c99_initializer(void)
 	['9'] = "IX"
 	};
 
-	print_string(to_roman['9']);	/*FIXME*//* expect: 168 */
+	print_string(to_roman['9']);
 	print_string(to_roman[':']);	/* expect: 168 */
 }
Index: src/tests/usr.bin/xlint/lint1/msg_168.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_168.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_168.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_168.exp:1.4	Thu Mar 25 22:15:38 2021
+++ src/tests/usr.bin/xlint/lint1/msg_168.exp	Thu Mar 25 22:53:05 2021
@@ -1,3 +1,2 @@
 msg_168.c(28): warning: array subscript cannot be > 19: 20 [168]
-msg_168.c(40): warning: array subscript cannot be > 51: 57 [168]
-msg_168.c(41): warning: array subscript cannot be > 51: 58 [168]
+msg_168.c(41): warning: array subscript cannot be > 57: 58 [168]

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.132 src/usr.bin/xlint/lint1/init.c:1.133
--- src/usr.bin/xlint/lint1/init.c:1.132	Thu Mar 25 22:15:38 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 22:53:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.132 2021/03/25 22:15:38 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.133 2021/03/25 22:53:05 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.132 2021/03/25 22:15:38 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.133 2021/03/25 22:53:05 rillig Exp $");
 #endif
 
 #include 
@@ -497,6 +497,9 @@ designation_add_name(sbuf_t *sb)
 	debug_designation();
 }
 
+/* TODO: Move the function body up here, to avoid the forward declaration. */
+static void initstack_pop_nobrace(void);
+
 /*
  * A sub-object of an array is initialized using a designator.  This does not
  * have to be an array element directly, it can also be used to initialize
@@ -523,9 +526,12 @@ designation_add_subscript(range_t range)
 	debug_step("subscript range is %zu ... %zu", range.lo, range.hi);
 	debug_initstack();
 
+	initstack_pop_nobrace();
+
 	istk = initstk_lvalue;
 	if (istk->i_array_of_unknown_size) {
-		int auto_dim = (int)(range.hi + 1);
+		/* No +1 here, extend_if_array_of_unknown_size will add it. */
+		int auto_dim = (int)range.hi;
 		if (auto_dim > istk->i_type->t_dim) {
 			debug_step("setting the array size to %d", auto_dim);
 			istk->i_type->t_dim = auto_dim;
@@ -734,6 +740,11 @@ extend_if_array_of_unknown_size(void)
 
 	if (istk->i_remaining != 0)
 		return;
+	/*
+	 * XXX: According to the function name, there should be a 'return' if
+	 * i_array_of_unknown_size is false.  There's probably a test missing
+	 * for that case.
+	 */
 
 	/*
 	 * The only place where an incomplete array may appear is at the
@@ -1292,11 +1303,6 @@ init_array_using_string(tnode_t *tn)
 	len = strg->st_len;
 
 	if (istk->i_array_of_unknown_size) {
-		/*
-		 * FIXME: C99 6.7.8p22 explicitly says that only "at the end
-		 * of its initializer list, the array no longer has incomplete
-		 * type".
-		 */
 		istk->i_array_of_unknown_size = false;
 		istk->i_type->t_dim = len + 1;
 		setcomplete(istk->i_type, true);



CVS commit: src

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 22:53:05 UTC 2021

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

Log Message:
lint: fix initialization for arrays with designators

>From the previous commit, there was an off-by-one error left, which was
due to the interaction between designation_add_subscript and
extend_if_array_of_unknown_size.

The other crucial point was to call initstack_pop_nobrace before
accessing the "current initialization stack element".  Without this
call, in msg_168.c the "current element" would point to the initializer
level for 'const char *' instead of the one for 'array of const char *'.

One more step towards supporting C99.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_168.c \
src/tests/usr.bin/xlint/lint1/msg_168.exp
cvs rdiff -u -r1.132 -r1.133 src/usr.bin/xlint/lint1/init.c

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



CVS commit: src

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 22:15:38 UTC 2021

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

Log Message:
lint: improve initialization of arrays with designators

Initialization is still buggy but better than before.  The remaining bug
is that only the first designator determines the array size, and after
that, the array is no longer considered of unknown size.  This
contradicts C99.  More improvements to come.


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

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



CVS commit: src

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 22:15:38 UTC 2021

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

Log Message:
lint: improve initialization of arrays with designators

Initialization is still buggy but better than before.  The remaining bug
is that only the first designator determines the array size, and after
that, the array is no longer considered of unknown size.  This
contradicts C99.  More improvements to come.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_168.c \
src/tests/usr.bin/xlint/lint1/msg_168.exp
cvs rdiff -u -r1.131 -r1.132 src/usr.bin/xlint/lint1/init.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_168.c
diff -u src/tests/usr.bin/xlint/lint1/msg_168.c:1.3 src/tests/usr.bin/xlint/lint1/msg_168.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_168.c:1.3	Sun Mar  7 16:40:20 2021
+++ src/tests/usr.bin/xlint/lint1/msg_168.c	Thu Mar 25 22:15:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_168.c,v 1.3 2021/03/07 16:40:20 rillig Exp $	*/
+/*	$NetBSD: msg_168.c,v 1.4 2021/03/25 22:15:38 rillig Exp $	*/
 # 3 "msg_168.c"
 
 // Test for message: array subscript cannot be > %d: %ld [168]
@@ -9,7 +9,7 @@ void print_char(char);
 void
 example(void)
 {
-	char buf[20] = {};
+	char buf[20] = {};	/* empty initializer is a GCC extension */
 
 	print_string(buf + 19);	/* inside the array */
 
Index: src/tests/usr.bin/xlint/lint1/msg_168.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_168.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_168.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_168.exp:1.3	Sun Mar  7 16:40:20 2021
+++ src/tests/usr.bin/xlint/lint1/msg_168.exp	Thu Mar 25 22:15:38 2021
@@ -1,3 +1,3 @@
 msg_168.c(28): warning: array subscript cannot be > 19: 20 [168]
-msg_168.c(40): warning: array subscript cannot be > 2: 57 [168]
-msg_168.c(41): warning: array subscript cannot be > 2: 58 [168]
+msg_168.c(40): warning: array subscript cannot be > 51: 57 [168]
+msg_168.c(41): warning: array subscript cannot be > 51: 58 [168]

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.131 src/usr.bin/xlint/lint1/init.c:1.132
--- src/usr.bin/xlint/lint1/init.c:1.131	Thu Mar 25 21:51:55 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 22:15:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.131 2021/03/25 21:51:55 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.132 2021/03/25 22:15:38 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.131 2021/03/25 21:51:55 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.132 2021/03/25 22:15:38 rillig Exp $");
 #endif
 
 #include 
@@ -517,9 +517,21 @@ designation_add_name(sbuf_t *sb)
 void
 designation_add_subscript(range_t range)
 {
+	initstack_element *istk;
+
 	debug_enter();
 	debug_step("subscript range is %zu ... %zu", range.lo, range.hi);
 	debug_initstack();
+
+	istk = initstk_lvalue;
+	if (istk->i_array_of_unknown_size) {
+		int auto_dim = (int)(range.hi + 1);
+		if (auto_dim > istk->i_type->t_dim) {
+			debug_step("setting the array size to %d", auto_dim);
+			istk->i_type->t_dim = auto_dim;
+		}
+	}
+
 	debug_leave();
 }
 
@@ -1280,6 +1292,11 @@ init_array_using_string(tnode_t *tn)
 	len = strg->st_len;
 
 	if (istk->i_array_of_unknown_size) {
+		/*
+		 * FIXME: C99 6.7.8p22 explicitly says that only "at the end
+		 * of its initializer list, the array no longer has incomplete
+		 * type".
+		 */
 		istk->i_array_of_unknown_size = false;
 		istk->i_type->t_dim = len + 1;
 		setcomplete(istk->i_type, true);



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

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 21:51:56 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y externs1.h init.c

Log Message:
lint: fix names of functions dealing with designations

These functions modify the whole designation, not only a single
designator.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.84 -r1.85 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.130 -r1.131 src/usr.bin/xlint/lint1/init.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-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 21:51:56 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y externs1.h init.c

Log Message:
lint: fix names of functions dealing with designations

These functions modify the whole designation, not only a single
designator.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.84 -r1.85 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.130 -r1.131 src/usr.bin/xlint/lint1/init.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/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.199 src/usr.bin/xlint/lint1/cgram.y:1.200
--- src/usr.bin/xlint/lint1/cgram.y:1.199	Tue Mar 23 20:57:40 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Thu Mar 25 21:51:55 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.199 2021/03/23 20:57:40 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.200 2021/03/25 21:51:55 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.199 2021/03/23 20:57:40 christos Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.200 2021/03/25 21:51:55 rillig Exp $");
 #endif
 
 #include 
@@ -1379,7 +1379,7 @@ range:
 
 designator:			/* C99 6.7.8 "Initialization" */
 	  T_LBRACK range T_RBRACK {
-		designator_push_subscript($2);
+		designation_add_subscript($2);
 		if (!Sflag)
 			/* array initializer with des.s is a C9X feature */
 			warning(321);
@@ -1388,7 +1388,7 @@ designator:			/* C99 6.7.8 "Initializati
 		if (!Sflag)
 			/* struct or union member name in initializer is ... */
 			warning(313);
-		designator_push_name($2);
+		designation_add_name($2);
 	  }
 	;
 
@@ -1402,7 +1402,7 @@ designation:			/* C99 6.7.8 "Initializat
 	| identifier T_COLON {
 		/* GCC style struct or union member name in initializer */
 		gnuism(315);
-		designator_push_name($1);
+		designation_add_name($1);
 	  }
 	;
 

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.84 src/usr.bin/xlint/lint1/externs1.h:1.85
--- src/usr.bin/xlint/lint1/externs1.h:1.84	Tue Mar 23 18:40:50 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Thu Mar 25 21:51:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.84 2021/03/23 18:40:50 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.85 2021/03/25 21:51:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -301,8 +301,8 @@ extern	void	initstack_init(void);
 extern	void	init_rbrace(void);
 extern	void	init_lbrace(void);
 extern	void	init_using_expr(tnode_t *);
-extern	void	designator_push_name(sbuf_t *);
-extern	void	designator_push_subscript(range_t);
+extern	void	designation_add_name(sbuf_t *);
+extern	void	designation_add_subscript(range_t);
 
 /*
  * emit.c

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.130 src/usr.bin/xlint/lint1/init.c:1.131
--- src/usr.bin/xlint/lint1/init.c:1.130	Thu Mar 25 21:45:10 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 21:51:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.130 2021/03/25 21:45:10 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.131 2021/03/25 21:51:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.130 2021/03/25 21:45:10 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.131 2021/03/25 21:51:55 rillig Exp $");
 #endif
 
 #include 
@@ -72,8 +72,8 @@ __RCSID("$NetBSD: init.c,v 1.130 2021/03
  *
  *	begin_initialization
  *		init_lbrace			for each '{'
- *		designator_push_name		for each '.member' before '='
- *		designator_push_subscript	for each '[123]' before '='
+ *		designation_add_name		for each '.member' before '='
+ *		designation_add_subscript	for each '[123]' before '='
  *		init_using_expr			for each expression
  *		init_rbrace			for each '}'
  *	end_initialization
@@ -479,7 +479,7 @@ end_initialization(void)
 }
 
 void
-designator_push_name(sbuf_t *sb)
+designation_add_name(sbuf_t *sb)
 {
 	designation *dd = current_designation_mod();
 
@@ -515,7 +515,7 @@ designator_push_name(sbuf_t *sb)
  * }
  */
 void
-designator_push_subscript(range_t range)
+designation_add_subscript(range_t range)
 {
 	debug_enter();
 	debug_step("subscript range is %zu ... %zu", range.lo, range.hi);
@@ -525,7 +525,7 @@ designator_push_subscript(range_t range)
 
 /* TODO: add support for array subscripts, not only named members */
 static void
-designator_shift_name(void)
+designation_shift_level(void)
 {
 	/* TODO: remove direct access to 'init' */
 	lint_assert(init != NULL);
@@ -609,7 +609,7 @@ initstack_pop_item_named_member(void)
 			/* XXX: why ++? */
 			istk->i_remaining++;
 			/* XXX: why is i_seen_named_member not set? */
-			designator_shift_name();
+			designation_shift_level();
 			

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

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 21:45:10 UTC 2021

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

Log Message:
lint: free the designator as soon as it is no longer needed

One of the latest "refactorings" introduced a small and practically
unimportant memory leak.  If the last initializer in an initialization
had a designator, that designator was not freed.

When the "current initialization" was still a global variable with
unlimited lifetime, it was freed at the beginning of the next
initialization.  After the refactorings, this "next initialization"
could no longer see anything from the previous initialization since all
references have been cleaned up at that point.  Freeing the memory so
late and in an almost totally unrelated place was a bad idea anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/usr.bin/xlint/lint1/init.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/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.129 src/usr.bin/xlint/lint1/init.c:1.130
--- src/usr.bin/xlint/lint1/init.c:1.129	Thu Mar 25 21:36:41 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 21:45:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.129 2021/03/25 21:36:41 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.130 2021/03/25 21:45:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.129 2021/03/25 21:36:41 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.130 2021/03/25 21:45:10 rillig Exp $");
 #endif
 
 #include 
@@ -557,10 +557,6 @@ initstack_init(void)
 	if (initerr)
 		return;
 
-	/* TODO: merge into init_using_expr */
-	while (current_designation().head != NULL)
-		designator_shift_name();
-
 	debug_enter();
 
 	/*
@@ -1203,7 +1199,11 @@ init_using_expr(tnode_t *tn)
 
 done_initstack:
 	debug_initstack();
+
 done:
+	while (current_designation().head != NULL)
+		designator_shift_name();
+
 	debug_leave();
 }
 



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

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 21:45:10 UTC 2021

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

Log Message:
lint: free the designator as soon as it is no longer needed

One of the latest "refactorings" introduced a small and practically
unimportant memory leak.  If the last initializer in an initialization
had a designator, that designator was not freed.

When the "current initialization" was still a global variable with
unlimited lifetime, it was freed at the beginning of the next
initialization.  After the refactorings, this "next initialization"
could no longer see anything from the previous initialization since all
references have been cleaned up at that point.  Freeing the memory so
late and in an almost totally unrelated place was a bad idea anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/usr.bin/xlint/lint1/init.c

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



CVS commit: src/distrib/sets/lists/debug

2021-03-25 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Thu Mar 25 21:37:10 UTC 2021

Modified Files:
src/distrib/sets/lists/debug: module.md.amd64 module.md.i386 module.mi

Log Message:
Move pad module to MI debug set lists


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/distrib/sets/lists/debug/module.md.amd64
cvs rdiff -u -r1.2 -r1.3 src/distrib/sets/lists/debug/module.md.i386
cvs rdiff -u -r1.7 -r1.8 src/distrib/sets/lists/debug/module.mi

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/debug/module.md.amd64
diff -u src/distrib/sets/lists/debug/module.md.amd64:1.4 src/distrib/sets/lists/debug/module.md.amd64:1.5
--- src/distrib/sets/lists/debug/module.md.amd64:1.4	Sun Nov  1 18:51:34 2020
+++ src/distrib/sets/lists/debug/module.md.amd64	Thu Mar 25 21:37:10 2021
@@ -1,4 +1,4 @@
-# $NetBSD: module.md.amd64,v 1.4 2020/11/01 18:51:34 pgoyette Exp $
+# $NetBSD: module.md.amd64,v 1.5 2021/03/25 21:37:10 nia Exp $
 ./usr/libdata/debug/@MODULEDIR@/acpiacadmodules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpiacad/acpiacad.kmod.debug		modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpibatmodules-base-kernel	kmod,debug
@@ -179,8 +179,6 @@
 ./usr/libdata/debug/@MODULEDIR@/nxt2k/nxt2k.kmod.debug			modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/odcmmodules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/odcm/odcm.kmod.debug			modules-base-kernel	kmod,debug
-./usr/libdata/debug/@MODULEDIR@/padmodules-base-kernel	kmod,debug
-./usr/libdata/debug/@MODULEDIR@/pad/pad.kmod.debug			modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/powernowmodules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/powernow/powernow.kmod.debug		modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/pwdogmodules-base-kernel	kmod,debug

Index: src/distrib/sets/lists/debug/module.md.i386
diff -u src/distrib/sets/lists/debug/module.md.i386:1.2 src/distrib/sets/lists/debug/module.md.i386:1.3
--- src/distrib/sets/lists/debug/module.md.i386:1.2	Tue Sep  8 14:57:32 2020
+++ src/distrib/sets/lists/debug/module.md.i386	Thu Mar 25 21:37:10 2021
@@ -1,4 +1,4 @@
-# $NetBSD: module.md.i386,v 1.2 2020/09/08 14:57:32 martin Exp $
+# $NetBSD: module.md.i386,v 1.3 2021/03/25 21:37:10 nia Exp $
 ./usr/libdata/debug/@MODULEDIR@/acpiacadmodules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpiacad/acpiacad.kmod.debug		modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpibatmodules-base-kernel	kmod,debug
@@ -135,8 +135,6 @@
 ./usr/libdata/debug/@MODULEDIR@/nxt2k/nxt2k.kmod.debug			modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/odcmmodules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/odcm/odcm.kmod.debug			modules-base-kernel	kmod,debug
-./usr/libdata/debug/@MODULEDIR@/padmodules-base-kernel	kmod,debug
-./usr/libdata/debug/@MODULEDIR@/pad/pad.kmod.debug			modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/padlockmodules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/padlock/padlock.kmod.debug		modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/powernowmodules-base-kernel	kmod,debug

Index: src/distrib/sets/lists/debug/module.mi
diff -u src/distrib/sets/lists/debug/module.mi:1.7 src/distrib/sets/lists/debug/module.mi:1.8
--- src/distrib/sets/lists/debug/module.mi:1.7	Sun Oct 18 10:10:18 2020
+++ src/distrib/sets/lists/debug/module.mi	Thu Mar 25 21:37:10 2021
@@ -1,4 +1,4 @@
-# $NetBSD: module.mi,v 1.7 2020/10/18 10:10:18 rin Exp $
+# $NetBSD: module.mi,v 1.8 2021/03/25 21:37:10 nia Exp $
 ./usr/libdata/debug/@MODULEDIR@	modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/accf_dataready			modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/accf_dataready/accf_dataready.kmod.debug	modules-base-kernel	kmod,debug
@@ -286,6 +286,8 @@
 ./usr/libdata/debug/@MODULEDIR@/opencrypto/opencrypto.kmod.debug	modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/overlaymodules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/overlay/overlay.kmod.debug		modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/padmodules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/pad/pad.kmod.debug			modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/pciverbose			modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/pciverbose/pciverbose.kmod.debug	modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/pfmodules-base-kernel	kmod,debug



CVS commit: src/distrib/sets/lists/debug

2021-03-25 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Thu Mar 25 21:37:10 UTC 2021

Modified Files:
src/distrib/sets/lists/debug: module.md.amd64 module.md.i386 module.mi

Log Message:
Move pad module to MI debug set lists


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/distrib/sets/lists/debug/module.md.amd64
cvs rdiff -u -r1.2 -r1.3 src/distrib/sets/lists/debug/module.md.i386
cvs rdiff -u -r1.7 -r1.8 src/distrib/sets/lists/debug/module.mi

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-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 21:36:41 UTC 2021

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

Log Message:
lint: distinguish between read and write access to initstk

There are far too many places that modify the top element of the
initializer stack.  Each of these places should get its own logging, as
long as the code is still complicated.  These places are now clearly
marked with initstk_lvalue.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/usr.bin/xlint/lint1/init.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-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 21:36:41 UTC 2021

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

Log Message:
lint: distinguish between read and write access to initstk

There are far too many places that modify the top element of the
initializer stack.  Each of these places should get its own logging, as
long as the code is still complicated.  These places are now clearly
marked with initstk_lvalue.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/usr.bin/xlint/lint1/init.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/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.128 src/usr.bin/xlint/lint1/init.c:1.129
--- src/usr.bin/xlint/lint1/init.c:1.128	Thu Mar 25 21:07:52 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 21:36:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.128 2021/03/25 21:07:52 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.129 2021/03/25 21:36:41 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.128 2021/03/25 21:07:52 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.129 2021/03/25 21:36:41 rillig Exp $");
 #endif
 
 #include 
@@ -294,10 +294,17 @@ current_designation(void)
 	return *current_designation_mod();
 }
 
-static initstack_element **
+static const initstack_element *
 current_initstk(void)
 {
 	lint_assert(init != NULL);
+	return init->initstk;
+}
+
+static initstack_element **
+current_initstk_lvalue(void)
+{
+	lint_assert(init != NULL);
 	return >initstk;
 }
 
@@ -316,7 +323,8 @@ free_initialization(struct initializatio
 
 #define initerr		(*current_initerr())
 #define initsym		(*current_initsym())
-#define initstk		(*current_initstk())
+#define initstk		(current_initstk())
+#define initstk_lvalue	(*current_initstk_lvalue())
 
 #ifndef DEBUG
 
@@ -563,7 +571,7 @@ initstack_init(void)
 		initsym->s_type = duptyp(initsym->s_type);
 	/* TODO: does 'duptyp' create a memory leak? */
 
-	istk = initstk = xcalloc(1, sizeof (initstack_element));
+	istk = initstk_lvalue = xcalloc(1, sizeof (initstack_element));
 	istk->i_subt = initsym->s_type;
 	istk->i_remaining = 1;
 
@@ -575,7 +583,7 @@ initstack_init(void)
 static void
 initstack_pop_item_named_member(void)
 {
-	initstack_element *istk = initstk;
+	initstack_element *istk = initstk_lvalue;
 	sym_t *m;
 
 	/*
@@ -621,7 +629,7 @@ initstack_pop_item_named_member(void)
 static void
 initstack_pop_item_unnamed(void)
 {
-	initstack_element *istk = initstk;
+	initstack_element *istk = initstk_lvalue;
 	sym_t *m;
 
 	/*
@@ -650,14 +658,14 @@ initstack_pop_item(void)
 
 	debug_enter();
 
-	istk = initstk;
+	istk = initstk_lvalue;
 	debug_indent();
 	debug_printf("popping: ");
 	debug_initstack_element(istk);
 
-	initstk = istk->i_enclosing;
+	initstk_lvalue = istk->i_enclosing;
 	free(istk);
-	istk = initstk;
+	istk = initstk_lvalue;
 	lint_assert(istk != NULL);
 
 	istk->i_remaining--;
@@ -714,7 +722,7 @@ initstack_pop_nobrace(void)
 static void
 extend_if_array_of_unknown_size(void)
 {
-	initstack_element *istk = initstk;
+	initstack_element *istk = initstk_lvalue;
 
 	if (istk->i_remaining != 0)
 		return;
@@ -740,7 +748,7 @@ extend_if_array_of_unknown_size(void)
 static void
 initstack_push_array(void)
 {
-	initstack_element *const istk = initstk;
+	initstack_element *istk = initstk_lvalue;
 
 	if (istk->i_enclosing->i_seen_named_member) {
 		istk->i_brace = true;
@@ -775,7 +783,7 @@ initstack_push_struct_or_union(void)
 	 * TODO: remove unnecessary 'const' for variables in functions that
 	 * fit on a single screen.  Keep it for larger functions.
 	 */
-	initstack_element *const istk = initstk;
+	initstack_element *istk = initstk_lvalue;
 	int cnt;
 	sym_t *m;
 
@@ -859,17 +867,17 @@ initstack_push(void)
 
 	extend_if_array_of_unknown_size();
 
-	istk = initstk;
+	istk = initstk_lvalue;
 	lint_assert(istk->i_remaining > 0);
 	lint_assert(istk->i_type == NULL || !is_scalar(istk->i_type->t_tspec));
 
-	initstk = xcalloc(1, sizeof (initstack_element));
-	initstk->i_enclosing = istk;
-	initstk->i_type = istk->i_subt;
-	lint_assert(initstk->i_type->t_tspec != FUNC);
+	initstk_lvalue = xcalloc(1, sizeof (initstack_element));
+	initstk_lvalue->i_enclosing = istk;
+	initstk_lvalue->i_type = istk->i_subt;
+	lint_assert(initstk_lvalue->i_type->t_tspec != FUNC);
 
 again:
-	istk = initstk;
+	istk = initstk_lvalue;
 
 	debug_step("expecting type '%s'", type_name(istk->i_type));
 	lint_assert(istk->i_type != NULL);
@@ -901,7 +909,7 @@ again:
 			/* TODO: extract this into end_initializer_level */
 			inxt = initstk->i_enclosing;
 			free(istk);
-			initstk = inxt;
+			initstk_lvalue = inxt;
 			goto again;
 		}
 		/* The initialization stack now expects a single scalar. */
@@ -962,7 +970,7 @@ initstack_next_brace(void)
 	if (!initerr)
 		

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

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 21:07:52 UTC 2021

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

Log Message:
lint: replace namlist with designation and designator

This makes it possible to accurately model C99 initializers, including
their optional designators.  Previously, array subscripts had not been
modeled at all.

In the previous commit, debug_designation crashed immediately since I
had not run the code in debug mode even once.  The condition 'name !=
head' was a left-over from the old times where the designator was still
a circular list.

No functional change outside debug mode.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/usr.bin/xlint/lint1/init.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/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.127 src/usr.bin/xlint/lint1/init.c:1.128
--- src/usr.bin/xlint/lint1/init.c:1.127	Thu Mar 25 20:38:16 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 21:07:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.127 2021/03/25 20:38:16 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.128 2021/03/25 21:07:52 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.127 2021/03/25 20:38:16 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.128 2021/03/25 21:07:52 rillig Exp $");
 #endif
 
 #include 
@@ -215,22 +215,24 @@ typedef	struct initstack_element {
 } initstack_element;
 
 /*
- * The names for a nested C99 initialization designator, in a circular list.
+ * Leads the path to the sub-object to initialize using the expression.
+ * Example designators are '.member' or '.member[123].member.member[1][1]'.
  *
- * Example:
- *	struct stat st = {
- *		.st_size = 123,
- *		.st_mtim.tv_sec = 45,
- *		.st_mtim.tv_nsec
- *	};
- *
- *	During initialization, this list first contains ["st_size"], then
- *	["st_mtim", "tv_sec"], then ["st_mtim", "tv_nsec"].
+ * See also: C99 6.7.8 "Initialization"
+ */
+typedef struct designator {
+	const char *name;		/* for struct and union */
+	/* TODO: add 'subscript' for arrays */
+	struct designator *next;
+} designator;
+
+/*
+ * See also: C99 6.7.8 "Initialization"
  */
-typedef struct namlist {
-	const char *n_name;
-	struct namlist *n_next;
-} namlist_t;
+typedef struct {
+	designator *head;
+	designator *tail;
+} designation;
 
 struct initialization {
 	/*
@@ -251,8 +253,7 @@ struct initialization {
 	 * The C99 designator, if any, for the current initialization
 	 * expression.
 	 */
-	namlist_t *designation;
-	namlist_t *designation_tail;
+	designation designation;
 
 	struct initialization *next;
 };
@@ -280,14 +281,14 @@ current_initsym(void)
 	return >initsym;
 }
 
-static namlist_t **
+static designation *
 current_designation_mod(void)
 {
 	lint_assert(init != NULL);
 	return >designation;
 }
 
-static const namlist_t *
+static designation
 current_designation(void)
 {
 	return *current_designation_mod();
@@ -375,17 +376,14 @@ debug_leave(const char *func)
 static void
 debug_designation(void)
 {
-	const namlist_t *head = current_designation(), *name;
+	const designator *head = current_designation().head, *p;
 	if (head == NULL)
 		return;
 
 	debug_indent();
 	debug_printf("designation: ");
-	name = head;
-	do {
-		debug_printf(".%s", name->n_name);
-		name = name->n_next;
-	} while (name != head);
+	for (p = head; p != NULL; p = p->next)
+		debug_printf(".%s", p->name);
 	debug_printf("\n");
 }
 
@@ -475,18 +473,17 @@ end_initialization(void)
 void
 designator_push_name(sbuf_t *sb)
 {
-	const namlist_t *designation = current_designation();
+	designation *dd = current_designation_mod();
 
-	namlist_t *nam = xcalloc(1, sizeof (namlist_t));
-	nam->n_name = sb->sb_name;
+	designator *d = xcalloc(1, sizeof *d);
+	d->name = sb->sb_name;
 
-	/* TODO: remove direct access to 'init' */
-	if (designation != NULL) {
-		init->designation_tail->n_next = nam;
-		init->designation_tail = nam;
+	if (dd->head != NULL) {
+		dd->tail->next = d;
+		dd->tail = d;
 	} else {
-		init->designation = nam;
-		init->designation_tail = nam;
+		dd->head = d;
+		dd->tail = d;
 	}
 
 	debug_designation();
@@ -524,13 +521,14 @@ designator_shift_name(void)
 {
 	/* TODO: remove direct access to 'init' */
 	lint_assert(init != NULL);
-	if (init->designation == init->designation_tail) {
-		free(init->designation);
-		init->designation = NULL;
-		init->designation_tail = NULL;
+	lint_assert(init->designation.head != NULL);
+	if (init->designation.head == init->designation.tail) {
+		free(init->designation.head);
+		init->designation.head = NULL;
+		init->designation.tail = NULL;
 	} else {
-		namlist_t *head = init->designation;
-		init->designation = init->designation->n_next;
+		designator *head = init->designation.head;
+		init->designation.head = init->designation.head->next;
 		

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

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 21:07:52 UTC 2021

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

Log Message:
lint: replace namlist with designation and designator

This makes it possible to accurately model C99 initializers, including
their optional designators.  Previously, array subscripts had not been
modeled at all.

In the previous commit, debug_designation crashed immediately since I
had not run the code in debug mode even once.  The condition 'name !=
head' was a left-over from the old times where the designator was still
a circular list.

No functional change outside debug mode.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/usr.bin/xlint/lint1/init.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-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 20:38:16 UTC 2021

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

Log Message:
lint: remove over-engineered doubly-linked circular list

The designation only needs to be navigated from head to tail, not the
other way round.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/usr.bin/xlint/lint1/init.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/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.126 src/usr.bin/xlint/lint1/init.c:1.127
--- src/usr.bin/xlint/lint1/init.c:1.126	Thu Mar 25 20:11:18 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 20:38:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.126 2021/03/25 20:11:18 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.127 2021/03/25 20:38:16 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.126 2021/03/25 20:11:18 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.127 2021/03/25 20:38:16 rillig Exp $");
 #endif
 
 #include 
@@ -229,7 +229,6 @@ typedef	struct initstack_element {
  */
 typedef struct namlist {
 	const char *n_name;
-	struct namlist *n_prev;
 	struct namlist *n_next;
 } namlist_t;
 
@@ -253,6 +252,7 @@ struct initialization {
 	 * expression.
 	 */
 	namlist_t *designation;
+	namlist_t *designation_tail;
 
 	struct initialization *next;
 };
@@ -475,23 +475,18 @@ end_initialization(void)
 void
 designator_push_name(sbuf_t *sb)
 {
-	namlist_t *designation = *current_designation_mod();
+	const namlist_t *designation = current_designation();
+
 	namlist_t *nam = xcalloc(1, sizeof (namlist_t));
 	nam->n_name = sb->sb_name;
 
-	if (designation == NULL) {
-		/*
-		 * XXX: Why is this a circular list?
-		 * XXX: Why is this a doubly-linked list?
-		 * A simple queue should suffice.
-		 */
-		nam->n_prev = nam->n_next = nam;
-		*current_designation_mod() = nam;
+	/* TODO: remove direct access to 'init' */
+	if (designation != NULL) {
+		init->designation_tail->n_next = nam;
+		init->designation_tail = nam;
 	} else {
-		designation->n_prev->n_next = nam;
-		nam->n_prev = designation->n_prev;
-		nam->n_next = designation;
-		designation->n_prev = nam;
+		init->designation = nam;
+		init->designation_tail = nam;
 	}
 
 	debug_designation();
@@ -527,15 +522,15 @@ designator_push_subscript(range_t range)
 static void
 designator_shift_name(void)
 {
-	namlist_t *head = *current_designation_mod();
-
-	if (head->n_next == head) {
-		free(head);
-		*current_designation_mod() = NULL;
+	/* TODO: remove direct access to 'init' */
+	lint_assert(init != NULL);
+	if (init->designation == init->designation_tail) {
+		free(init->designation);
+		init->designation = NULL;
+		init->designation_tail = NULL;
 	} else {
-		*current_designation_mod() = head->n_next;
-		head->n_prev->n_next = head->n_next;
-		head->n_next->n_prev = head->n_prev;
+		namlist_t *head = init->designation;
+		init->designation = init->designation->n_next;
 		free(head);
 	}
 



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

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 20:38:16 UTC 2021

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

Log Message:
lint: remove over-engineered doubly-linked circular list

The designation only needs to be navigated from head to tail, not the
other way round.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/usr.bin/xlint/lint1/init.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-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 20:11:18 UTC 2021

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

Log Message:
lint: rename debug_named_member to debug_designation

No functional change outside debug mode.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/xlint/lint1/init.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/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.125 src/usr.bin/xlint/lint1/init.c:1.126
--- src/usr.bin/xlint/lint1/init.c:1.125	Thu Mar 25 19:48:25 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 20:11:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.125 2021/03/25 19:48:25 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.126 2021/03/25 20:11:18 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.125 2021/03/25 19:48:25 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.126 2021/03/25 20:11:18 rillig Exp $");
 #endif
 
 #include 
@@ -324,7 +324,7 @@ free_initialization(struct initializatio
 #define debug_enter(a)		do { } while (false)
 #define debug_step(fmt, ...)	do { } while (false)
 #define debug_leave(a)		do { } while (false)
-#define debug_named_member()	do { } while (false)
+#define debug_designation()	do { } while (false)
 #define debug_initstack_element(elem) do { } while (false)
 #define debug_initstack()	do { } while (false)
 
@@ -373,14 +373,14 @@ debug_leave(const char *func)
 }
 
 static void
-debug_named_member(void)
+debug_designation(void)
 {
 	const namlist_t *head = current_designation(), *name;
-
 	if (head == NULL)
 		return;
+
 	debug_indent();
-	debug_printf("named member: ");
+	debug_printf("designation: ");
 	name = head;
 	do {
 		debug_printf(".%s", name->n_name);
@@ -494,7 +494,7 @@ designator_push_name(sbuf_t *sb)
 		designation->n_prev = nam;
 	}
 
-	debug_named_member();
+	debug_designation();
 }
 
 /*
@@ -527,20 +527,19 @@ designator_push_subscript(range_t range)
 static void
 designator_shift_name(void)
 {
-	namlist_t *designation = *current_designation_mod();
+	namlist_t *head = *current_designation_mod();
 
-	if (designation->n_next == designation) {
-		free(designation);
+	if (head->n_next == head) {
+		free(head);
 		*current_designation_mod() = NULL;
 	} else {
-		namlist_t *nam = designation;
-		*current_designation_mod() = designation->n_next;
-		nam->n_prev->n_next = nam->n_next;
-		nam->n_next->n_prev = nam->n_prev;
-		free(nam);
+		*current_designation_mod() = head->n_next;
+		head->n_prev->n_next = head->n_next;
+		head->n_next->n_prev = head->n_prev;
+		free(head);
 	}
 
-	debug_named_member();
+	debug_designation();
 }
 
 /*
@@ -769,7 +768,7 @@ initstack_push_array(void)
 	istk->i_subt = istk->i_type->t_subt;
 	istk->i_array_of_unknown_size = is_incomplete(istk->i_type);
 	istk->i_remaining = istk->i_type->t_dim;
-	debug_named_member();
+	debug_designation();
 	debug_step("type '%s' remaining %d",
 	type_name(istk->i_type), istk->i_remaining);
 }
@@ -795,7 +794,7 @@ initstack_push_struct_or_union(void)
 	}
 
 	cnt = 0;
-	debug_named_member();
+	debug_designation();
 	debug_step("lookup for '%s'%s",
 	type_name(istk->i_type),
 	istk->i_seen_named_member ? ", seen named member" : "");
@@ -970,7 +969,7 @@ initstack_next_brace(void)
 		initstack_push();
 	if (!initerr) {
 		initstk->i_brace = true;
-		debug_named_member();
+		debug_designation();
 		debug_step("expecting type '%s'",
 		type_name(initstk->i_type != NULL ? initstk->i_type
 			: initstk->i_subt));
@@ -1172,7 +1171,7 @@ init_using_expr(tnode_t *tn)
 
 	debug_enter();
 	debug_initstack();
-	debug_named_member();
+	debug_designation();
 	debug_step("expr:");
 	debug_node(tn, debug_ind + 1);
 



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

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 20:11:18 UTC 2021

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

Log Message:
lint: rename debug_named_member to debug_designation

No functional change outside debug mode.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/xlint/lint1/init.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-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 19:48:25 UTC 2021

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

Log Message:
lint: rename i_current_object to i_next_member

No functional change outside debug mode.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/usr.bin/xlint/lint1/init.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/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.124 src/usr.bin/xlint/lint1/init.c:1.125
--- src/usr.bin/xlint/lint1/init.c:1.124	Thu Mar 25 19:33:44 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 19:48:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.124 2021/03/25 19:33:44 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.125 2021/03/25 19:48:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.124 2021/03/25 19:33:44 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.125 2021/03/25 19:48:25 rillig Exp $");
 #endif
 
 #include 
@@ -172,16 +172,14 @@ typedef	struct initstack_element {
 	bool i_seen_named_member: 1;
 
 	/*
-	 * For structs, the next member to be initialized by an initializer
-	 * without an optional designator.
-	 *
-	 * FIXME: The name is wrong.  C99 defines the "current object" as
-	 * being the subobject being initialized, while this is rather the
-	 * next member.  This only makes sense for structs anyway and should
-	 * be amended by i_next_subscript for arrays.  See C99 6.7.8p17 and
-	 * footnote 128 for unions.
+	 * For structs, the next member to be initialized by a designator-less
+	 * initializer.
 	 */
-	sym_t *i_current_object;
+	sym_t *i_next_member;
+
+	/* TODO: Add i_next_subscript for arrays. */
+
+	/* TODO: Understand C99 6.7.8p17 and footnote 128 for unions. */
 
 	/*
 	 * The number of remaining elements to be used by expressions without
@@ -200,7 +198,7 @@ typedef	struct initstack_element {
 	 *
 	 * XXX: Having the count of remaining objects should not be necessary.
 	 * It is probably clearer to use i_next_member and i_next_subscript
-	 * (as suggested in i_current_object) for this purpose.
+	 * for this purpose.
 	 */
 	int i_remaining;
 
@@ -417,9 +415,9 @@ debug_initstack_element(const initstack_
 
 	const type_t *eff_type = elem->i_type != NULL
 	? elem->i_type : elem->i_subt;
-	if (eff_type->t_tspec == STRUCT && elem->i_current_object != NULL)
-		debug_printf(", current object '%s'",
-		elem->i_current_object->s_name);
+	if (eff_type->t_tspec == STRUCT && elem->i_next_member != NULL)
+		debug_printf(", next member '%s'",
+		elem->i_next_member->s_name);
 
 	debug_printf(", remaining %d\n", elem->i_remaining);
 }
@@ -641,8 +639,8 @@ initstack_pop_item_unnamed(void)
 	if (istk->i_remaining > 0 && istk->i_type->t_tspec == STRUCT &&
 	!istk->i_seen_named_member) {
 		do {
-			m = istk->i_current_object =
-			istk->i_current_object->s_next;
+			m = istk->i_next_member =
+			istk->i_next_member->s_next;
 			/* XXX: can this assertion be made to fail? */
 			lint_assert(m != NULL);
 			debug_step("pop %s", m->s_name);
@@ -826,7 +824,7 @@ initstack_push_struct_or_union(void)
 continue;
 		}
 		if (++cnt == 1) {
-			istk->i_current_object = m;
+			istk->i_next_member = m;
 			istk->i_subt = m->s_type;
 		}
 	}
@@ -836,7 +834,7 @@ initstack_push_struct_or_union(void)
 			debug_step("pop struct");
 			return true;
 		}
-		istk->i_current_object = m;
+		istk->i_next_member = m;
 		istk->i_subt = m->s_type;
 		istk->i_seen_named_member = true;
 		debug_step("named member '%s'", current_designation()->n_name);



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

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 19:48:25 UTC 2021

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

Log Message:
lint: rename i_current_object to i_next_member

No functional change outside debug mode.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/usr.bin/xlint/lint1/init.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-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 19:33:44 UTC 2021

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

Log Message:
lint: rename the few remaining instances of 'namedmem'

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/usr.bin/xlint/lint1/init.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/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.123 src/usr.bin/xlint/lint1/init.c:1.124
--- src/usr.bin/xlint/lint1/init.c:1.123	Thu Mar 25 19:20:15 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 19:33:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.123 2021/03/25 19:20:15 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.124 2021/03/25 19:33:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.123 2021/03/25 19:20:15 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.124 2021/03/25 19:33:44 rillig Exp $");
 #endif
 
 #include 
@@ -250,8 +250,11 @@ struct initialization {
 	/* Points to the top element of the initialization stack. */
 	initstack_element *initstk;
 
-	/* Points to a c9x named member. */
-	namlist_t *namedmem;
+	/*
+	 * The C99 designator, if any, for the current initialization
+	 * expression.
+	 */
+	namlist_t *designation;
 
 	struct initialization *next;
 };
@@ -283,7 +286,7 @@ static namlist_t **
 current_designation_mod(void)
 {
 	lint_assert(init != NULL);
-	return >namedmem;
+	return >designation;
 }
 
 static const namlist_t *
@@ -751,8 +754,10 @@ initstack_push_array(void)
 
 	if (istk->i_enclosing->i_seen_named_member) {
 		istk->i_brace = true;
-		debug_step("ARRAY brace=%d, namedmem=%d",
-		istk->i_brace, istk->i_enclosing->i_seen_named_member);
+		debug_step("ARRAY%s%s",
+		istk->i_brace ? ", needs closing brace" : "",
+		istk->i_enclosing->i_seen_named_member
+			? ", seen named member" : "");
 	}
 
 	if (is_incomplete(istk->i_type) &&
@@ -880,8 +885,9 @@ again:
 	switch (istk->i_type->t_tspec) {
 	case ARRAY:
 		if (current_designation() != NULL) {
-			debug_step("pop array namedmem=%s brace=%d",
-			current_designation()->n_name, istk->i_brace);
+			debug_step("pop array, named member '%s'%s",
+			current_designation()->n_name,
+			istk->i_brace ? ", needs closing brace" : "");
 			goto pop;
 		}
 



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

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 19:33:44 UTC 2021

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

Log Message:
lint: rename the few remaining instances of 'namedmem'

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/usr.bin/xlint/lint1/init.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-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 19:20:15 UTC 2021

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

Log Message:
lint: split current_namedmem into lvalue and rvalue form, rename them

This is a small step towards using the terminology from C99.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/usr.bin/xlint/lint1/init.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/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.122 src/usr.bin/xlint/lint1/init.c:1.123
--- src/usr.bin/xlint/lint1/init.c:1.122	Thu Mar 25 19:11:18 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 19:20:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.122 2021/03/25 19:11:18 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.123 2021/03/25 19:20:15 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.122 2021/03/25 19:11:18 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.123 2021/03/25 19:20:15 rillig Exp $");
 #endif
 
 #include 
@@ -280,12 +280,18 @@ current_initsym(void)
 }
 
 static namlist_t **
-current_namedmem(void)
+current_designation_mod(void)
 {
 	lint_assert(init != NULL);
 	return >namedmem;
 }
 
+static const namlist_t *
+current_designation(void)
+{
+	return *current_designation_mod();
+}
+
 static initstack_element **
 current_initstk(void)
 {
@@ -368,7 +374,7 @@ debug_leave(const char *func)
 static void
 debug_named_member(void)
 {
-	namlist_t *head = *current_namedmem(), *name;
+	const namlist_t *head = current_designation(), *name;
 
 	if (head == NULL)
 		return;
@@ -468,7 +474,7 @@ end_initialization(void)
 void
 designator_push_name(sbuf_t *sb)
 {
-	namlist_t *designation = *current_namedmem();
+	namlist_t *designation = *current_designation_mod();
 	namlist_t *nam = xcalloc(1, sizeof (namlist_t));
 	nam->n_name = sb->sb_name;
 
@@ -479,7 +485,7 @@ designator_push_name(sbuf_t *sb)
 		 * A simple queue should suffice.
 		 */
 		nam->n_prev = nam->n_next = nam;
-		*current_namedmem() = nam;
+		*current_designation_mod() = nam;
 	} else {
 		designation->n_prev->n_next = nam;
 		nam->n_prev = designation->n_prev;
@@ -520,14 +526,14 @@ designator_push_subscript(range_t range)
 static void
 designator_shift_name(void)
 {
-	namlist_t *designation = *current_namedmem();
+	namlist_t *designation = *current_designation_mod();
 
 	if (designation->n_next == designation) {
 		free(designation);
-		*current_namedmem() = NULL;
+		*current_designation_mod() = NULL;
 	} else {
 		namlist_t *nam = designation;
-		*current_namedmem() = designation->n_next;
+		*current_designation_mod() = designation->n_next;
 		nam->n_prev->n_next = nam->n_next;
 		nam->n_next->n_prev = nam->n_prev;
 		free(nam);
@@ -551,7 +557,7 @@ initstack_init(void)
 		return;
 
 	/* TODO: merge into init_using_expr */
-	while (*current_namedmem() != NULL)
+	while (current_designation() != NULL)
 		designator_shift_name();
 
 	debug_enter();
@@ -584,7 +590,7 @@ initstack_pop_item_named_member(void)
 	 * related to initializing the named member.
 	 */
 	debug_step("initializing named member '%s'",
-	(*current_namedmem())->n_name);
+	current_designation()->n_name);
 
 	if (istk->i_type->t_tspec != STRUCT &&
 	istk->i_type->t_tspec != UNION) {
@@ -600,7 +606,7 @@ initstack_pop_item_named_member(void)
 		if (m->s_bitfield && m->s_name == unnamed)
 			continue;
 
-		if (strcmp(m->s_name, (*current_namedmem())->n_name) == 0) {
+		if (strcmp(m->s_name, current_designation()->n_name) == 0) {
 			debug_step("found matching member");
 			istk->i_subt = m->s_type;
 			/* XXX: why ++? */
@@ -612,7 +618,7 @@ initstack_pop_item_named_member(void)
 	}
 
 	/* undefined struct/union member: %s */
-	error(101, (*current_namedmem())->n_name);
+	error(101, current_designation()->n_name);
 
 	designator_shift_name();
 	istk->i_seen_named_member = true;
@@ -665,7 +671,7 @@ initstack_pop_item(void)
 	lint_assert(istk->i_remaining >= 0);
 	debug_step("%d elements remaining", istk->i_remaining);
 
-	if (*current_namedmem() != NULL)
+	if (current_designation() != NULL)
 		initstack_pop_item_named_member();
 	else
 		initstack_pop_item_unnamed();
@@ -803,11 +809,11 @@ initstack_push_struct_or_union(void)
 		 * look_up_struct_next
 		 * look_up_struct_designator
 		 */
-		if (*current_namedmem() != NULL) {
+		if (current_designation() != NULL) {
 			/* XXX: this log entry looks unnecessarily verbose */
 			debug_step("have member '%s', want member '%s'",
-			m->s_name, (*current_namedmem())->n_name);
-			if (strcmp(m->s_name, (*current_namedmem())->n_name) ==
+			m->s_name, current_designation()->n_name);
+			if (strcmp(m->s_name, current_designation()->n_name) ==
 			0) {
 cnt++;
 break;
@@ -820,7 +826,7 @@ initstack_push_struct_or_union(void)
 		}
 	}
 
-	if 

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

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 19:20:15 UTC 2021

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

Log Message:
lint: split current_namedmem into lvalue and rvalue form, rename them

This is a small step towards using the terminology from C99.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/usr.bin/xlint/lint1/init.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-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 19:11:18 UTC 2021

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

Log Message:
lint: inline macro 'namedmem' for C99 designators

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/xlint/lint1/init.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/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.121 src/usr.bin/xlint/lint1/init.c:1.122
--- src/usr.bin/xlint/lint1/init.c:1.121	Thu Mar 25 16:43:51 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 19:11:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.121 2021/03/25 16:43:51 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.122 2021/03/25 19:11:18 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.121 2021/03/25 16:43:51 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.122 2021/03/25 19:11:18 rillig Exp $");
 #endif
 
 #include 
@@ -309,7 +309,6 @@ free_initialization(struct initializatio
 #define initerr		(*current_initerr())
 #define initsym		(*current_initsym())
 #define initstk		(*current_initstk())
-#define namedmem	(*current_namedmem())
 
 #ifndef DEBUG
 
@@ -369,17 +368,17 @@ debug_leave(const char *func)
 static void
 debug_named_member(void)
 {
-	namlist_t *name;
+	namlist_t *head = *current_namedmem(), *name;
 
-	if (namedmem == NULL)
+	if (head == NULL)
 		return;
-	name = namedmem;
 	debug_indent();
 	debug_printf("named member: ");
+	name = head;
 	do {
 		debug_printf(".%s", name->n_name);
 		name = name->n_next;
-	} while (name != namedmem);
+	} while (name != head);
 	debug_printf("\n");
 }
 
@@ -469,22 +468,23 @@ end_initialization(void)
 void
 designator_push_name(sbuf_t *sb)
 {
+	namlist_t *designation = *current_namedmem();
 	namlist_t *nam = xcalloc(1, sizeof (namlist_t));
 	nam->n_name = sb->sb_name;
 
-	if (namedmem == NULL) {
+	if (designation == NULL) {
 		/*
 		 * XXX: Why is this a circular list?
 		 * XXX: Why is this a doubly-linked list?
 		 * A simple queue should suffice.
 		 */
 		nam->n_prev = nam->n_next = nam;
-		namedmem = nam;
+		*current_namedmem() = nam;
 	} else {
-		namedmem->n_prev->n_next = nam;
-		nam->n_prev = namedmem->n_prev;
-		nam->n_next = namedmem;
-		namedmem->n_prev = nam;
+		designation->n_prev->n_next = nam;
+		nam->n_prev = designation->n_prev;
+		nam->n_next = designation;
+		designation->n_prev = nam;
 	}
 
 	debug_named_member();
@@ -520,12 +520,14 @@ designator_push_subscript(range_t range)
 static void
 designator_shift_name(void)
 {
-	if (namedmem->n_next == namedmem) {
-		free(namedmem);
-		namedmem = NULL;
+	namlist_t *designation = *current_namedmem();
+
+	if (designation->n_next == designation) {
+		free(designation);
+		*current_namedmem() = NULL;
 	} else {
-		namlist_t *nam = namedmem;
-		namedmem = namedmem->n_next;
+		namlist_t *nam = designation;
+		*current_namedmem() = designation->n_next;
 		nam->n_prev->n_next = nam->n_next;
 		nam->n_next->n_prev = nam->n_prev;
 		free(nam);
@@ -549,7 +551,7 @@ initstack_init(void)
 		return;
 
 	/* TODO: merge into init_using_expr */
-	while (namedmem != NULL)
+	while (*current_namedmem() != NULL)
 		designator_shift_name();
 
 	debug_enter();
@@ -581,7 +583,8 @@ initstack_pop_item_named_member(void)
 	 * TODO: fix wording of the debug message; this doesn't seem to be
 	 * related to initializing the named member.
 	 */
-	debug_step("initializing named member '%s'", namedmem->n_name);
+	debug_step("initializing named member '%s'",
+	(*current_namedmem())->n_name);
 
 	if (istk->i_type->t_tspec != STRUCT &&
 	istk->i_type->t_tspec != UNION) {
@@ -597,7 +600,7 @@ initstack_pop_item_named_member(void)
 		if (m->s_bitfield && m->s_name == unnamed)
 			continue;
 
-		if (strcmp(m->s_name, namedmem->n_name) == 0) {
+		if (strcmp(m->s_name, (*current_namedmem())->n_name) == 0) {
 			debug_step("found matching member");
 			istk->i_subt = m->s_type;
 			/* XXX: why ++? */
@@ -609,7 +612,7 @@ initstack_pop_item_named_member(void)
 	}
 
 	/* undefined struct/union member: %s */
-	error(101, namedmem->n_name);
+	error(101, (*current_namedmem())->n_name);
 
 	designator_shift_name();
 	istk->i_seen_named_member = true;
@@ -662,7 +665,7 @@ initstack_pop_item(void)
 	lint_assert(istk->i_remaining >= 0);
 	debug_step("%d elements remaining", istk->i_remaining);
 
-	if (namedmem != NULL)
+	if (*current_namedmem() != NULL)
 		initstack_pop_item_named_member();
 	else
 		initstack_pop_item_unnamed();
@@ -800,11 +803,12 @@ initstack_push_struct_or_union(void)
 		 * look_up_struct_next
 		 * look_up_struct_designator
 		 */
-		if (namedmem != NULL) {
+		if (*current_namedmem() != NULL) {
 			/* XXX: this log entry looks unnecessarily verbose */
 			debug_step("have member '%s', want member '%s'",
-			m->s_name, 

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

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 19:11:18 UTC 2021

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

Log Message:
lint: inline macro 'namedmem' for C99 designators

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/xlint/lint1/init.c

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



CVS commit: src/doc

2021-03-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 25 18:52:23 UTC 2021

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new OpenSSL


To generate a diff of this commit:
cvs rdiff -u -r1.1785 -r1.1786 src/doc/3RDPARTY
cvs rdiff -u -r1.2786 -r1.2787 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1785 src/doc/3RDPARTY:1.1786
--- src/doc/3RDPARTY:1.1785	Mon Mar 15 16:18:21 2021
+++ src/doc/3RDPARTY	Thu Mar 25 14:52:23 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1785 2021/03/15 20:18:21 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1786 2021/03/25 18:52:23 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1113,12 +1113,12 @@ markus is very cooperative about it):
 - adjust the DEFAULT_PKCS11_WHITELIST for ssh-agent
 
 Package:	OpenSSL
-Version:	1.0.2o/1.1.1j
-Current Vers:	1.0.2t/1.1.1j
+Version:	1.0.2o/1.1.1k
+Current Vers:	1.0.2t/1.1.1k
 Maintainer:	The OpenSSL Project
 Archive Site:	ftp://ftp.openssl.org/source/
 Home Page:	http://www.openssl.org/
-Date:		2021-02-19
+Date:		2021-03-25
 Mailing List:	openssl-annou...@openssl.org
 Responsible:	christos, mjf, tls, riastradh, spz
 License:	OpenSSL and SSLeay license (both BSD-like)

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2786 src/doc/CHANGES:1.2787
--- src/doc/CHANGES:1.2786	Mon Mar 15 16:18:21 2021
+++ src/doc/CHANGES	Thu Mar 25 14:52:23 2021
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2786 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2787 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -340,3 +340,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	OpenSSH: Import 8.5. [christos 20210304]
 	nsd: Import 4.3.5. [christos 20210315]
 	unbound(8): Import 1.13.1. [christos 20210315]
+	OpenSSL: Imported 1.1.1k. [christos 20210325]



CVS commit: src/doc

2021-03-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 25 18:52:23 UTC 2021

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new OpenSSL


To generate a diff of this commit:
cvs rdiff -u -r1.1785 -r1.1786 src/doc/3RDPARTY
cvs rdiff -u -r1.2786 -r1.2787 src/doc/CHANGES

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



CVS commit: src/crypto/external/bsd/openssl/dist

2021-03-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 25 18:51:19 UTC 2021

Modified Files:
src/crypto/external/bsd/openssl/dist: CHANGES NEWS README
src/crypto/external/bsd/openssl/dist/apps: s_time.c
src/crypto/external/bsd/openssl/dist/crypto/engine: eng_devcrypto.c
src/crypto/external/bsd/openssl/dist/crypto/evp: evp_enc.c
src/crypto/external/bsd/openssl/dist/crypto/modes: gcm128.c
src/crypto/external/bsd/openssl/dist/crypto/x509: x509_vfy.c
src/crypto/external/bsd/openssl/dist/ssl: s3_lib.c ssl_lib.c
src/crypto/external/bsd/openssl/dist/test: rsa_test.c

Log Message:
merge our changes between 1.1.1j and 1.1.1k


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/crypto/external/bsd/openssl/dist/CHANGES \
src/crypto/external/bsd/openssl/dist/NEWS \
src/crypto/external/bsd/openssl/dist/README
cvs rdiff -u -r1.11 -r1.12 src/crypto/external/bsd/openssl/dist/apps/s_time.c
cvs rdiff -u -r1.8 -r1.9 \
src/crypto/external/bsd/openssl/dist/crypto/engine/eng_devcrypto.c
cvs rdiff -u -r1.12 -r1.13 \
src/crypto/external/bsd/openssl/dist/crypto/evp/evp_enc.c
cvs rdiff -u -r1.10 -r1.11 \
src/crypto/external/bsd/openssl/dist/crypto/modes/gcm128.c
cvs rdiff -u -r1.22 -r1.23 \
src/crypto/external/bsd/openssl/dist/crypto/x509/x509_vfy.c
cvs rdiff -u -r1.27 -r1.28 src/crypto/external/bsd/openssl/dist/ssl/s3_lib.c
cvs rdiff -u -r1.19 -r1.20 src/crypto/external/bsd/openssl/dist/ssl/ssl_lib.c
cvs rdiff -u -r1.7 -r1.8 src/crypto/external/bsd/openssl/dist/test/rsa_test.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/CHANGES
diff -u src/crypto/external/bsd/openssl/dist/CHANGES:1.26 src/crypto/external/bsd/openssl/dist/CHANGES:1.27
--- src/crypto/external/bsd/openssl/dist/CHANGES:1.26	Fri Feb 19 22:22:13 2021
+++ src/crypto/external/bsd/openssl/dist/CHANGES	Thu Mar 25 14:51:18 2021
@@ -7,6 +7,50 @@
  https://github.com/openssl/openssl/commits/ and pick the appropriate
  release branch.
 
+ Changes between 1.1.1j and 1.1.1k [25 Mar 2021]
+
+  *) Fixed a problem with verifying a certificate chain when using the
+ X509_V_FLAG_X509_STRICT flag. This flag enables additional security checks
+ of the certificates present in a certificate chain. It is not set by
+ default.
+
+ Starting from OpenSSL version 1.1.1h a check to disallow certificates in
+ the chain that have explicitly encoded elliptic curve parameters was added
+ as an additional strict check.
+
+ An error in the implementation of this check meant that the result of a
+ previous check to confirm that certificates in the chain are valid CA
+ certificates was overwritten. This effectively bypasses the check
+ that non-CA certificates must not be able to issue other certificates.
+
+ If a "purpose" has been configured then there is a subsequent opportunity
+ for checks that the certificate is a valid CA.  All of the named "purpose"
+ values implemented in libcrypto perform this check.  Therefore, where
+ a purpose is set the certificate chain will still be rejected even when the
+ strict flag has been used. A purpose is set by default in libssl client and
+ server certificate verification routines, but it can be overridden or
+ removed by an application.
+
+ In order to be affected, an application must explicitly set the
+ X509_V_FLAG_X509_STRICT verification flag and either not set a purpose
+ for the certificate verification or, in the case of TLS client or server
+ applications, override the default purpose.
+ (CVE-2021-3450)
+ [Tomáš Mráz]
+
+  *) Fixed an issue where an OpenSSL TLS server may crash if sent a maliciously
+ crafted renegotiation ClientHello message from a client. If a TLSv1.2
+ renegotiation ClientHello omits the signature_algorithms extension (where
+ it was present in the initial ClientHello), but includes a
+ signature_algorithms_cert extension then a NULL pointer dereference will
+ result, leading to a crash and a denial of service attack.
+
+ A server is only vulnerable if it has TLSv1.2 and renegotiation enabled
+ (which is the default configuration). OpenSSL TLS clients are not impacted
+ by this issue.
+ (CVE-2021-3449)
+ [Peter Kästle and Samuel Sapalski]
+
  Changes between 1.1.1i and 1.1.1j [16 Feb 2021]
 
   *) Fixed the X509_issuer_and_serial_hash() function. It attempts to
Index: src/crypto/external/bsd/openssl/dist/NEWS
diff -u src/crypto/external/bsd/openssl/dist/NEWS:1.26 src/crypto/external/bsd/openssl/dist/NEWS:1.27
--- src/crypto/external/bsd/openssl/dist/NEWS:1.26	Fri Feb 19 22:22:13 2021
+++ src/crypto/external/bsd/openssl/dist/NEWS	Thu Mar 25 14:51:18 2021
@@ -5,6 +5,14 @@
   This file gives a brief overview of the major changes between each OpenSSL
   release. 

CVS commit: src/crypto/external/bsd/openssl/dist

2021-03-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 25 18:51:19 UTC 2021

Modified Files:
src/crypto/external/bsd/openssl/dist: CHANGES NEWS README
src/crypto/external/bsd/openssl/dist/apps: s_time.c
src/crypto/external/bsd/openssl/dist/crypto/engine: eng_devcrypto.c
src/crypto/external/bsd/openssl/dist/crypto/evp: evp_enc.c
src/crypto/external/bsd/openssl/dist/crypto/modes: gcm128.c
src/crypto/external/bsd/openssl/dist/crypto/x509: x509_vfy.c
src/crypto/external/bsd/openssl/dist/ssl: s3_lib.c ssl_lib.c
src/crypto/external/bsd/openssl/dist/test: rsa_test.c

Log Message:
merge our changes between 1.1.1j and 1.1.1k


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/crypto/external/bsd/openssl/dist/CHANGES \
src/crypto/external/bsd/openssl/dist/NEWS \
src/crypto/external/bsd/openssl/dist/README
cvs rdiff -u -r1.11 -r1.12 src/crypto/external/bsd/openssl/dist/apps/s_time.c
cvs rdiff -u -r1.8 -r1.9 \
src/crypto/external/bsd/openssl/dist/crypto/engine/eng_devcrypto.c
cvs rdiff -u -r1.12 -r1.13 \
src/crypto/external/bsd/openssl/dist/crypto/evp/evp_enc.c
cvs rdiff -u -r1.10 -r1.11 \
src/crypto/external/bsd/openssl/dist/crypto/modes/gcm128.c
cvs rdiff -u -r1.22 -r1.23 \
src/crypto/external/bsd/openssl/dist/crypto/x509/x509_vfy.c
cvs rdiff -u -r1.27 -r1.28 src/crypto/external/bsd/openssl/dist/ssl/s3_lib.c
cvs rdiff -u -r1.19 -r1.20 src/crypto/external/bsd/openssl/dist/ssl/ssl_lib.c
cvs rdiff -u -r1.7 -r1.8 src/crypto/external/bsd/openssl/dist/test/rsa_test.c

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



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2021-03-25 Thread Greg Troxel
Module Name:src
Committed By:   gdt
Date:   Thu Mar 25 18:41:29 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_ioctl.c

Log Message:
zfs_ioctl.c: Drop WARNING that ZFS is under development

Following discussions on current-users@, it seems many rely on ZFS to
store data, and there are not particularly large issues with ZFS.  ATF
tests with /tmp as tmpfs, ffs2, and zfs are similar, with only a
slight increase in failures under zfs.

(This commit should probably NOT be pulled up to 9.)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.22 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.23
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.22	Fri Feb 28 03:52:26 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c	Thu Mar 25 18:41:29 2021
@@ -7194,7 +7194,6 @@ zfs_modcmd(modcmd_t cmd, void *arg)
 		/* XXXNETBSD trim is not supported yet */
 		zfs_trim_enabled = B_FALSE;
 
-		printf("WARNING: ZFS on NetBSD is under development\n");
 		availrmem = (uint64_t)physmem * PAGE_SIZE / 1048576;
 		if (availrmem < ZFS_MIN_MEGS * 80 / 100) {
 			printf("ERROR: at least %dMB of memory required to "



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2021-03-25 Thread Greg Troxel
Module Name:src
Committed By:   gdt
Date:   Thu Mar 25 18:41:29 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_ioctl.c

Log Message:
zfs_ioctl.c: Drop WARNING that ZFS is under development

Following discussions on current-users@, it seems many rely on ZFS to
store data, and there are not particularly large issues with ZFS.  ATF
tests with /tmp as tmpfs, ffs2, and zfs are similar, with only a
slight increase in failures under zfs.

(This commit should probably NOT be pulled up to 9.)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c

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



CVS commit: xsrc/external/mit/xf86-video-nv/dist/src

2021-03-25 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Mar 25 17:22:02 UTC 2021

Modified Files:
xsrc/external/mit/xf86-video-nv/dist/src: nv_setup.c

Log Message:
try WSDISPLAYIO_GET_EDID if DDC2 fails
now my iMac G5 correctly identifies its display


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.5 -r1.2 \
xsrc/external/mit/xf86-video-nv/dist/src/nv_setup.c

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



CVS commit: xsrc/external/mit/xf86-video-nv/dist/src

2021-03-25 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Mar 25 17:22:02 UTC 2021

Modified Files:
xsrc/external/mit/xf86-video-nv/dist/src: nv_setup.c

Log Message:
try WSDISPLAYIO_GET_EDID if DDC2 fails
now my iMac G5 correctly identifies its display


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.5 -r1.2 \
xsrc/external/mit/xf86-video-nv/dist/src/nv_setup.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-nv/dist/src/nv_setup.c
diff -u xsrc/external/mit/xf86-video-nv/dist/src/nv_setup.c:1.1.1.5 xsrc/external/mit/xf86-video-nv/dist/src/nv_setup.c:1.2
--- xsrc/external/mit/xf86-video-nv/dist/src/nv_setup.c:1.1.1.5	Sun Mar  5 01:55:42 2017
+++ xsrc/external/mit/xf86-video-nv/dist/src/nv_setup.c	Thu Mar 25 17:22:02 2021
@@ -25,8 +25,16 @@
 #include "config.h"
 #endif
 
+#include "xf86Priv.h"
+#include "xf86Privstr.h"
 #include "nv_include.h"
 
+#ifdef __NetBSD__
+#include 
+#include 
+#include 
+#endif
+
 /*
  * Override VGA I/O routines.
  */
@@ -234,6 +242,26 @@ NVProbeDDC (ScrnInfoPtr pScrn, int bus)
 #else
 MonInfo = xf86DoEDID_DDC2(XF86_SCRN_ARG(pScrn), pNv->I2C);
 #endif
+#ifdef __NetBSD__
+if (!MonInfo) {
+	/* ask wsdisplay */
+	struct wsdisplayio_edid_info ei;
+	char *buffer;
+	xf86MonPtr tmp;
+
+	buffer = malloc(1024);
+	ei.edid_data = buffer;
+	ei.buffer_size = 1024;
+	if (ioctl(xf86Info.consoleFd, WSDISPLAYIO_GET_EDID, ) != -1) {
+	xf86Msg(X_INFO, "got %d bytes worth of EDID from wsdisplay\n",
+		ei.data_size);
+	tmp = xf86InterpretEEDID(pScrn->scrnIndex, buffer);
+	tmp->flags |= MONITOR_EDID_COMPLETE_RAWDATA;
+	MonInfo = tmp;
+	}
+	free(buffer);
+}
+#endif
 if (MonInfo) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
   "DDC detected a %s:\n", MonInfo->features.input_type ?



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

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 16:43:51 UTC 2021

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

Log Message:
lint: free memory at the end of an initialization

No functional change, just more clarity in the code.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/lint1/init.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-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 16:43:51 UTC 2021

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

Log Message:
lint: free memory at the end of an initialization

No functional change, just more clarity in the code.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/lint1/init.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/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.120 src/usr.bin/xlint/lint1/init.c:1.121
--- src/usr.bin/xlint/lint1/init.c:1.120	Thu Mar 25 16:30:23 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 16:43:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.120 2021/03/25 16:30:23 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.121 2021/03/25 16:43:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.120 2021/03/25 16:30:23 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.121 2021/03/25 16:43:51 rillig Exp $");
 #endif
 
 #include 
@@ -293,6 +293,19 @@ current_initstk(void)
 	return >initstk;
 }
 
+static void
+free_initialization(struct initialization *in)
+{
+	initstack_element *el, *next;
+
+	for (el = in->initstk; el != NULL; el = next) {
+		next = el->i_enclosing;
+		free(el);
+	}
+
+	free(in);
+}
+
 #define initerr		(*current_initerr())
 #define initsym		(*current_initsym())
 #define initstk		(*current_initstk())
@@ -449,7 +462,7 @@ end_initialization(void)
 
 	curr_init = init;
 	init = init->next;
-	free(curr_init);
+	free_initialization(curr_init);
 	debug_step("end initialization");
 }
 
@@ -535,13 +548,6 @@ initstack_init(void)
 	if (initerr)
 		return;
 
-	/* TODO: merge into end_initialization */
-	/* free memory used in last initialization */
-	while ((istk = initstk) != NULL) {
-		initstk = istk->i_enclosing;
-		free(istk);
-	}
-
 	/* TODO: merge into init_using_expr */
 	while (namedmem != NULL)
 		designator_shift_name();



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

2021-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Mar 25 16:34:59 UTC 2021

Modified Files:
src/sys/arch/arm/omap: ti_iic.c

Log Message:
ti_iic_{acquire,release}_bus are no more.  Missed in rev 1.11.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/omap/ti_iic.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/arm/omap/ti_iic.c
diff -u src/sys/arch/arm/omap/ti_iic.c:1.12 src/sys/arch/arm/omap/ti_iic.c:1.13
--- src/sys/arch/arm/omap/ti_iic.c:1.12	Thu May 14 08:34:20 2020
+++ src/sys/arch/arm/omap/ti_iic.c	Thu Mar 25 16:34:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_iic.c,v 1.12 2020/05/14 08:34:20 msaitoh Exp $ */
+/* $NetBSD: ti_iic.c,v 1.13 2021/03/25 16:34:59 thorpej Exp $ */
 
 /*
  * Copyright (c) 2013 Manuel Bouyer.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.12 2020/05/14 08:34:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.13 2021/03/25 16:34:59 thorpej Exp $");
 
 #include "opt_omap.h"
 #include "locators.h"
@@ -216,8 +216,6 @@ ti_iic_attach(device_t parent, device_t 
 
 	iic_tag_init(>sc_ic);
 	sc->sc_ic.ic_cookie = sc;
-	sc->sc_ic.ic_acquire_bus = ti_iic_acquire_bus;
-	sc->sc_ic.ic_release_bus = ti_iic_release_bus;
 	sc->sc_ic.ic_exec = ti_iic_exec;
 
 	if (bus_space_map(obio->obio_iot, obio->obio_addr, obio->obio_size,



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

2021-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Mar 25 16:34:59 UTC 2021

Modified Files:
src/sys/arch/arm/omap: ti_iic.c

Log Message:
ti_iic_{acquire,release}_bus are no more.  Missed in rev 1.11.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/omap/ti_iic.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-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 16:30:23 UTC 2021

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

Log Message:
lint: condense debug output for initializations

This way it does not look more impressive than it really is.

No functional change outside debug mode.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/usr.bin/xlint/lint1/init.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/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.119 src/usr.bin/xlint/lint1/init.c:1.120
--- src/usr.bin/xlint/lint1/init.c:1.119	Thu Mar 25 13:10:19 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 16:30:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.119 2021/03/25 13:10:19 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.120 2021/03/25 16:30:23 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.119 2021/03/25 13:10:19 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.120 2021/03/25 16:30:23 rillig Exp $");
 #endif
 
 #include 
@@ -380,27 +380,27 @@ debug_named_member(void)
 static void
 debug_initstack_element(const initstack_element *elem)
 {
-	/* TODO: use debug_ind++ instead of the leading spaces here */
-
 	if (elem->i_type != NULL)
-		debug_step("  i_type   = %s", type_name(elem->i_type));
+		debug_printf("type '%s'", type_name(elem->i_type));
+	if (elem->i_type != NULL && elem->i_subt != NULL)
+		debug_printf(", ");
 	if (elem->i_subt != NULL)
-		debug_step("  i_subt   = %s", type_name(elem->i_subt));
+		debug_printf("subtype '%s'", type_name(elem->i_subt));
 
 	if (elem->i_brace)
-		debug_step("  i_brace");
+		debug_printf(", needs closing brace");
 	if (elem->i_array_of_unknown_size)
-		debug_step("  i_array_of_unknown_size");
+		debug_printf(", array of unknown size");
 	if (elem->i_seen_named_member)
-		debug_step("  i_seen_named_member");
+		debug_printf(", seen named member");
 
 	const type_t *eff_type = elem->i_type != NULL
 	? elem->i_type : elem->i_subt;
 	if (eff_type->t_tspec == STRUCT && elem->i_current_object != NULL)
-		debug_step("  i_current_object = %s",
+		debug_printf(", current object '%s'",
 		elem->i_current_object->s_name);
 
-	debug_step("  i_remaining  = %d", elem->i_remaining);
+	debug_printf(", remaining %d\n", elem->i_remaining);
 }
 
 /*
@@ -417,7 +417,8 @@ debug_initstack(void)
 	size_t i = 0;
 	for (const initstack_element *elem = initstk;
 	 elem != NULL; elem = elem->i_enclosing) {
-		debug_step("initstk[%zu]:", i);
+		debug_indent();
+		debug_printf("initstk[%zu]: ", i);
 		debug_initstack_element(elem);
 		i++;
 	}
@@ -642,7 +643,8 @@ initstack_pop_item(void)
 	debug_enter();
 
 	istk = initstk;
-	debug_step("popping:");
+	debug_indent();
+	debug_printf("popping: ");
 	debug_initstack_element(istk);
 
 	initstk = istk->i_enclosing;



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

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 16:30:23 UTC 2021

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

Log Message:
lint: condense debug output for initializations

This way it does not look more impressive than it really is.

No functional change outside debug mode.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/usr.bin/xlint/lint1/init.c

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



CVS commit: [thorpej-cfargs] src/sys/arch/arm/omap

2021-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Mar 25 15:59:50 UTC 2021

Modified Files:
src/sys/arch/arm/omap [thorpej-cfargs]: files.omap2

Log Message:
Nothing uses / references the "mode" locator on the "tiotg_port"
interface attribute; remove it.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.30.1 src/sys/arch/arm/omap/files.omap2

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/omap/files.omap2
diff -u src/sys/arch/arm/omap/files.omap2:1.36 src/sys/arch/arm/omap/files.omap2:1.36.30.1
--- src/sys/arch/arm/omap/files.omap2:1.36	Sat Oct 15 15:11:56 2016
+++ src/sys/arch/arm/omap/files.omap2	Thu Mar 25 15:59:49 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.omap2,v 1.36 2016/10/15 15:11:56 kiyohara Exp $
+#	$NetBSD: files.omap2,v 1.36.30.1 2021/03/25 15:59:49 thorpej Exp $
 #
 # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support
 # Based on xscale/files.pxa2x0
@@ -126,7 +126,7 @@ attach	edma at mainbus
 file	arch/arm/omap/omap_edma.c		edma needs-flag
 
 # TI OTG controller
-define  tiotg_port {[port = -1], [mode = -1]}
+define  tiotg_port { [port = -1] }
 device	tiotg: tiotg_port
 attach	tiotg at mainbus
 file	arch/arm/omap/tiotg.c			tiotg



CVS commit: [thorpej-cfargs] src/sys/arch/arm/omap

2021-03-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Mar 25 15:59:50 UTC 2021

Modified Files:
src/sys/arch/arm/omap [thorpej-cfargs]: files.omap2

Log Message:
Nothing uses / references the "mode" locator on the "tiotg_port"
interface attribute; remove it.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.30.1 src/sys/arch/arm/omap/files.omap2

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-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 13:10:19 UTC 2021

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

Log Message:
lint: add comments about things left to do, from code review

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/usr.bin/xlint/lint1/init.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/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.118 src/usr.bin/xlint/lint1/init.c:1.119
--- src/usr.bin/xlint/lint1/init.c:1.118	Thu Mar 25 01:42:53 2021
+++ src/usr.bin/xlint/lint1/init.c	Thu Mar 25 13:10:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.118 2021/03/25 01:42:53 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.119 2021/03/25 13:10:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.118 2021/03/25 01:42:53 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.119 2021/03/25 13:10:19 rillig Exp $");
 #endif
 
 #include 
@@ -59,21 +59,30 @@ __RCSID("$NetBSD: init.c,v 1.118 2021/03
  *	int array_nested[2][2] = { { 11, 12 }, { 21, 22 } };
  *
  *	struct { int x, y; } point = { 3, 4 };
- *	struct { int x, y; } point = { .y = 3, .x = 4 };
+ *	struct { int x, y; } point = { .y = 4, .x = 3 };
  *
- * Any scalar expression in the initializer may be surrounded by an extra pair
- * of braces, like in the example 'number_with_braces' (C99 6.7.8p11).  For
- * multi-dimensional arrays, the inner braces may be omitted like in
+ * Any scalar expression in the initializer may be surrounded by arbitrarily
+ * many extra pairs of braces, like in the example 'number_with_braces' (C99
+ * 6.7.8p11).
+ *
+ * For multi-dimensional arrays, the inner braces may be omitted like in
  * array_flat or spelled out like in array_nested.
  *
  * For the initializer, the grammar parser calls these functions:
  *
- *	init_lbrace	for each '{'
- *	init_using_expr	for each value
- *	init_rbrace	for each '}'
+ *	begin_initialization
+ *		init_lbrace			for each '{'
+ *		designator_push_name		for each '.member' before '='
+ *		designator_push_subscript	for each '[123]' before '='
+ *		init_using_expr			for each expression
+ *		init_rbrace			for each '}'
+ *	end_initialization
  *
  * The state of the current initialization is stored in initstk, a stack of
  * initstack_element, one element per type aggregate level.
+ * XXX: Or is that "one element per brace level"?  C99 mandates in 6.7.8p17
+ * that "each brace-enclosed initializer list has an associated current
+ * object".
  *
  * Most of the time, the topmost level of initstk contains a scalar type, and
  * its remaining count toggles between 1 and 0.
@@ -87,16 +96,11 @@ __RCSID("$NetBSD: init.c,v 1.118 2021/03
 /*
  * Type of stack which is used for initialization of aggregate types.
  *
- * XXX: Since C99, a stack is an inappropriate data structure for modelling
- * an initialization, since the designators don't have to be listed in a
- * particular order and can designate parts of sub-objects.  The member names
+ * XXX: Since C99, the initializers can be listed in arbitrary order by using
+ * designators to specify the sub-object to be initialized.  The member names
  * of non-leaf structs may thus appear repeatedly, as demonstrated in
  * d_init_pop_member.c.
  *
- * XXX: During initialization, there may be members of the top-level struct
- * that are partially initialized.  The simple i_remaining cannot model this
- * appropriately.
- *
  * See C99 6.7.8, which spans 6 pages full of tricky details and carefully
  * selected examples.
  */
@@ -107,8 +111,11 @@ typedef	struct initstack_element {
 	 *
 	 * On the outermost element, this is always NULL since the outermost
 	 * initializer-expression may be enclosed in an optional pair of
-	 * braces.  This optional pair of braces is handled by the combination
-	 * of i_type and i_subt.
+	 * braces, as of the current implementation.
+	 *
+	 * FIXME: This approach is wrong.  It's not that the outermost
+	 * initializer may be enclosed in additional braces, it's every scalar
+	 * that may be enclosed in additional braces, as of C99 6.7.8p11.
 	 *
 	 * Everywhere else it is nonnull.
 	 */
@@ -131,28 +138,48 @@ typedef	struct initstack_element {
 	 *
 	 * During initialization, only the top 2 elements of the stack are
 	 * looked at.
+	 *
+	 * XXX: Having i_subt here is the wrong approach, it should not be
+	 * necessary at all; see i_type.
 	 */
 	type_t	*i_subt;
 
 	/*
-	 * This level of the initializer requires a '}' to be completed.
+	 * Whether this level of the initializer requires a '}' to be
+	 * completed.
 	 *
 	 * Multidimensional arrays do not need a closing brace to complete
 	 * an inner array; for example, { 1, 2, 3, 4 } is a valid initializer
-	 * for int arr[2][2].
+	 * for 'int arr[2][2]'.
 	 *
 	 * TODO: Do structs 

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

2021-03-25 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Mar 25 13:10:19 UTC 2021

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

Log Message:
lint: add comments about things left to do, from code review

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/usr.bin/xlint/lint1/init.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/audio/record

2021-03-25 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Thu Mar 25 10:03:26 UTC 2021

Modified Files:
src/usr.bin/audio/record: audiorecord.1

Log Message:
Add an example for recording CD quality audio


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/audio/record/audiorecord.1

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



CVS commit: src/usr.bin/audio/record

2021-03-25 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Thu Mar 25 10:03:26 UTC 2021

Modified Files:
src/usr.bin/audio/record: audiorecord.1

Log Message:
Add an example for recording CD quality audio


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/audio/record/audiorecord.1

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/audio/record/audiorecord.1
diff -u src/usr.bin/audio/record/audiorecord.1:1.43 src/usr.bin/audio/record/audiorecord.1:1.44
--- src/usr.bin/audio/record/audiorecord.1:1.43	Fri Jan 31 00:21:53 2020
+++ src/usr.bin/audio/record/audiorecord.1	Thu Mar 25 10:03:26 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audiorecord.1,v 1.43 2020/01/31 00:21:53 sevan Exp $
+.\"	$NetBSD: audiorecord.1,v 1.44 2021/03/25 10:03:26 nia Exp $
 .\"
 .\" Copyright (c) 1998, 1999, 2001, 2002, 2010 Matthew R. Green
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd January 31, 2020
+.Dd March 25, 2021
 .Dt AUDIORECORD 1
 .Os
 .Sh NAME
@@ -181,6 +181,9 @@ the audio control device to be used.
 .It AUDIODEVICE
 the audio device to be used.
 .El
+.Sh EXAMPLES
+Record CD quality audio to a WAVE file:
+.Dl audiorecord -c 2 -e slinear_le -P 16 -s 44100 recording.wav
 .Sh SEE ALSO
 .Xr audioctl 1 ,
 .Xr audioplay 1 ,



CVS commit: src

2021-03-25 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Thu Mar 25 09:49:00 UTC 2021

Modified Files:
src/distrib/sets/lists/modules: md.amd64 md.i386 mi
src/sys/modules: Makefile

Log Message:
don't restrict pad module to i386 and amd64.

- module build tested on amiga, vax, i386, amd64, evbarm.
- build.sh release tested on i386.
- pad module functionality tested on aarch64.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.89 -r1.90 src/distrib/sets/lists/modules/md.i386
cvs rdiff -u -r1.142 -r1.143 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r1.248 -r1.249 src/sys/modules/Makefile

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/modules/md.amd64
diff -u src/distrib/sets/lists/modules/md.amd64:1.91 src/distrib/sets/lists/modules/md.amd64:1.92
--- src/distrib/sets/lists/modules/md.amd64:1.91	Sun Nov  1 18:51:34 2020
+++ src/distrib/sets/lists/modules/md.amd64	Thu Mar 25 09:49:00 2021
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.91 2020/11/01 18:51:34 pgoyette Exp $
+# $NetBSD: md.amd64,v 1.92 2021/03/25 09:49:00 nia Exp $
 #
 ./@MODULEDIR@/acpiacadmodules-base-kernel	kmod
 ./@MODULEDIR@/acpiacad/acpiacad.kmod		modules-base-kernel	kmod
@@ -190,8 +190,6 @@
 ./@MODULEDIR@/nxt2k/nxt2k.kmod			modules-base-kernel	kmod
 ./@MODULEDIR@/odcmmodules-base-kernel	kmod
 ./@MODULEDIR@/odcm/odcm.kmod			modules-base-kernel	kmod
-./@MODULEDIR@/padmodules-base-kernel	kmod
-./@MODULEDIR@/pad/pad.kmod			modules-base-kernel	kmod
 ./@MODULEDIR@/powernowmodules-base-kernel	kmod
 ./@MODULEDIR@/powernow/powernow.kmod		modules-base-kernel	kmod
 ./@MODULEDIR@/pwdogmodules-base-kernel	kmod

Index: src/distrib/sets/lists/modules/md.i386
diff -u src/distrib/sets/lists/modules/md.i386:1.89 src/distrib/sets/lists/modules/md.i386:1.90
--- src/distrib/sets/lists/modules/md.i386:1.89	Tue Sep  8 10:05:47 2020
+++ src/distrib/sets/lists/modules/md.i386	Thu Mar 25 09:49:00 2021
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.89 2020/09/08 10:05:47 yamaguchi Exp $
+# $NetBSD: md.i386,v 1.90 2021/03/25 09:49:00 nia Exp $
 #
 ./@MODULEDIR@/acpiacadmodules-base-kernel	kmod
 ./@MODULEDIR@/acpiacad/acpiacad.kmod		modules-base-kernel	kmod
@@ -150,8 +150,6 @@
 ./@MODULEDIR@/nxt2k/nxt2k.kmod			modules-base-kernel	kmod
 ./@MODULEDIR@/odcmmodules-base-kernel	kmod
 ./@MODULEDIR@/odcm/odcm.kmod			modules-base-kernel	kmod
-./@MODULEDIR@/padmodules-base-kernel	kmod
-./@MODULEDIR@/pad/pad.kmod			modules-base-kernel	kmod
 ./@MODULEDIR@/padlockmodules-base-kernel	kmod
 ./@MODULEDIR@/padlock/padlock.kmod		modules-base-kernel	kmod
 ./@MODULEDIR@/powernowmodules-base-kernel	kmod

Index: src/distrib/sets/lists/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.142 src/distrib/sets/lists/modules/mi:1.143
--- src/distrib/sets/lists/modules/mi:1.142	Sat Sep 26 17:49:50 2020
+++ src/distrib/sets/lists/modules/mi	Thu Mar 25 09:49:00 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.142 2020/09/26 17:49:50 jmcneill Exp $
+# $NetBSD: mi,v 1.143 2021/03/25 09:49:00 nia Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -345,6 +345,8 @@
 ./@MODULEDIR@/opencrypto/opencrypto.kmod	modules-base-kernel	kmod
 ./@MODULEDIR@/overlaymodules-base-kernel	kmod
 ./@MODULEDIR@/overlay/overlay.kmod		modules-base-kernel	kmod
+./@MODULEDIR@/padmodules-base-kernel	kmod
+./@MODULEDIR@/pad/pad.kmod			modules-base-kernel	kmod
 ./@MODULEDIR@/pciverbose			modules-base-kernel	kmod
 ./@MODULEDIR@/pciverbose/pciverbose.kmod	modules-base-kernel	kmod
 ./@MODULEDIR@/pfmodules-base-kernel	kmod

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.248 src/sys/modules/Makefile:1.249
--- src/sys/modules/Makefile:1.248	Sun Nov  1 18:51:02 2020
+++ src/sys/modules/Makefile	Thu Mar 25 09:49:00 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.248 2020/11/01 18:51:02 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.249 2021/03/25 09:49:00 nia Exp $
 
 .include 
 
@@ -129,6 +129,7 @@ SUBDIR+=	null
 SUBDIR+=	onewire
 SUBDIR+=	opencrypto
 SUBDIR+=	overlay
+SUBDIR+=	pad
 SUBDIR+=	pciverbose
 SUBDIR+=	pf
 SUBDIR+=	ppp_bsdcomp
@@ -342,7 +343,6 @@ SUBDIR+=	drmkms_linux
 SUBDIR+=	drmkms_pci
 SUBDIR+=	i915drm
 SUBDIR+=	i915drmkms
-SUBDIR+=	pad
 #
 # ISA modules
 #



CVS commit: src

2021-03-25 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Thu Mar 25 09:49:00 UTC 2021

Modified Files:
src/distrib/sets/lists/modules: md.amd64 md.i386 mi
src/sys/modules: Makefile

Log Message:
don't restrict pad module to i386 and amd64.

- module build tested on amiga, vax, i386, amd64, evbarm.
- build.sh release tested on i386.
- pad module functionality tested on aarch64.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.89 -r1.90 src/distrib/sets/lists/modules/md.i386
cvs rdiff -u -r1.142 -r1.143 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r1.248 -r1.249 src/sys/modules/Makefile

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



CVS commit: src/sys/net

2021-03-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Mar 25 08:18:03 UTC 2021

Modified Files:
src/sys/net: pktqueue.c

Log Message:
Remove strange padding #define and replace with anonymous struct/union


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/net/pktqueue.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/net/pktqueue.c
diff -u src/sys/net/pktqueue.c:1.12 src/sys/net/pktqueue.c:1.13
--- src/sys/net/pktqueue.c:1.12	Fri Sep 11 14:29:00 2020
+++ src/sys/net/pktqueue.c	Thu Mar 25 08:18:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pktqueue.c,v 1.12 2020/09/11 14:29:00 riastradh Exp $	*/
+/*	$NetBSD: pktqueue.c,v 1.13 2021/03/25 08:18:03 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pktqueue.c,v 1.12 2020/09/11 14:29:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pktqueue.c,v 1.13 2021/03/25 08:18:03 skrll Exp $");
 
 #include 
 #include 
@@ -52,21 +52,19 @@ __KERNEL_RCSID(0, "$NetBSD: pktqueue.c,v
 
 #include 
 
-/*
- * WARNING: update this if struct pktqueue changes.
- */
-#define	PKTQ_CLPAD	\
-MAX(COHERENCY_UNIT, COHERENCY_UNIT - sizeof(kmutex_t) - sizeof(u_int))
-
 struct pktqueue {
 	/*
 	 * The lock used for a barrier mechanism.  The barrier counter,
 	 * as well as the drop counter, are managed atomically though.
 	 * Ensure this group is in a separate cache line.
 	 */
-	kmutex_t	pq_lock;
-	volatile u_int	pq_barrier;
-	uint8_t		_pad[PKTQ_CLPAD];
+	union {
+		struct {
+			kmutex_t	pq_lock;
+			volatile u_int	pq_barrier;
+		};
+		uint8_t	 _pad[COHERENCY_UNIT];
+	};
 
 	/* The size of the queue, counters and the interrupt handler. */
 	u_int		pq_maxlen;



CVS commit: src/sys/net

2021-03-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Mar 25 08:18:03 UTC 2021

Modified Files:
src/sys/net: pktqueue.c

Log Message:
Remove strange padding #define and replace with anonymous struct/union


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/net/pktqueue.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-03-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Mar 25 07:31:57 UTC 2021

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

Log Message:
More debug


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/aarch64/aarch64/aarch64_machdep.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/aarch64_machdep.c
diff -u src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.59 src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.60
--- src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.59	Thu Mar 25 07:30:16 2021
+++ src/sys/arch/aarch64/aarch64/aarch64_machdep.c	Thu Mar 25 07:31:56 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: aarch64_machdep.c,v 1.59 2021/03/25 07:30:16 skrll Exp $ */
+/* $NetBSD: aarch64_machdep.c,v 1.60 2021/03/25 07:31:56 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.59 2021/03/25 07:30:16 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.60 2021/03/25 07:31:56 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_cpuoptions.h"
@@ -251,7 +251,7 @@ initarm_common(vaddr_t kvm_base, vsize_t
 	vaddr_t kernstart, kernend;
 	vaddr_t kernstart_l2 __unused, kernend_l2;	/* L2 table 2MB aligned */
 	vaddr_t kernelvmstart;
-	int i;
+	size_t i;
 
 	cputype = cpu_idnum();	/* for compatible arm */
 
@@ -382,6 +382,10 @@ initarm_common(vaddr_t kvm_base, vsize_t
 		end = start + bootconfig.dram[i].pages;
 
 		int vm_freelist = VM_FREELIST_DEFAULT;
+
+		VPRINTF("block %2zu start %08lx  end %08lx\n", i, ptoa(start),
+		ptoa(end));
+
 		/*
 		 * This assumes the bp list is sorted in ascending
 		 * order.
@@ -404,6 +408,10 @@ initarm_common(vaddr_t kvm_base, vsize_t
 }
 vm_freelist = bp[j].bp_freelist;
 
+VPRINTF(" start %08lx  end %08lx"
+"... loading in freelist %d\n", ptoa(start),
+ptoa(segend), vm_freelist);
+
 uvm_page_physload(start, segend, start, segend,
 vm_freelist);
 memsize_total += ptoa(segend - start);



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

2021-03-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Mar 25 07:31:57 UTC 2021

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

Log Message:
More debug


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/aarch64/aarch64/aarch64_machdep.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-03-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Mar 25 07:30:16 UTC 2021

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

Log Message:
Update a comment to reflect reality


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/aarch64/aarch64/aarch64_machdep.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/aarch64_machdep.c
diff -u src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.58 src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.59
--- src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.58	Sun Mar 21 07:32:44 2021
+++ src/sys/arch/aarch64/aarch64/aarch64_machdep.c	Thu Mar 25 07:30:16 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: aarch64_machdep.c,v 1.58 2021/03/21 07:32:44 skrll Exp $ */
+/* $NetBSD: aarch64_machdep.c,v 1.59 2021/03/25 07:30:16 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.58 2021/03/21 07:32:44 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.59 2021/03/25 07:30:16 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_cpuoptions.h"
@@ -215,12 +215,14 @@ cpu_kernel_vm_init(uint64_t memory_start
  *   0x__ffe0_  End of KVA
  *  = VM_MAX_KERNEL_ADDRESS
  *
+ *   0x_c000_4000_  Start of KVA
+ *
  *   0x_c000_0???_  End of kernel
  *  = _end[]
  *   0x_c000_00??_  Start of kernel
  *  = __kernel_text[]
  *
- *   0x_c000__  Kernel base address & start of KVA
+ *   0x_c000__  Kernel base address
  *  = VM_MIN_KERNEL_ADDRESS
  *
  *   0x_bfff__  End of direct mapped



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

2021-03-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Mar 25 07:30:16 UTC 2021

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

Log Message:
Update a comment to reflect reality


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/aarch64/aarch64/aarch64_machdep.c

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