CVS commit: src/usr.bin/at

2021-04-02 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Apr  3 04:33:08 UTC 2021

Modified Files:
src/usr.bin/at: at.c

Log Message:
Revert parsedate(3) XXX as per discussion with kre@.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/at/at.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/at/at.c
diff -u src/usr.bin/at/at.c:1.32 src/usr.bin/at/at.c:1.33
--- src/usr.bin/at/at.c:1.32	Fri Apr  2 06:31:53 2021
+++ src/usr.bin/at/at.c	Sat Apr  3 04:33:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: at.c,v 1.32 2021/04/02 06:31:53 simonb Exp $	*/
+/*	$NetBSD: at.c,v 1.33 2021/04/03 04:33:08 simonb Exp $	*/
 
 /*
  *  at.c : Put file into atrun queue
@@ -53,7 +53,7 @@
 /* Local headers */
 #include "at.h"
 #include "panic.h"
-#include "parsetime.h"		/* XXX should use parsedate(3) in  */
+#include "parsetime.h"
 #include "perm.h"
 #include "pathnames.h"
 #include "stime.h"
@@ -71,7 +71,7 @@ enum { ATQ, ATRM, AT, BATCH, CAT };	/* w
 #if 0
 static char rcsid[] = "$OpenBSD: at.c,v 1.15 1998/06/03 16:20:26 deraadt Exp $";
 #else
-__RCSID("$NetBSD: at.c,v 1.32 2021/04/02 06:31:53 simonb Exp $");
+__RCSID("$NetBSD: at.c,v 1.33 2021/04/03 04:33:08 simonb Exp $");
 #endif
 #endif
 



CVS commit: src/sys/dev

2021-04-02 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Apr  3 04:10:30 UTC 2021

Modified Files:
src/sys/dev: spkr.c spkr_audio.c spkrvar.h
src/sys/dev/isa: spkr_pcppi.c

Log Message:
Rework about the rest note in speaker(4).
- Obsolete the sc_rest callback.  The rest note operation can be done by
  the common spkr layer.  This also fixes PR kern/56060.
  This work-in-progress patch was left in my local tree for years. :(
- Improve calculations of tone and rest length.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/spkr.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/spkr_audio.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/spkrvar.h
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/isa/spkr_pcppi.c

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

Modified files:

Index: src/sys/dev/spkr.c
diff -u src/sys/dev/spkr.c:1.18 src/sys/dev/spkr.c:1.19
--- src/sys/dev/spkr.c:1.18	Sat Apr  3 03:21:53 2021
+++ src/sys/dev/spkr.c	Sat Apr  3 04:10:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: spkr.c,v 1.18 2021/04/03 03:21:53 isaki Exp $	*/
+/*	$NetBSD: spkr.c,v 1.19 2021/04/03 04:10:30 isaki Exp $	*/
 
 /*
  * Copyright (c) 1990 Eric S. Raymond (e...@snark.thyrsus.com)
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.18 2021/04/03 03:21:53 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.19 2021/04/03 04:10:30 isaki Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "wsmux.h"
@@ -99,12 +99,10 @@ static void playstring(struct spkr_softc
  *
  * Play string interpretation is modelled on IBM BASIC 2.0's PLAY statement;
  * M[LNS] are missing and the ~ synonym and octave-tracking facility is added.
- * Requires spkr_tone(), spkr_rest(). String play is not interruptible
- * except possibly at physical block boundaries.
+ * String play is not interruptible except possibly at physical block
+ * boundaries.
  */
 
-#define dtoi(c)		((c) - '0')
-
 /*
  * Magic number avoidance...
  */
@@ -156,45 +154,82 @@ playinit(struct spkr_softc *sc)
 	sc->sc_octprefix = true;/* act as though there was an initial O(n) */
 }
 
-/* play tone of proper duration for current rhythm signature */
+#define SPKRPRI (PZERO - 1)
+
+/* Rest for given number of ticks */
+static void
+rest(struct spkr_softc *sc, int ticks)
+{
+
+#ifdef SPKRDEBUG
+	device_printf(sc->sc_dev, "%s: rest for %d ticks\n", __func__, ticks);
+#endif /* SPKRDEBUG */
+	KASSERT(ticks > 0);
+
+	tsleep(sc->sc_dev, SPKRPRI | PCATCH, device_xname(sc->sc_dev), ticks);
+}
+
+/*
+ * Play tone of proper duration for current rhythm signature.
+ * note indicates "O0C" = 0, "O0C#" = 1, "O0D" = 2, ... , and
+ * -1 indiacates a rest.
+ * val indicates the length, "L4" = 4, "L8" = 8.
+ * sustain indicates the number of subsequent dots that extend the sound
+ * by one a half.
+ */
 static void
-playtone(struct spkr_softc *sc, int pitch, int val, int sustain)
+playtone(struct spkr_softc *sc, int note, int val, int sustain)
 {
-	int sound, silence, snum = 1, sdenom = 1;
+	int whole;
+	int total;
+	int sound;
+	int silence;
 
 	/* this weirdness avoids floating-point arithmetic */
+	whole = sc->sc_whole;
 	for (; sustain; sustain--) {
-		snum *= NUM_MULT;
-		sdenom *= DENOM_MULT;
+		whole *= NUM_MULT;
+		val *= DENOM_MULT;
 	}
 
-	if (pitch == -1) {
-		(*sc->sc_rest)(sc->sc_dev, sc->sc_whole
-		* snum / (val * sdenom));
+	/* Total length in tick */
+	total = whole / val;
+
+	if (note == -1) {
+#ifdef SPKRDEBUG
+		device_printf(sc->sc_dev, "%s: rest for %d ticks\n",
+		__func__, total);
+#endif /* SPKRDEBUG */
+		if (total != 0)
+			rest(sc, total);
 		return;
 	}
 
-	int fac = sc->sc_whole * (FILLTIME - sc->sc_fill);
-	int fval = FILLTIME * val;
-	sound = (sc->sc_whole * snum) / (val * sdenom) -  fac / fval;
-	silence = fac * snum / (fval * sdenom);
+	/*
+	 * Rest 1/8 (if NORMAL) or 3/8 (if STACCATO) in tick.
+	 * silence should be rounded down.
+	 */
+	silence = total * (FILLTIME - sc->sc_fill) / FILLTIME;
+	sound = total - silence;
 
 #ifdef SPKRDEBUG
 	device_printf(sc->sc_dev,
-	"%s: pitch %d for %d ticks, rest for %d ticks\n", __func__,
-	pitch, sound, silence);
+	"%s: note %d for %d ticks, rest for %d ticks\n", __func__,
+	note, sound, silence);
 #endif /* SPKRDEBUG */
 
-	(*sc->sc_tone)(sc->sc_dev, pitchtab[pitch], sound);
-	if (sc->sc_fill != LEGATO)
-		(*sc->sc_rest)(sc->sc_dev, silence);
+	if (sound != 0)
+		(*sc->sc_tone)(sc->sc_dev, pitchtab[note], sound);
+	if (silence != 0)
+		rest(sc, silence);
 }
 
 /* interpret and play an item from a notation string */
 static void
 playstring(struct spkr_softc *sc, const char *cp, size_t slen)
 {
-	int		pitch, lastpitch = OCTAVE_NOTES * DFLT_OCTAVE;
+	int pitch;
+	int lastpitch = OCTAVE_NOTES * DFLT_OCTAVE;
 
 #define GETNUM(cp, v)	\
 	for (v = 0; slen > 0 && isdigit((unsigned char)cp[1]); ) { \
@@ -357,16 +392,26 @@ playstring(struct spkr_softc *sc, const 
 	}
 }
 
-/*** UNIX DRIVER HOOKS BEGIN 

CVS commit: src/sys/dev

2021-04-02 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Apr  3 03:21:53 UTC 2021

Modified Files:
src/sys/dev: spkr.c spkr_audio.c
src/sys/dev/isa: spkr_pcppi.c

Log Message:
Improve SPKRDEBUG code.
- Replace wrong aprint_debug_dev() with device_printf().
  By this, it no longer need to print dev_t.
- Improve some messages.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/spkr.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/spkr_audio.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/isa/spkr_pcppi.c

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

Modified files:

Index: src/sys/dev/spkr.c
diff -u src/sys/dev/spkr.c:1.17 src/sys/dev/spkr.c:1.18
--- src/sys/dev/spkr.c:1.17	Thu Apr 18 13:01:38 2019
+++ src/sys/dev/spkr.c	Sat Apr  3 03:21:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: spkr.c,v 1.17 2019/04/18 13:01:38 isaki Exp $	*/
+/*	$NetBSD: spkr.c,v 1.18 2021/04/03 03:21:53 isaki Exp $	*/
 
 /*
  * Copyright (c) 1990 Eric S. Raymond (e...@snark.thyrsus.com)
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.17 2019/04/18 13:01:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.18 2021/04/03 03:21:53 isaki Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "wsmux.h"
@@ -180,7 +180,7 @@ playtone(struct spkr_softc *sc, int pitc
 	silence = fac * snum / (fval * sdenom);
 
 #ifdef SPKRDEBUG
-	aprint_debug_dev(sc->sc_dev,
+	device_printf(sc->sc_dev,
 	"%s: pitch %d for %d ticks, rest for %d ticks\n", __func__,
 	pitch, sound, silence);
 #endif /* SPKRDEBUG */
@@ -207,7 +207,11 @@ playstring(struct spkr_softc *sc, const 
 		char c = toupper((unsigned char)*cp);
 
 #ifdef SPKRDEBUG
-		aprint_debug_dev(sc->sc_dev, "%s: %c (%x)\n", __func__, c, c);
+		if (0x20 <= c && c < 0x7f) {
+			device_printf(sc->sc_dev, "%s: '%c'\n", __func__, c);
+		} else {
+			device_printf(sc->sc_dev, "%s: (0x%x)\n", __func__, c);
+		}
 #endif /* SPKRDEBUG */
 
 		switch (c) {
@@ -431,11 +435,11 @@ spkr_childdet(device_t self, device_t ch
 int
 spkropen(dev_t dev, int	flags, int mode, struct lwp *l)
 {
-#ifdef SPKRDEBUG
-	aprint_debug("%s: entering with dev = %"PRIx64"\n", __func__, dev);
-#endif /* SPKRDEBUG */
 	struct spkr_softc *sc = spkrenter(minor(dev));
 
+#ifdef SPKRDEBUG
+	device_printf(sc->sc_dev, "%s: entering\n", __func__);
+#endif /* SPKRDEBUG */
 	if (sc == NULL)
 		return ENXIO;
 	if (sc->sc_inbuf != NULL)
@@ -449,12 +453,12 @@ spkropen(dev_t dev, int	flags, int mode,
 int
 spkrwrite(dev_t dev, struct uio *uio, int flags)
 {
-#ifdef SPKRDEBUG
-	aprint_debug("%s: entering with dev = %"PRIx64", count = %zu\n",
-	__func__, dev, uio->uio_resid);
-#endif /* SPKRDEBUG */
 	struct spkr_softc *sc = spkrenter(minor(dev));
 
+#ifdef SPKRDEBUG
+	device_printf(sc->sc_dev, "%s: entering with length = %zu\n",
+	__func__, uio->uio_resid);
+#endif /* SPKRDEBUG */
 	if (sc == NULL)
 		return ENXIO;
 	if (sc->sc_inbuf == NULL)
@@ -471,11 +475,11 @@ spkrwrite(dev_t dev, struct uio *uio, in
 int
 spkrclose(dev_t dev, int flags, int mode, struct lwp *l)
 {
-#ifdef SPKRDEBUG
-	aprint_debug("%s: entering with dev = %"PRIx64"\n", __func__, dev);
-#endif /* SPKRDEBUG */
 	struct spkr_softc *sc = spkrenter(minor(dev));
 
+#ifdef SPKRDEBUG
+	device_printf(sc->sc_dev, "%s: entering\n", __func__);
+#endif /* SPKRDEBUG */
 	if (sc == NULL)
 		return ENXIO;
 	if (sc->sc_inbuf == NULL)
@@ -500,16 +504,15 @@ playonetone(struct spkr_softc *sc, tone_
 int
 spkrioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
 {
+	struct spkr_softc *sc = spkrenter(minor(dev));
 	tone_t *tp;
 	tone_t ttp;
 	int error;
+
 #ifdef SPKRDEBUG
-	aprint_debug("%s: entering with dev = %"PRIx64", cmd = %lx\n",
-	__func__, dev, cmd);
+	device_printf(sc->sc_dev, "%s: entering with cmd = %lx\n",
+	__func__, cmd);
 #endif /* SPKRDEBUG */
-
-	struct spkr_softc *sc = spkrenter(minor(dev));
-
 	if (sc == NULL)
 		return ENXIO;
 	if (sc->sc_inbuf == NULL)

Index: src/sys/dev/spkr_audio.c
diff -u src/sys/dev/spkr_audio.c:1.9 src/sys/dev/spkr_audio.c:1.10
--- src/sys/dev/spkr_audio.c:1.9	Wed Feb 17 12:37:33 2021
+++ src/sys/dev/spkr_audio.c	Sat Apr  3 03:21:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: spkr_audio.c,v 1.9 2021/02/17 12:37:33 isaki Exp $	*/
+/*	$NetBSD: spkr_audio.c,v 1.10 2021/04/03 03:21:53 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spkr_audio.c,v 1.9 2021/02/17 12:37:33 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr_audio.c,v 1.10 2021/04/03 03:21:53 isaki Exp $");
 
 #include 
 #include 
@@ -69,7 +69,7 @@ spkr_audio_tone(device_t self, u_int xhz
 	struct spkr_audio_softc *sc = device_private(self);
 
 #ifdef SPKRDEBUG
-	aprint_debug_dev(self, "%s: %u %d\n", __func__, xhz, ticks);
+	device_printf(self, "%s: %u %u\n", __func__, xhz, ticks);
 #endif /* SPKRDEBUG */
 	audiobell(sc->sc_audiodev, xhz, hztoms(ticks),
 	sc->sc_spkr.sc_vol, 0);


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

2021-04-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Apr  3 01:52:16 UTC 2021

Modified Files:
src/sys/dev/pci [thorpej-cfargs]: ismt.c

Log Message:
ismt_config_interrupts(): remove a now-unused variable.


To generate a diff of this commit:
cvs rdiff -u -r1.7.10.1 -r1.7.10.2 src/sys/dev/pci/ismt.c

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

Modified files:

Index: src/sys/dev/pci/ismt.c
diff -u src/sys/dev/pci/ismt.c:1.7.10.1 src/sys/dev/pci/ismt.c:1.7.10.2
--- src/sys/dev/pci/ismt.c:1.7.10.1	Wed Mar 24 14:21:08 2021
+++ src/sys/dev/pci/ismt.c	Sat Apr  3 01:52:16 2021
@@ -60,7 +60,7 @@
 #if 0
 __FBSDID("$FreeBSD: head/sys/dev/ismt/ismt.c 266474 2014-05-20 19:55:06Z jimharris $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: ismt.c,v 1.7.10.1 2021/03/24 14:21:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ismt.c,v 1.7.10.2 2021/04/03 01:52:16 thorpej Exp $");
 
 #include 
 #include 
@@ -810,7 +810,6 @@ ismt_rescan(device_t self, const char *i
 static void
 ismt_config_interrupts(device_t self)
 {
-	int flags = 0;
 
 	ismt_rescan(self, NULL, NULL);
 }



CVS commit: src

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 22:41:54 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_bool_strict.exp msg_239.c
msg_239.exp
src/usr.bin/xlint/lint1: err.c tree.c

Log Message:
lint: reword message about constant argument to '!'

In the other messages, operators are typically written in their literal
form as well.  Using single quotes disambiguates them from normal
punctuation.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_239.c \
src/tests/usr.bin/xlint/lint1/msg_239.exp
cvs rdiff -u -r1.100 -r1.101 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.264 -r1.265 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp
diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.23 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.24
--- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.23	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp	Fri Apr  2 22:41:54 2021
@@ -64,9 +64,9 @@ d_c99_bool_strict.c(386): error: control
 d_c99_bool_strict.c(392): error: controlling expression must be bool, not 'double' [333]
 d_c99_bool_strict.c(398): error: controlling expression must be bool, not 'pointer' [333]
 d_c99_bool_strict.c(419): warning: constant in conditional context [161]
-d_c99_bool_strict.c(419): warning: constant argument to NOT [239]
+d_c99_bool_strict.c(419): warning: constant argument to '!' [239]
 d_c99_bool_strict.c(420): warning: constant in conditional context [161]
-d_c99_bool_strict.c(420): warning: constant argument to NOT [239]
+d_c99_bool_strict.c(420): warning: constant argument to '!' [239]
 d_c99_bool_strict.c(424): error: operand of '!' must be bool, not 'int' [330]
 d_c99_bool_strict.c(425): error: operand of '!' must be bool, not 'int' [330]
 d_c99_bool_strict.c(426): error: operand of '!' must be bool, not 'int' [330]

Index: src/tests/usr.bin/xlint/lint1/msg_239.c
diff -u src/tests/usr.bin/xlint/lint1/msg_239.c:1.3 src/tests/usr.bin/xlint/lint1/msg_239.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_239.c:1.3	Fri Apr  2 22:38:42 2021
+++ src/tests/usr.bin/xlint/lint1/msg_239.c	Fri Apr  2 22:41:54 2021
@@ -1,7 +1,7 @@
-/*	$NetBSD: msg_239.c,v 1.3 2021/04/02 22:38:42 rillig Exp $	*/
+/*	$NetBSD: msg_239.c,v 1.4 2021/04/02 22:41:54 rillig Exp $	*/
 # 3 "msg_239.c"
 
-// Test for message: constant argument to NOT [239]
+// Test for message: constant argument to '!' [239]
 
 /* lint1-extra-flags: -h */
 
Index: src/tests/usr.bin/xlint/lint1/msg_239.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_239.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_239.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_239.exp:1.3	Fri Apr  2 22:38:42 2021
+++ src/tests/usr.bin/xlint/lint1/msg_239.exp	Fri Apr  2 22:41:54 2021
@@ -1,4 +1,4 @@
 msg_239.c(13): warning: constant in conditional context [161]
-msg_239.c(13): warning: constant argument to NOT [239]
+msg_239.c(13): warning: constant argument to '!' [239]
 msg_239.c(14): warning: constant in conditional context [161]
-msg_239.c(14): warning: constant argument to NOT [239]
+msg_239.c(14): warning: constant argument to '!' [239]

Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.100 src/usr.bin/xlint/lint1/err.c:1.101
--- src/usr.bin/xlint/lint1/err.c:1.100	Fri Apr  2 12:16:50 2021
+++ src/usr.bin/xlint/lint1/err.c	Fri Apr  2 22:41:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.c,v 1.100 2021/04/02 12:16:50 rillig Exp $	*/
+/*	$NetBSD: err.c,v 1.101 2021/04/02 22:41:53 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.100 2021/04/02 12:16:50 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.101 2021/04/02 22:41:53 rillig Exp $");
 #endif
 
 #include 
@@ -293,7 +293,7 @@ const	char *msgs[] = {
 	"static function %s unused",  /* 236 */
 	"redeclaration of formal parameter %s",			  /* 237 */
 	"initialization of union is illegal in traditional C",	  /* 238 */
-	"constant argument to NOT",  /* 239 */
+	"constant argument to '!'",  /* 239 */
 	"assignment of different structures (%s != %s)",	  /* 240 */
 	"dubious operation on enum, op %s",			  /* 241 */
 	"combination of '%s' and '%s', op %s",			  /* 242 */

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.264 src/usr.bin/xlint/lint1/tree.c:1.265
--- src/usr.bin/xlint/lint1/tree.c:1.264	Fri Apr  2 17:10:52 2021
+++ src/usr.bin/xlint/lint1/tree.c	Fri Apr  2 22:41:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.264 2021/04/02 17:10:52 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.265 2021/04/02 22:41:53 rillig Exp $	*/
 

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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 22:38:42 UTC 2021

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

Log Message:
tests/lint: add test for constant argument to '!'


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

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_239.c
diff -u src/tests/usr.bin/xlint/lint1/msg_239.c:1.2 src/tests/usr.bin/xlint/lint1/msg_239.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_239.c:1.2	Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_239.c	Fri Apr  2 22:38:42 2021
@@ -1,7 +1,18 @@
-/*	$NetBSD: msg_239.c,v 1.2 2021/02/21 09:07:58 rillig Exp $	*/
+/*	$NetBSD: msg_239.c,v 1.3 2021/04/02 22:38:42 rillig Exp $	*/
 # 3 "msg_239.c"
 
 // Test for message: constant argument to NOT [239]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* lint1-extra-flags: -h */
+
+_Bool
+example(int n)
+{
+	_Bool b;
+
+	b = !0;		/* expect: constant in conditional context, 239 */
+	b = !1;		/* expect: constant in conditional context, 239 */
+	b = !(n > 1);
+
+	return b;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_239.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_239.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_239.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_239.exp:1.2	Sun Mar 21 20:45:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_239.exp	Fri Apr  2 22:38:42 2021
@@ -1 +1,4 @@
-msg_239.c(6): error: syntax error ':' [249]
+msg_239.c(13): warning: constant in conditional context [161]
+msg_239.c(13): warning: constant argument to NOT [239]
+msg_239.c(14): warning: constant in conditional context [161]
+msg_239.c(14): warning: constant argument to NOT [239]



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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 22:05:44 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: lex.c lint1.h

Log Message:
lint: reduce memory usage

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.91 -r1.92 src/usr.bin/xlint/lint1/lint1.h

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/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.22 src/usr.bin/xlint/lint1/lex.c:1.23
--- src/usr.bin/xlint/lint1/lex.c:1.22	Fri Apr  2 12:16:50 2021
+++ src/usr.bin/xlint/lint1/lex.c	Fri Apr  2 22:05:43 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.22 2021/04/02 12:16:50 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.23 2021/04/02 22:05:43 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.22 2021/04/02 12:16:50 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.23 2021/04/02 22:05:43 rillig Exp $");
 #endif
 
 #include 
@@ -56,13 +56,13 @@ __RCSID("$NetBSD: lex.c,v 1.22 2021/04/0
 
 
 /* Current position (it's also updated when an included file is parsed) */
-pos_t	curr_pos = { 1, "", 0 };
+pos_t	curr_pos = { "", 1, 0 };
 
 /*
  * Current position in C source (not updated when an included file is
  * parsed).
  */
-pos_t	csrc_pos = { 1, "", 0 };
+pos_t	csrc_pos = { "", 1, 0 };
 
 /* Are we parsing a gcc attribute? */
 bool attron;

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.91 src/usr.bin/xlint/lint1/lint1.h:1.92
--- src/usr.bin/xlint/lint1/lint1.h:1.91	Fri Apr  2 09:39:25 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Fri Apr  2 22:05:43 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.91 2021/04/02 09:39:25 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.92 2021/04/02 22:05:43 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -59,8 +59,8 @@
  * Describes the position of a declaration or anything else.
  */
 typedef struct {
-	int	p_line;
 	const	char *p_file;
+	int	p_line;
 	int	p_uniq;			/* uniquifier */
 } pos_t;
 



CVS commit: src

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 17:25:04 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile t_integration.sh
Added Files:
src/tests/usr.bin/xlint/lint1: op_colon.c op_colon.exp

Log Message:
tests/lint: prevent typo from tree.c 1.264 from happening again


To generate a diff of this commit:
cvs rdiff -u -r1.1034 -r1.1035 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.37 -r1.38 src/tests/usr.bin/xlint/lint1/Makefile \
src/tests/usr.bin/xlint/lint1/t_integration.sh
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/op_colon.c \
src/tests/usr.bin/xlint/lint1/op_colon.exp

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1034 src/distrib/sets/lists/tests/mi:1.1035
--- src/distrib/sets/lists/tests/mi:1.1034	Sun Mar 28 14:01:49 2021
+++ src/distrib/sets/lists/tests/mi	Fri Apr  2 17:25:04 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1034 2021/03/28 14:01:49 rillig Exp $
+# $NetBSD: mi,v 1.1035 2021/04/02 17:25:04 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6861,6 +6861,8 @@
 ./usr/tests/usr.bin/xlint/lint1/msg_339.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_340.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_340.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/op_colon.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/op_colon.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/t_integration			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/ztesttests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/ztest/Atffile			tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.37 src/tests/usr.bin/xlint/lint1/Makefile:1.38
--- src/tests/usr.bin/xlint/lint1/Makefile:1.37	Sun Mar 28 14:01:50 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Fri Apr  2 17:25:04 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.37 2021/03/28 14:01:50 rillig Exp $
+# $NetBSD: Makefile,v 1.38 2021/04/02 17:25:04 rillig Exp $
 
 NOMAN=		# defined
 
@@ -99,6 +99,8 @@ FILES+=		d_typefun.c
 FILES+=		d_typename_as_var.c
 FILES+=		d_zero_sized_arrays.c
 FILES+=		${:U0 ${:U:range=340}:C,^.$,0&,:C,^..$,0&,:@msg@msg_${msg}.c msg_${msg}.exp@:Nmsg_176.exp}
+FILES+=		op_colon.c
+FILES+=		op_colon.exp
 
 # Note: only works for adding tests.
 # To remove a test, the $$mi file must be edited manually.
Index: src/tests/usr.bin/xlint/lint1/t_integration.sh
diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.37 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.38
--- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.37	Sun Mar 28 14:01:50 2021
+++ src/tests/usr.bin/xlint/lint1/t_integration.sh	Fri Apr  2 17:25:04 2021
@@ -1,4 +1,4 @@
-# $NetBSD: t_integration.sh,v 1.37 2021/03/28 14:01:50 rillig Exp $
+# $NetBSD: t_integration.sh,v 1.38 2021/04/02 17:25:04 rillig Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -166,6 +166,8 @@ test_case d_type_conv3
 test_case d_incorrect_array_size
 test_case d_long_double_int
 
+test_case op_colon
+
 test_case all_messages
 all_messages_body()
 {

Added files:

Index: src/tests/usr.bin/xlint/lint1/op_colon.c
diff -u /dev/null src/tests/usr.bin/xlint/lint1/op_colon.c:1.1
--- /dev/null	Fri Apr  2 17:25:04 2021
+++ src/tests/usr.bin/xlint/lint1/op_colon.c	Fri Apr  2 17:25:04 2021
@@ -0,0 +1,35 @@
+/*	$NetBSD: op_colon.c,v 1.1 2021/04/02 17:25:04 rillig Exp $	*/
+# 3 "op_colon.c"
+
+/*
+ * Test handling of the operator ':', as part of the '?:'.
+ */
+
+/* lint1-extra-flags: -p */
+
+void sink(void *);
+
+void
+test_merge_qualifiers(_Bool cond, int *p, const int *c, volatile int *v,
+		  const volatile int *cv)
+{
+	sink(cond ? p : p);
+	sink(cond ? p : c);	/* expect: 'pointer to const int' */
+	sink(cond ? p : v);	/* expect: 'pointer to volatile int' */
+	sink(cond ? p : cv);	/* expect: 'pointer to const volatile int' */
+
+	sink(cond ? c : p);	/* expect: 'pointer to const int' */
+	sink(cond ? c : c);	/* expect: 'pointer to const int' */
+	sink(cond ? c : v);	/* expect: 'pointer to const volatile int' */
+	sink(cond ? c : cv);	/* expect: 'pointer to const volatile int' */
+
+	sink(cond ? v : p);	/* expect: 'pointer to volatile int' */
+	sink(cond ? v : c);	/* expect: 'pointer to const volatile int' */
+	sink(cond ? v : v);	/* expect: 'pointer to volatile int' */
+	sink(cond ? v : cv);	/* expect: 'pointer to const volatile int' */
+
+	sink(cond ? cv : p);	/* expect: 'pointer to const volatile int' */
+	sink(cond ? cv : c);	/* expect: 'pointer to const volatile int' */
+	sink(cond ? cv : v);	/* expect: 'pointer 

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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 17:10:52 UTC 2021

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

Log Message:
lint: fix typo from previous commit in merge_qualifiers


To generate a diff of this commit:
cvs rdiff -u -r1.263 -r1.264 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.263 src/usr.bin/xlint/lint1/tree.c:1.264
--- src/usr.bin/xlint/lint1/tree.c:1.263	Fri Apr  2 17:01:39 2021
+++ src/usr.bin/xlint/lint1/tree.c	Fri Apr  2 17:10:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.263 2021/04/02 17:01:39 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.264 2021/04/02 17:10:52 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.263 2021/04/02 17:01:39 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.264 2021/04/02 17:10:52 rillig Exp $");
 #endif
 
 #include 
@@ -2621,12 +2621,12 @@ merge_qualifiers(type_t *tp1, const type
 	bool v1 = tp1->t_subt->t_volatile;
 	bool v2 = tp2->t_subt->t_volatile;
 
-	if (c1 == (c1 | c2) && v2 == (v1 | v2))
+	if (c1 == (c1 | c2) && v1 == (v1 | v2))
 		return tp1;
 
 	nstp = expr_dup_type(tp1->t_subt);
-	nstp->t_const = c1 | c2;
-	nstp->t_volatile = v1 | v2;
+	nstp->t_const |= c2;
+	nstp->t_volatile |= v2;
 
 	ntp = expr_dup_type(tp1);
 	ntp->t_subt = nstp;



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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 17:01:39 UTC 2021

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

Log Message:
lint: clean up merge_qualifiers

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.262 -r1.263 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.262 src/usr.bin/xlint/lint1/tree.c:1.263
--- src/usr.bin/xlint/lint1/tree.c:1.262	Fri Apr  2 16:38:08 2021
+++ src/usr.bin/xlint/lint1/tree.c	Fri Apr  2 17:01:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.262 2021/04/02 16:38:08 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.263 2021/04/02 17:01:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.262 2021/04/02 16:38:08 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.263 2021/04/02 17:01:39 rillig Exp $");
 #endif
 
 #include 
@@ -67,7 +67,6 @@ static	void	warn_incompatible_types(op_t
 	const type_t *, tspec_t);
 static	void	warn_incompatible_pointers(const mod_t *,
 	   const type_t *, const type_t *);
-static	void	merge_qualifiers(type_t **, type_t *, type_t *);
 static	bool	has_constant_member(const type_t *);
 static	void	check_prototype_conversion(int, tspec_t, tspec_t, type_t *,
 	   tnode_t *);
@@ -2608,31 +2607,30 @@ warn_incompatible_pointers(const mod_t *
 	}
 }
 
-/*
- * Make sure type (*tpp)->t_subt has at least the qualifiers
- * of tp1->t_subt and tp2->t_subt.
- */
-static void
-merge_qualifiers(type_t **tpp, type_t *tp1, type_t *tp2)
+/* Return a type based on tp1, with added qualifiers from tp2. */
+static type_t *
+merge_qualifiers(type_t *tp1, const type_t *tp2)
 {
+	type_t *ntp, *nstp;
 
-	lint_assert((*tpp)->t_tspec == PTR);
 	lint_assert(tp1->t_tspec == PTR);
 	lint_assert(tp2->t_tspec == PTR);
 
-	if ((*tpp)->t_subt->t_const ==
-	(tp1->t_subt->t_const | tp2->t_subt->t_const) &&
-	(*tpp)->t_subt->t_volatile ==
-	(tp1->t_subt->t_volatile | tp2->t_subt->t_volatile)) {
-		return;
-	}
-
-	*tpp = expr_dup_type(*tpp);
-	(*tpp)->t_subt = expr_dup_type((*tpp)->t_subt);
-	(*tpp)->t_subt->t_const =
-		tp1->t_subt->t_const | tp2->t_subt->t_const;
-	(*tpp)->t_subt->t_volatile =
-		tp1->t_subt->t_volatile | tp2->t_subt->t_volatile;
+	bool c1 = tp1->t_subt->t_const;
+	bool c2 = tp2->t_subt->t_const;
+	bool v1 = tp1->t_subt->t_volatile;
+	bool v2 = tp2->t_subt->t_volatile;
+
+	if (c1 == (c1 | c2) && v2 == (v1 | v2))
+		return tp1;
+
+	nstp = expr_dup_type(tp1->t_subt);
+	nstp->t_const = c1 | c2;
+	nstp->t_volatile = v1 | v2;
+
+	ntp = expr_dup_type(tp1);
+	ntp->t_subt = nstp;
+	return ntp;
 }
 
 /*
@@ -2894,24 +2892,17 @@ build_colon(tnode_t *ln, tnode_t *rn)
 		}
 		tp = rn->tn_type;
 	} else if (lt == PTR && ln->tn_type->t_subt->t_tspec == VOID) {
-		lint_assert(rt == PTR);
-		tp = rn->tn_type;
-		merge_qualifiers(, ln->tn_type, rn->tn_type);
+		tp = merge_qualifiers(rn->tn_type, ln->tn_type);
 	} else if (rt == PTR && rn->tn_type->t_subt->t_tspec == VOID) {
-		lint_assert(lt == PTR);
-		tp = ln->tn_type;
-		merge_qualifiers(, ln->tn_type, rn->tn_type);
+		tp = merge_qualifiers(ln->tn_type, rn->tn_type);
 	} else {
-		lint_assert(lt == PTR);
-		lint_assert(rt == PTR);
 		/*
 		 * XXX For now we simply take the left type. This is
 		 * probably wrong, if one type contains a function prototype
 		 * and the other one, at the same place, only an old style
 		 * declaration.
 		 */
-		tp = ln->tn_type;
-		merge_qualifiers(, ln->tn_type, rn->tn_type);
+		tp = merge_qualifiers(ln->tn_type, rn->tn_type);
 	}
 
 	ntn = new_tnode(COLON, tp, ln, rn);



CVS commit: src/sys/arch/powerpc/oea

2021-04-02 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Apr  2 16:59:59 UTC 2021

Modified Files:
src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
clarify comment in previous
( this is a hack, should go away when the root cause is fixed etc. )
no functional change


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/powerpc/oea/ofwoea_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/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.60 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.61
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.60	Thu Apr  1 22:02:20 2021
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Fri Apr  2 16:59:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.60 2021/04/01 22:02:20 macallan Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.61 2021/04/02 16:59:59 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.60 2021/04/01 22:02:20 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.61 2021/04/02 16:59:59 macallan Exp $");
 
 #include "ksyms.h"
 #include "wsdisplay.h"
@@ -379,9 +379,12 @@ restore_ofmap(void)
 			continue;
 
 		/*
-		 * XXX
-		 * my beige G3 throws a DSI trap if we try to map the last page
-		 * of the firmware ROM
+		 * XXX macallan@
+		 * My beige G3 throws a DSI trap if we try to map the last page
+		 * of the 32bit address space. On old world macs the firmware
+		 * ROM occupies 4MB at 0xffc0, triggering it when we 
+		 * restore OF translations. This just works around a bug
+		 * elsewhere in pmap and should go away once fixed there.
 		 */
 		if (pa == 0xffc0 && size == 0x40)
 			size = 0x3ff000;



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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 16:38:08 UTC 2021

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

Log Message:
lint: rename local variable in build_colon

The name 'rtp' was confusing since it did not correspond to 'rn'.  The
'r' meant 'result', not 'right-hand side'.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.261 -r1.262 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.261 src/usr.bin/xlint/lint1/tree.c:1.262
--- src/usr.bin/xlint/lint1/tree.c:1.261	Fri Apr  2 16:17:19 2021
+++ src/usr.bin/xlint/lint1/tree.c	Fri Apr  2 16:38:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.261 2021/04/02 16:17:19 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.262 2021/04/02 16:38:08 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.261 2021/04/02 16:17:19 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.262 2021/04/02 16:38:08 rillig Exp $");
 #endif
 
 #include 
@@ -2854,7 +2854,7 @@ static tnode_t *
 build_colon(tnode_t *ln, tnode_t *rn)
 {
 	tspec_t	lt, rt, pdt;
-	type_t	*rtp;
+	type_t	*tp;
 	tnode_t	*ntn;
 
 	lt = ln->tn_type->t_tspec;
@@ -2866,11 +2866,11 @@ build_colon(tnode_t *ln, tnode_t *rn)
 	 * still need to be handled.
 	 */
 	if (is_arithmetic(lt) && is_arithmetic(rt)) {
-		rtp = ln->tn_type;
+		tp = ln->tn_type;
 	} else if (lt == BOOL && rt == BOOL) {
-		rtp = ln->tn_type;
+		tp = ln->tn_type;
 	} else if (lt == VOID || rt == VOID) {
-		rtp = gettyp(VOID);
+		tp = gettyp(VOID);
 	} else if (lt == STRUCT || lt == UNION) {
 		/* Both types must be identical. */
 		lint_assert(rt == STRUCT || rt == UNION);
@@ -2880,27 +2880,27 @@ build_colon(tnode_t *ln, tnode_t *rn)
 			error(138, op_name(COLON));
 			return NULL;
 		}
-		rtp = ln->tn_type;
+		tp = ln->tn_type;
 	} else if (lt == PTR && is_integer(rt)) {
 		if (rt != pdt) {
 			rn = convert(NOOP, 0, gettyp(pdt), rn);
 			rt = pdt;
 		}
-		rtp = ln->tn_type;
+		tp = ln->tn_type;
 	} else if (rt == PTR && is_integer(lt)) {
 		if (lt != pdt) {
 			ln = convert(NOOP, 0, gettyp(pdt), ln);
 			lt = pdt;
 		}
-		rtp = rn->tn_type;
+		tp = rn->tn_type;
 	} else if (lt == PTR && ln->tn_type->t_subt->t_tspec == VOID) {
 		lint_assert(rt == PTR);
-		rtp = rn->tn_type;
-		merge_qualifiers(, ln->tn_type, rn->tn_type);
+		tp = rn->tn_type;
+		merge_qualifiers(, ln->tn_type, rn->tn_type);
 	} else if (rt == PTR && rn->tn_type->t_subt->t_tspec == VOID) {
 		lint_assert(lt == PTR);
-		rtp = ln->tn_type;
-		merge_qualifiers(, ln->tn_type, rn->tn_type);
+		tp = ln->tn_type;
+		merge_qualifiers(, ln->tn_type, rn->tn_type);
 	} else {
 		lint_assert(lt == PTR);
 		lint_assert(rt == PTR);
@@ -2910,11 +2910,11 @@ build_colon(tnode_t *ln, tnode_t *rn)
 		 * and the other one, at the same place, only an old style
 		 * declaration.
 		 */
-		rtp = ln->tn_type;
-		merge_qualifiers(, ln->tn_type, rn->tn_type);
+		tp = ln->tn_type;
+		merge_qualifiers(, ln->tn_type, rn->tn_type);
 	}
 
-	ntn = new_tnode(COLON, rtp, ln, rn);
+	ntn = new_tnode(COLON, tp, ln, rn);
 
 	return ntn;
 }



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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 16:17:19 UTC 2021

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

Log Message:
lint: replace a new modtab with op_name

This reduces the types of variables that are passed around.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.260 -r1.261 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.260 src/usr.bin/xlint/lint1/tree.c:1.261
--- src/usr.bin/xlint/lint1/tree.c:1.260	Fri Apr  2 15:06:35 2021
+++ src/usr.bin/xlint/lint1/tree.c	Fri Apr  2 16:17:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.260 2021/04/02 15:06:35 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.261 2021/04/02 16:17:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.260 2021/04/02 15:06:35 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.261 2021/04/02 16:17:19 rillig Exp $");
 #endif
 
 #include 
@@ -695,7 +695,7 @@ cconv(tnode_t *tn)
 		if (!tn->tn_lvalue) {
 			/* XXX print correct operator */
 			/* %soperand of '%s' must be lvalue */
-			gnuism(114, "", modtab[ADDR].m_name);
+			gnuism(114, "", op_name(ADDR));
 		}
 		tn = new_tnode(ADDR,
 		expr_derive_type(tn->tn_type->t_subt, PTR), tn, NULL);
@@ -774,7 +774,7 @@ is_typeok_bool_operand(const tnode_t *tn
 }
 
 static bool
-typeok_incdec(const mod_t *mp, const tnode_t *tn, const type_t *tp)
+typeok_incdec(op_t op, const tnode_t *tn, const type_t *tp)
 {
 	/* operand has scalar type (checked in typeok) */
 	if (!tn->tn_lvalue) {
@@ -786,12 +786,12 @@ typeok_incdec(const mod_t *mp, const tno
 			error(163);
 		}
 		/* %soperand of '%s' must be lvalue */
-		error(114, "", mp->m_name);
+		error(114, "", op_name(op));
 		return false;
 	} else if (tp->t_const) {
 		if (!tflag)
 			/* %soperand of '%s' must be modifiable lvalue */
-			warning(115, "", mp->m_name);
+			warning(115, "", op_name(op));
 	}
 	return true;
 }
@@ -1334,7 +1334,7 @@ typeok_op(op_t op, const mod_t *mp, int 
 	case DECAFT:
 	case INCBEF:
 	case DECBEF:
-		if (!typeok_incdec(mp, ln, ltp))
+		if (!typeok_incdec(op, ln, ltp))
 			return false;
 		break;
 	case ADDR:
@@ -2877,7 +2877,7 @@ build_colon(tnode_t *ln, tnode_t *rn)
 		lint_assert(ln->tn_type->t_str == rn->tn_type->t_str);
 		if (is_incomplete(ln->tn_type)) {
 			/* unknown operand size, op %s */
-			error(138, modtab[COLON].m_name);
+			error(138, op_name(COLON));
 			return NULL;
 		}
 		rtp = ln->tn_type;
@@ -3183,7 +3183,7 @@ fold(tnode_t *tn)
 	(q & ~mask) != 0)) {
 		if (hflag)
 			/* integer overflow detected, op %s */
-			warning(141, modtab[tn->tn_op].m_name);
+			warning(141, op_name(tn->tn_op));
 	}
 
 	v->v_quad = xsign(q, t, -1);
@@ -3317,7 +3317,7 @@ fold_float(tnode_t *tn)
 	(t == DOUBLE &&
 	 (v->v_ldbl > DBL_MAX || v->v_ldbl < -DBL_MAX))) {
 		/* floating point overflow detected, op %s */
-		warning(142, modtab[tn->tn_op].m_name);
+		warning(142, op_name(tn->tn_op));
 		if (t == FLOAT) {
 			v->v_ldbl = v->v_ldbl < 0 ? -FLT_MAX : FLT_MAX;
 		} else if (t == DOUBLE) {
@@ -3878,7 +3878,7 @@ display_expression(const tnode_t *tn, in
 		(void)printf("%*s%s\n", offs, "", "NULL");
 		return;
 	}
-	(void)printf("%*sop %s  ", offs, "", modtab[tn->tn_op].m_name);
+	(void)printf("%*sop %s  ", offs, "", op_name(tn->tn_op));
 
 	if (tn->tn_op == NAME) {
 		(void)printf("%s: %s ",
@@ -4173,11 +4173,9 @@ static void
 check_integer_comparison(op_t op, tnode_t *ln, tnode_t *rn)
 {
 	tspec_t	lt, rt;
-	const mod_t *mp;
 
 	lt = ln->tn_type->t_tspec;
 	rt = rn->tn_type->t_tspec;
-	mp = [op];
 
 	if (ln->tn_op != CON && rn->tn_op != CON)
 		return;
@@ -4189,14 +4187,14 @@ check_integer_comparison(op_t op, tnode_
 	(rn->tn_val->v_quad < 0 ||
 	 rn->tn_val->v_quad > (int)~(~0U << (CHAR_SIZE - 1 {
 		/* nonportable character comparison, op %s */
-		warning(230, mp->m_name);
+		warning(230, op_name(op));
 		return;
 	}
 	if ((hflag || pflag) && rt == CHAR && ln->tn_op == CON &&
 	(ln->tn_val->v_quad < 0 ||
 	 ln->tn_val->v_quad > (int)~(~0U << (CHAR_SIZE - 1 {
 		/* nonportable character comparison, op %s */
-		warning(230, mp->m_name);
+		warning(230, op_name(op));
 		return;
 	}
 	if (is_uinteger(lt) && !is_uinteger(rt) &&
@@ -4204,10 +4202,10 @@ check_integer_comparison(op_t op, tnode_
 		if (rn->tn_val->v_quad < 0) {
 			/* comparison of %s with %s, op %s */
 			warning(162, type_name(ln->tn_type),
-			"negative constant", mp->m_name);
+			"negative constant", op_name(op));
 		} else if (op == LT || op == GE || (hflag && op == LE)) {
 			/* comparison of %s with %s, op %s */
-			warning(162, type_name(ln->tn_type), "0", mp->m_name);
+			warning(162, type_name(ln->tn_type), "0", op_name(op));
 		}
 		return;
 	}
@@ 

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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 15:06:35 UTC 2021

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

Log Message:
lint: rename getopname to op_name

There are several functions called 'get' that allocate memory.  Remove
this possible confusion.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.259 -r1.260 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.101 src/usr.bin/xlint/lint1/func.c:1.102
--- src/usr.bin/xlint/lint1/func.c:1.101	Fri Apr  2 12:16:50 2021
+++ src/usr.bin/xlint/lint1/func.c	Fri Apr  2 15:06:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: func.c,v 1.101 2021/04/02 12:16:50 rillig Exp $	*/
+/*	$NetBSD: func.c,v 1.102 2021/04/02 15:06:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.101 2021/04/02 12:16:50 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.102 2021/04/02 15:06:35 rillig Exp $");
 #endif
 
 #include 
@@ -447,7 +447,7 @@ check_case_label_enum(const tnode_t *tn,
 
 #if 0 /* not yet ready, see msg_130.c */
 	/* enum type mismatch: '%s' '%s' '%s' */
-	warning(130, type_name(ci->c_switch_type), getopname(EQ),
+	warning(130, type_name(ci->c_switch_type), op_name(EQ),
 	type_name(tn->tn_type));
 #endif
 }

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.259 src/usr.bin/xlint/lint1/tree.c:1.260
--- src/usr.bin/xlint/lint1/tree.c:1.259	Fri Apr  2 12:16:50 2021
+++ src/usr.bin/xlint/lint1/tree.c	Fri Apr  2 15:06:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.259 2021/04/02 12:16:50 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.260 2021/04/02 15:06:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.259 2021/04/02 12:16:50 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.260 2021/04/02 15:06:35 rillig Exp $");
 #endif
 
 #include 
@@ -99,7 +99,7 @@ static	void	check_precedence_confusion(t
 extern sig_atomic_t fpe;
 
 static const char *
-getopname(op_t op)
+op_name(op_t op)
 {
 	return modtab[op].m_name;
 }
@@ -118,7 +118,7 @@ debug_node(const tnode_t *tn, int indent
 	op = tn->tn_op;
 	printf("%*s%s with type '%s'%s%s",
 	2 * indent, "",
-	op == CVT && !tn->tn_cast ? "convert" : getopname(op),
+	op == CVT && !tn->tn_cast ? "convert" : op_name(op),
 	type_name(tn->tn_type), tn->tn_lvalue ? ", lvalue" : "",
 	tn->tn_parenthesized ? ", parenthesized" : "");
 
@@ -477,7 +477,7 @@ struct_or_union_member(tnode_t *tn, op_t
 			error(105, op == POINT ? "object" : "pointer");
 		} else {
 			/* unacceptable operand of '%s' */
-			error(111, getopname(op));
+			error(111, op_name(op));
 		}
 	}
 
@@ -999,7 +999,7 @@ typeok_ordered_comparison(op_t op,
 	const char *lx = lt == PTR ? "pointer" : "integer";
 	const char *rx = rt == PTR ? "pointer" : "integer";
 	/* illegal combination of %s (%s) and %s (%s), op %s */
-	warning(123, lx, type_name(ltp), rx, type_name(rtp), getopname(op));
+	warning(123, lx, type_name(ltp), rx, type_name(rtp), op_name(op));
 	return true;
 }
 
@@ -1184,7 +1184,7 @@ typeok_strict_bool_compatible(op_t op, i
 		error(211, tspec_name(lt), tspec_name(rt));
 	} else {
 		/* operands of '%s' have incompatible types (%s != %s) */
-		error(107, getopname(op), tspec_name(lt), tspec_name(rt));
+		error(107, op_name(op), tspec_name(lt), tspec_name(rt));
 	}
 
 	return false;
@@ -1222,17 +1222,17 @@ typeok_scalar_strict_bool(op_t op, const
 
 		if (!binary && !lbool) {
 			/* operand of '%s' must be bool, not '%s' */
-			error(330, getopname(op), tspec_name(lt));
+			error(330, op_name(op), tspec_name(lt));
 			ok = false;
 		}
 		if (binary && !lbool) {
 			/* left operand of '%s' must be bool, not '%s' */
-			error(331, getopname(op), tspec_name(lt));
+			error(331, op_name(op), tspec_name(lt));
 			ok = false;
 		}
 		if (binary && op != QUEST && !is_typeok_bool_operand(rn)) {
 			/* right operand of '%s' must be bool, not '%s' */
-			error(332, getopname(op), tspec_name(rt));
+			error(332, op_name(op), tspec_name(rt));
 			ok = false;
 		}
 		return ok;
@@ -1245,17 +1245,17 @@ typeok_scalar_strict_bool(op_t op, const
 
 		if (!binary && lbool) {
 			/* operand of '%s' must not be bool */
-			error(335, getopname(op));
+			error(335, op_name(op));
 			ok = false;
 		}
 		if (binary && lbool) {
 			/* left operand of '%s' must not be bool */
-			error(336, getopname(op));
+			error(336, op_name(op));
 			ok = false;
 		}
 		if (binary && rn->tn_type->t_tspec == BOOL) {
 			/* right operand of '%s' must not be bool */
-			error(337, getopname(op));
+			error(337, op_name(op));
 			ok = false;
 		

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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 14:50:47 UTC 2021

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

Log Message:
lint: reorder struct members to be in comprehension order

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 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.192 src/usr.bin/xlint/lint1/init.c:1.193
--- src/usr.bin/xlint/lint1/init.c:1.192	Fri Apr  2 14:32:27 2021
+++ src/usr.bin/xlint/lint1/init.c	Fri Apr  2 14:50:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.192 2021/04/02 14:32:27 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.193 2021/04/02 14:50:47 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.192 2021/04/02 14:32:27 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.193 2021/04/02 14:50:47 rillig Exp $");
 #endif
 
 #include 
@@ -117,22 +117,27 @@ struct designation {
  * See C99 6.7.8p17.
  */
 struct brace_level {
-	/*
-	 * The type of the current object that is initialized at this brace
-	 * level.
-	 */
-	const type_t	*bl_type;
+	const type_t	*bl_type;	/* The type of the current object that
+	 * is initialized at this brace
+	 * level. */
+
+	struct designation bl_designation;	/* .member[123].member */
 
 	const sym_t	*bl_member;		/* for structs and unions */
 	size_t		bl_subscript;		/* for arrays */
 	bool		bl_scalar_done: 1;	/* for scalars */
 	bool		bl_confused: 1;		/* skip further checks */
-	struct designation bl_designation;	/* .member[123].member */
 
 	struct brace_level *bl_enclosing;
 };
 
 struct initialization {
+	/* The symbol that is to be initialized. */
+	sym_t		*in_sym;
+
+	/* The innermost brace level. */
+	struct brace_level *in_brace_level;
+
 	/*
 	 * Is set as soon as a fatal error occurred in the initialization.
 	 * The effect is that the rest of the initialization is ignored
@@ -141,12 +146,6 @@ struct initialization {
 	 */
 	bool		in_err;
 
-	/* The symbol that is to be initialized. */
-	sym_t		*in_sym;
-
-	/* The innermost brace level. */
-	struct brace_level *in_brace_level;
-
 	struct initialization *in_enclosing;
 };
 



CVS commit: src/doc

2021-04-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr  2 14:41:07 UTC 2021

Modified Files:
src/doc: CHANGES

Log Message:
Fix style to appease changes2html.


To generate a diff of this commit:
cvs rdiff -u -r1.2789 -r1.2790 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/CHANGES
diff -u src/doc/CHANGES:1.2789 src/doc/CHANGES:1.2790
--- src/doc/CHANGES:1.2789	Fri Apr  2 07:00:33 2021
+++ src/doc/CHANGES	Fri Apr  2 14:41:07 2021
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2789 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2790 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -335,8 +335,8 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	bind: Import version 9.16.12. [christos 20210219]
 	OpenSSL: Imported 1.1.1j. [christos 20210219]
 	byacc: Update to 20210109. [christos 20210220]
-	regex: Add NLS support and gnu regex extensions (off by default)
-	[christos 20210223]
+	regex: Add NLS support and gnu regex extensions (off by default).
+		[christos 20210223]
 	wpa: Import wpa_supplicant and hostapd 2.9. [christos 20210228]
 	tzcode: Updated to 2021a. [christos 20210228]
 	OpenSSH: Import 8.5. [christos 20210304]



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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 14:32:27 UTC 2021

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

Log Message:
lint: rename members of brace_level

The terms 'member' and 'subscript' are distinctive enough.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 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.191 src/usr.bin/xlint/lint1/init.c:1.192
--- src/usr.bin/xlint/lint1/init.c:1.191	Fri Apr  2 14:19:33 2021
+++ src/usr.bin/xlint/lint1/init.c	Fri Apr  2 14:32:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.191 2021/04/02 14:19:33 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.192 2021/04/02 14:32:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.191 2021/04/02 14:19:33 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.192 2021/04/02 14:32:27 rillig Exp $");
 #endif
 
 #include 
@@ -122,11 +122,13 @@ struct brace_level {
 	 * level.
 	 */
 	const type_t	*bl_type;
-	const sym_t	*bl_next_member;	/* for structs and unions */
-	size_t		bl_array_next_subscript;
+
+	const sym_t	*bl_member;		/* for structs and unions */
+	size_t		bl_subscript;		/* for arrays */
 	bool		bl_scalar_done: 1;	/* for scalars */
 	bool		bl_confused: 1;		/* skip further checks */
 	struct designation bl_designation;	/* .member[123].member */
+
 	struct brace_level *bl_enclosing;
 };
 
@@ -549,7 +551,7 @@ brace_level_new(const type_t *tp, struct
 	bl->bl_type = tp;
 	bl->bl_enclosing = enclosing;
 	if (is_struct_or_union(tp->t_tspec))
-		bl->bl_next_member = first_named_member(tp);
+		bl->bl_member = first_named_member(tp);
 
 	return bl;
 }
@@ -568,18 +570,14 @@ brace_level_debug(const struct brace_lev
 {
 
 	lint_assert(bl->bl_type != NULL);
-	lint_assert(bl->bl_next_member == NULL ||
-	!is_unnamed(bl->bl_next_member));
+	lint_assert(bl->bl_member == NULL || !is_unnamed(bl->bl_member));
 
 	debug_printf("type '%s'", type_name(bl->bl_type));
 
-	if (is_struct_or_union(bl->bl_type->t_tspec) &&
-	bl->bl_next_member != NULL)
-		debug_printf(", next member '%s'",
-		bl->bl_next_member->s_name);
+	if (is_struct_or_union(bl->bl_type->t_tspec) && bl->bl_member != NULL)
+		debug_printf(", member '%s'", bl->bl_member->s_name);
 	if (bl->bl_type->t_tspec == ARRAY)
-		debug_printf(", next array subscript %zu",
-		bl->bl_array_next_subscript);
+		debug_printf(", subscript %zu", bl->bl_subscript);
 
 	debug_printf("\n");
 }
@@ -591,14 +589,14 @@ static const type_t *
 brace_level_sub_type_struct_or_union(const struct brace_level *bl)
 {
 
-	if (bl->bl_next_member == NULL) {
+	if (bl->bl_member == NULL) {
 		/* too many struct/union initializers */
 		error(172);
 		return NULL;
 	}
 
-	lint_assert(!is_unnamed(bl->bl_next_member));
-	return sym_type(bl->bl_next_member);
+	lint_assert(!is_unnamed(bl->bl_member));
+	return sym_type(bl->bl_member);
 }
 
 static const type_t *
@@ -606,7 +604,7 @@ brace_level_sub_type_array(const struct 
 {
 
 	if (!bl->bl_confused && !bl->bl_type->t_incomplete_array &&
-	bl->bl_array_next_subscript >= (size_t)bl->bl_type->t_dim) {
+	bl->bl_subscript >= (size_t)bl->bl_type->t_dim) {
 		/* too many array initializers, expected %d */
 		error(173, bl->bl_type->t_dim);
 	}
@@ -645,6 +643,7 @@ brace_level_sub_type(const struct brace_
 	}
 }
 
+/* C99 6.7.8p17 */
 static void
 brace_level_apply_designation(struct brace_level *bl)
 {
@@ -660,12 +659,12 @@ brace_level_apply_designation(struct bra
 	case UNION:
 		if (dr->dr_name == NULL)
 			return;	/* error, silently ignored */
-		bl->bl_next_member = look_up_member(bl->bl_type, dr->dr_name);
+		bl->bl_member = look_up_member(bl->bl_type, dr->dr_name);
 		break;
 	case ARRAY:
 		if (dr->dr_name != NULL)
 			return;	/* error, silently ignored */
-		bl->bl_array_next_subscript = dr->dr_subscript;
+		bl->bl_subscript = dr->dr_subscript;
 		break;
 	default:
 		break;		/* error, silently ignored */
@@ -683,14 +682,14 @@ brace_level_advance(struct brace_level *
 
 	switch (bl->bl_type->t_tspec) {
 	case STRUCT:
-		lint_assert(bl->bl_next_member != NULL);
-		bl->bl_next_member = skip_unnamed(bl->bl_next_member->s_next);
+		lint_assert(bl->bl_member != NULL);
+		bl->bl_member = skip_unnamed(bl->bl_member->s_next);
 		break;
 	case UNION:
-		bl->bl_next_member = NULL;
+		bl->bl_member = NULL;
 		break;
 	case ARRAY:
-		bl->bl_array_next_subscript++;
+		bl->bl_subscript++;
 		break;
 	default:
 		bl->bl_scalar_done = true;
@@ -813,7 +812,7 @@ initialization_set_size_of_unknown_array
 	if (in->in_sym->s_type->t_incomplete_array &&
 	in->in_brace_level->bl_enclosing == NULL)
 		update_type_of_array_of_unknown_size(in->in_sym,
-		in->in_brace_level->bl_array_next_subscript);
+		

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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 14:19:33 UTC 2021

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

Log Message:
lint: remove unused brace_level.bl_array_of_unknown_size

Since init.c 1.177 from 2021-03-29, the type of the object to be
initialized is no longer modified in the middle of the initialization,
as required by C99 6.7.8p22.  Therefore it is no longer necessary to
keep this redundant information around.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 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.190 src/usr.bin/xlint/lint1/init.c:1.191
--- src/usr.bin/xlint/lint1/init.c:1.190	Fri Apr  2 12:16:50 2021
+++ src/usr.bin/xlint/lint1/init.c	Fri Apr  2 14:19:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.190 2021/04/02 12:16:50 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.191 2021/04/02 14:19:33 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.190 2021/04/02 12:16:50 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.191 2021/04/02 14:19:33 rillig Exp $");
 #endif
 
 #include 
@@ -124,7 +124,6 @@ struct brace_level {
 	const type_t	*bl_type;
 	const sym_t	*bl_next_member;	/* for structs and unions */
 	size_t		bl_array_next_subscript;
-	bool		bl_array_of_unknown_size: 1;
 	bool		bl_scalar_done: 1;	/* for scalars */
 	bool		bl_confused: 1;		/* skip further checks */
 	struct designation bl_designation;	/* .member[123].member */
@@ -526,8 +525,6 @@ designation_look_up(const struct designa
 	return tp;
 }
 
-
-
 static void
 designation_reset(struct designation *dn)
 {
@@ -576,9 +573,6 @@ brace_level_debug(const struct brace_lev
 
 	debug_printf("type '%s'", type_name(bl->bl_type));
 
-	if (bl->bl_array_of_unknown_size)
-		debug_printf(", array of unknown size");
-
 	if (is_struct_or_union(bl->bl_type->t_tspec) &&
 	bl->bl_next_member != NULL)
 		debug_printf(", next member '%s'",



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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 13:16:38 UTC 2021

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

Log Message:
tests/lint: add test for enum type mismatch


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/xlint/lint1/msg_130.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_130.c
diff -u src/tests/usr.bin/xlint/lint1/msg_130.c:1.12 src/tests/usr.bin/xlint/lint1/msg_130.c:1.13
--- src/tests/usr.bin/xlint/lint1/msg_130.c:1.12	Sun Mar 21 15:24:56 2021
+++ src/tests/usr.bin/xlint/lint1/msg_130.c	Fri Apr  2 13:16:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_130.c,v 1.12 2021/03/21 15:24:56 rillig Exp $	*/
+/*	$NetBSD: msg_130.c,v 1.13 2021/04/02 13:16:38 rillig Exp $	*/
 # 3 "msg_130.c"
 
 // Test for message: enum type mismatch: '%s' '%s' '%s' [130]
@@ -127,3 +127,44 @@ state_machine(const char *str)
 	if (state == sizeof_int)	/* expect: 130 */
 		return;
 }
+
+/*
+ * For check_case_label_enum, a warning only makes sense if the type of the
+ * enum can actually be specified somehow, either explicitly by using a tag
+ * name or a typedef name, or implicitly by using a variable in a switch
+ * expression.
+ */
+
+typedef enum {
+	has_typedef = 1001
+} typedef_name;
+
+enum tag_name {
+	has_tag = 1002
+};
+
+enum {
+	has_variable = 1003
+} variable;
+
+enum {
+	inaccessible = 1004
+};
+
+/*
+ * This check is already done by Clang, so it may not be necessary to add it
+ * to lint as well.  Except if there are some cases that Clang didn't
+ * implement.
+ */
+void
+test_check_case_label_enum(enum color color)
+{
+	switch (color)
+	{
+	case has_typedef:
+	case has_tag:
+	case has_variable:
+	case inaccessible:
+		return;
+	}
+}



CVS commit: src

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 12:16:50 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_init.c msg_144.c
src/usr.bin/xlint/common: tyname.c
src/usr.bin/xlint/lint1: cgram.y decl.c err.c func.c init.c lex.c
main1.c mem1.c tree.c
src/usr.bin/xlint/lint2: chk.c emit2.c hash.c main2.c read.c
src/usr.bin/xlint/xlint: xlint.c

Log Message:
lint: add parentheses after sizeof, as required by share/misc/style

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/tests/usr.bin/xlint/lint1/d_c99_init.c
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_144.c
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/xlint/common/tyname.c
cvs rdiff -u -r1.210 -r1.211 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.169 -r1.170 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.99 -r1.100 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.100 -r1.101 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/xlint/lint1/main1.c
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.258 -r1.259 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/xlint/lint2/chk.c \
src/usr.bin/xlint/lint2/read.c
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/lint2/emit2.c
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/xlint/lint2/hash.c \
src/usr.bin/xlint/lint2/main2.c
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/xlint/xlint/xlint.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/d_c99_init.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.30 src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.31
--- src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.30	Thu Apr  1 14:20:30 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_init.c	Fri Apr  2 12:16:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_c99_init.c,v 1.30 2021/04/01 14:20:30 rillig Exp $	*/
+/*	$NetBSD: d_c99_init.c,v 1.31 2021/04/02 12:16:50 rillig Exp $	*/
 # 3 "d_c99_init.c"
 
 /*
@@ -185,7 +185,7 @@ struct point points[] = {
 		 * extend_if_array_of_unknown_size, setcomplete is called too
 		 * early.
 		 */
-		sizeof points,
+		sizeof(points),
 		4
 	}
 };

Index: src/tests/usr.bin/xlint/lint1/msg_144.c
diff -u src/tests/usr.bin/xlint/lint1/msg_144.c:1.3 src/tests/usr.bin/xlint/lint1/msg_144.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_144.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_144.c	Fri Apr  2 12:16:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_144.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_144.c,v 1.4 2021/04/02 12:16:50 rillig Exp $	*/
 # 3 "msg_144.c"
 
 // Test for message: cannot take size/alignment of function [144]
@@ -6,5 +6,5 @@
 unsigned long
 example(void)
 {
-	return sizeof example;	/* expect: 144 */
+	return sizeof(example);	/* expect: 144 */
 }

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.36 src/usr.bin/xlint/common/tyname.c:1.37
--- src/usr.bin/xlint/common/tyname.c:1.36	Sat Mar 27 12:42:22 2021
+++ src/usr.bin/xlint/common/tyname.c	Fri Apr  2 12:16:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.36 2021/03/27 12:42:22 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.37 2021/04/02 12:16:50 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.36 2021/03/27 12:42:22 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.37 2021/04/02 12:16:50 rillig Exp $");
 #endif
 
 #include 
@@ -74,7 +74,7 @@ new_name_tree_node(const char *name)
 {
 	name_tree_node *n;
 
-	n = xmalloc(sizeof *n);
+	n = xmalloc(sizeof(*n));
 	n->ntn_name = xstrdup(name);
 	n->ntn_less = NULL;
 	n->ntn_greater = NULL;
@@ -137,9 +137,9 @@ buf_add(buffer *buf, const char *s)
 static void
 buf_add_int(buffer *buf, int n)
 {
-	char num[1 + sizeof n * CHAR_BIT + 1];
+	char num[1 + sizeof(n) * CHAR_BIT + 1];
 
-	snprintf(num, sizeof num, "%d", n);
+	snprintf(num, sizeof(num), "%d", n);
 	buf_add(buf, num);
 }
 

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.210 src/usr.bin/xlint/lint1/cgram.y:1.211
--- src/usr.bin/xlint/lint1/cgram.y:1.210	Fri Apr  2 11:53:25 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Fri Apr  2 12:16:50 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.210 2021/04/02 11:53:25 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.211 2021/04/02 12:16:50 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.210 2021/04/02 11:53:25 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.211 2021/04/02 12:16:50 rillig Exp $");
 #endif
 
 #include 
@@ -1197,7 +1197,7 @@ 

CVS commit: src/sys/arch

2021-04-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr  2 12:11:42 UTC 2021

Modified Files:
src/sys/arch/atari/include: intr.h
src/sys/arch/cesfic/cesfic: isr.c
src/sys/arch/luna68k/luna68k: isr.c
src/sys/arch/mac68k/mac68k: intr.c
src/sys/arch/mvme68k/mvme68k: isr.c
src/sys/arch/next68k/next68k: isr.c
src/sys/arch/sun3/sun3: clock.c
src/sys/arch/sun3/sun3x: clock.c

Log Message:
For ports with __HAVE_LEGACY_INTRCNT, turn intrcnt[] and derived
variables into u_int, to match with kern/subr_evcnt.c.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/atari/include/intr.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/cesfic/cesfic/isr.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/luna68k/luna68k/isr.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/mac68k/mac68k/intr.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/mvme68k/mvme68k/isr.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/next68k/next68k/isr.c
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sun3/sun3/clock.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/sun3/sun3x/clock.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/atari/include/intr.h
diff -u src/sys/arch/atari/include/intr.h:1.21 src/sys/arch/atari/include/intr.h:1.22
--- src/sys/arch/atari/include/intr.h:1.21	Wed Jul  8 12:23:10 2009
+++ src/sys/arch/atari/include/intr.h	Fri Apr  2 12:11:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.21 2009/07/08 12:23:10 tsutsui Exp $	*/
+/*	$NetBSD: intr.h,v 1.22 2021/04/02 12:11:41 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 2007 The NetBSD Foundation, Inc.
@@ -114,7 +114,7 @@ struct intrhand {
 	int			ih_type;
 	int			ih_pri;
 	int			ih_vector;
-	u_long			*ih_intrcnt;
+	u_int			*ih_intrcnt;
 };
 
 void		intr_init(void);
@@ -127,9 +127,9 @@ void		intr_glue(void);
  * Exported by intrcnt.h
  */
 extern u_long	autovects[];
-extern u_long	intrcnt_auto[];
+extern u_int	intrcnt_auto[];
 extern u_long	uservects[];
-extern u_long	intrcnt_user[];
+extern u_int	intrcnt_user[];
 
 #endif /* _KERNEL */
 

Index: src/sys/arch/cesfic/cesfic/isr.c
diff -u src/sys/arch/cesfic/cesfic/isr.c:1.18 src/sys/arch/cesfic/cesfic/isr.c:1.19
--- src/sys/arch/cesfic/cesfic/isr.c:1.18	Wed Nov 18 03:40:50 2020
+++ src/sys/arch/cesfic/cesfic/isr.c	Fri Apr  2 12:11:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.18 2020/11/18 03:40:50 thorpej Exp $	*/
+/*	$NetBSD: isr.c,v 1.19 2021/04/02 12:11:41 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.18 2020/11/18 03:40:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.19 2021/04/02 12:11:41 rin Exp $");
 
 #include 
 #include 
@@ -50,7 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.18
 typedef LIST_HEAD(, isr) isr_list_t;
 isr_list_t isr_list[NISR];
 
-extern	int intrcnt[];		/* from locore.s */
+extern	u_int intrcnt[];	/* from locore.s */
 
 void
 isrinit(void)

Index: src/sys/arch/luna68k/luna68k/isr.c
diff -u src/sys/arch/luna68k/luna68k/isr.c:1.24 src/sys/arch/luna68k/luna68k/isr.c:1.25
--- src/sys/arch/luna68k/luna68k/isr.c:1.24	Sat Dec 19 21:38:30 2020
+++ src/sys/arch/luna68k/luna68k/isr.c	Fri Apr  2 12:11:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.24 2020/12/19 21:38:30 thorpej Exp $	*/
+/*	$NetBSD: isr.c,v 1.25 2021/04/02 12:11:41 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.24 2020/12/19 21:38:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.25 2021/04/02 12:11:41 rin Exp $");
 
 /*
  * Link and dispatch interrupts.
@@ -51,7 +51,7 @@ isr_autovec_list_t isr_autovec[NISRAUTOV
 struct	isr_vectored isr_vectored[NISRVECTORED];
 int	idepth;
 
-extern	int intrcnt[];		/* from locore.s */
+extern	u_int intrcnt[];	/* from locore.s */
 extern	void (*vectab[])(void);
 extern	void badtrap(void);
 extern	void intrhand_vectored(void);

Index: src/sys/arch/mac68k/mac68k/intr.c
diff -u src/sys/arch/mac68k/mac68k/intr.c:1.31 src/sys/arch/mac68k/mac68k/intr.c:1.32
--- src/sys/arch/mac68k/mac68k/intr.c:1.31	Tue Jul 21 06:10:26 2020
+++ src/sys/arch/mac68k/mac68k/intr.c	Fri Apr  2 12:11:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.31 2020/07/21 06:10:26 rin Exp $	*/
+/*	$NetBSD: intr.c,v 1.32 2021/04/02 12:11:41 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.31 2020/07/21 06:10:26 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.32 2021/04/02 12:11:41 rin Exp $");
 
 #include 
 #include 
@@ -85,7 +85,7 @@ uint16_t ipl2psl_table[NIPL];
 int idepth;
 volatile int ssir;
 
-extern	int intrcnt[];		/* from locore.s */
+extern	u_int intrcnt[];	/* from locore.s */
 
 void	intr_computeipl(void);
 

Index: 

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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 11:53:25 UTC 2021

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

Log Message:
lint: rename functions for duplicating types

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.209 -r1.210 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.168 -r1.169 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.98 -r1.99 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.99 -r1.100 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.188 -r1.189 src/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.257 -r1.258 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.209 src/usr.bin/xlint/lint1/cgram.y:1.210
--- src/usr.bin/xlint/lint1/cgram.y:1.209	Fri Apr  2 10:13:03 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Fri Apr  2 11:53:25 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.209 2021/04/02 10:13:03 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.210 2021/04/02 11:53:25 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.209 2021/04/02 10:13:03 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.210 2021/04/02 11:53:25 rillig Exp $");
 #endif
 
 #include 
@@ -1889,7 +1889,7 @@ term:
 	expr_statement_list {
 		block_level--;
 		mem_block_level--;
-		begin_initialization(mktempsym(duptyp($4->tn_type)));
+		begin_initialization(mktempsym(dup_type($4->tn_type)));
 		mem_block_level++;
 		block_level++;
 		/* ({ }) is a GCC extension */

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.168 src/usr.bin/xlint/lint1/decl.c:1.169
--- src/usr.bin/xlint/lint1/decl.c:1.168	Fri Apr  2 10:13:03 2021
+++ src/usr.bin/xlint/lint1/decl.c	Fri Apr  2 11:53:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.168 2021/04/02 10:13:03 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.169 2021/04/02 11:53:25 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.168 2021/04/02 10:13:03 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.169 2021/04/02 11:53:25 rillig Exp $");
 #endif
 
 #include 
@@ -133,8 +133,9 @@ initdecl(void)
 /*
  * Returns a shared type structure for arithmetic types and void.
  *
- * It's important to duplicate this structure (using duptyp() or tduptyp())
- * if it is to be modified (adding qualifiers or anything else).
+ * It's important to duplicate this structure (using dup_type() or
+ * expr_dup_type()) if it is to be modified (adding qualifiers or anything
+ * else).
  */
 type_t *
 gettyp(tspec_t t)
@@ -144,7 +145,7 @@ gettyp(tspec_t t)
 }
 
 type_t *
-duptyp(const type_t *tp)
+dup_type(const type_t *tp)
 {
 	type_t	*ntp;
 
@@ -154,11 +155,11 @@ duptyp(const type_t *tp)
 }
 
 /*
- * Use tduptyp() instead of duptyp() inside expressions (if the
+ * Use expr_dup_type() instead of dup_type() inside expressions (if the
  * allocated memory should be freed after the expr).
  */
 type_t *
-tduptyp(const type_t *tp)
+expr_dup_type(const type_t *tp)
 {
 	type_t	*ntp;
 
@@ -394,7 +395,7 @@ tdeferr(type_t *td, tspec_t t)
 			if (!tflag)
 /* modifying typedef with '%s'; only ... */
 warning(5, ttab[t].tt_name);
-			td = duptyp(gettyp(merge_type_specifiers(t2, t)));
+			td = dup_type(gettyp(merge_type_specifiers(t2, t)));
 			td->t_typedef = true;
 			return td;
 		}
@@ -403,7 +404,7 @@ tdeferr(type_t *td, tspec_t t)
 		if (t2 == INT || t2 == UINT) {
 			/* modifying typedef with '%s'; only qualifiers ... */
 			warning(5, "short");
-			td = duptyp(gettyp(t2 == INT ? SHORT : USHORT));
+			td = dup_type(gettyp(t2 == INT ? SHORT : USHORT));
 			td->t_typedef = true;
 			return td;
 		}
@@ -428,7 +429,7 @@ tdeferr(type_t *td, tspec_t t)
 			} else if (t2 == DCOMPLEX) {
 td = gettyp(LCOMPLEX);
 			}
-			td = duptyp(td);
+			td = dup_type(td);
 			td->t_typedef = true;
 			return td;
 		}
@@ -857,7 +858,7 @@ deftyp(void)
 	}
 
 	if (dcs->d_const || dcs->d_volatile) {
-		dcs->d_type = duptyp(dcs->d_type);
+		dcs->d_type = dup_type(dcs->d_type);
 		dcs->d_type->t_const |= dcs->d_const;
 		dcs->d_type->t_volatile |= dcs->d_volatile;
 	}
@@ -1123,7 +1124,7 @@ declare_bit_field(sym_t *dsym, tspec_t *
 			/* illegal bit-field type '%s' */
 			warning(35, type_name(tp));
 			int sz = tp->t_flen;
-			dsym->s_type = tp = duptyp(gettyp(t = INT));
+			dsym->s_type = tp = dup_type(gettyp(t = INT));
 			if ((tp->t_flen = sz) > size_in_bits(t))
 tp->t_flen = size_in_bits(t);
 		}
@@ -1267,7 +1268,7 @@ bitfield(sym_t *dsym, int len)
 		dsym->s_type = gettyp(UINT);
 		dsym->s_block_level = -1;
 	}
-	dsym->s_type = duptyp(dsym->s_type);
+	

CVS commit: src/sys/kern

2021-04-02 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Apr  2 10:39:22 UTC 2021

Modified Files:
src/sys/kern: subr_evcnt.c

Log Message:
Make extern declaration of intrcnt a u_int instead of a long.  Matches
some declartions in some ports.  Fixes build on news68k (and probably
newsmips).


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/subr_evcnt.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/kern/subr_evcnt.c
diff -u src/sys/kern/subr_evcnt.c:1.14 src/sys/kern/subr_evcnt.c:1.15
--- src/sys/kern/subr_evcnt.c:1.14	Thu Apr  1 04:41:38 2021
+++ src/sys/kern/subr_evcnt.c	Fri Apr  2 10:39:22 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_evcnt.c,v 1.14 2021/04/01 04:41:38 simonb Exp $ */
+/* $NetBSD: subr_evcnt.c,v 1.15 2021/04/02 10:39:22 simonb Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.14 2021/04/01 04:41:38 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.15 2021/04/02 10:39:22 simonb Exp $");
 
 #include 
 #include 
@@ -380,7 +380,7 @@ SYSCTL_SETUP(sysctl_evcnt_setup, "sysctl
 }
 
 #ifdef __HAVE_LEGACY_INTRCNT
-extern long intrcnt[], eintrcnt[];
+extern u_int intrcnt[], eintrcnt[];
 extern char intrnames[];
 static size_t nintr;
 struct evcnt *intr_evcnts;



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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 10:30:35 UTC 2021

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

Log Message:
lint: rename members of struct memory_block

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/xlint/lint1/mem1.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/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.41 src/usr.bin/xlint/lint1/mem1.c:1.42
--- src/usr.bin/xlint/lint1/mem1.c:1.41	Fri Apr  2 10:13:03 2021
+++ src/usr.bin/xlint/lint1/mem1.c	Fri Apr  2 10:30:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.41 2021/04/02 10:13:03 rillig Exp $	*/
+/*	$NetBSD: mem1.c,v 1.42 2021/04/02 10:30:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.41 2021/04/02 10:13:03 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.42 2021/04/02 10:30:35 rillig Exp $");
 #endif
 
 #include 
@@ -172,18 +172,18 @@ get_filename_id(const char *s)
 /*
  * Memory for declarations and other things which must be available
  * until the end of a block (or the end of the translation unit)
- * are associated with the level (mem_block_level) of the block (or with 0).
+ * is associated with the corresponding mem_block_level, which may be 0.
  * Because this memory is allocated in large blocks associated with
  * a given level it can be freed easily at the end of a block.
  */
 #define	ML_INC	((size_t)32)		/* Increment for length of *mblks */
 
 typedef struct memory_block {
-	void	*blk;			/* beginning of memory block */
-	void	*ffree;			/* first free byte */
+	void	*start;			/* beginning of memory block */
+	void	*first_free;		/* first free byte */
 	size_t	nfree;			/* # of free bytes */
 	size_t	size;			/* total size of memory block */
-	struct	memory_block *nxt;	/* next block */
+	struct	memory_block *next;
 } memory_block;
 
 /*
@@ -211,7 +211,7 @@ xnewblk(void)
 	memory_block	*mb = xmalloc(sizeof *mb);
 
 	/* use mmap instead of malloc to avoid malloc's size overhead */
-	mb->blk = xmapalloc(mblklen);
+	mb->start = xmapalloc(mblklen);
 	mb->size = mblklen;
 
 	return mb;
@@ -244,20 +244,20 @@ xgetblk(memory_block **mbp, size_t s)
 			}
 			mb = xnewblk();
 #ifndef BLKDEBUG
-			(void)memset(mb->blk, 0, mb->size);
+			(void)memset(mb->start, 0, mb->size);
 #endif
 			if (t > 0)
 mblklen = t;
 		} else {
-			frmblks = mb->nxt;
+			frmblks = mb->next;
 		}
-		mb->ffree = mb->blk;
+		mb->first_free = mb->start;
 		mb->nfree = mb->size;
-		mb->nxt = *mbp;
+		mb->next = *mbp;
 		*mbp = mb;
 	}
-	p = mb->ffree;
-	mb->ffree = (char *)mb->ffree + s;
+	p = mb->first_free;
+	mb->first_free = (char *)mb->first_free + s;
 	mb->nfree -= s;
 #ifdef BLKDEBUG
 	(void)memset(p, 0, s);
@@ -275,10 +275,10 @@ xfreeblk(memory_block **fmbp)
 	memory_block	*mb;
 
 	while ((mb = *fmbp) != NULL) {
-		*fmbp = mb->nxt;
-		mb->nxt = frmblks;
+		*fmbp = mb->next;
+		mb->next = frmblks;
 		frmblks = mb;
-		(void)memset(mb->blk, ZERO, mb->size - mb->nfree);
+		(void)memset(mb->start, ZERO, mb->size - mb->nfree);
 	}
 }
 
@@ -388,7 +388,7 @@ expr_restore_memory(memory_block *tmem)
 
 	expr_free_all();
 	if (tmblk != NULL) {
-		free(tmblk->blk);
+		free(tmblk->start);
 		free(tmblk);
 	}
 	tmblk = tmem;



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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 10:13:03 UTC 2021

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

Log Message:
lint: name memory allocation functions consistently

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.208 -r1.209 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.167 -r1.168 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.97 -r1.98 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.98 -r1.99 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.187 -r1.188 src/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.256 -r1.257 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.208 src/usr.bin/xlint/lint1/cgram.y:1.209
--- src/usr.bin/xlint/lint1/cgram.y:1.208	Fri Apr  2 09:52:36 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Fri Apr  2 10:13:03 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.208 2021/04/02 09:52:36 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.209 2021/04/02 10:13:03 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.208 2021/04/02 09:52:36 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.209 2021/04/02 10:13:03 rillig Exp $");
 #endif
 
 #include 
@@ -1878,7 +1878,7 @@ term:
 		$$ = new_string_node($1);
 	  }
 	| T_CON {
-		$$ = new_constant_node(gettyp($1->v_tspec), $1);
+		$$ = expr_new_constant(gettyp($1->v_tspec), $1);
 	  }
 	| T_LPAREN expr T_RPAREN {
 		if ($2 != NULL)

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.167 src/usr.bin/xlint/lint1/decl.c:1.168
--- src/usr.bin/xlint/lint1/decl.c:1.167	Tue Mar 30 14:25:28 2021
+++ src/usr.bin/xlint/lint1/decl.c	Fri Apr  2 10:13:03 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.167 2021/03/30 14:25:28 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.168 2021/04/02 10:13:03 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.167 2021/03/30 14:25:28 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.168 2021/04/02 10:13:03 rillig Exp $");
 #endif
 
 #include 
@@ -162,7 +162,7 @@ tduptyp(const type_t *tp)
 {
 	type_t	*ntp;
 
-	ntp = tgetblk(sizeof *ntp);
+	ntp = expr_zalloc(sizeof *ntp);
 	*ntp = *tp;
 	return ntp;
 }
@@ -1015,9 +1015,9 @@ check_type(sym_t *sym)
 /* function returns illegal type */
 error(15);
 if (t == FUNC) {
-	*tpp = incref(*tpp, PTR);
+	*tpp = derive_type(*tpp, PTR);
 } else {
-	*tpp = incref((*tpp)->t_subt, PTR);
+	*tpp = derive_type((*tpp)->t_subt, PTR);
 }
 return;
 			} else if (tp->t_const || tp->t_volatile) {
@@ -1183,7 +1183,7 @@ declarator_1_struct_union(sym_t *dsym)
 	} else if (t == FUNC) {
 		/* function illegal in structure or union */
 		error(38);
-		dsym->s_type = tp = incref(tp, t = PTR);
+		dsym->s_type = tp = derive_type(tp, t = PTR);
 	}
 
 	/*
@@ -2416,12 +2416,12 @@ declare_argument(sym_t *sym, bool initfl
 	}
 
 	if ((t = sym->s_type->t_tspec) == ARRAY) {
-		sym->s_type = incref(sym->s_type->t_subt, PTR);
+		sym->s_type = derive_type(sym->s_type->t_subt, PTR);
 	} else if (t == FUNC) {
 		if (tflag)
 			/* a function is declared as an argument: %s */
 			warning(50, sym->s_name);
-		sym->s_type = incref(sym->s_type, PTR);
+		sym->s_type = derive_type(sym->s_type, PTR);
 	} else if (t == FLOAT) {
 		if (tflag)
 			sym->s_type = gettyp(DOUBLE);
@@ -3334,7 +3334,7 @@ to_int_constant(tnode_t *tn, bool requir
 	 * will be used later to match types.
 	 */
 	if (tn->tn_op != CON && dcs->d_ctx != ABSTRACT)
-		tfreeblk();
+		expr_free_all();
 
 	if ((t = v->v_tspec) == FLOAT || t == DOUBLE || t == LDOUBLE) {
 		i = (int)v->v_ldbl;

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.97 src/usr.bin/xlint/lint1/externs1.h:1.98
--- src/usr.bin/xlint/lint1/externs1.h:1.97	Fri Apr  2 09:52:36 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Fri Apr  2 10:13:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.97 2021/04/02 09:52:36 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.98 2021/04/02 10:13:03 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -105,11 +105,11 @@ extern	void	*getlblk(size_t, size_t);
 extern	void	freeblk(void);
 extern	void	freelblk(int);
 
-extern	void	*tgetblk(size_t);
+extern	void	*expr_zalloc(size_t);
 extern	tnode_t	*expr_zalloc_tnode(void);
-extern	void	tfreeblk(void);
-extern	struct	memory_block *tsave(void);
-extern	void	trestor(struct memory_block *);
+extern	void	expr_free_all(void);
+extern	struct	memory_block *expr_save_memory(void);
+extern	

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

2021-04-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr  2 10:06:27 UTC 2021

Modified Files:
src/distrib/sets/lists/base: shl.mi

Log Message:
named/filter-.so is unrelated to DYNAMICROOT


To generate a diff of this commit:
cvs rdiff -u -r1.914 -r1.915 src/distrib/sets/lists/base/shl.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/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.914 src/distrib/sets/lists/base/shl.mi:1.915
--- src/distrib/sets/lists/base/shl.mi:1.914	Thu Apr  1 10:35:24 2021
+++ src/distrib/sets/lists/base/shl.mi	Fri Apr  2 10:06:26 2021
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.914 2021/04/01 10:35:24 martin Exp $
+# $NetBSD: shl.mi,v 1.915 2021/04/02 10:06:26 martin Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -1002,4 +1002,4 @@
 ./usr/lib/security/pam_u2f.so.4			base-sys-shlib		compatfile,pam
 ./usr/lib/security/pam_unix.so.4		base-sys-shlib		compatfile,pam
 ./usr/libexec/ld.elf_sobase-sys-shlib		dynamicroot
-./usr/libexec/named/filter-.so		base-bind-bin		dynamicroot
+./usr/libexec/named/filter-.so		base-bind-bin



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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 09:52:36 UTC 2021

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

Log Message:
lint: rename getnode to expr_zalloc_tnode

The new name highlights that the returned memory is only valid in the
scope of the current expression.  This was misleading before since the
other related functions all have a 't' (probably for 'temporary') in
their names.

Also encode in the function name that the returned memory is zeroed out
as that could not be inferred from the old name.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.207 -r1.208 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.96 -r1.97 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.255 -r1.256 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.207 src/usr.bin/xlint/lint1/cgram.y:1.208
--- src/usr.bin/xlint/lint1/cgram.y:1.207	Tue Mar 30 14:25:28 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Fri Apr  2 09:52:36 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.207 2021/03/30 14:25:28 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.208 2021/04/02 09:52:36 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.207 2021/03/30 14:25:28 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.208 2021/04/02 09:52:36 rillig Exp $");
 #endif
 
 #include 
@@ -1596,7 +1596,7 @@ expr_statement_val:
 		seen_fallthrough = false;
 	  }
 	| non_expr_statement {
-		$$ = getnode();
+		$$ = expr_zalloc_tnode();
 		$$->tn_type = gettyp(VOID);
 	  }
 	;

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.96 src/usr.bin/xlint/lint1/externs1.h:1.97
--- src/usr.bin/xlint/lint1/externs1.h:1.96	Fri Apr  2 09:39:25 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Fri Apr  2 09:52:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.96 2021/04/02 09:39:25 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.97 2021/04/02 09:52:36 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -106,7 +106,7 @@ extern	void	freeblk(void);
 extern	void	freelblk(int);
 
 extern	void	*tgetblk(size_t);
-extern	tnode_t	*getnode(void);
+extern	tnode_t	*expr_zalloc_tnode(void);
 extern	void	tfreeblk(void);
 extern	struct	memory_block *tsave(void);
 extern	void	trestor(struct memory_block *);

Index: src/usr.bin/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.39 src/usr.bin/xlint/lint1/mem1.c:1.40
--- src/usr.bin/xlint/lint1/mem1.c:1.39	Fri Apr  2 09:45:55 2021
+++ src/usr.bin/xlint/lint1/mem1.c	Fri Apr  2 09:52:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.39 2021/04/02 09:45:55 rillig Exp $	*/
+/*	$NetBSD: mem1.c,v 1.40 2021/04/02 09:52:36 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.39 2021/04/02 09:45:55 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.40 2021/04/02 09:52:36 rillig Exp $");
 #endif
 
 #include 
@@ -344,7 +344,7 @@ tgetblk(size_t s)
 
 /* Return a freshly allocated tree node. */
 tnode_t *
-getnode(void)
+expr_zalloc_tnode(void)
 {
 	tnode_t *tn = tgetblk(sizeof *tn);
 	tn->tn_from_system_header = in_system_header;

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.255 src/usr.bin/xlint/lint1/tree.c:1.256
--- src/usr.bin/xlint/lint1/tree.c:1.255	Thu Apr  1 15:06:49 2021
+++ src/usr.bin/xlint/lint1/tree.c	Fri Apr  2 09:52:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.255 2021/04/01 15:06:49 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.256 2021/04/02 09:52:36 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.255 2021/04/01 15:06:49 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.256 2021/04/02 09:52:36 rillig Exp $");
 #endif
 
 #include 
@@ -181,7 +181,7 @@ new_constant_node(type_t *tp, val_t *v)
 {
 	tnode_t	*n;
 
-	n = getnode();
+	n = expr_zalloc_tnode();
 	n->tn_op = CON;
 	n->tn_type = tp;
 	n->tn_val = tgetblk(sizeof *n->tn_val);
@@ -197,7 +197,7 @@ new_integer_constant_node(tspec_t t, int
 {
 	tnode_t	*n;
 
-	n = getnode();
+	n = expr_zalloc_tnode();
 	n->tn_op = CON;
 	n->tn_type = gettyp(t);
 	n->tn_val = tgetblk(sizeof *n->tn_val);
@@ -279,7 +279,7 @@ new_name_node(sym_t *sym, int follow_tok
 
 	lint_assert(sym->s_kind == FVFT || sym->s_kind == FMEMBER);
 
-	n = getnode();
+	n = expr_zalloc_tnode();
 	n->tn_type = sym->s_type;
 	if (sym->s_scl != CTCONST) {
 		n->tn_op = NAME;
@@ -303,7 +303,7 @@ new_string_node(strg_t *strg)
 
 	len = strg->st_len;
 
-	n = getnode();
+	n = 

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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 09:45:55 UTC 2021

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

Log Message:
lint: extract filename ID counter into separate function

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/xlint/lint1/mem1.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/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.38 src/usr.bin/xlint/lint1/mem1.c:1.39
--- src/usr.bin/xlint/lint1/mem1.c:1.38	Fri Apr  2 09:39:25 2021
+++ src/usr.bin/xlint/lint1/mem1.c	Fri Apr  2 09:45:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.38 2021/04/02 09:39:25 rillig Exp $	*/
+/*	$NetBSD: mem1.c,v 1.39 2021/04/02 09:45:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.38 2021/04/02 09:39:25 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.39 2021/04/02 09:45:55 rillig Exp $");
 #endif
 
 #include 
@@ -115,6 +115,14 @@ transform_filename(const char *name, siz
 	return buf;
 }
 
+static int
+next_filename_id(void)
+{
+	static int next_id = 0;
+
+	return next_id++;
+}
+
 /*
  * Return a copy of the filename s with unlimited lifetime.
  * If the filename is new, write it to the output file.
@@ -125,8 +133,6 @@ record_filename(const char *s, size_t sl
 	const struct filename *existing_fn;
 	struct filename *fn;
 
-	static	int	nxt_id = 0;
-
 	if (s == NULL)
 		return NULL;
 
@@ -139,7 +145,7 @@ record_filename(const char *s, size_t sl
 	(void)memcpy(fn->fn_name, s, slen);
 	fn->fn_name[slen] = '\0';
 	fn->fn_len = slen;
-	fn->fn_id = nxt_id++;
+	fn->fn_id = next_filename_id();
 	fn->fn_next = filenames;
 	filenames = fn;
 



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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 09:39:25 UTC 2021

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

Log Message:
lint: rename mbl to memory_block

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.186 -r1.187 src/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.90 -r1.91 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/xlint/lint1/mem1.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/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.95 src/usr.bin/xlint/lint1/externs1.h:1.96
--- src/usr.bin/xlint/lint1/externs1.h:1.95	Tue Mar 30 14:25:28 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Fri Apr  2 09:39:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.95 2021/03/30 14:25:28 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.96 2021/04/02 09:39:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -108,8 +108,8 @@ extern	void	freelblk(int);
 extern	void	*tgetblk(size_t);
 extern	tnode_t	*getnode(void);
 extern	void	tfreeblk(void);
-extern	struct	mbl *tsave(void);
-extern	void	trestor(struct mbl *);
+extern	struct	memory_block *tsave(void);
+extern	void	trestor(struct memory_block *);
 
 /*
  * err.c

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.186 src/usr.bin/xlint/lint1/init.c:1.187
--- src/usr.bin/xlint/lint1/init.c:1.186	Fri Apr  2 08:38:44 2021
+++ src/usr.bin/xlint/lint1/init.c	Fri Apr  2 09:39:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.186 2021/04/02 08:38:44 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.187 2021/04/02 09:39:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.186 2021/04/02 08:38:44 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.187 2021/04/02 09:39:25 rillig Exp $");
 #endif
 
 #include 
@@ -380,7 +380,7 @@ check_init_expr(const type_t *tp, sym_t 
 {
 	tnode_t *ln;
 	tspec_t lt, rt;
-	struct mbl *tmem;
+	struct memory_block *tmem;
 
 	/* Create a temporary node for the left side. */
 	ln = tgetblk(sizeof *ln);

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.90 src/usr.bin/xlint/lint1/lint1.h:1.91
--- src/usr.bin/xlint/lint1/lint1.h:1.90	Sat Mar 27 12:42:22 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Fri Apr  2 09:39:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.90 2021/03/27 12:42:22 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.91 2021/04/02 09:39:25 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -411,7 +411,7 @@ typedef struct control_statement {
 	type_t	*c_switch_type;		/* type of switch expression */
 	case_label_t *c_case_labels;	/* list of case values */
 
-	struct	mbl *c_for_expr3_mem;	/* saved memory for end of loop
+	struct	memory_block *c_for_expr3_mem; /* saved memory for end of loop
 	 * expression in for() */
 	tnode_t	*c_for_expr3;		/* end of loop expr in for() */
 	pos_t	c_for_expr3_pos;	/* position of end of loop expr */

Index: src/usr.bin/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.37 src/usr.bin/xlint/lint1/mem1.c:1.38
--- src/usr.bin/xlint/lint1/mem1.c:1.37	Sat Mar 27 12:32:19 2021
+++ src/usr.bin/xlint/lint1/mem1.c	Fri Apr  2 09:39:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.37 2021/03/27 12:32:19 rillig Exp $	*/
+/*	$NetBSD: mem1.c,v 1.38 2021/04/02 09:39:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.37 2021/03/27 12:32:19 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.38 2021/04/02 09:39:25 rillig Exp $");
 #endif
 
 #include 
@@ -172,37 +172,37 @@ get_filename_id(const char *s)
  */
 #define	ML_INC	((size_t)32)		/* Increment for length of *mblks */
 
-typedef struct mbl {
+typedef struct memory_block {
 	void	*blk;			/* beginning of memory block */
 	void	*ffree;			/* first free byte */
 	size_t	nfree;			/* # of free bytes */
 	size_t	size;			/* total size of memory block */
-	struct	mbl *nxt;		/* next block */
-} mbl_t;
+	struct	memory_block *nxt;	/* next block */
+} memory_block;
 
 /*
  * Array of pointers to lists of memory blocks. mem_block_level is used as
  * index into this array.
  */
-static	mbl_t	**mblks;
+static	memory_block	**mblks;
 
 /* number of elements in *mblks */
 static	size_t	nmblks;
 
 /* free list for memory blocks */
-static	mbl_t	*frmblks;
+static	memory_block	*frmblks;
 
 /* length of new allocated memory blocks */
 static	size_t	mblklen;
 
-static	void	*xgetblk(mbl_t **, size_t);
-static	void	xfreeblk(mbl_t **);
-static	mbl_t	*xnewblk(void);
+static	void	*xgetblk(memory_block **, size_t);
+static	void	xfreeblk(memory_block **);
+static	memory_block *xnewblk(void);
 

CVS commit: src/sys/dev/usb

2021-04-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Apr  2 09:27:44 UTC 2021

Modified Files:
src/sys/dev/usb: if_udav.c

Log Message:
Call usbnet_attach before usbnet_{lock_core,busy}

kern/56090: panic in udav_attach


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/usb/if_udav.c

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

Modified files:

Index: src/sys/dev/usb/if_udav.c
diff -u src/sys/dev/usb/if_udav.c:1.77 src/sys/dev/usb/if_udav.c:1.78
--- src/sys/dev/usb/if_udav.c:1.77	Sun Mar 15 23:04:51 2020
+++ src/sys/dev/usb/if_udav.c	Fri Apr  2 09:27:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_udav.c,v 1.77 2020/03/15 23:04:51 thorpej Exp $	*/
+/*	$NetBSD: if_udav.c,v 1.78 2021/04/02 09:27:44 skrll Exp $	*/
 /*	$nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $	*/
 
 /*
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.77 2020/03/15 23:04:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.78 2021/04/02 09:27:44 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -237,14 +237,14 @@ udav_attach(device_t parent, device_t se
 	/* Not supported yet. */
 	un->un_ed[USBNET_ENDPT_INTR] = 0;
 
+	usbnet_attach(un, "udavdet");
+
 	usbnet_lock_core(un);
 	usbnet_busy(un);
 
 // 	/* reset the adapter */
 // 	udav_reset(un);
 
-	usbnet_attach(un, "udavdet");
-
 	/* Get Ethernet Address */
 	err = udav_csr_read(un, UDAV_PAR, un->un_eaddr, ETHER_ADDR_LEN);
 	usbnet_unbusy(un);



CVS commit: src/sys/arch/macppc/conf

2021-04-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr  2 09:27:32 UTC 2021

Modified Files:
src/sys/arch/macppc/conf: POWERMAC_G5

Log Message:
Add gpt wedge support


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/macppc/conf/POWERMAC_G5

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/macppc/conf/POWERMAC_G5
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.48 src/sys/arch/macppc/conf/POWERMAC_G5:1.49
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.48	Fri Apr  2 06:55:14 2021
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Fri Apr  2 09:27:32 2021
@@ -56,6 +56,14 @@ options 	TRAP_PANICWAIT
 include 	"conf/compat_netbsd70.config"
 #options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
 
+# Wedge support
+options DKWEDGE_AUTODISCOVER# Automatically add dk(4) instances
+options DKWEDGE_METHOD_GPT  # Supports GPT partitions as wedges
+#options	DKWEDGE_METHOD_BSDLABEL # Support disklabel entries as wedges
+#options	DKWEDGE_METHOD_MBR  # Support MBR partitions as wedges
+#options	DKWEDGE_METHOD_APPLE# Support Apple partitions as wedges
+#options 	DKWEDGE_METHOD_RDB	# Support RDB partitions as wedges
+
 # File systems
 file-system 	FFS		# UFS
 file-system 	MFS		# memory file system



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

2021-04-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  2 08:38:44 UTC 2021

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

Log Message:
lint: make debug logging compatible with C90

The previous code used the GCC-style varargs macros, which did not even
conform to C99.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 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.185 src/usr.bin/xlint/lint1/init.c:1.186
--- src/usr.bin/xlint/lint1/init.c:1.185	Thu Apr  1 14:20:30 2021
+++ src/usr.bin/xlint/lint1/init.c	Fri Apr  2 08:38:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.185 2021/04/01 14:20:30 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.186 2021/04/02 08:38:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.185 2021/04/01 14:20:30 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.186 2021/04/02 08:38:44 rillig Exp $");
 #endif
 
 #include 
@@ -192,6 +192,9 @@ debug_step(const char *fmt, ...)
 	va_end(va);
 	printf("\n");
 }
+#define debug_step0		debug_step
+#define debug_step1		debug_step
+#define debug_step2		debug_step
 
 static void
 debug_leave(const char *func)
@@ -205,11 +208,11 @@ debug_leave(const char *func)
 
 #else
 
-/* TODO: This is C99 */
-#define debug_printf(fmt, ...)	do { } while (false)
 #define debug_indent()		do { } while (false)
 #define debug_enter()		do { } while (false)
-#define debug_step(fmt, ...)	do { } while (false)
+#define debug_step0(msg)	do { } while (false)
+#define debug_step1(fmt, arg0)	do { } while (false)
+#define debug_step2(fmt, arg1, arg2) do { } while (false)
 #define debug_leave()		do { } while (false)
 
 #endif
@@ -392,7 +395,7 @@ check_init_expr(const type_t *tp, sym_t 
 	lt = ln->tn_type->t_tspec;
 	rt = tn->tn_type->t_tspec;
 
-	debug_step("typeok '%s', '%s'",
+	debug_step2("typeok '%s', '%s'",
 	type_name(ln->tn_type), type_name(tn->tn_type));
 	if (!typeok(INIT, 0, ln, tn))
 		return;
@@ -874,7 +877,7 @@ initialization_expr_using_assign(struct 
 	if (in->in_sym->s_type->t_tspec == ARRAY)
 		return false;
 
-	debug_step("handing over to ASSIGN");
+	debug_step0("handing over to ASSIGN");
 
 	ln = new_name_node(in->in_sym, 0);
 	ln->tn_type = tduptyp(ln->tn_type);
@@ -976,7 +979,7 @@ initialization_expr(struct initializatio
 		goto done;
 	}
 
-	debug_step("expecting '%s', expression has '%s'",
+	debug_step2("expecting '%s', expression has '%s'",
 	type_name(tp), type_name(tn->tn_type));
 	check_init_expr(tp, in->in_sym, tn);
 
@@ -1015,7 +1018,7 @@ begin_initialization(sym_t *sym)
 {
 	struct initialization *in;
 
-	debug_step("begin initialization of '%s'", type_name(sym->s_type));
+	debug_step1("begin initialization of '%s'", type_name(sym->s_type));
 #ifdef DEBUG
 	debug_indentation++;
 #endif
@@ -1037,7 +1040,7 @@ end_initialization(void)
 #ifdef DEBUG
 	debug_indentation--;
 #endif
-	debug_step("end initialization");
+	debug_step0("end initialization");
 }
 
 void



CVS commit: src/sbin/rndctl

2021-04-02 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri Apr  2 07:17:56 UTC 2021

Modified Files:
src/sbin/rndctl: rndctl.c

Log Message:
rndctl: make -l's "Flags" field reflect current reality

don't print "legacy options" RND_FLAG_ESTIMATE_TIME and
"RND_FLAG_ESTIMATE_VALUE"

only print "estimate" if we have actually counted any bits from
something, since it's no longer really possible to "enable estimation".

ideally, there should also be a "samples" field so it's clear
collected bits are not being counted.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sbin/rndctl/rndctl.c

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

Modified files:

Index: src/sbin/rndctl/rndctl.c
diff -u src/sbin/rndctl/rndctl.c:1.37 src/sbin/rndctl/rndctl.c:1.38
--- src/sbin/rndctl/rndctl.c:1.37	Tue May 12 09:48:44 2020
+++ src/sbin/rndctl/rndctl.c	Fri Apr  2 07:17:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rndctl.c,v 1.37 2020/05/12 09:48:44 simonb Exp $	*/
+/*	$NetBSD: rndctl.c,v 1.38 2021/04/02 07:17:56 nia Exp $	*/
 
 /*-
  * Copyright (c) 1997 Michael Graff.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: rndctl.c,v 1.37 2020/05/12 09:48:44 simonb Exp $");
+__RCSID("$NetBSD: rndctl.c,v 1.38 2021/04/02 07:17:56 nia Exp $");
 #endif
 
 #include 
@@ -75,7 +75,7 @@ __dead static void usage(void);
 static u_int32_t find_type(const char *name);
 static const char *find_name(u_int32_t);
 static void do_ioctl(rndctl_t *);
-static char * strflags(u_int32_t);
+static char * strflags(uint32_t, u_int32_t);
 static void do_list(int, u_int32_t, char *);
 static void do_stats(void);
 
@@ -444,29 +444,21 @@ do_ioctl(rndctl_t *rctl)
 }
 
 static char *
-strflags(u_int32_t fl)
+strflags(uint32_t totalbits, u_int32_t fl)
 {
 	static char str[512];
 
 	str[0] = '\0';
-	if (fl & RND_FLAG_NO_ESTIMATE)
-		;
-	else
+	if (totalbits > 0 && (fl & RND_FLAG_NO_ESTIMATE) == 0)
 		strlcat(str, "estimate, ", sizeof(str));
 
-	if (fl & RND_FLAG_NO_COLLECT)
-		;
-	else
+	if ((fl & RND_FLAG_NO_COLLECT) == 0)
 		strlcat(str, "collect, ", sizeof(str));
 
 	if (fl & RND_FLAG_COLLECT_VALUE)
 		strlcat(str, "v, ", sizeof(str));
 	if (fl & RND_FLAG_COLLECT_TIME)
 		strlcat(str, "t, ", sizeof(str));
-	if (fl & RND_FLAG_ESTIMATE_VALUE)
-		strlcat(str, "dv, ", sizeof(str));
-	if (fl & RND_FLAG_ESTIMATE_TIME)
-		strlcat(str, "dt, ", sizeof(str));
 
 	if (str[strlen(str) - 2] == ',')
 		str[strlen(str) - 2] = '\0';
@@ -500,7 +492,8 @@ do_list(int all, u_int32_t type, char *n
 		rstat_name.source.rt.name,
 		rstat_name.source.rt.total,
 		find_name(rstat_name.source.rt.type),
-		strflags(rstat_name.source.rt.flags));
+		strflags(rstat_name.source.rt.total,
+			rstat_name.source.rt.flags));
 		if (vflag) {
 			printf("\tDt samples = %d\n",
 			   rstat_name.source.dt_samples);
@@ -538,7 +531,8 @@ do_list(int all, u_int32_t type, char *n
 rstat.source[i].rt.name,
 rstat.source[i].rt.total,
 find_name(rstat.source[i].rt.type),
-strflags(rstat.source[i].rt.flags));
+strflags(rstat.source[i].rt.total,
+	rstat.source[i].rt.flags));
 			if (vflag) {
 printf("\tDt samples = %d\n",
    rstat.source[i].dt_samples);



CVS commit: src/distrib/notes

2021-04-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr  2 07:09:11 UTC 2021

Modified Files:
src/distrib/notes/common: contents
src/distrib/notes/evbppc: contents

Log Message:
Document DHT kernel for evbppc.


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/distrib/notes/common/contents
cvs rdiff -u -r1.8 -r1.9 src/distrib/notes/evbppc/contents

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

Modified files:

Index: src/distrib/notes/common/contents
diff -u src/distrib/notes/common/contents:1.184 src/distrib/notes/common/contents:1.185
--- src/distrib/notes/common/contents:1.184	Tue Sep 22 02:53:52 2020
+++ src/distrib/notes/common/contents	Fri Apr  2 07:09:11 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: contents,v 1.184 2020/09/22 02:53:52 snj Exp $
+.\"	$NetBSD: contents,v 1.185 2021/04/02 07:09:11 rin Exp $
 .\"
 .\" Copyright (c) 1999-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -206,6 +206,10 @@ A kernel suitable for booting on O2.
 .\}
 .
 .if \n[evbppc] \{\
+.			It Pa netbsd-DHT.gz
+A gzipped kernel (in ELF format) for the DHT Walnut 405GP evaluation board.
+.			It Pa netbsd.bin-DHT.gz
+Same as the above, but in the raw binary format expected by the firmware.
 .			It Pa netbsd-EV64260.gz
 A gzipped kernel (in ELF format) for the Marvell EV-64260.
 .			It Pa netbsd.img-EV64260.gz
@@ -743,6 +747,15 @@ kernel, which will use multiple processo
 .\}
 .el \{\
 .ie \n[evbppc] \{\
+.It Sy kern-DHT
+This set contains a
+.Nx*M
+\*V
+kernel in ELF format named
+.Pa /netbsd
+and the same kernel in the raw binary format needed by the bootloader as
+.Pa /netbsd.bin .
+These kernels are specific to the DHT Walnut 405GP evaluation board.
 .It Sy kern-EV64260
 This set contains a
 .Nx*M

Index: src/distrib/notes/evbppc/contents
diff -u src/distrib/notes/evbppc/contents:1.8 src/distrib/notes/evbppc/contents:1.9
--- src/distrib/notes/evbppc/contents:1.8	Fri Aug  7 00:43:48 2020
+++ src/distrib/notes/evbppc/contents	Fri Apr  2 07:09:11 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: contents,v 1.8 2020/08/07 00:43:48 snj Exp $
+.\"	$NetBSD: contents,v 1.9 2021/04/02 07:09:11 rin Exp $
 .\"
 .\" Copyright (c) 1999-2005 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -56,6 +56,14 @@ conventions for indicating italic and bo
 .
 .		(tag netbsd.gz -compact \" binary/kernel
 .
+.			It Pa netbsd-DHT.gz
+.
+A gzipped kernel (in ELF format) for the DHT Walnut 405GP evaluation board.
+.
+.			It Pa netbsd.bin-DHT.gz
+.
+Same as the above, but in the raw binary format expected by the firmware.
+.
 .			It Pa netbsd-EV64260.gz
 .
 A gzipped kernel (in ELF format) for the Marvell EV-64260.
@@ -222,6 +230,15 @@ This set includes the games and their ma
 .
 .\" MD kernel set(s) -
 .
+.It Sy kern-DHT
+This set contains a
+.Nx*M
+\*V
+kernel in ELF format named
+.Pa /netbsd
+and the same kernel in the raw binary format needed by the bootloader as
+.Pa /netbsd.bin .
+These kernels are specific to the DHT Walnut 405GP evaluation board.
 .It Sy kern-EV64260
 This set contains a
 .Nx*M



CVS commit: src/etc/etc.evbppc

2021-04-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr  2 07:08:36 UTC 2021

Modified Files:
src/etc/etc.evbppc: Makefile.inc

Log Message:
- Hook DHT kernel
- Add bin and ub to KERNEL_SUFFIXES
- Group and sort kernels


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/etc/etc.evbppc/Makefile.inc

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

Modified files:

Index: src/etc/etc.evbppc/Makefile.inc
diff -u src/etc/etc.evbppc/Makefile.inc:1.13 src/etc/etc.evbppc/Makefile.inc:1.14
--- src/etc/etc.evbppc/Makefile.inc:1.13	Fri Jan 30 15:04:35 2015
+++ src/etc/etc.evbppc/Makefile.inc	Fri Apr  2 07:08:36 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.13 2015/01/30 15:04:35 nonaka Exp $
+#	$NetBSD: Makefile.inc,v 1.14 2021/04/02 07:08:36 rin Exp $
 #
 #	etc.evbppc/Makefile.inc -- evbppc-specific etc Makefile targets
 #
@@ -7,13 +7,25 @@
 # to update the release documentation in distrib/notes/common/contents
 
 .if ${MACHINE_ARCH} == "powerpc"
-KERNEL_SETS=		WALNUT EXPLORA451 OPENBLOCKS200 OPENBLOCKS266
-KERNEL_SETS+=		EV64260 PMPPC
-KERNEL_SETS+=		MPC8536DS MPC8548CDS P2020DS P2020RDB RB800 RB850GX2
+# oea
+KERNEL_SETS+=		EV64260
+KERNEL_SETS+=		PMPPC
+BUILD_KERNELS+=		INSTALL_PMPPC
+# ibm4xx
+KERNEL_SETS+=		DHT
+KERNEL_SETS+=		EXPLORA451
+KERNEL_SETS+=		OPENBLOCKS200 OPENBLOCKS266
+KERNEL_SETS+=		WALNUT
+BUILD_KERNELS+=		INSTALL_OPENBLOCKS266
+BUILD_KERNELS+=		INSTALL_WALNUT
+# booke
+KERNEL_SETS+=		MPC8536DS MPC8548CDS
+KERNEL_SETS+=		P2020DS P2020RDB
+KERNEL_SETS+=		RB800 RB850GX2
 KERNEL_SETS+=		TWRP1025
-KERNEL_SUFFIXES=	img
-
-BUILD_KERNELS=		INSTALL_WALNUT INSTALL_OPENBLOCKS266 INSTALL_PMPPC
-BUILD_KERNELS+=		INSTALL_P2020DS INSTALL_P2020RDB INSTALL_RB850GX2
+BUILD_KERNELS+=		INSTALL_P2020DS INSTALL_P2020RDB
+BUILD_KERNELS+=		INSTALL_RB850GX2
 BUILD_KERNELS+=		INSTALL_TWRP1025
+#
+KERNEL_SUFFIXES=	img bin ub
 .endif



CVS commit: src/sbin/rndctl

2021-04-02 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri Apr  2 07:04:05 UTC 2021

Modified Files:
src/sbin/rndctl: rndctl.8

Log Message:
rndctl.8: reflect current reality


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sbin/rndctl/rndctl.8

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

Modified files:

Index: src/sbin/rndctl/rndctl.8
diff -u src/sbin/rndctl/rndctl.8:1.26 src/sbin/rndctl/rndctl.8:1.27
--- src/sbin/rndctl/rndctl.8:1.26	Thu May  7 19:09:26 2020
+++ src/sbin/rndctl/rndctl.8	Fri Apr  2 07:04:05 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: rndctl.8,v 1.26 2020/05/07 19:09:26 riastradh Exp $
+.\"	$NetBSD: rndctl.8,v 1.27 2021/04/02 07:04:05 nia Exp $
 .\"
 .\" Copyright (c) 1997 Michael Graff
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd August 10, 2014
+.Dd April 2, 2021
 .Dt RNDCTL 8
 .Os
 .Sh NAME
@@ -56,11 +56,9 @@ entropy pool maintained by
 The following options are available:
 .Bl -tag -width 123456
 .It Fl C
-Disable collection of timing information for the given
-device name or device type.
+Disable collection of data for the given device name or device type.
 .It Fl c
-Enable collection of timing information for the given
-device name or device type.
+Enable collection of data for the given device name or device type.
 .It Fl d
 Only the device named
 .Ar devname
@@ -68,14 +66,15 @@ is altered or displayed.
 This is mutually exclusive with
 .Fl t .
 .It Fl E
-Disable entropy estimation from the collected timing information for
-the given device name or device type.
-If collection is still enabled, timing information is still
-collected and mixed into the internal entropy pool,
-but no entropy is assumed to be present.
+Disable entropy estimation for the given device name or device type.
+If collection is still enabled, data is still collected and mixed into
+the internal entropy pool, but no entropy is assumed to be present.
 .It Fl e
-Enable entropy estimation using the collected timing information
-for the given device name or device type.
+Re-enable entropy estimation for the given device name or device type.
+If the kernel's estimate for the given device is zero, as it is for
+devices of types other than
+.Ic rng ,
+this does not increase the estimate.
 .It Fl i
 With the
 .Fl L
@@ -138,6 +137,7 @@ Verbose output.
 .El
 .Sh SEE ALSO
 .Xr rnd 4 ,
+.Xr entropy 7 ,
 .Xr rnd 9
 .Sh HISTORY
 The



CVS commit: src

2021-04-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr  2 07:00:33 UTC 2021

Modified Files:
src/doc: CHANGES
Added Files:
src/sys/arch/evbppc/conf: DHT Makefile.dht.inc files.dht std.dht
src/sys/arch/evbppc/dht: autoconf.c locore.S machdep.c
src/sys/arch/evbppc/include: dht.h

Log Message:
evbppc: Add support for DHT Walnut 405GP evaluation board.
(Digital Home Technologies PCB 01070201 Rev. 1.1)

Official web page seems gone, but analyses by Linux people are at:

- https://elinux.org/DHT-Walnut
- 
http://web.archive.org/web/20070225171826/http://supernova.stanford.edu/dingdong/

The board features:

- 266MHz PowerPC 405GP processor
- one PC133 SDRAM slot
- two 32-bit 5V PCI slot
- on-chip ethernet controller with DP83843 PHY
- on-chip serial port / GPIO controller
- on-board PDC20265 IDE controller

Hardware limitations:

- no MAC address assigned
- no RTC present

Known problem:

- atabus(4) channels cannot be attached to pdcide(4) for cold boot

dmesg:

- https://dmesgd.nycbug.org/index.cgi?do=view=5997

Have fun!


To generate a diff of this commit:
cvs rdiff -u -r1.2788 -r1.2789 src/doc/CHANGES
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbppc/conf/DHT \
src/sys/arch/evbppc/conf/Makefile.dht.inc \
src/sys/arch/evbppc/conf/files.dht src/sys/arch/evbppc/conf/std.dht
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbppc/dht/autoconf.c \
src/sys/arch/evbppc/dht/locore.S src/sys/arch/evbppc/dht/machdep.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbppc/include/dht.h

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2788 src/doc/CHANGES:1.2789
--- src/doc/CHANGES:1.2788	Tue Mar 30 23:31:53 2021
+++ src/doc/CHANGES	Fri Apr  2 07:00:33 2021
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2788 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2789 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -343,3 +343,5 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	nsd: Import 4.3.5. [christos 20210315]
 	unbound(8): Import 1.13.1. [christos 20210315]
 	OpenSSL: Imported 1.1.1k. [christos 20210325]
+	evbppc: Add support for DHT Walnut 405GP evaluation board.
+		[rin 20210402]

Added files:

Index: src/sys/arch/evbppc/conf/DHT
diff -u /dev/null src/sys/arch/evbppc/conf/DHT:1.1
--- /dev/null	Fri Apr  2 07:00:33 2021
+++ src/sys/arch/evbppc/conf/DHT	Fri Apr  2 07:00:33 2021
@@ -0,0 +1,237 @@
+#	$NetBSD: DHT,v 1.1 2021/04/02 07:00:33 rin Exp $
+#
+#	DHT --- DHT Walnut 405GP Evaluation Board
+#		(Digital Home Technologies PCB 01070201 Rev. 1.1)
+#
+
+include 	"arch/evbppc/conf/std.dht"
+
+options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+
+#ident 		"DHT-$Revision: 1.1 $"
+
+maxusers	32
+
+
+#
+# Standard system options
+#
+
+options 	INSECURE		# disable kernel security levels
+options 	NTP			# NTP phase/frequency locked loop
+options 	KTRACE			# system call tracing via ktrace(1)
+
+options 	SYSVMSG			# System V message queues
+options 	SYSVSEM			# System V semaphores
+options 	SYSVSHM			# System V shared memory
+
+options 	MODULAR			# new style module(7) framework
+#options 	MODULAR_DEFAULT_AUTOLOAD
+#options 	USERCONF		# userconf(4) support
+#options	PIPE_SOCKETPAIR		# smaller, but slower pipe(2)
+#options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
+
+#options 	UVMHIST
+#options 	UVMHIST_PRINT
+
+
+# Alternate buffer queue strategies for better responsiveness under high
+# disk I/O load.
+#options 	BUFQ_READPRIO
+options 	BUFQ_PRIOCSCAN
+
+#
+# Diagnostic/debugging support options
+#
+
+options 	DIAGNOSTIC		# cheap kernel consistency checks
+#options 	DEBUG			# expensive debugging checks/support
+options 	DDB			# in-kernel debugger
+options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
+#options 	TRAP_PANICWAIT
+makeoptions	COPY_SYMTAB=1	# size for embedded symbol table
+
+makeoptions	DEBUG="-g"		# compile full symbol table
+
+
+#
+# Compatibility options
+#
+
+include 	"conf/compat_netbsd13.config"
+#options 	COMPAT_386BSD_MBRPART	# recognize old partition ID
+
+#
+# File systems
+#
+
+file-system 	FFS		# UFS
+file-system 	EXT2FS		# second extended file system (linux)
+file-system 	LFS		# log-structured file system
+file-system 	MFS		# memory file system
+file-system 	NFS		# Network File System client
+file-system 	CD9660		# ISO 9660 + Rock Ridge file system
+file-system 	MSDOSFS		# MS-DOS file system
+file-system 	FDESC		# /dev/fd
+file-system 	KERNFS		# /kern
+file-system 	NULLFS		# loopback file system
+file-system 	OVERLAY		# overlay file system
+file-system	PUFFS		# Userspace file systems (e.g. ntfs-3g & sshfs)
+file-system 	PROCFS		# /proc
+file-system 	UMAPFS		# NULLFS + uid and gid remapping
+file-system 	UNION		# union file system
+file-system	PTYFS		# /dev/pts/N support
+file-system	

CVS commit: src/sys/arch/macppc/conf

2021-04-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Apr  2 06:55:14 UTC 2021

Modified Files:
src/sys/arch/macppc/conf: POWERMAC_G5

Log Message:
Add bpf


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/macppc/conf/POWERMAC_G5

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/macppc/conf/POWERMAC_G5
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.47 src/sys/arch/macppc/conf/POWERMAC_G5:1.48
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.47	Sun Mar 28 08:43:05 2021
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Fri Apr  2 06:55:14 2021
@@ -229,6 +229,7 @@ pseudo-device	wsmux			# mouse and keyboa
 pseudo-device	clockctl		# user control of clock subsystem
 pseudo-device	drvctl			# user control of drive subsystem
 pseudo-device	ksyms			# /dev/ksyms
+pseudo-device	bpfilter		# packet filter
 #pseudo-device	npf			# NPF packet filter
 
 # Enable the hooks used for initializing the ram-disk.



CVS commit: src/usr.bin/at

2021-04-02 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Apr  2 06:31:53 UTC 2021

Modified Files:
src/usr.bin/at: at.c

Log Message:
Add an XXX reminder to convert at(1) to use parsedate(3) in .


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/at/at.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/at/at.c
diff -u src/usr.bin/at/at.c:1.31 src/usr.bin/at/at.c:1.32
--- src/usr.bin/at/at.c:1.31	Sun Mar 13 00:32:09 2016
+++ src/usr.bin/at/at.c	Fri Apr  2 06:31:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: at.c,v 1.31 2016/03/13 00:32:09 dholland Exp $	*/
+/*	$NetBSD: at.c,v 1.32 2021/04/02 06:31:53 simonb Exp $	*/
 
 /*
  *  at.c : Put file into atrun queue
@@ -53,7 +53,7 @@
 /* Local headers */
 #include "at.h"
 #include "panic.h"
-#include "parsetime.h"
+#include "parsetime.h"		/* XXX should use parsedate(3) in  */
 #include "perm.h"
 #include "pathnames.h"
 #include "stime.h"
@@ -71,7 +71,7 @@ enum { ATQ, ATRM, AT, BATCH, CAT };	/* w
 #if 0
 static char rcsid[] = "$OpenBSD: at.c,v 1.15 1998/06/03 16:20:26 deraadt Exp $";
 #else
-__RCSID("$NetBSD: at.c,v 1.31 2016/03/13 00:32:09 dholland Exp $");
+__RCSID("$NetBSD: at.c,v 1.32 2021/04/02 06:31:53 simonb Exp $");
 #endif
 #endif
 



CVS commit: src/usr.bin/vmstat

2021-04-02 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Apr  2 06:28:55 UTC 2021

Modified Files:
src/usr.bin/vmstat: Makefile vmstat.c

Log Message:
Drop setgid kmem, simplify nlist setup.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/vmstat/Makefile
cvs rdiff -u -r1.245 -r1.246 src/usr.bin/vmstat/vmstat.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/vmstat/Makefile
diff -u src/usr.bin/vmstat/Makefile:1.34 src/usr.bin/vmstat/Makefile:1.35
--- src/usr.bin/vmstat/Makefile:1.34	Thu Dec 29 23:42:39 2016
+++ src/usr.bin/vmstat/Makefile	Fri Apr  2 06:28:55 2021
@@ -1,8 +1,7 @@
-#	$NetBSD: Makefile,v 1.34 2016/12/29 23:42:39 mrg Exp $
+#	$NetBSD: Makefile,v 1.35 2021/04/02 06:28:55 simonb Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 .include 
-USE_FORT?= yes	# setgid
 PROG=	vmstat
 
 CPPFLAGS+=-D_KMEMUSER -I${NETBSDSRCDIR}/sys
@@ -10,8 +9,6 @@ SRCS=	drvstats.c vmstat.c
 MAN=	vmstat.1
 DPADD=	${LIBKVM}
 LDADD=	-lkvm
-BINGRP=	kmem
-BINMODE=2555
 
 CWARNFLAGS.clang+=	-Wno-format-extra-args
 COPTS.vmstat.c += -Wno-format-nonliteral
@@ -19,6 +16,4 @@ COPTS.vmstat.c += -Wno-format-nonliteral
 # sparc64 is broken!
 COPTS.vmstat.c += -Wno-error=stack-protector
 
-.include "../../compat/exec.mk"
-
 .include 

Index: src/usr.bin/vmstat/vmstat.c
diff -u src/usr.bin/vmstat/vmstat.c:1.245 src/usr.bin/vmstat/vmstat.c:1.246
--- src/usr.bin/vmstat/vmstat.c:1.245	Thu Apr  1 06:23:14 2021
+++ src/usr.bin/vmstat/vmstat.c	Fri Apr  2 06:28:55 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.245 2021/04/01 06:23:14 simonb Exp $ */
+/* $NetBSD: vmstat.c,v 1.246 2021/04/02 06:28:55 simonb Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.245 2021/04/01 06:23:14 simonb Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.246 2021/04/02 06:28:55 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -328,7 +328,6 @@ static const int clockrate_mib[] = { CTL
 static const int vmmeter_mib[] = { CTL_VM, VM_METER };
 static const int uvmexp2_mib[] = { CTL_VM, VM_UVMEXP2 };
 static const int boottime_mib[] = { CTL_KERN, KERN_BOOTTIME };
-static char kvm_errbuf[_POSIX2_LINE_MAX];
 
 int
 main(int argc, char *argv[])
@@ -336,11 +335,10 @@ main(int argc, char *argv[])
 	int c, todo, verbose, wide;
 	struct timespec interval;
 	int reps;
-	gid_t egid = getegid();
 	const char *histname, *hashname;
+	char errbuf[_POSIX2_LINE_MAX];
 
 	histname = hashname = NULL;
-	(void)setegid(getgid());
 	memf = nlistf = NULL;
 	reps = todo = verbose = wide = 0;
 	interval.tv_sec = 0;
@@ -415,35 +413,21 @@ main(int argc, char *argv[])
 	if (todo == 0)
 		todo = VMSTAT;
 
-	/*
-	 * Discard setgid privileges.  If not the running kernel, we toss
-	 * them away totally so that bad guys can't print interesting stuff
-	 * from kernel memory, otherwise switch back to kmem for the
-	 * duration of the kvm_openfiles() call.
-	 */
-	if (nlistf != NULL || memf != NULL)
-		(void)setgid(getgid());
-	else
-		(void)setegid(egid);
-
-	kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, kvm_errbuf);
-	if (kd == NULL) {
-		if (nlistf != NULL || memf != NULL) {
-			errx(1, "kvm_openfiles: %s", kvm_errbuf);
-		}
+	if (memf == NULL) {
+		kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf);
+	} else {
+		kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf);
+		getnlist(todo);
 	}
 
-	if (nlistf == NULL && memf == NULL)
-		(void)setgid(getgid());
-
+	if (kd == NULL)
+		errx(EXIT_FAILURE, "%s", errbuf);
 
 	if (todo & VMSTAT) {
 		struct winsize winsize;
 
 		(void)drvinit(0);/* Initialize disk stats, no disks selected. */
 
-		(void)setgid(getgid()); /* don't need privs anymore */
-
 		argv = choosedrives(argv);	/* Select disks. */
 		winsize.ws_row = 0;
 		(void)ioctl(STDOUT_FILENO, TIOCGWINSZ, );
@@ -466,8 +450,6 @@ main(int argc, char *argv[])
 	} else if (reps)
 		interval.tv_sec = 1;
 
-
-	getnlist(todo);
 	/*
 	 * Statistics dumping is incompatible with the default
 	 * VMSTAT/dovmstat() output. So perform the interval/reps handling
@@ -539,36 +521,30 @@ main(int argc, char *argv[])
 void
 getnlist(int todo)
 {
-	static int namelist_done = 0;
 	static int done = 0;
 	int c;
 	size_t i;
 
-	if (kd == NULL)
-		errx(1, "kvm_openfiles: %s", kvm_errbuf);
-
-	if (!namelist_done) {
-		namelist_done = 1;
-		if ((c = kvm_nlist(kd, namelist)) != 0) {
-			int doexit = 0;
-			if (c == -1)
-errx(1, "kvm_nlist: %s %s",
-"namelist", kvm_geterr(kd));
-			for (i = 0; i < __arraycount(namelist)-1; i++)
-if (namelist[i].n_type == 0) {
-	if (doexit++ == 0)
-		(void)fprintf(stderr,
-		"%s: undefined symbols:",
-		getprogname());
-	(void)fprintf(stderr, " %s",
-	namelist[i].n_name);
-}
-			if (doexit) {
-