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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jan 19 05:49:33 UTC 2021

Modified Files:
src/usr.bin/make/unit-tests: Makefile

Log Message:
make(1): normalize shell error messages in tests

Newly supported is bash, which outputs "bash: line 123".


To generate a diff of this commit:
cvs rdiff -u -r1.260 -r1.261 src/usr.bin/make/unit-tests/Makefile

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

Modified files:

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.260 src/usr.bin/make/unit-tests/Makefile:1.261
--- src/usr.bin/make/unit-tests/Makefile:1.260	Thu Dec 31 03:05:12 2020
+++ src/usr.bin/make/unit-tests/Makefile	Tue Jan 19 05:49:33 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.260 2020/12/31 03:05:12 rillig Exp $
+# $NetBSD: Makefile,v 1.261 2021/01/19 05:49:33 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -504,10 +504,9 @@ SED_CMDS.sh-flags=		${STD_SED_CMDS.hide-
 SED_CMDS.suff-main+=		${STD_SED_CMDS.dg1}
 SED_CMDS.suff-main-several+=	${STD_SED_CMDS.dg1}
 SED_CMDS.suff-transform-debug+=	${STD_SED_CMDS.dg1}
-SED_CMDS.var-op-shell+=	\
-	-e 's,^${.SHELL:T}: [ 0-9:]*,,' \
-	-e '/command/s,No such.*,not found,'
-SED_CMDS.vardebug+=	-e 's,${.SHELL},,'
+SED_CMDS.var-op-shell+=		${STD_SED_CMDS.shell}
+SED_CMDS.var-op-shell+=		-e '/command/s,No such.*,not found,'
+SED_CMDS.vardebug+=		-e 's,${.SHELL},,'
 SED_CMDS.varmod-subst-regex+= \
 			-e 's,\(Regex compilation error:\).*,\1 (details omitted),'
 SED_CMDS.varname-dot-parsedir=	-e '/in some cases/ s,^make: "[^"]*,make: ",'
@@ -553,6 +552,25 @@ STD_SED_CMDS.hide-from-output= \
 	-e 's,hide-from-output ,,' \
 	-e 's,hide-from-output,,'
 
+# Normalize the output for error messages from the shell.
+#
+# $shell -c '...'
+#	NetBSD sh	...: not found
+#	NetBSD ksh	ksh: ...: not found
+#	bash 5		bash: line 1: ...: command not found
+#	dash		dash: 1: ...: not found
+#
+# $shell -c '< /nonexistent'
+#	NetBSD sh	sh: cannot open /nonexistent: no such file
+#	NetBSD ksh	ksh: cannot open /nonexistent: No such file or directory
+#	bash 5		bash: line 1: /nonexistent: No such file or directory
+#	dash		dash: 1: cannot open /nonexistent: No such file
+#
+#
+STD_SED_CMDS.shell+=		-e 's,^${.SHELL:T}: line [0-9][0-9]*:,,'
+STD_SED_CMDS.shell+=		-e 's,^${.SHELL:T}: [0-9][0-9]*:,,'
+STD_SED_CMDS.shell+=		-e 's,^${.SHELL:T}: ,,'
+
 # End of the configuration helpers section.
 
 .MAIN: all



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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Jan 19 05:26:34 UTC 2021

Modified Files:
src/usr.bin/make/unit-tests: varmod-gmtime.exp varmod-gmtime.mk
varmod-localtime.exp varmod-localtime.mk

Log Message:
make(1): fix tests for :gmtime and :localtime for 32-bit time_t

The comparison operator had accidentally been '!=' instead of '=='.

While here, proofread the documentation and add references for where the
32-bit time_t is defined on Linux and FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-gmtime.exp
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-gmtime.mk
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-localtime.exp \
src/usr.bin/make/unit-tests/varmod-localtime.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/varmod-gmtime.exp
diff -u src/usr.bin/make/unit-tests/varmod-gmtime.exp:1.10 src/usr.bin/make/unit-tests/varmod-gmtime.exp:1.11
--- src/usr.bin/make/unit-tests/varmod-gmtime.exp:1.10	Mon Dec 21 21:04:18 2020
+++ src/usr.bin/make/unit-tests/varmod-gmtime.exp	Tue Jan 19 05:26:34 2021
@@ -1,13 +1,13 @@
-make: "varmod-gmtime.mk" line 60: Invalid time value: ${:U1593536400}} != "mtime=11593536400}"
-make: "varmod-gmtime.mk" line 60: Malformed conditional (${%Y:L:gmtime=${:U1593536400}} != "mtime=11593536400}")
-make: "varmod-gmtime.mk" line 70: Invalid time value: -1} != ""
-make: "varmod-gmtime.mk" line 70: Malformed conditional (${:L:gmtime=-1} != "")
-make: "varmod-gmtime.mk" line 79: Invalid time value:  1} != ""
-make: "varmod-gmtime.mk" line 79: Malformed conditional (${:L:gmtime= 1} != "")
-make: "varmod-gmtime.mk" line 118: Invalid time value: 1000} != ""
-make: "varmod-gmtime.mk" line 118: Malformed conditional (${:L:gmtime=1000} != "")
-make: "varmod-gmtime.mk" line 129: Invalid time value: error} != ""
-make: "varmod-gmtime.mk" line 129: Malformed conditional (${:L:gmtime=error} != "")
+make: "varmod-gmtime.mk" line 57: Invalid time value: ${:U1593536400}} != "mtime=11593536400}"
+make: "varmod-gmtime.mk" line 57: Malformed conditional (${%Y:L:gmtime=${:U1593536400}} != "mtime=11593536400}")
+make: "varmod-gmtime.mk" line 67: Invalid time value: -1} != ""
+make: "varmod-gmtime.mk" line 67: Malformed conditional (${:L:gmtime=-1} != "")
+make: "varmod-gmtime.mk" line 76: Invalid time value:  1} != ""
+make: "varmod-gmtime.mk" line 76: Malformed conditional (${:L:gmtime= 1} != "")
+make: "varmod-gmtime.mk" line 119: Invalid time value: 1000} != ""
+make: "varmod-gmtime.mk" line 119: Malformed conditional (${:L:gmtime=1000} != "")
+make: "varmod-gmtime.mk" line 130: Invalid time value: error} != ""
+make: "varmod-gmtime.mk" line 130: Malformed conditional (${:L:gmtime=error} != "")
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/varmod-gmtime.mk
diff -u src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.9 src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.10
--- src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.9	Tue Dec 22 07:22:39 2020
+++ src/usr.bin/make/unit-tests/varmod-gmtime.mk	Tue Jan 19 05:26:34 2021
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-gmtime.mk,v 1.9 2020/12/22 07:22:39 rillig Exp $
+# $NetBSD: varmod-gmtime.mk,v 1.10 2021/01/19 05:26:34 rillig Exp $
 #
 # Tests for the :gmtime variable modifier, which formats a timestamp
 # using strftime(3) in UTC.
@@ -54,9 +54,6 @@
 #
 # If ApplyModifier_Gmtime were to pass its argument through
 # ParseModifierPart, this would work.
-#
-# XXX: Where does the empty line 4 in varmod-gmtime.exp come from?
-# TODO: Remove the \n from "Invalid time value: %s\n" in var.c.
 .if ${%Y:L:gmtime=${:U1593536400}} != "mtime=11593536400}"
 .  error
 .endif
@@ -74,8 +71,8 @@
 .endif
 
 
-# Spaces were allowed before var.c 1.631, not because it would make sense
-# but just as a side-effect from using strtoul.
+# Spaces were allowed before var.c 1.631 from 2020-10-31 21:40:20, not
+# because it would make sense but just as a side-effect from using strtoul.
 .if ${:L:gmtime= 1} != ""
 .  error
 .endif
@@ -102,8 +99,12 @@
 
 .if ${:L:gmtime=2147483648} == "Tue Jan 19 03:14:08 2038"
 # All systems that have unsigned time_t or 64-bit time_t.
-.elif ${:L:gmtime=2147483648} != "Fri Dec 13 20:45:52 1901"
-# FreeBSD-12.0-i386 still has 32-bit signed time_t.
+.elif ${:L:gmtime=2147483648} == "Fri Dec 13 20:45:52 1901"
+# FreeBSD-12.0-i386 still has 32-bit signed time_t, see
+# sys/x86/include/_types.h, __LP64__.
+#
+# Linux on 32-bit systems may still have 32-bit signed time_t, see
+# sysdeps/unix/sysv/linux/generic/bits/typesizes.h, __TIMESIZE.
 .else
 .  error
 .endif
@@ -122,7 +123,7 @@
 .endif
 
 # Before var.c 1.631 from 2020-10-31, there was 

CVS commit: src/share/man/man4

2021-01-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jan 19 05:05:39 UTC 2021

Modified Files:
src/share/man/man4: tpm.4

Log Message:
Add note about enabling TPM and rnd(4) source.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/tpm.4

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

Modified files:

Index: src/share/man/man4/tpm.4
diff -u src/share/man/man4/tpm.4:1.6 src/share/man/man4/tpm.4:1.7
--- src/share/man/man4/tpm.4:1.6	Sat Jan 16 01:47:23 2021
+++ src/share/man/man4/tpm.4	Tue Jan 19 05:05:39 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: tpm.4,v 1.6 2021/01/16 01:47:23 thorpej Exp $
+.\"	$NetBSD: tpm.4,v 1.7 2021/01/19 05:05:39 riastradh Exp $
 .\"
 .\" Copyright (c) 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -51,9 +51,19 @@ TPM 1.2 chips over ACPI and ISA
 .El
 .Pp
 Note that the supported interface version is TIS1.2 in each case.
+.Pp
+The TPM may need to be enabled in the system's firmware or BIOS, which
+requires a reboot to take effect.
+This is generally beyond the control of
+.Nx .
+Enabling a TPM does not require using trusted boot \(em it can be
+enabled, for example, only for the
+.Xr rnd 4
+entropy source.
 .Sh SEE ALSO
 .Xr config 1 ,
-.Xr intro 4
+.Xr intro 4 ,
+.Xr rnd 4
 .Sh AUTHORS
 .An -nosplit
 The



CVS commit: src/sys/compat/netbsd32

2021-01-18 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Jan 19 03:41:22 UTC 2021

Modified Files:
src/sys/compat/netbsd32: netbsd32.h netbsd32_conv.h netbsd32_fs.c
netbsd32_netbsd.c netbsd32_socket.c

Log Message:
The read/write/send/recv system calls return ssize_t because -1 is
returned on error.  Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sys/compat/netbsd32/netbsd32.h
cvs rdiff -u -r1.44 -r1.45 src/sys/compat/netbsd32/netbsd32_conv.h
cvs rdiff -u -r1.91 -r1.92 src/sys/compat/netbsd32/netbsd32_fs.c
cvs rdiff -u -r1.231 -r1.232 src/sys/compat/netbsd32/netbsd32_netbsd.c
cvs rdiff -u -r1.55 -r1.56 src/sys/compat/netbsd32/netbsd32_socket.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/compat/netbsd32/netbsd32.h
diff -u src/sys/compat/netbsd32/netbsd32.h:1.136 src/sys/compat/netbsd32/netbsd32.h:1.137
--- src/sys/compat/netbsd32/netbsd32.h:1.136	Mon Jan 18 23:14:22 2021
+++ src/sys/compat/netbsd32/netbsd32.h	Tue Jan 19 03:41:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32.h,v 1.136 2021/01/18 23:14:22 simonb Exp $	*/
+/*	$NetBSD: netbsd32.h,v 1.137 2021/01/19 03:41:22 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@@ -58,7 +58,7 @@
 #include 
 
 /*
- * first, define the basic types we need.
+ * first define the basic types we need, and any applicable limits.
  */
 
 typedef int32_t netbsd32_long;
@@ -73,6 +73,9 @@ typedef int32_t netbsd32_key_t;
 typedef int32_t netbsd32_intptr_t;
 typedef uint32_t netbsd32_uintptr_t;
 
+/* Note: 32-bit sparc defines ssize_t as long but still has same size as int. */
+#define	NETBSD32_SSIZE_MAX	INT32_MAX
+
 /* netbsd32_[u]int64 are machine dependent and defined below */
 
 /*

Index: src/sys/compat/netbsd32/netbsd32_conv.h
diff -u src/sys/compat/netbsd32/netbsd32_conv.h:1.44 src/sys/compat/netbsd32/netbsd32_conv.h:1.45
--- src/sys/compat/netbsd32/netbsd32_conv.h:1.44	Tue Jan 19 03:20:13 2021
+++ src/sys/compat/netbsd32/netbsd32_conv.h	Tue Jan 19 03:41:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_conv.h,v 1.44 2021/01/19 03:20:13 simonb Exp $	*/
+/*	$NetBSD: netbsd32_conv.h,v 1.45 2021/01/19 03:41:22 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -246,13 +246,15 @@ netbsd32_to_iovecin(const struct netbsd3
 {
 	int i, error=0;
 	uint32_t iov_base;
-	uint32_t iov_len;
+	uint32_t iov_len, total_iov_len;
+
 	/*
 	 * We could allocate an iov32p, do a copyin, and translate
 	 * each field and then free it all up, or we could copyin
 	 * each field separately.  I'm doing the latter to reduce
 	 * the number of MALLOC()s.
 	 */
+	total_iov_len = 0;
 	for (i = 0; i < len; i++, iovp++, iov32p++) {
 		if ((error = copyin(>iov_base, _base, sizeof(iov_base
 		return error;
@@ -260,6 +262,19 @@ netbsd32_to_iovecin(const struct netbsd3
 		return error;
 		iovp->iov_base = (void *)(u_long)iov_base;
 		iovp->iov_len = (size_t)iov_len;
+
+		/*
+		 * System calls return ssize_t because -1 is returned
+		 * on error.  Therefore we must restrict the length to
+		 * SSIZE_MAX (NETBSD32_SSIZE_MAX with compat32) to
+		 * avoid garbage return values.
+		 */
+		total_iov_len += iov_len;
+		if (iov_len > NETBSD32_SSIZE_MAX ||
+		total_iov_len > NETBSD32_SSIZE_MAX) {
+			return EINVAL;
+			break;
+		}
 	}
 	return error;
 }

Index: src/sys/compat/netbsd32/netbsd32_fs.c
diff -u src/sys/compat/netbsd32/netbsd32_fs.c:1.91 src/sys/compat/netbsd32/netbsd32_fs.c:1.92
--- src/sys/compat/netbsd32/netbsd32_fs.c:1.91	Tue Jan 19 03:20:13 2021
+++ src/sys/compat/netbsd32/netbsd32_fs.c	Tue Jan 19 03:41:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_fs.c,v 1.91 2021/01/19 03:20:13 simonb Exp $	*/
+/*	$NetBSD: netbsd32_fs.c,v 1.92 2021/01/19 03:41:22 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.91 2021/01/19 03:20:13 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.92 2021/01/19 03:41:22 simonb Exp $");
 
 #include 
 #include 
@@ -176,7 +176,8 @@ dofilereadv32(int fd, struct file *fp, s
 		 * Therefore we must restrict the length to SSIZE_MAX to
 		 * avoid garbage return values.
 		 */
-		if (iov->iov_len > SSIZE_MAX || auio.uio_resid > SSIZE_MAX) {
+		if (iov->iov_len > NETBSD32_SSIZE_MAX ||
+		auio.uio_resid > NETBSD32_SSIZE_MAX) {
 			error = EINVAL;
 			goto done;
 		}
@@ -281,7 +282,8 @@ dofilewritev32(int fd, struct file *fp, 
 		 * Therefore we must restrict the length to SSIZE_MAX to
 		 * avoid garbage return values.
 		 */
-		if (iov->iov_len > SSIZE_MAX || auio.uio_resid > SSIZE_MAX) {
+		if (iov->iov_len > NETBSD32_SSIZE_MAX ||
+		auio.uio_resid > NETBSD32_SSIZE_MAX) {
 			error = EINVAL;
 			goto 

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

2021-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 19 03:25:50 UTC 2021

Modified Files:
src/sys/arch/arm/altera: cycv_clkmgr.c

Log Message:
Use device_compatible_entry / of_search_compatible() to match the clock
type rather than calling of_compatible() on different sets of compatible
strings.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/altera/cycv_clkmgr.c

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

Modified files:

Index: src/sys/arch/arm/altera/cycv_clkmgr.c
diff -u src/sys/arch/arm/altera/cycv_clkmgr.c:1.4 src/sys/arch/arm/altera/cycv_clkmgr.c:1.5
--- src/sys/arch/arm/altera/cycv_clkmgr.c:1.4	Fri Oct 18 06:50:08 2019
+++ src/sys/arch/arm/altera/cycv_clkmgr.c	Tue Jan 19 03:25:50 2021
@@ -1,9 +1,9 @@
-/* $NetBSD: cycv_clkmgr.c,v 1.4 2019/10/18 06:50:08 skrll Exp $ */
+/* $NetBSD: cycv_clkmgr.c,v 1.5 2021/01/19 03:25:50 thorpej Exp $ */
 
 /* This file is in the public domain. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cycv_clkmgr.c,v 1.4 2019/10/18 06:50:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cycv_clkmgr.c,v 1.5 2021/01/19 03:25:50 thorpej Exp $");
 
 #include 
 #include 
@@ -64,6 +64,7 @@ struct cycv_clk {
 	int parent_id;
 
 	int type;
+#define	CYCV_CLK_TYPE_PERIP	0x	/* pseudo-type */
 #define CYCV_CLK_TYPE_PLL	0x0001
 #define CYCV_CLK_TYPE_FIXED	0x0002
 #define CYCV_CLK_TYPE_FIXED_DIV	0x0003
@@ -110,13 +111,17 @@ static void cycv_clkmgr_clock_print(stru
 CFATTACH_DECL_NEW(cycvclkmgr, sizeof (struct cycv_clkmgr_softc),
 	cycv_clkmgr_match, cycv_clkmgr_attach, NULL, NULL);
 
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "altr,clk-mgr" },
+	{ 0 }
+};
+
 static int
 cycv_clkmgr_match(device_t parent, cfdata_t cf, void *aux)
 {
-	const char *compatible[] = { "altr,clk-mgr", NULL };
 	struct fdt_attach_args *faa = aux;
 
-	return of_match_compatible(faa->faa_phandle, compatible);
+	return of_match_compat_data(faa->faa_phandle, compat_data);
 }
 
 static void
@@ -208,13 +213,12 @@ static struct cycv_clk_mux_info {
 	{ "nand_clk", { "nand_x_clk" }, 1, 0, 0 },
 };
 
-static const char * const cycv_clkmgr_compat_fixed[] = { "fixed-clock", NULL };
-static const char * const cycv_clkmgr_compat_pll[] = { "altr,socfpga-pll-clock",
-	NULL };
-static const char * const cycv_clkmgr_compat_perip[] = {
-	"altr,socfpga-perip-clk",
-	"altr,socfpga-gate-clk",
-	NULL
+static const struct device_compatible_entry clock_types[] = {
+	{ .compat = "fixed-clock",		.value = CYCV_CLK_TYPE_FIXED },
+	{ .compat = "altr,socfpga-pll-clock",	.value = CYCV_CLK_TYPE_PLL },
+	{ .compat = "altr,socfpga-perip-clk",	.value = CYCV_CLK_TYPE_PERIP },
+	{ .compat = "altr,socfpga-gate-clk",	.value = CYCV_CLK_TYPE_PERIP },
+	{ 0 }
 };
 
 static void
@@ -234,18 +238,22 @@ cycv_clkmgr_clock_parse(struct cycv_clkm
 	clk->parent_id = 0;
 	clk->refcnt = 0;
 
-	if (of_compatible(handle, cycv_clkmgr_compat_fixed) != -1) {
-		clk->type = CYCV_CLK_TYPE_FIXED;
+	const struct device_compatible_entry * const dce =
+	of_search_compatible(handle, clock_types);
+	if (dce == NULL)
+		goto err;
+	clk->type = dce->value;
+
+	if (clk->type == CYCV_CLK_TYPE_FIXED) {
 		if (of_getprop_uint32(handle, "clock-frequency",
   >u.fixed_freq) == 0) {
 			flags |= CYCV_CLK_FLAG_IS_AVAIL;
 		}
-	} else if (of_compatible(handle, cycv_clkmgr_compat_pll) != -1) {
+	} else if (clk->type == CYCV_CLK_TYPE_PLL) {
 		if (fdtbus_get_reg(handle, 0, >u.pll_addr, NULL) != 0)
 			goto err;
-		clk->type = CYCV_CLK_TYPE_PLL;
 		flags |= CYCV_CLK_FLAG_IS_AVAIL;
-	} else if (of_compatible(handle, cycv_clkmgr_compat_perip) != -1) {
+	} else if (clk->type == CYCV_CLK_TYPE_PERIP) {
 		if (of_getprop_uint32(handle, "fixed-divider",
   >u.fixed_div) == 0) {
 			clk->type = CYCV_CLK_TYPE_FIXED_DIV;



CVS commit: src/sys/compat/netbsd32

2021-01-18 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Jan 19 03:20:13 UTC 2021

Modified Files:
src/sys/compat/netbsd32: netbsd32_compat_09.c netbsd32_compat_10_sysv.c
netbsd32_compat_12.c netbsd32_compat_13.c netbsd32_compat_14_sysv.c
netbsd32_compat_20.c netbsd32_compat_30.c netbsd32_compat_43.c
netbsd32_compat_50.c netbsd32_compat_50_quota.c
netbsd32_compat_50_sysv.c netbsd32_conv.h netbsd32_exec_aout.c
netbsd32_fs.c netbsd32_ipc.c netbsd32_rlimit.c
netbsd32_rndpseudo_50.c netbsd32_signal.c netbsd32_socket.c
netbsd32_sysctl.c netbsd32_time.c

Log Message:
KNF consistency: No parentheses are needed around the return value.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/compat/netbsd32/netbsd32_compat_09.c \
src/sys/compat/netbsd32/netbsd32_ipc.c
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/netbsd32/netbsd32_compat_10_sysv.c
cvs rdiff -u -r1.34 -r1.35 src/sys/compat/netbsd32/netbsd32_compat_12.c
cvs rdiff -u -r1.27 -r1.28 src/sys/compat/netbsd32/netbsd32_compat_13.c
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/netbsd32/netbsd32_compat_14_sysv.c \
src/sys/compat/netbsd32/netbsd32_compat_50_sysv.c
cvs rdiff -u -r1.39 -r1.40 src/sys/compat/netbsd32/netbsd32_compat_20.c
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/netbsd32/netbsd32_compat_30.c
cvs rdiff -u -r1.60 -r1.61 src/sys/compat/netbsd32/netbsd32_compat_43.c
cvs rdiff -u -r1.49 -r1.50 src/sys/compat/netbsd32/netbsd32_compat_50.c
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/netbsd32/netbsd32_compat_50_quota.c \
src/sys/compat/netbsd32/netbsd32_rlimit.c
cvs rdiff -u -r1.43 -r1.44 src/sys/compat/netbsd32/netbsd32_conv.h
cvs rdiff -u -r1.30 -r1.31 src/sys/compat/netbsd32/netbsd32_exec_aout.c
cvs rdiff -u -r1.90 -r1.91 src/sys/compat/netbsd32/netbsd32_fs.c
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c
cvs rdiff -u -r1.50 -r1.51 src/sys/compat/netbsd32/netbsd32_signal.c
cvs rdiff -u -r1.54 -r1.55 src/sys/compat/netbsd32/netbsd32_socket.c
cvs rdiff -u -r1.44 -r1.45 src/sys/compat/netbsd32/netbsd32_sysctl.c
cvs rdiff -u -r1.53 -r1.54 src/sys/compat/netbsd32/netbsd32_time.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/compat/netbsd32/netbsd32_compat_09.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_09.c:1.19 src/sys/compat/netbsd32/netbsd32_compat_09.c:1.20
--- src/sys/compat/netbsd32/netbsd32_compat_09.c:1.19	Sun Jan 27 02:08:40 2019
+++ src/sys/compat/netbsd32/netbsd32_compat_09.c	Tue Jan 19 03:20:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_09.c,v 1.19 2019/01/27 02:08:40 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_compat_09.c,v 1.20 2021/01/19 03:20:13 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_09.c,v 1.19 2019/01/27 02:08:40 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_09.c,v 1.20 2021/01/19 03:20:13 simonb Exp $");
 
 #include 
 #include 
@@ -59,8 +59,8 @@ compat_09_netbsd32_ogetdomainname(struct
 	name[0] = CTL_KERN;
 	name[1] = KERN_DOMAINNAME;
 	sz = SCARG(uap, len);
-	return (old_sysctl([0], 2,
-	(char *)SCARG_P32(uap, domainname), , 0, 0, l));
+	return old_sysctl([0], 2,
+	(char *)SCARG_P32(uap, domainname), , 0, 0, l);
 }
 
 int
@@ -74,8 +74,8 @@ compat_09_netbsd32_osetdomainname(struct
 
 	name[0] = CTL_KERN;
 	name[1] = KERN_DOMAINNAME;
-	return (old_sysctl([0], 2, 0, 0,
-	(char *)SCARG_P32(uap, domainname), SCARG(uap, len), l));
+	return old_sysctl([0], 2, 0, 0,
+	(char *)SCARG_P32(uap, domainname), SCARG(uap, len), l);
 }
 
 int
@@ -87,7 +87,7 @@ compat_09_netbsd32_uname(struct lwp *l, 
 	struct compat_09_sys_uname_args ua;
 
 	NETBSD32TOP_UAP(name, struct outsname);
-	return (compat_09_sys_uname(l, , retval));
+	return compat_09_sys_uname(l, , retval);
 }
 
 static struct syscall_package compat_netbsd32_09_syscalls[] = {
Index: src/sys/compat/netbsd32/netbsd32_ipc.c
diff -u src/sys/compat/netbsd32/netbsd32_ipc.c:1.19 src/sys/compat/netbsd32/netbsd32_ipc.c:1.20
--- src/sys/compat/netbsd32/netbsd32_ipc.c:1.19	Sun Jan 27 02:08:40 2019
+++ src/sys/compat/netbsd32/netbsd32_ipc.c	Tue Jan 19 03:20:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ipc.c,v 1.19 2019/01/27 02:08:40 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_ipc.c,v 1.20 2021/01/19 03:20:13 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ipc.c,v 1.19 2019/01/27 02:08:40 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ipc.c,v 1.20 2021/01/19 03:20:13 simonb Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sysv.h"
@@ -162,7 +162,7 @@ netbsd32_semctl50(struct lwp *l, con
 			error = copyin(NETBSD32PTR64(karg32.buf), ,
 			sizeof(sembuf32));
 			if (error)
-return (error);
+return error;
 			

CVS commit: src/sys/compat/netbsd32

2021-01-18 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Jan 19 02:40:07 UTC 2021

Modified Files:
src/sys/compat/netbsd32: netbsd32_exec.h

Log Message:
Whitespace nits.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/netbsd32/netbsd32_exec.h

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_exec.h
diff -u src/sys/compat/netbsd32/netbsd32_exec.h:1.35 src/sys/compat/netbsd32/netbsd32_exec.h:1.36
--- src/sys/compat/netbsd32/netbsd32_exec.h:1.35	Mon Jan 18 23:14:22 2021
+++ src/sys/compat/netbsd32/netbsd32_exec.h	Tue Jan 19 02:40:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_exec.h,v 1.35 2021/01/18 23:14:22 simonb Exp $	*/
+/*	$NetBSD: netbsd32_exec.h,v 1.36 2021/01/19 02:40:07 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -70,9 +70,9 @@ int netbsd32_elf32_copyargs(struct lwp *
 static __inline int netbsd32_copyargs(struct lwp *, struct exec_package *,
 struct ps_strings *, char **, void *);
 
-void netbsd32_setregs (struct lwp *, struct exec_package *, vaddr_t stack);
-int netbsd32_sigreturn (struct proc *, void *, register_t *);
-void netbsd32_sendsig (const ksiginfo_t *, const sigset_t *);
+void netbsd32_setregs(struct lwp *, struct exec_package *, vaddr_t stack);
+int netbsd32_sigreturn(struct proc *, void *, register_t *);
+void netbsd32_sendsig(const ksiginfo_t *, const sigset_t *);
 
 extern char netbsd32_esigcode[], netbsd32_sigcode[];
 



CVS commit: src/sys/compat/netbsd32

2021-01-18 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Jan 19 01:47:58 UTC 2021

Modified Files:
src/sys/compat/netbsd32: netbsd32_vm.c

Log Message:
Also print mmap return value and error code #ifdef DEBUG_MMAP.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/netbsd32/netbsd32_vm.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/compat/netbsd32/netbsd32_vm.c
diff -u src/sys/compat/netbsd32/netbsd32_vm.c:1.2 src/sys/compat/netbsd32/netbsd32_vm.c:1.3
--- src/sys/compat/netbsd32/netbsd32_vm.c:1.2	Tue Jan  7 07:26:21 2020
+++ src/sys/compat/netbsd32/netbsd32_vm.c	Tue Jan 19 01:47:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_vm.c,v 1.2 2020/01/07 07:26:21 mrg Exp $	*/
+/*	$NetBSD: netbsd32_vm.c,v 1.3 2021/01/19 01:47:58 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_vm.c,v 1.2 2020/01/07 07:26:21 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_vm.c,v 1.3 2021/01/19 01:47:58 simonb Exp $");
 
 #include 
 #include 
@@ -86,6 +86,9 @@ netbsd32_mmap(struct lwp *l, const struc
 #endif
 
 	error = sys_mmap(l, , retval);
+#ifdef DEBUG_MMAP
+	printf("mmap error = %d  *retval = %#"PRIxREGISTER"\n", error, *retval);
+#endif
 	if (error == 0 && (u_long)*retval > (u_long)UINT_MAX) {
 		const char *name = curlwp->l_name;
 



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

2021-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 19 00:40:17 UTC 2021

Modified Files:
src/sys/arch/arm/fdt: gicv3_fdt.c

Log Message:
Use device_compatible_entry / of_search_compatible() for the GICv3
quirk table.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/fdt/gicv3_fdt.c

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

Modified files:

Index: src/sys/arch/arm/fdt/gicv3_fdt.c
diff -u src/sys/arch/arm/fdt/gicv3_fdt.c:1.11 src/sys/arch/arm/fdt/gicv3_fdt.c:1.12
--- src/sys/arch/arm/fdt/gicv3_fdt.c:1.11	Fri Jan 15 00:38:22 2021
+++ src/sys/arch/arm/fdt/gicv3_fdt.c	Tue Jan 19 00:40:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_fdt.c,v 1.11 2021/01/15 00:38:22 jmcneill Exp $ */
+/* $NetBSD: gicv3_fdt.c,v 1.12 2021/01/19 00:40:17 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill 
@@ -31,7 +31,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3_fdt.c,v 1.11 2021/01/15 00:38:22 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3_fdt.c,v 1.12 2021/01/19 00:40:17 thorpej Exp $");
 
 #include 
 #include 
@@ -107,29 +107,26 @@ struct gicv3_fdt_softc {
 	struct gicv3_fdt_irq	*sc_irq[GICV3_MAXIRQ];
 };
 
-struct gicv3_fdt_quirk {
-	const char		*compat;
-	u_int			quirks;
-};
-
-static const struct gicv3_fdt_quirk gicv3_fdt_quirks[] = {
-	{ "rockchip,rk3399",	GICV3_QUIRK_RK3399 },
+static const struct device_compatible_entry gicv3_fdt_quirks[] = {
+	{ .compat = "rockchip,rk3399",		.value = GICV3_QUIRK_RK3399 },
+	{ 0 }
 };
 
 CFATTACH_DECL_NEW(gicv3_fdt, sizeof(struct gicv3_fdt_softc),
 	gicv3_fdt_match, gicv3_fdt_attach, NULL, NULL);
 
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "arm,gic-v3" },
+	{ 0 }
+};
+
 static int
 gicv3_fdt_match(device_t parent, cfdata_t cf, void *aux)
 {
-	const char * const compatible[] = {
-		"arm,gic-v3",
-		NULL
-	};
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
 
-	return of_match_compatible(phandle, compatible);
+	return of_match_compat_data(phandle, compat_data);
 }
 
 static void
@@ -138,7 +135,7 @@ gicv3_fdt_attach(device_t parent, device
 	struct gicv3_fdt_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
-	int error, n;
+	int error;
 
 	error = fdtbus_register_interrupt_controller(self, phandle,
 	_fdt_funcs);
@@ -164,11 +161,10 @@ gicv3_fdt_attach(device_t parent, device
 	aprint_debug_dev(self, "%d redistributors\n", sc->sc_gic.sc_bsh_r_count);
 
 	/* Apply quirks */
-	for (n = 0; n < __arraycount(gicv3_fdt_quirks); n++) {
-		const char *compat[] = { gicv3_fdt_quirks[n].compat, NULL };
-		if (of_match_compatible(OF_finddevice("/"), compat)) {
-			sc->sc_gic.sc_quirks |= gicv3_fdt_quirks[n].quirks;
-		}
+	const struct device_compatible_entry *dce =
+	of_search_compatible(OF_finddevice("/"), gicv3_fdt_quirks);
+	if (dce != NULL) {
+		sc->sc_gic.sc_quirks |= dce->value;
 	}
 
 	error = gicv3_init(>sc_gic);
@@ -183,11 +179,16 @@ gicv3_fdt_attach(device_t parent, device
 		gicv3_fdt_attach_mbi(sc);
 	} else {
 		/* Interrupt Translation Services */
-		for (int child = OF_child(phandle); child; child = OF_peer(child)) {
+		static const struct device_compatible_entry its_compat[] = {
+			{ .compat = "arm,gic-v3-its" },
+			{ 0 }
+		};
+
+		for (int child = OF_child(phandle); child;
+		 child = OF_peer(child)) {
 			if (!fdtbus_status_okay(child))
 continue;
-			const char * const its_compat[] = { "arm,gic-v3-its", NULL };
-			if (of_match_compatible(child, its_compat))
+			if (of_match_compat_data(child, its_compat))
 gicv3_fdt_attach_its(sc, faa->faa_bst, child);
 		}
 	}



CVS commit: src/sys/arch/arm

2021-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 19 00:38:52 UTC 2021

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_intr.c
src/sys/arch/arm/rockchip: rk_tsadc.c
src/sys/arch/arm/samsung: exynos_dwcmmc.c

Log Message:
Use device_compatible_entry / of_search_compatible() rather than
matching against multiple sets of compatibility strings.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/broadcom/bcm2835_intr.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/rockchip/rk_tsadc.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/exynos_dwcmmc.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_intr.c
diff -u src/sys/arch/arm/broadcom/bcm2835_intr.c:1.34 src/sys/arch/arm/broadcom/bcm2835_intr.c:1.35
--- src/sys/arch/arm/broadcom/bcm2835_intr.c:1.34	Fri Jan 15 00:38:22 2021
+++ src/sys/arch/arm/broadcom/bcm2835_intr.c	Tue Jan 19 00:38:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_intr.c,v 1.34 2021/01/15 00:38:22 jmcneill Exp $	*/
+/*	$NetBSD: bcm2835_intr.c,v 1.35 2021/01/19 00:38:52 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2015, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.34 2021/01/15 00:38:22 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.35 2021/01/19 00:38:52 thorpej Exp $");
 
 #define _INTR_PRIVATE
 
@@ -254,20 +254,21 @@ static const char * const bcm2836mp_sour
 CFATTACH_DECL_NEW(bcmicu, sizeof(struct bcm2835icu_softc),
 bcm2835_icu_match, bcm2835_icu_attach, NULL, NULL);
 
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "brcm,bcm2708-armctrl-ic",	.value = 0 },
+	{ .compat = "brcm,bcm2709-armctrl-ic",	.value = 0 },
+	{ .compat = "brcm,bcm2835-armctrl-ic",	.value = 0 },
+	{ .compat = "brcm,bcm2836-armctrl-ic",	.value = 0 },
+	{ .compat = "brcm,bcm2836-l1-intc",	.value = 1 },
+	{ 0 }
+};
+
 static int
 bcm2835_icu_match(device_t parent, cfdata_t cf, void *aux)
 {
-	const char * const compatible[] = {
-	"brcm,bcm2708-armctrl-ic",
-	"brcm,bcm2709-armctrl-ic",
-	"brcm,bcm2835-armctrl-ic",
-	"brcm,bcm2836-armctrl-ic",
-	"brcm,bcm2836-l1-intc",
-	NULL
-	};
 	struct fdt_attach_args * const faa = aux;
 
-	return of_match_compatible(faa->faa_phandle, compatible);
+	return of_match_compat_data(faa->faa_phandle, compat_data);
 }
 
 static void
@@ -276,6 +277,7 @@ bcm2835_icu_attach(device_t parent, devi
 	struct bcm2835icu_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	struct fdtbus_interrupt_controller_func *ifuncs;
+	const struct device_compatible_entry *dce;
 	const int phandle = faa->faa_phandle;
 	bus_addr_t addr;
 	bus_size_t size;
@@ -298,8 +300,10 @@ bcm2835_icu_attach(device_t parent, devi
 	sc->sc_ioh = ioh;
 	sc->sc_phandle = phandle;
 
-	const char * const local_intc[] = { "brcm,bcm2836-l1-intc", NULL };
-	if (of_match_compatible(faa->faa_phandle, local_intc)) {
+	dce = of_search_compatible(faa->faa_phandle, compat_data);
+	KASSERT(dce != NULL);
+
+	if (dce->value != 0) {
 #if defined(MULTIPROCESSOR)
 		aprint_normal(": Multiprocessor");
 #endif

Index: src/sys/arch/arm/rockchip/rk_tsadc.c
diff -u src/sys/arch/arm/rockchip/rk_tsadc.c:1.8 src/sys/arch/arm/rockchip/rk_tsadc.c:1.9
--- src/sys/arch/arm/rockchip/rk_tsadc.c:1.8	Fri Jan 15 18:42:41 2021
+++ src/sys/arch/arm/rockchip/rk_tsadc.c	Tue Jan 19 00:38:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rk_tsadc.c,v 1.8 2021/01/15 18:42:41 ryo Exp $	*/
+/*	$NetBSD: rk_tsadc.c,v 1.9 2021/01/19 00:38:52 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -30,7 +30,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: rk_tsadc.c,v 1.8 2021/01/15 18:42:41 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_tsadc.c,v 1.9 2021/01/19 00:38:52 thorpej Exp $");
 
 /*
  * Driver for the TSADC temperature sensor monitor in RK3328 and RK3399.
@@ -374,14 +374,10 @@ static const rk_data rk3399_data_table =
 	.rd_num_sensors = 2,
 };
 
-static const char * const compatible_rk3328[] = {
-	"rockchip,rk3328-tsadc",
-	NULL
-};
-
-static const char * const compatible_rk3399[] = {
-	"rockchip,rk3399-tsadc",
-	NULL
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "rockchip,rk3328-tsadc",	.data = _data_table },
+	{ .compat = "rockchip,rk3399-tsadc",	.data = _data_table },
+	{ 0 }
 };
 
 #define	TSADC_READ(sc, reg)		\
@@ -399,8 +395,7 @@ rk_tsadc_match(device_t parent, cfdata_t
 {
 	struct fdt_attach_args * const faa = aux;
 
-	return of_match_compatible(faa->faa_phandle, compatible_rk3328) ||
-	   of_match_compatible(faa->faa_phandle, compatible_rk3399);
+	return of_match_compat_data(faa->faa_phandle, compat_data);
 }
 
 static void
@@ -430,12 +425,7 @@ rk_tsadc_attach(device_t parent, device_
 
 	pmf_device_register(self, NULL, NULL);
 
-	if 

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

2021-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 19 00:36:09 UTC 2021

Modified Files:
src/sys/arch/arm/nvidia: tegra_pcie.c

Log Message:
Use device_compatible_entry / of_search_compatible() rather than
matching against multiple sets of compatinbility strings.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/nvidia/tegra_pcie.c

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

Modified files:

Index: src/sys/arch/arm/nvidia/tegra_pcie.c
diff -u src/sys/arch/arm/nvidia/tegra_pcie.c:1.32 src/sys/arch/arm/nvidia/tegra_pcie.c:1.33
--- src/sys/arch/arm/nvidia/tegra_pcie.c:1.32	Fri Jan 15 23:11:59 2021
+++ src/sys/arch/arm/nvidia/tegra_pcie.c	Tue Jan 19 00:36:09 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_pcie.c,v 1.32 2021/01/15 23:11:59 jmcneill Exp $ */
+/* $NetBSD: tegra_pcie.c,v 1.33 2021/01/19 00:36:09 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_pcie.c,v 1.32 2021/01/15 23:11:59 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_pcie.c,v 1.33 2021/01/19 00:36:09 thorpej Exp $");
 
 #include 
 
@@ -65,6 +65,11 @@ static void	tegra_pcie_attach(device_t, 
 #define TEGRA_PCIE_NBUS 256
 #define TEGRA_PCIE_ECFB (1<<(12 - 8))	/* extended conf frags per bus */
 
+enum tegra_pcie_type {
+	TEGRA_PCIE_124		= 0,
+	TEGRA_PCIE_210		= 1,
+};
+
 struct tegra_pcie_ih {
 	int			(*ih_callback)(void *);
 	void			*ih_arg;
@@ -81,6 +86,7 @@ struct tegra_pcie_softc {
 	bus_space_handle_t	sc_bsh_pads;
 	bus_space_handle_t	sc_bsh_rpconf;
 	int			sc_phandle;
+	enum tegra_pcie_type	sc_type;
 
 	struct arm32_pci_chipset sc_pc;
 
@@ -130,17 +136,18 @@ static void	tegra_pcie_intr_disestablish
 CFATTACH_DECL_NEW(tegra_pcie, sizeof(struct tegra_pcie_softc),
 	tegra_pcie_match, tegra_pcie_attach, NULL, NULL);
 
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "nvidia,tegra210-pcie",	.value = TEGRA_PCIE_210 },
+	{ .compat = "nvidia,tegra124-pcie",	.value = TEGRA_PCIE_124 },
+	{ 0 }
+};
+
 static int
 tegra_pcie_match(device_t parent, cfdata_t cf, void *aux)
 {
-	const char * const compatible[] = {
-		"nvidia,tegra210-pcie",
-		"nvidia,tegra124-pcie",
-		NULL
-	};
 	struct fdt_attach_args * const faa = aux;
 
-	return of_match_compatible(faa->faa_phandle, compatible);
+	return of_match_compat_data(faa->faa_phandle, compat_data);
 }
 
 static void
@@ -148,6 +155,7 @@ tegra_pcie_attach(device_t parent, devic
 {
 	struct tegra_pcie_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
+	const struct device_compatible_entry *dce;
 	struct pciconf_resources *pcires;
 	struct pcibus_attach_args pba;
 	bus_addr_t afi_addr, cs_addr, pads_addr;
@@ -196,6 +204,10 @@ tegra_pcie_attach(device_t parent, devic
 		return;
 	}
 
+	dce = of_search_compatible(faa->faa_phandle, compat_data);
+	KASSERT(dce != NULL);
+	sc->sc_type = dce->value;
+
 	tegra_pcie_conf_map_buses(sc);
 
 	TAILQ_INIT(>sc_intrs);
@@ -463,14 +475,14 @@ tegra_pcie_setup(struct tegra_pcie_softc
 	bus_space_write_4(sc->sc_bst, sc->sc_bsh_afi, AFI_PCIE_CONFIG_REG, cfg);
 
 	/* Configure refclk pad */
-	const char * const tegra124_compat[] = { "nvidia,tegra124-pcie", NULL };
-	if (of_match_compatible(sc->sc_phandle, tegra124_compat))
-		bus_space_write_4(sc->sc_bst, sc->sc_bsh_pads, PADS_REFCLK_CFG0_REG,
-		0x44ac44ac);
-	const char * const tegra210_compat[] = { "nvidia,tegra210-pcie", NULL };
-	if (of_match_compatible(sc->sc_phandle, tegra210_compat))
-		bus_space_write_4(sc->sc_bst, sc->sc_bsh_pads, PADS_REFCLK_CFG0_REG,
-		0x90b890b8);
+	if (sc->sc_type == TEGRA_PCIE_124) {
+		bus_space_write_4(sc->sc_bst, sc->sc_bsh_pads,
+		PADS_REFCLK_CFG0_REG, 0x44ac44ac);
+	}
+	if (sc->sc_type == TEGRA_PCIE_210) {
+		bus_space_write_4(sc->sc_bst, sc->sc_bsh_pads,
+		PADS_REFCLK_CFG0_REG, 0x90b890b8);
+	}
 
 	/*
 	 * Map PCI address spaces into ARM address space via



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

2021-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 19 00:35:10 UTC 2021

Modified Files:
src/sys/arch/arm/sunxi: sunxi_sramc.c

Log Message:
Use device_compatible_entry / of_search_compatible() rather than matching
against multiple sets of compatibility strings.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sunxi_sramc.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_sramc.c
diff -u src/sys/arch/arm/sunxi/sunxi_sramc.c:1.5 src/sys/arch/arm/sunxi/sunxi_sramc.c:1.6
--- src/sys/arch/arm/sunxi/sunxi_sramc.c:1.5	Thu Jul 11 18:22:14 2019
+++ src/sys/arch/arm/sunxi/sunxi_sramc.c	Tue Jan 19 00:35:10 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_sramc.c,v 1.5 2019/07/11 18:22:14 macallan Exp $ */
+/* $NetBSD: sunxi_sramc.c,v 1.6 2021/01/19 00:35:10 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_sramc.c,v 1.5 2019/07/11 18:22:14 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_sramc.c,v 1.6 2021/01/19 00:35:10 thorpej Exp $");
 
 #include 
 #include 
@@ -42,33 +42,57 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_sramc.
 
 #include 
 
-static const char * compatible[] = {
-	"allwinner,sun4i-a10-sram-controller",	/* old compat string */
-	"allwinner,sun4i-a10-system-control",
-	"allwinner,sun8i-h3-system-control",
-	"allwinner,sun50i-a64-system-control",
-	"allwinner,sun50i-h5-system-control",
-	"allwinner,sun50i-h6-system-control",
-	NULL
+static const struct device_compatible_entry compat_data[] = {
+		/* old compat string */
+	{ .compat = "allwinner,sun4i-a10-sram-controller" },
+	{ .compat = "allwinner,sun4i-a10-system-control" },
+	{ .compat = "allwinner,sun8i-h3-system-control" },
+	{ .compat = "allwinner,sun50i-a64-system-control" },
+	{ .compat = "allwinner,sun50i-h5-system-control" },
+	{ .compat = "allwinner,sun50i-h6-system-control" },
+	{ 0 }
 };
 
-static const struct sunxi_sramc_area {
-	const char			*compatible;
+struct sunxi_sramc_area {
 	const char			*desc;
 	bus_size_t			reg;
 	uint32_t			mask;
 	u_intflags;
 #define	SUNXI_SRAMC_F_SWAP		__BIT(0)
-} sunxi_sramc_areas[] = {
-	{ "allwinner,sun4i-a10-sram-a3-a4",
-	  "SRAM A3/A4",
-	  0x04, __BITS(5,4), 0 },
-	{ "allwinner,sun4i-a10-sram-d",
-	  "SRAM D",
-	  0x04, __BIT(0), 0 },
-	{ "allwinner,sun50i-a64-sram-c",
-	  "SRAM C",
-	  0x04, __BIT(24), SUNXI_SRAMC_F_SWAP },
+};
+
+static const struct sunxi_sramc_area sunxi_sramc_area_a3_a4 = {
+	.desc = "SRAM A3/A4",
+	.reg = 0x04,
+	.mask = __BITS(5,4),
+	.flags = 0,
+};
+
+static const struct sunxi_sramc_area sunxi_sramc_area_d = {
+	.desc = "SRAM D",
+	.reg = 0x04,
+	.mask = __BIT(0),
+	.flags = 0,
+};
+
+static const struct sunxi_sramc_area sunxi_sramc_area_c = {
+	.desc = "SRAM C",
+	.reg = 0x04,
+	.mask = __BIT(24),
+	.flags = SUNXI_SRAMC_F_SWAP,
+};
+
+static const struct device_compatible_entry sunxi_sramc_areas[] = {
+	{ .compat = "allwinner,sun4i-a10-sram-a3-a4",
+	  .data = _sramc_area_a3_a4 },
+
+	{ .compat = "allwinner,sun4i-a10-sram-d",
+	  .data = _sramc_area_d },
+
+	{ .compat = "allwinner,sun50i-a64-sram-c",
+	  .data = _sramc_area_c },
+
+	{ 0 }
 };
 
 struct sunxi_sramc_node {
@@ -97,31 +121,34 @@ static struct sunxi_sramc_softc *sramc_s
 static void
 sunxi_sramc_init_mmio(struct sunxi_sramc_softc *sc, int phandle)
 {
+	const struct device_compatible_entry *dce;
 	struct sunxi_sramc_node *node;
-	int child, i;
+	int child;
 
-	for (child = OF_child(phandle); child; child = OF_peer(child))
-		for (i = 0; i < __arraycount(sunxi_sramc_areas); i++) {
-			const char * area_compatible[] = { sunxi_sramc_areas[i].compatible, NULL };
-			if (of_match_compatible(child, area_compatible)) {
-node = kmem_alloc(sizeof(*node), KM_SLEEP);
-node->phandle = child;
-node->area = _sramc_areas[i];
-TAILQ_INSERT_TAIL(>sc_nodes, node, nodes);
-aprint_verbose_dev(sc->sc_dev, "area: %s\n", node->area->desc);
-break;
-			}
+	for (child = OF_child(phandle); child; child = OF_peer(child)) {
+		dce = of_search_compatible(child, sunxi_sramc_areas);
+		if (dce != NULL) {
+			node = kmem_alloc(sizeof(*node), KM_SLEEP);
+			node->phandle = child;
+			node->area = dce->data;
+			TAILQ_INSERT_TAIL(>sc_nodes, node, nodes);
+			aprint_verbose_dev(sc->sc_dev, "area: %s\n",
+			node->area->desc);
 		}
+	}
 }
 
 static void
 sunxi_sramc_init(struct sunxi_sramc_softc *sc)
 {
-	const char * mmio_compatible[] = { "mmio-sram", NULL };
+	const struct device_compatible_entry mmio_compat_data[] = {
+		{ .compat = "mmio-sram" },
+		{ 0 }
+	};
 	int child;
 
 	for (child = OF_child(sc->sc_phandle); child; child = OF_peer(child)) {
-		if (!of_match_compatible(child, mmio_compatible))
+		if (!of_match_compat_data(child, mmio_compat_data))
 			continue;
 		sunxi_sramc_init_mmio(sc, child);
 	}
@@ -168,7 +195,7 @@ sunxi_sramc_match(device_t parent, cfdat
 

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

2021-01-18 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jan 18 23:43:35 UTC 2021

Modified Files:
src/sys/arch/arm/cortex: gtmr.c

Log Message:
Fix a comment


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/arm/cortex/gtmr.c

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

Modified files:

Index: src/sys/arch/arm/cortex/gtmr.c
diff -u src/sys/arch/arm/cortex/gtmr.c:1.42 src/sys/arch/arm/cortex/gtmr.c:1.43
--- src/sys/arch/arm/cortex/gtmr.c:1.42	Fri Oct 30 18:54:36 2020
+++ src/sys/arch/arm/cortex/gtmr.c	Mon Jan 18 23:43:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtmr.c,v 1.42 2020/10/30 18:54:36 skrll Exp $	*/
+/*	$NetBSD: gtmr.c,v 1.43 2021/01/18 23:43:34 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.42 2020/10/30 18:54:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.43 2021/01/18 23:43:34 jmcneill Exp $");
 
 #include 
 #include 
@@ -178,7 +178,7 @@ gtmr_read_cntct(struct gtmr_softc *sc)
 		/*
 		 * The Allwinner A64 SoC has an unstable architectural timer.
 		 * To workaround this problem, ignore reads where the lower
-		 * 11 bits are all 0s or 1s.
+		 * 10 bits are all 0s or 1s.
 		 */
 		uint64_t val;
 		u_int bits;



CVS commit: src/sys/compat/netbsd32

2021-01-18 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Jan 18 23:14:22 UTC 2021

Modified Files:
src/sys/compat/netbsd32: netbsd32.h netbsd32_conv.h netbsd32_exec.h
netbsd32_socket.c

Log Message:
s/u_intN_t/uintN_t/


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/compat/netbsd32/netbsd32.h
cvs rdiff -u -r1.42 -r1.43 src/sys/compat/netbsd32/netbsd32_conv.h
cvs rdiff -u -r1.34 -r1.35 src/sys/compat/netbsd32/netbsd32_exec.h
cvs rdiff -u -r1.53 -r1.54 src/sys/compat/netbsd32/netbsd32_socket.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/compat/netbsd32/netbsd32.h
diff -u src/sys/compat/netbsd32/netbsd32.h:1.135 src/sys/compat/netbsd32/netbsd32.h:1.136
--- src/sys/compat/netbsd32/netbsd32.h:1.135	Thu Jan 14 08:00:45 2021
+++ src/sys/compat/netbsd32/netbsd32.h	Mon Jan 18 23:14:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32.h,v 1.135 2021/01/14 08:00:45 simonb Exp $	*/
+/*	$NetBSD: netbsd32.h,v 1.136 2021/01/18 23:14:22 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@@ -1071,14 +1071,14 @@ typedef netbsd32_pointer_t netbsd32_nfsd
 struct netbsd32_nfsd_srvargs {
 	netbsd32_nfsdp	nsd_nfsd;
 	uid_t		nsd_uid;
-	u_int32_t	nsd_haddr;
+	uint32_t	nsd_haddr;
 	struct uucred	nsd_cr;
 	int		nsd_authlen;
 	netbsd32_u_charp nsd_authstr;
 	int		nsd_verflen;
 	netbsd32_u_charp nsd_verfstr;
 	struct netbsd32_timeval	nsd_timestamp;
-	u_int32_t	nsd_ttl;
+	uint32_t	nsd_ttl;
 	NFSKERBKEY_T	nsd_key;
 };
 

Index: src/sys/compat/netbsd32/netbsd32_conv.h
diff -u src/sys/compat/netbsd32/netbsd32_conv.h:1.42 src/sys/compat/netbsd32/netbsd32_conv.h:1.43
--- src/sys/compat/netbsd32/netbsd32_conv.h:1.42	Mon Nov 18 04:17:08 2019
+++ src/sys/compat/netbsd32/netbsd32_conv.h	Mon Jan 18 23:14:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_conv.h,v 1.42 2019/11/18 04:17:08 rin Exp $	*/
+/*	$NetBSD: netbsd32_conv.h,v 1.43 2021/01/18 23:14:22 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -245,8 +245,8 @@ netbsd32_to_iovecin(const struct netbsd3
 int len)
 {
 	int i, error=0;
-	u_int32_t iov_base;
-	u_int32_t iov_len;
+	uint32_t iov_base;
+	uint32_t iov_len;
 	/*
 	 * We could allocate an iov32p, do a copyin, and translate
 	 * each field and then free it all up, or we could copyin
@@ -799,11 +799,11 @@ netbsd32_to_dirent12(char *buf, int nbyt
 	 */
 	for (; ndp < endp; ndp = nndp) {
 		nndp = _DIRENT_NEXT(ndp);
-		odp->d_fileno = (u_int32_t)ndp->d_fileno;
+		odp->d_fileno = (uint32_t)ndp->d_fileno;
 		if (ndp->d_namlen >= sizeof(odp->d_name))
 			odp->d_namlen = sizeof(odp->d_name) - 1;
 		else
-			odp->d_namlen = (u_int8_t)ndp->d_namlen;
+			odp->d_namlen = (uint8_t)ndp->d_namlen;
 		odp->d_type = ndp->d_type;
 		(void)memcpy(odp->d_name, ndp->d_name, (size_t)odp->d_namlen);
 		odp->d_name[odp->d_namlen] = '\0';

Index: src/sys/compat/netbsd32/netbsd32_exec.h
diff -u src/sys/compat/netbsd32/netbsd32_exec.h:1.34 src/sys/compat/netbsd32/netbsd32_exec.h:1.35
--- src/sys/compat/netbsd32/netbsd32_exec.h:1.34	Sun Jan 27 02:08:40 2019
+++ src/sys/compat/netbsd32/netbsd32_exec.h	Mon Jan 18 23:14:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_exec.h,v 1.34 2019/01/27 02:08:40 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_exec.h,v 1.35 2021/01/18 23:14:22 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -83,9 +83,9 @@ static __inline int
 netbsd32_copyargs(struct lwp *l, struct exec_package *pack,
 		struct ps_strings *arginfo, char **stackp, void *argp)
 {
-	u_int32_t *cpp = (u_int32_t *)*stackp;
+	uint32_t *cpp = (uint32_t *)*stackp;
 	netbsd32_pointer_t dp;
-	u_int32_t nullp = 0;
+	uint32_t nullp = 0;
 	char *sp;
 	size_t len;
 	int argc = arginfo->ps_nargvstr;

Index: src/sys/compat/netbsd32/netbsd32_socket.c
diff -u src/sys/compat/netbsd32/netbsd32_socket.c:1.53 src/sys/compat/netbsd32/netbsd32_socket.c:1.54
--- src/sys/compat/netbsd32/netbsd32_socket.c:1.53	Sat Sep 28 08:21:08 2019
+++ src/sys/compat/netbsd32/netbsd32_socket.c	Mon Jan 18 23:14:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_socket.c,v 1.53 2019/09/28 08:21:08 mlelstv Exp $	*/
+/*	$NetBSD: netbsd32_socket.c,v 1.54 2021/01/18 23:14:22 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.53 2019/09/28 08:21:08 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.54 2021/01/18 23:14:22 simonb Exp $");
 
 #include 
 #include 
@@ -386,7 +386,7 @@ copyin32_msg_control(struct lwp *l, stru
 	struct mbuf *ctl_mbuf;
 	ssize_t resid = mp->msg_controllen;
 	size_t clen, cidx = 0, cspace;
-	u_int8_t *control;
+	uint8_t *control;
 	int error;
 
 	ctl_mbuf = m_get(M_WAIT, MT_CONTROL);
@@ -414,7 +414,7 @@ copyin32_msg_control(struct lwp *l, stru
 
 		/* Check the buffer is big enough */
 		if (__predict_false(cidx + cspace > clen)) {
-			u_int8_t *nc;
+			

CVS commit: src

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 20:02:34 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: t_integration.sh
src/usr.bin/xlint/lint1: func.c mem1.c oper.c scan.l tree.c
src/usr.bin/xlint/lint2: chk.c

Log Message:
lint: clean up code (mostly comments)


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/usr.bin/xlint/lint1/t_integration.sh
cvs rdiff -u -r1.63 -r1.64 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/xlint/lint1/oper.c
cvs rdiff -u -r1.128 -r1.129 src/usr.bin/xlint/lint1/scan.l
cvs rdiff -u -r1.181 -r1.182 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/xlint/lint2/chk.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/t_integration.sh
diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.27 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.28
--- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.27	Sun Jan 17 23:00:41 2021
+++ src/tests/usr.bin/xlint/lint1/t_integration.sh	Mon Jan 18 20:02:34 2021
@@ -1,4 +1,4 @@
-# $NetBSD: t_integration.sh,v 1.27 2021/01/17 23:00:41 rillig Exp $
+# $NetBSD: t_integration.sh,v 1.28 2021/01/18 20:02:34 rillig Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -177,7 +177,8 @@ test_case long_double_int	"Checks for co
 "'long int'; PR bin/39639"
 
 test_case all_messages
-all_messages_body() {
+all_messages_body()
+{
 	local srcdir ok msg base flags
 
 	srcdir="$(atf_get_srcdir)"

Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.63 src/usr.bin/xlint/lint1/func.c:1.64
--- src/usr.bin/xlint/lint1/func.c:1.63	Mon Jan 18 19:24:09 2021
+++ src/usr.bin/xlint/lint1/func.c	Mon Jan 18 20:02:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: func.c,v 1.63 2021/01/18 19:24:09 rillig Exp $	*/
+/*	$NetBSD: func.c,v 1.64 2021/01/18 20:02:34 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.63 2021/01/18 19:24:09 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.64 2021/01/18 20:02:34 rillig Exp $");
 #endif
 
 #include 
@@ -462,7 +462,7 @@ check_case_label(tnode_t *tn, cstk_t *ci
 	 * to the type of the switch expression
 	 */
 	v = constant(tn, true);
-	(void) memset(, 0, sizeof nv);
+	(void)memset(, 0, sizeof nv);
 	convert_constant(CASE, 0, ci->c_swtype, , v);
 	free(v);
 

Index: src/usr.bin/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.23 src/usr.bin/xlint/lint1/mem1.c:1.24
--- src/usr.bin/xlint/lint1/mem1.c:1.23	Sat Jan 16 02:40:02 2021
+++ src/usr.bin/xlint/lint1/mem1.c	Mon Jan 18 20:02:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.23 2021/01/16 02:40:02 rillig Exp $	*/
+/*	$NetBSD: mem1.c,v 1.24 2021/01/18 20:02:34 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.23 2021/01/16 02:40:02 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.24 2021/01/18 20:02:34 rillig Exp $");
 #endif
 
 #include 
@@ -140,7 +140,7 @@ fnnalloc(const char *s, size_t len)
 
 	if ((fn = srchfn(s, len)) == NULL) {
 		fn = xmalloc(sizeof (fn_t));
-		/* Do not used strdup() because string is not NUL-terminated.*/
+		/* Do not use strdup() because string is not NUL-terminated.*/
 		fn->fn_name = xmalloc(len + 1);
 		(void)memcpy(fn->fn_name, s, len);
 		fn->fn_name[len] = '\0';

Index: src/usr.bin/xlint/lint1/oper.c
diff -u src/usr.bin/xlint/lint1/oper.c:1.4 src/usr.bin/xlint/lint1/oper.c:1.5
--- src/usr.bin/xlint/lint1/oper.c:1.4	Sat Jan 16 02:40:02 2021
+++ src/usr.bin/xlint/lint1/oper.c	Mon Jan 18 20:02:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: oper.c,v 1.4 2021/01/16 02:40:02 rillig Exp $	*/
+/*	$NetBSD: oper.c,v 1.5 2021/01/18 20:02:34 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -51,7 +51,8 @@ static const struct {
 #include "ops.def"
 
 const char *
-getopname(op_t op) {
+getopname(op_t op)
+{
 	return imods[op].m.m_name;
 }
 

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.128 src/usr.bin/xlint/lint1/scan.l:1.129
--- src/usr.bin/xlint/lint1/scan.l:1.128	Mon Jan 18 17:54:50 2021
+++ src/usr.bin/xlint/lint1/scan.l	Mon Jan 18 20:02:34 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.128 2021/01/18 17:54:50 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.129 2021/01/18 20:02:34 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.128 2021/01/18 17:54:50 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.129 2021/01/18 20:02:34 rillig Exp $");
 #endif
 
 #include 
@@ -108,11 +108,11 @@ TL	([fFlL]?[i]?)
 

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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 19:24:09 UTC 2021

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

Log Message:
lint: clean up member names of control_structure and comments


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.129 -r1.130 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.62 -r1.63 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.58 -r1.59 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/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.156 src/usr.bin/xlint/lint1/cgram.y:1.157
--- src/usr.bin/xlint/lint1/cgram.y:1.156	Mon Jan 18 18:53:28 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jan 18 19:24:09 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.156 2021/01/18 18:53:28 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.157 2021/01/18 19:24:09 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.156 2021/01/18 18:53:28 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.157 2021/01/18 19:24:09 rillig Exp $");
 #endif
 
 #include 
@@ -2085,7 +2085,8 @@ q_gt(int64_t a, int64_t b)
 /*
  * Gets a node for a constant and returns the value of this constant
  * as integer.
- * Is the node not constant or too large for int or of type float,
+ *
+ * If the node is not constant or too large for int or of type float,
  * a warning will be printed.
  *
  * toicon() should be used only inside declarations. If it is used in

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.129 src/usr.bin/xlint/lint1/decl.c:1.130
--- src/usr.bin/xlint/lint1/decl.c:1.129	Mon Jan 18 19:21:52 2021
+++ src/usr.bin/xlint/lint1/decl.c	Mon Jan 18 19:24:09 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.129 2021/01/18 19:21:52 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.130 2021/01/18 19:24:09 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.129 2021/01/18 19:21:52 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.130 2021/01/18 19:24:09 rillig Exp $");
 #endif
 
 #include 
@@ -1287,7 +1287,7 @@ merge_pointers_and_qualifiers(pqinf_t *p
  * The following 3 functions extend the type of a declarator with
  * pointer, function and array types.
  *
- * The current type is the Type built by deftyp() (dcs->d_type) and
+ * The current type is the type built by deftyp() (dcs->d_type) and
  * pointer, function and array types already added for this
  * declarator. The new type extension is inserted between both.
  */
@@ -1464,8 +1464,8 @@ old_style_function(sym_t *decl, sym_t *a
 }
 
 /*
- * Lists of Identifiers in functions declarations are allowed only if
- * it's also a function definition. If this is not the case, print a
+ * Lists of identifiers in functions declarations are allowed only if
+ * it's also a function definition. If this is not the case, print an
  * error message.
  */
 void
@@ -1580,7 +1580,7 @@ declarator_name(sym_t *sym)
 }
 
 /*
- * Process a name in the list of formal params in an old style function
+ * Process a name in the list of formal parameters in an old style function
  * definition.
  */
 sym_t *
@@ -1614,7 +1614,7 @@ old_style_function_name(sym_t *sym)
 type_t *
 mktag(sym_t *tag, tspec_t kind, bool decl, bool semi)
 {
-	scl_t	scl = NOSCL;
+	scl_t	scl;
 	type_t	*tp;
 
 	if (kind == STRUCT) {
@@ -2200,10 +2200,10 @@ eqargs(const type_t *tp1, const type_t *
 
 /*
  * mnoarg() (matches functions with no argument type information)
- * returns 1 if all parameters of a prototype are compatible with
+ * returns whether all parameters of a prototype are compatible with
  * an old style function declaration.
  * This is the case if the following conditions are met:
- *	1. the prototype must have a fixed number of parameters
+ *	1. the prototype has a fixed number of parameters
  *	2. no parameter is of type float
  *	3. no parameter is converted to another type if integer promotion
  *	   is applied on it

Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.62 src/usr.bin/xlint/lint1/func.c:1.63
--- src/usr.bin/xlint/lint1/func.c:1.62	Sun Jan 17 14:50:11 2021
+++ src/usr.bin/xlint/lint1/func.c	Mon Jan 18 19:24:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: func.c,v 1.62 2021/01/17 14:50:11 rillig Exp $	*/
+/*	$NetBSD: func.c,v 1.63 2021/01/18 19:24:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.62 2021/01/17 14:50:11 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.63 2021/01/18 19:24:09 rillig Exp $");
 #endif
 
 #include 
@@ 

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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 19:21:53 UTC 2021

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

Log Message:
lint: flatten check_global_variable_size


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.128 src/usr.bin/xlint/lint1/decl.c:1.129
--- src/usr.bin/xlint/lint1/decl.c:1.128	Mon Jan 18 17:43:43 2021
+++ src/usr.bin/xlint/lint1/decl.c	Mon Jan 18 19:21:52 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.128 2021/01/18 17:43:43 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.129 2021/01/18 19:21:52 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.128 2021/01/18 17:43:43 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.129 2021/01/18 19:21:52 rillig Exp $");
 #endif
 
 #include 
@@ -3194,23 +3194,24 @@ static void
 check_global_variable_size(const sym_t *sym)
 {
 
-	if (sym->s_def == TDEF) {
-		if (sym->s_type->t_tspec == FUNC)
-			/*
-			 * this can happen if an syntax error occurred
-			 * after a function declaration
-			 */
-			return;
-		curr_pos = sym->s_def_pos;
-		if (length(sym->s_type, sym->s_name) == 0 &&
-		sym->s_type->t_tspec == ARRAY && sym->s_type->t_dim == 0) {
-			if (tflag || (sym->s_scl == EXTERN && !sflag)) {
-/* empty array declaration: %s */
-warning(190, sym->s_name);
-			} else {
-/* empty array declaration: %s */
-error(190, sym->s_name);
-			}
+	if (sym->s_def != TDEF)
+		return;
+	if (sym->s_type->t_tspec == FUNC)
+		/*
+		 * this can happen if a syntax error occurred after a
+		 * function declaration
+		 */
+		return;
+
+	curr_pos = sym->s_def_pos;
+	if (length(sym->s_type, sym->s_name) == 0 &&
+	sym->s_type->t_tspec == ARRAY && sym->s_type->t_dim == 0) {
+		if (tflag || (sym->s_scl == EXTERN && !sflag)) {
+			/* empty array declaration: %s */
+			warning(190, sym->s_name);
+		} else {
+			/* empty array declaration: %s */
+			error(190, sym->s_name);
 		}
 	}
 }



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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 18:53:28 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: rename grammar rule lorange

It looked too much like an orange.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/usr.bin/xlint/lint1/cgram.y

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.155 src/usr.bin/xlint/lint1/cgram.y:1.156
--- src/usr.bin/xlint/lint1/cgram.y:1.155	Mon Jan 18 18:18:20 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jan 18 18:53:28 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.155 2021/01/18 18:18:20 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.156 2021/01/18 18:53:28 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.155 2021/01/18 18:18:20 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.156 2021/01/18 18:53:28 rillig Exp $");
 #endif
 
 #include 
@@ -329,7 +329,7 @@ anonymize(sym_t *s)
 %type		string2
 %type			opt_asm_or_symbolrename
 %type		range
-%type		lorange
+%type		low_range
 
 
 %%
@@ -1350,7 +1350,7 @@ init_expr_list:
 	| init_expr_list T_COMMA init_assign_expr
 	;
 
-lorange:
+low_range:
 	  constant T_ELLIPSIS {
 		$$.lo = toicon($1, 1);
 	  }
@@ -1360,7 +1360,7 @@ range:
 		$$.lo = toicon($1, 1);
 		$$.hi = $$.lo + 1;
 	  }
-	| lorange constant {
+	| low_range constant {
 		$$.lo = $1.lo;
 		$$.hi = toicon($2, 1);
 	  }



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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 18:18:20 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: rename grammar rules to align with C99 6.7.6


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/usr.bin/xlint/lint1/cgram.y

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.154 src/usr.bin/xlint/lint1/cgram.y:1.155
--- src/usr.bin/xlint/lint1/cgram.y:1.154	Mon Jan 18 18:14:57 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jan 18 18:18:20 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.154 2021/01/18 18:14:57 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.155 2021/01/18 18:18:20 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.154 2021/01/18 18:14:57 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.155 2021/01/18 18:18:20 rillig Exp $");
 #endif
 
 #include 
@@ -302,15 +302,15 @@ anonymize(sym_t *s)
 %type		asterisk
 %type			param_decl
 %type			param_list
-%type			abs_decl_param_list
+%type			abstract_decl_param_list
 %type			direct_param_decl
 %type			notype_param_decl
 %type			direct_notype_param_decl
 %type		type_qualifier_list
 %type		type_qualifier
 %type			identifier_list
-%type			abs_decl
-%type			direct_abs_decl
+%type			abstract_decl
+%type			direct_abstract_decl
 %type			vararg_parameter_type_list
 %type			parameter_type_list
 %type			parameter_declaration
@@ -1208,7 +1208,7 @@ param_list:
 	  id_list_lparn identifier_list T_RPAREN {
 		$$ = $2;
 	  }
-	| abs_decl_param_list {
+	| abstract_decl_param_list {
 		$$ = $1;
 	  }
 	;
@@ -1232,20 +1232,20 @@ identifier_list:
 	  }
 	;
 
-abs_decl_param_list:
-	  abs_decl_lparn T_RPAREN {
+abstract_decl_param_list:
+	  abstract_decl_lparn T_RPAREN {
 		$$ = NULL;
 	  }
-	| abs_decl_lparn vararg_parameter_type_list T_RPAREN {
+	| abstract_decl_lparn vararg_parameter_type_list T_RPAREN {
 		dcs->d_proto = true;
 		$$ = $2;
 	  }
-	| abs_decl_lparn error T_RPAREN {
+	| abstract_decl_lparn error T_RPAREN {
 		$$ = NULL;
 	  }
 	;
 
-abs_decl_lparn:
+abstract_decl_lparn:
 	  T_LPAREN {
 		blklev++;
 		pushdecl(PARG);
@@ -1302,10 +1302,10 @@ parameter_declaration:
 	| declspecs deftyp param_decl {
 		$$ = declare_argument($3, 0);
 	  }
-	| declmods deftyp abs_decl {
+	| declmods deftyp abstract_decl {
 		$$ = declare_argument($3, 0);
 	  }
-	| declspecs deftyp abs_decl {
+	| declspecs deftyp abstract_decl {
 		$$ = declare_argument($3, 0);
 	  }
 	;
@@ -1422,22 +1422,22 @@ abstract_declaration:
 	| noclass_declspecs deftyp {
 		$$ = declare_1_abstract(abstract_name());
 	  }
-	| noclass_declmods deftyp abs_decl {
+	| noclass_declmods deftyp abstract_decl {
 		$$ = declare_1_abstract($3);
 	  }
-	| noclass_declspecs deftyp abs_decl {
+	| noclass_declspecs deftyp abstract_decl {
 		$$ = declare_1_abstract($3);
 	  }
 	;
 
-abs_decl:
+abstract_decl:
 	  pointer {
 		$$ = add_pointer(abstract_name(), $1);
 	  }
-	| direct_abs_decl {
+	| direct_abstract_decl {
 		$$ = $1;
 	  }
-	| pointer direct_abs_decl {
+	| pointer direct_abstract_decl {
 		$$ = add_pointer($2, $1);
 	  }
 	| T_TYPEOF term {
@@ -1445,8 +1445,8 @@ abs_decl:
 	  }
 	;
 
-direct_abs_decl:
-	  T_LPAREN abs_decl T_RPAREN {
+direct_abstract_decl:
+	  T_LPAREN abstract_decl T_RPAREN {
 		$$ = $2;
 	  }
 	| T_LBRACK T_RBRACK {
@@ -1455,26 +1455,26 @@ direct_abs_decl:
 	| T_LBRACK constant T_RBRACK {
 		$$ = add_array(abstract_name(), 1, toicon($2, 0));
 	  }
-	| type_attribute direct_abs_decl {
+	| type_attribute direct_abstract_decl {
 		$$ = $2;
 	  }
-	| direct_abs_decl T_LBRACK T_RBRACK {
+	| direct_abstract_decl T_LBRACK T_RBRACK {
 		$$ = add_array($1, 0, 0);
 	  }
-	| direct_abs_decl T_LBRACK constant T_RBRACK {
+	| direct_abstract_decl T_LBRACK constant T_RBRACK {
 		$$ = add_array($1, 1, toicon($3, 0));
 	  }
-	| abs_decl_param_list opt_asm_or_symbolrename {
+	| abstract_decl_param_list opt_asm_or_symbolrename {
 		$$ = add_function(symbolrename(abstract_name(), $2), $1);
 		popdecl();
 		blklev--;
 	  }
-	| direct_abs_decl abs_decl_param_list opt_asm_or_symbolrename {
+	| direct_abstract_decl abstract_decl_param_list opt_asm_or_symbolrename {
 		$$ = add_function(symbolrename($1, $3), $2);
 		popdecl();
 		blklev--;
 	  }
-	| direct_abs_decl type_attribute_list
+	| direct_abstract_decl type_attribute_list
 	;
 
 non_expr_statement:



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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 18:14:57 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: fix precedence of __builtin_offsetof

A previous version of the C grammar contained TBUILTIN_SIZEOF in this
place, which had two typos.  Therefore it was handled as a separate
token that was otherwise ignored.  Curiously, bison didn't warn about
this obvious inconsistency.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/usr.bin/xlint/lint1/cgram.y

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.153 src/usr.bin/xlint/lint1/cgram.y:1.154
--- src/usr.bin/xlint/lint1/cgram.y:1.153	Mon Jan 18 17:59:51 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jan 18 18:14:57 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.153 2021/01/18 17:59:51 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.154 2021/01/18 18:14:57 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.153 2021/01/18 17:59:51 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.154 2021/01/18 18:14:57 rillig Exp $");
 #endif
 
 #include 
@@ -261,7 +261,7 @@ anonymize(sym_t *s)
 %left	T_SHIFT
 %left	T_ADDITIVE
 %left	T_ASTERISK T_MULTIPLICATIVE
-%right	T_UNARY T_INCDEC T_SIZEOF T_ALIGNOF T_REAL T_IMAG
+%right	T_UNARY T_INCDEC T_SIZEOF T_BUILTIN_OFFSETOF T_ALIGNOF T_REAL T_IMAG
 %left	T_LPAREN T_LBRACK T_MEMBACC
 
 %token			T_NAME



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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 17:59:51 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: sort tokens in grammar


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/usr.bin/xlint/lint1/cgram.y

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.152 src/usr.bin/xlint/lint1/cgram.y:1.153
--- src/usr.bin/xlint/lint1/cgram.y:1.152	Mon Jan 18 17:54:50 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jan 18 17:59:51 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.152 2021/01/18 17:54:50 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.153 2021/01/18 17:59:51 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.152 2021/01/18 17:54:50 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.153 2021/01/18 17:59:51 rillig Exp $");
 #endif
 
 #include 
@@ -185,30 +185,28 @@ anonymize(sym_t *s)
 /* struct or union */
 %token		T_STRUCT_OR_UNION
 
-/* enum */
-%token			T_ENUM
-
 /* remaining keywords */
+%token			T_ASM
+%token			T_BREAK
 %token			T_CASE
+%token			T_CONTINUE
 %token			T_DEFAULT
-%token			T_IF
-%token			T_ELSE
-%token			T_SWITCH
 %token			T_DO
-%token			T_WHILE
+%token			T_ELSE
+%token			T_ENUM
 %token			T_FOR
 %token			T_GOTO
-%token			T_CONTINUE
-%token			T_BREAK
+%token			T_IF
+%token			T_PACKED
 %token			T_RETURN
-%token			T_ASM
+%token			T_SWITCH
 %token			T_SYMBOLRENAME
-%token			T_PACKED
+%token			T_WHILE
 /* Type Attributes */
 %token 		T_ATTRIBUTE
 %token 		T_AT_ALIAS
-%token 		T_AT_ALLOC_SIZE
 %token 		T_AT_ALIGNED
+%token 		T_AT_ALLOC_SIZE
 %token 		T_AT_ALWAYS_INLINE
 %token 		T_AT_BOUNDED
 %token 		T_AT_BUFFER



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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 17:54:50 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y scan.l

Log Message:
lint: rename T_SOU to T_STRUCT_OR_UNION

This abbreviation occurred too seldom to be used.


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.127 -r1.128 src/usr.bin/xlint/lint1/scan.l

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.151 src/usr.bin/xlint/lint1/cgram.y:1.152
--- src/usr.bin/xlint/lint1/cgram.y:1.151	Mon Jan 18 17:47:44 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jan 18 17:54:50 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.151 2021/01/18 17:47:44 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.152 2021/01/18 17:54: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.151 2021/01/18 17:47:44 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.152 2021/01/18 17:54:50 rillig Exp $");
 #endif
 
 #include 
@@ -173,14 +173,17 @@ anonymize(sym_t *s)
 /* storage classes (extern, static, auto, register and typedef) */
 %token			T_SCLASS
 
-/* types (char, int, short, long, unsigned, signed, float, double, void) */
+/*
+ * predefined type keywords (char, int, short, long, unsigned, signed,
+ * float, double, void); see T_TYPENAME
+ */
 %token		T_TYPE
 
-/* qualifiers (const, volatile) */
+/* qualifiers (const, volatile, restrict, _Thread_local) */
 %token		T_QUAL
 
 /* struct or union */
-%token		T_SOU
+%token		T_STRUCT_OR_UNION
 
 /* enum */
 %token			T_ENUM
@@ -724,7 +727,7 @@ struct_spec:
 
 struct:
 	  struct type_attribute
-	| T_SOU {
+	| T_STRUCT_OR_UNION {
 		symtyp = FTAG;
 		pushdecl($1 == STRUCT ? MOS : MOU);
 		dcs->d_offset = 0;

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.127 src/usr.bin/xlint/lint1/scan.l:1.128
--- src/usr.bin/xlint/lint1/scan.l:1.127	Mon Jan 18 17:20:15 2021
+++ src/usr.bin/xlint/lint1/scan.l	Mon Jan 18 17:54:50 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.127 2021/01/18 17:20:15 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.128 2021/01/18 17:54:50 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.127 2021/01/18 17:20:15 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.128 2021/01/18 17:54:50 rillig Exp $");
 #endif
 
 #include 
@@ -202,7 +202,8 @@ static	struct	kwtab {
 	const	char *kw_name;	/* keyword */
 	int	kw_token;	/* token returned by yylex() */
 	scl_t	kw_scl;		/* storage class if kw_token T_SCLASS */
-	tspec_t	kw_tspec;	/* type spec. if kw_token T_TYPE or T_SOU */
+	tspec_t	kw_tspec;	/* type spec. if kw_token
+ * T_TYPE or T_STRUCT_OR_UNION */
 	tqual_t	kw_tqual;	/* type qual. fi kw_token T_QUAL */
 	bool	kw_c89 : 1;	/* C89 keyword */
 	bool	kw_c99 : 1;	/* C99 keyword */
@@ -291,7 +292,7 @@ static	struct	kwtab {
 	{ "strfmon",	T_AT_FORMAT_STRFMON,0,	0,	0,	  0,0,1,1,5 },
 	{ "strftime",	T_AT_FORMAT_STRFTIME,0,	0,	0,	  0,0,1,1,5 },
 	{ "string",	T_AT_STRING,	0,	0,	0,	  0,0,1,1,5 },
-	{ "struct",	T_SOU,		0,	STRUCT,	0,	  0,0,0,0,1 },
+	{ "struct",	T_STRUCT_OR_UNION, 0,	STRUCT,	0,	  0,0,0,0,1 },
 	{ "switch",	T_SWITCH,	0,	0,	0,	  0,0,0,0,1 },
 	{ "symbolrename", T_SYMBOLRENAME,0,	0,	0,	  0,0,0,0,2 },
 	{ "syslog",	T_AT_FORMAT_SYSLOG,0,	0,	0,	  0,0,1,1,5 },
@@ -299,7 +300,7 @@ static	struct	kwtab {
 	{ "tls_model",	T_AT_TLS_MODEL,	0,	0,	0,	  0,0,1,1,5 },
 	{ "typedef",	T_SCLASS,	TYPEDEF, 0,	0,	  0,0,0,0,1 },
 	{ "typeof",	T_TYPEOF,	0,	0,	0,	  0,0,1,0,7 },
-	{ "union",	T_SOU,		0,	UNION,	0,	  0,0,0,0,1 },
+	{ "union",	T_STRUCT_OR_UNION, 0,	UNION,	0,	  0,0,0,0,1 },
 	{ "unsigned",	T_TYPE,		0,	UNSIGN,	0,	  0,0,0,0,1 },
 	{ "unused",	T_AT_UNUSED,	0,	0,	0,	  0,0,1,1,5 },
 	{ "used",	T_AT_USED,	0,	0,	0,	  0,0,1,1,5 },
@@ -364,7 +365,7 @@ add_keyword(struct kwtab *kw, int deco)
 	sym->s_name = name;
 	sym->s_keyword = kw;
 	sym->s_value.v_quad = kw->kw_token;
-	if (kw->kw_token == T_TYPE || kw->kw_token == T_SOU) {
+	if (kw->kw_token == T_TYPE || kw->kw_token == T_STRUCT_OR_UNION) {
 		sym->s_tspec = kw->kw_tspec;
 	} else if (kw->kw_token == T_SCLASS) {
 		sym->s_scl = kw->kw_scl;
@@ -551,7 +552,7 @@ keyw(sym_t *sym)
 
 	if ((t = (int)sym->s_value.v_quad) == T_SCLASS) {
 		yylval.y_scl = sym->s_scl;
-	} else if (t == T_TYPE || t == T_SOU) {
+	} else if (t == T_TYPE || t == T_STRUCT_OR_UNION) {
 		yylval.y_tspec = sym->s_tspec;
 	} else if (t == T_QUAL) {
 		yylval.y_tqual = sym->s_tqual;



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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 17:47:44 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: don't treat restrict and _Thread_local as volatile anymore


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/usr.bin/xlint/lint1/cgram.y

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.150 src/usr.bin/xlint/lint1/cgram.y:1.151
--- src/usr.bin/xlint/lint1/cgram.y:1.150	Mon Jan 18 17:20:15 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jan 18 17:47:44 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.150 2021/01/18 17:20:15 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.151 2021/01/18 17:47:44 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.150 2021/01/18 17:20:15 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.151 2021/01/18 17:47:44 rillig Exp $");
 #endif
 
 #include 
@@ -1195,8 +1195,10 @@ type_qualifier:
 		$$ = xcalloc(1, sizeof (pqinf_t));
 		if ($1 == CONST) {
 			$$->p_const = true;
-		} else {
+		} else if ($1 == VOLATILE) {
 			$$->p_volatile = true;
+		} else {
+			lint_assert($1 == RESTRICT || $1 == THREAD);
 		}
 	  }
 	;



CVS commit: src

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 17:43:44 UTC 2021

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

Log Message:
lint: fix assertion failure for restrict and _Thread_local


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_010.c
cvs rdiff -u -r1.127 -r1.128 src/usr.bin/xlint/lint1/decl.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_010.c
diff -u src/tests/usr.bin/xlint/lint1/msg_010.c:1.3 src/tests/usr.bin/xlint/lint1/msg_010.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_010.c:1.3	Mon Jan 18 17:41:04 2021
+++ src/tests/usr.bin/xlint/lint1/msg_010.c	Mon Jan 18 17:43:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_010.c,v 1.3 2021/01/18 17:41:04 rillig Exp $	*/
+/*	$NetBSD: msg_010.c,v 1.4 2021/01/18 17:43:44 rillig Exp $	*/
 # 3 "msg_010.c"
 
 // Test for message: duplicate '%s' [10]
@@ -21,7 +21,7 @@ double_volatile(void)
 }
 
 int
-restrict_pointer(const int * /*restrict*/ p) // FIXME: assertion "== VOLATILE" failed
+restrict_pointer(const int *restrict p)
 {
 	return *p;
 }

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.127 src/usr.bin/xlint/lint1/decl.c:1.128
--- src/usr.bin/xlint/lint1/decl.c:1.127	Sun Jan 17 16:25:30 2021
+++ src/usr.bin/xlint/lint1/decl.c	Mon Jan 18 17:43:43 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.127 2021/01/17 16:25:30 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.128 2021/01/18 17:43:43 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.127 2021/01/17 16:25:30 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.128 2021/01/18 17:43:43 rillig Exp $");
 #endif
 
 #include 
@@ -565,15 +565,15 @@ add_qualifier(tqual_t q)
 			warning(10, "const");
 		}
 		dcs->d_const = true;
-	} else {
-		if (q == THREAD)
-			return;
-		lint_assert(q == VOLATILE);
+	} else if (q == VOLATILE) {
 		if (dcs->d_volatile) {
 			/* duplicate '%s' */
 			warning(10, "volatile");
 		}
 		dcs->d_volatile = true;
+	} else {
+		lint_assert(q == RESTRICT || q == THREAD);
+		/* Silently ignore these qualifiers. */
 	}
 }
 



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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 17:41:04 UTC 2021

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

Log Message:
lint: add more test cases for duplicate type qualifiers


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_010.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_010.c
diff -u src/tests/usr.bin/xlint/lint1/msg_010.c:1.2 src/tests/usr.bin/xlint/lint1/msg_010.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_010.c:1.2	Thu Jan  7 18:37:41 2021
+++ src/tests/usr.bin/xlint/lint1/msg_010.c	Mon Jan 18 17:41:04 2021
@@ -1,21 +1,36 @@
-/*	$NetBSD: msg_010.c,v 1.2 2021/01/07 18:37:41 rillig Exp $	*/
+/*	$NetBSD: msg_010.c,v 1.3 2021/01/18 17:41:04 rillig Exp $	*/
 # 3 "msg_010.c"
 
 // Test for message: duplicate '%s' [10]
 
-inline inline void
+inline inline void		/* expect: [10] */
 double_inline(void)
 {
 }
 
-const const int
+const const int			/* expect: [10] */
 double_const(void)
 {
 	return 0;
 }
 
-volatile volatile int
+volatile volatile int		/* expect: [10] */
 double_volatile(void)
 {
 	return 0;
 }
+
+int
+restrict_pointer(const int * /*restrict*/ p) // FIXME: assertion "== VOLATILE" failed
+{
+	return *p;
+}
+
+_Thread_local int thread_local_int;
+_Thread_local int *pointer_to_thread_local;
+
+int
+thread_local_parameter(_Thread_local int i) /* caught by the compiler */
+{
+	return i;
+}



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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 17:20:15 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y scan.l

Log Message:
lint: align token names with the wording from C99


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.126 -r1.127 src/usr.bin/xlint/lint1/scan.l

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.149 src/usr.bin/xlint/lint1/cgram.y:1.150
--- src/usr.bin/xlint/lint1/cgram.y:1.149	Mon Jan 18 16:47:46 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jan 18 17:20:15 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.149 2021/01/18 16:47:46 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.150 2021/01/18 17:20:15 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.149 2021/01/18 16:47:46 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.150 2021/01/18 17:20:15 rillig Exp $");
 #endif
 
 #include 
@@ -140,7 +140,7 @@ anonymize(sym_t *s)
 
 %token			T_LBRACE T_RBRACE T_LBRACK T_RBRACK T_LPAREN T_RPAREN
 %token			T_MEMBACC
-%token			T_UNOP
+%token			T_UNARY
 %token			T_INCDEC
 %token			T_SIZEOF
 %token			T_BUILTIN_OFFSETOF
@@ -148,20 +148,20 @@ anonymize(sym_t *s)
 %token			T_EXTENSION
 %token			T_ALIGNOF
 %token			T_ASTERISK
-%token			T_DIVOP
-%token			T_ADDOP
-%token			T_SHFTOP
-%token			T_RELOP
-%token			T_EQOP
+%token			T_MULTIPLICATIVE
+%token			T_ADDITIVE
+%token			T_SHIFT
+%token			T_RELATIONAL
+%token			T_EQUALITY
 %token			T_AMPER
 %token			T_XOR
-%token			T_OR
+%token			T_BITOR
 %token			T_LOGAND
 %token			T_LOGOR
 %token			T_QUEST
 %token			T_COLON
 %token			T_ASSIGN
-%token			T_OPASS
+%token			T_OPASSIGN
 %token			T_COMMA
 %token			T_SEMI
 %token			T_ELLIPSIS
@@ -248,19 +248,19 @@ anonymize(sym_t *s)
 %token 		T_AT_WEAK
 
 %left	T_COMMA
-%right	T_ASSIGN T_OPASS
+%right	T_ASSIGN T_OPASSIGN
 %right	T_QUEST T_COLON
 %left	T_LOGOR
 %left	T_LOGAND
-%left	T_OR
+%left	T_BITOR
 %left	T_XOR
 %left	T_AMPER
-%left	T_EQOP
-%left	T_RELOP
-%left	T_SHFTOP
-%left	T_ADDOP
-%left	T_ASTERISK T_DIVOP
-%right	T_UNOP T_INCDEC T_SIZEOF T_ALIGNOF T_REAL T_IMAG
+%left	T_EQUALITY
+%left	T_RELATIONAL
+%left	T_SHIFT
+%left	T_ADDITIVE
+%left	T_ASTERISK T_MULTIPLICATIVE
+%right	T_UNARY T_INCDEC T_SIZEOF T_ALIGNOF T_REAL T_IMAG
 %left	T_LPAREN T_LBRACK T_MEMBACC
 
 %token			T_NAME
@@ -1802,19 +1802,19 @@ expr:
 	  expr T_ASTERISK expr {
 		$$ = build(MULT, $1, $3);
 	  }
-	| expr T_DIVOP expr {
+	| expr T_MULTIPLICATIVE expr {
 		$$ = build($2, $1, $3);
 	  }
-	| expr T_ADDOP expr {
+	| expr T_ADDITIVE expr {
 		$$ = build($2, $1, $3);
 	  }
-	| expr T_SHFTOP expr {
+	| expr T_SHIFT expr {
 		$$ = build($2, $1, $3);
 	  }
-	| expr T_RELOP expr {
+	| expr T_RELATIONAL expr {
 		$$ = build($2, $1, $3);
 	  }
-	| expr T_EQOP expr {
+	| expr T_EQUALITY expr {
 		$$ = build($2, $1, $3);
 	  }
 	| expr T_AMPER expr {
@@ -1823,7 +1823,7 @@ expr:
 	| expr T_XOR expr {
 		$$ = build(BITXOR, $1, $3);
 	  }
-	| expr T_OR expr {
+	| expr T_BITOR expr {
 		$$ = build(BITOR, $1, $3);
 	  }
 	| expr T_LOGAND expr {
@@ -1838,7 +1838,7 @@ expr:
 	| expr T_ASSIGN expr {
 		$$ = build(ASSIGN, $1, $3);
 	  }
-	| expr T_OPASS expr {
+	| expr T_OPASSIGN expr {
 		$$ = build($2, $1, $3);
 	  }
 	| expr T_COMMA expr {
@@ -1905,10 +1905,10 @@ term:
 	| T_AMPER term {
 		$$ = build(ADDR, $2, NULL);
 	  }
-	| T_UNOP term {
+	| T_UNARY term {
 		$$ = build($1, $2, NULL);
 	  }
-	| T_ADDOP term {
+	| T_ADDITIVE term {
 		if (tflag && $1 == PLUS) {
 			/* unary + is illegal in traditional C */
 			warning(100);
@@ -1975,10 +1975,10 @@ term:
 	| T_ALIGNOF T_LPAREN type_name T_RPAREN		%prec T_ALIGNOF {
 		$$ = build_alignof($3);
 	  }
-	| T_LPAREN type_name T_RPAREN term		%prec T_UNOP {
+	| T_LPAREN type_name T_RPAREN term		%prec T_UNARY {
 		$$ = cast($4, $2);
 	  }
-	| T_LPAREN type_name T_RPAREN			%prec T_UNOP {
+	| T_LPAREN type_name T_RPAREN			%prec T_UNARY {
 		sym_t *tmp = mktempsym($2);
 		idecl(tmp, 1, NULL);
 	  } init_lbrace init_expr_list init_rbrace {

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.126 src/usr.bin/xlint/lint1/scan.l:1.127
--- src/usr.bin/xlint/lint1/scan.l:1.126	Mon Jan 18 17:11:14 2021
+++ src/usr.bin/xlint/lint1/scan.l	Mon Jan 18 17:20:15 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.126 2021/01/18 17:11:14 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.127 2021/01/18 17:20:15 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.126 2021/01/18 17:11:14 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.127 2021/01/18 17:20:15 rillig Exp $");
 #endif
 
 #include 
@@ 

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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 17:11:14 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: scan.l

Log Message:
lint: remove redundant operators from lexer

Several tokens correspond to exactly one operator.  For these tokens,
the operator is never accessed, therefore it is confusing to associate
it with the token.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/xlint/lint1/scan.l

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/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.125 src/usr.bin/xlint/lint1/scan.l:1.126
--- src/usr.bin/xlint/lint1/scan.l:1.125	Mon Jan 18 16:47:46 2021
+++ src/usr.bin/xlint/lint1/scan.l	Mon Jan 18 17:11:14 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.125 2021/01/18 16:47:46 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.126 2021/01/18 17:11:14 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.125 2021/01/18 16:47:46 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.126 2021/01/18 17:11:14 rillig Exp $");
 #endif
 
 #include 
@@ -113,7 +113,7 @@ TL	([fFlL]?[i]?)
 0[xX]{HD}+\.{HD}*{HX}{TL} |
 0[xX]{HD}+{HX}{TL}	|
 \.{D}+{EX}?{TL}		return fcon();
-"="return operator(T_ASSIGN, ASSIGN);
+"="return operator(T_ASSIGN, NOOP);
 "*="return operator(T_OPASS, MULASS);
 "/="return operator(T_OPASS, DIVASS);
 "%="return operator(T_OPASS, MODASS);
@@ -124,11 +124,11 @@ TL	([fFlL]?[i]?)
 "&="return operator(T_OPASS, ANDASS);
 "^="return operator(T_OPASS, XORASS);
 "|="return operator(T_OPASS, ORASS);
-"||"return operator(T_LOGOR, LOGOR);
-"&&"return operator(T_LOGAND, LOGAND);
-"|"return operator(T_OR, BITOR);
-"&"return operator(T_AMPER, BITAND);
-"^"return operator(T_XOR, BITXOR);
+"||"return operator(T_LOGOR, NOOP);
+"&&"return operator(T_LOGAND, NOOP);
+"|"return operator(T_OR, NOOP);
+"&"return operator(T_AMPER, NOOP);
+"^"return operator(T_XOR, NOOP);
 "=="return operator(T_EQOP, EQ);
 "!="return operator(T_EQOP, NE);
 "<"return operator(T_RELOP, LT);



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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 16:47:46 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y scan.l

Log Message:
lint: replace abort with lint_assert


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.124 -r1.125 src/usr.bin/xlint/lint1/scan.l

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.148 src/usr.bin/xlint/lint1/cgram.y:1.149
--- src/usr.bin/xlint/lint1/cgram.y:1.148	Mon Jan 18 16:41:57 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jan 18 16:47:46 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.148 2021/01/18 16:41:57 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.149 2021/01/18 16:47:46 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.148 2021/01/18 16:41:57 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.149 2021/01/18 16:47:46 rillig Exp $");
 #endif
 
 #include 
@@ -85,8 +85,7 @@ CLEAR_WARN_FLAGS(const char *file, size_
 static void
 SAVE_WARN_FLAGS(const char *file, size_t line)
 {
-	if (olwarn != LWARN_BAD)
-		abort();
+	lint_assert(olwarn == LWARN_BAD);
 	printf("%s, %d: save flags %s %zu = %d\n", curr_pos.p_file,
 	curr_pos.p_line, file, line, lwarn);
 	olwarn = lwarn;

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.124 src/usr.bin/xlint/lint1/scan.l:1.125
--- src/usr.bin/xlint/lint1/scan.l:1.124	Mon Jan 18 16:41:57 2021
+++ src/usr.bin/xlint/lint1/scan.l	Mon Jan 18 16:47:46 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.124 2021/01/18 16:41:57 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.125 2021/01/18 16:47:46 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.124 2021/01/18 16:41:57 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.125 2021/01/18 16:47:46 rillig Exp $");
 #endif
 
 #include 
@@ -350,12 +350,11 @@ add_keyword(struct kwtab *kw, int deco)
 		snprintf(buf, sizeof(buf), "__%s", kw->kw_name);
 		name = strdup(buf);
 		break;
-	case 4:
+	default:
+		lint_assert(deco == 4);
 		snprintf(buf, sizeof(buf), "__%s__", kw->kw_name);
 		name = strdup(buf);
 		break;
-	default:
-		abort();
 	}
 
 	if (name == NULL)



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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 16:41:57 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y externs1.h scan.l

Log Message:
lint: expand abbreviations in function names


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.123 -r1.124 src/usr.bin/xlint/lint1/scan.l

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.147 src/usr.bin/xlint/lint1/cgram.y:1.148
--- src/usr.bin/xlint/lint1/cgram.y:1.147	Mon Jan 18 16:34:08 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jan 18 16:41:57 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.147 2021/01/18 16:34:08 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.148 2021/01/18 16:41:57 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.147 2021/01/18 16:34:08 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.148 2021/01/18 16:41:57 rillig Exp $");
 #endif
 
 #include 
@@ -47,8 +47,8 @@ __RCSID("$NetBSD: cgram.y,v 1.147 2021/0
 extern char *yytext;
 
 /*
- * Contains the level of current declaration. 0 is extern.
- * Used for symbol table entries.
+ * Contains the level of current declaration, used for symbol table entries.
+ * 0 is the top-level, > 0 is inside a function body.
  */
 int	blklev;
 
@@ -68,22 +68,22 @@ static int olwarn = LWARN_BAD;
 
 static	int	toicon(tnode_t *, int);
 static	void	idecl(sym_t *, int, sbuf_t *);
-static	void	ignuptorp(void);
+static	void	ignore_up_to_rparen(void);
 static	sym_t	*symbolrename(sym_t *, sbuf_t *);
 
 
 #ifdef DEBUG
-static inline void CLRWFLGS(const char *file, size_t line);
-static inline void CLRWFLGS(const char *file, size_t line)
+static void
+CLEAR_WARN_FLAGS(const char *file, size_t line)
 {
 	printf("%s, %d: clear flags %s %zu\n", curr_pos.p_file,
 	curr_pos.p_line, file, line);
-	clrwflgs();
+	clear_warn_flags();
 	olwarn = LWARN_BAD;
 }
 
-static inline void SAVE(const char *file, size_t line);
-static inline void SAVE(const char *file, size_t line)
+static void
+SAVE_WARN_FLAGS(const char *file, size_t line)
 {
 	if (olwarn != LWARN_BAD)
 		abort();
@@ -92,8 +92,8 @@ static inline void SAVE(const char *file
 	olwarn = lwarn;
 }
 
-static inline void RESTORE(const char *file, size_t line);
-static inline void RESTORE(const char *file, size_t line)
+static void
+RESTORE_WARN_FLAGS(const char *file, size_t line)
 {
 	if (olwarn != LWARN_BAD) {
 		lwarn = olwarn;
@@ -101,13 +101,14 @@ static inline void RESTORE(const char *f
 		curr_pos.p_line, file, line, lwarn);
 		olwarn = LWARN_BAD;
 	} else
-		CLRWFLGS(file, line);
+		CLEAR_WARN_FLAGS(file, line);
 }
 #define cgram_debug(fmt, args...) printf("cgram_debug: " fmt "\n", ##args)
 #else
-#define CLRWFLGS(f, l) clrwflgs(), olwarn = LWARN_BAD
-#define SAVE(f, l)	olwarn = lwarn
-#define RESTORE(f, l) (void)(olwarn == LWARN_BAD ? (clrwflgs(), 0) : (lwarn = olwarn))
+#define CLEAR_WARN_FLAGS(f, l) clear_warn_flags(), olwarn = LWARN_BAD
+#define SAVE_WARN_FLAGS(f, l)	olwarn = lwarn
+#define RESTORE_WARN_FLAGS(f, l) \
+	(void)(olwarn == LWARN_BAD ? (clear_warn_flags(), 0) : (lwarn = olwarn))
 #define cgram_debug(fmt, args...) (void)0
 #endif
 
@@ -355,11 +356,11 @@ external_declaration:		/* C99 6.9 */
 	  asm_statement
 	| function_definition {
 		global_clean_up_decl(0);
-		CLRWFLGS(__FILE__, __LINE__);
+		CLEAR_WARN_FLAGS(__FILE__, __LINE__);
 	  }
 	| data_def {
 		global_clean_up_decl(0);
-		CLRWFLGS(__FILE__, __LINE__);
+		CLEAR_WARN_FLAGS(__FILE__, __LINE__);
 	  }
 	;
 
@@ -1551,7 +1552,7 @@ compound_statement_rbrace:
 statement_list:
 	  statement
 	| statement_list statement {
-		RESTORE(__FILE__, __LINE__);
+		RESTORE_WARN_FLAGS(__FILE__, __LINE__);
 	  }
 	| statement_list error T_SEMI
 	;
@@ -1595,27 +1596,27 @@ expr_statement_list:
 
 selection_statement:		/* C99 6.8.4 */
 	  if_without_else {
-		SAVE(__FILE__, __LINE__);
+		SAVE_WARN_FLAGS(__FILE__, __LINE__);
 		if2();
 		if3(0);
 	  }
 	| if_without_else T_ELSE {
-		SAVE(__FILE__, __LINE__);
+		SAVE_WARN_FLAGS(__FILE__, __LINE__);
 		if2();
 	  } statement {
-		CLRWFLGS(__FILE__, __LINE__);
+		CLEAR_WARN_FLAGS(__FILE__, __LINE__);
 		if3(1);
 	  }
 	| if_without_else T_ELSE error {
-		CLRWFLGS(__FILE__, __LINE__);
+		CLEAR_WARN_FLAGS(__FILE__, __LINE__);
 		if3(0);
 	  }
 	| switch_expr statement {
-		CLRWFLGS(__FILE__, __LINE__);
+		CLEAR_WARN_FLAGS(__FILE__, __LINE__);
 		switch2();
 	  }
 	| switch_expr error {
-		CLRWFLGS(__FILE__, __LINE__);
+		CLEAR_WARN_FLAGS(__FILE__, __LINE__);
 		switch2();
 	  }
 	;
@@ -1628,14 +1629,14 @@ if_without_else:
 if_expr:
 	  T_IF T_LPAREN expr T_RPAREN {
 		if1($3);
-		CLRWFLGS(__FILE__, __LINE__);
+		

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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 16:34:09 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y scan.l

Log Message:
lint: rename T_ELLIPSE to T_ELLIPSIS

The 3 dots have nothing to do with geometry.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.122 -r1.123 src/usr.bin/xlint/lint1/scan.l

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.146 src/usr.bin/xlint/lint1/cgram.y:1.147
--- src/usr.bin/xlint/lint1/cgram.y:1.146	Mon Jan 18 16:29:59 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jan 18 16:34:08 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.146 2021/01/18 16:29:59 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.147 2021/01/18 16:34:08 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.146 2021/01/18 16:29:59 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.147 2021/01/18 16:34:08 rillig Exp $");
 #endif
 
 #include 
@@ -164,7 +164,7 @@ anonymize(sym_t *s)
 %token			T_OPASS
 %token			T_COMMA
 %token			T_SEMI
-%token			T_ELLIPSE
+%token			T_ELLIPSIS
 %token			T_REAL
 %token			T_IMAG
 %token			T_GENERIC
@@ -1253,11 +1253,11 @@ vararg_parameter_type_list:
 	  parameter_type_list {
 		$$ = $1;
 	  }
-	| parameter_type_list T_COMMA T_ELLIPSE {
+	| parameter_type_list T_COMMA T_ELLIPSIS {
 		dcs->d_vararg = true;
 		$$ = $1;
 	  }
-	| T_ELLIPSE {
+	| T_ELLIPSIS {
 		if (sflag) {
 			/* ANSI C requires formal parameter before '...' */
 			error(84);
@@ -1348,7 +1348,7 @@ init_expr_list:
 	;
 
 lorange:
-	  constant T_ELLIPSE {
+	  constant T_ELLIPSIS {
 		$$.lo = toicon($1, 1);
 	  }
 	;
@@ -1502,7 +1502,7 @@ label:
 		case_label($2);
 		ftflg = true;
 	  }
-	| T_CASE constant T_ELLIPSE constant T_COLON {
+	| T_CASE constant T_ELLIPSIS constant T_COLON {
 		/* XXX: We don't fill all cases */
 		case_label($2);
 		ftflg = true;

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.122 src/usr.bin/xlint/lint1/scan.l:1.123
--- src/usr.bin/xlint/lint1/scan.l:1.122	Mon Jan 18 16:29:59 2021
+++ src/usr.bin/xlint/lint1/scan.l	Mon Jan 18 16:34:08 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.122 2021/01/18 16:29:59 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.123 2021/01/18 16:34:08 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.122 2021/01/18 16:29:59 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.123 2021/01/18 16:34:08 rillig Exp $");
 #endif
 
 #include 
@@ -160,7 +160,7 @@ TL	([fFlL]?[i]?)
 "]"return T_RBRACK;
 "("return T_LPAREN;
 ")"return T_RPAREN;
-"..."return T_ELLIPSE;
+"..."return T_ELLIPSIS;
 "'"return ccon();
 "L'"return wccon();
 ^#.*$directive();



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

2021-01-18 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Jan 18 16:29:59 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y scan.l

Log Message:
lint: rename T_STROP to T_MEMBACC

The 'STR' was misleading since it is the abbreviation for 'string' in
many other programs.  Member access not only happens in structs, it also
happens in unions.


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/xlint/lint1/scan.l

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.145 src/usr.bin/xlint/lint1/cgram.y:1.146
--- src/usr.bin/xlint/lint1/cgram.y:1.145	Sun Jan 17 15:09:56 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jan 18 16:29:59 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.145 2021/01/17 15:09:56 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.146 2021/01/18 16:29:59 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.145 2021/01/17 15:09:56 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.146 2021/01/18 16:29:59 rillig Exp $");
 #endif
 
 #include 
@@ -139,7 +139,7 @@ anonymize(sym_t *s)
 };
 
 %token			T_LBRACE T_RBRACE T_LBRACK T_RBRACK T_LPAREN T_RPAREN
-%token			T_STROP
+%token			T_MEMBACC
 %token			T_UNOP
 %token			T_INCDEC
 %token			T_SIZEOF
@@ -261,7 +261,7 @@ anonymize(sym_t *s)
 %left	T_ADDOP
 %left	T_ASTERISK T_DIVOP
 %right	T_UNOP T_INCDEC T_SIZEOF T_ALIGNOF T_REAL T_IMAG
-%left	T_LPAREN T_LBRACK T_STROP
+%left	T_LPAREN T_LBRACK T_MEMBACC
 
 %token			T_NAME
 %token			T_TYPENAME
@@ -2021,14 +2021,14 @@ func_arg_list:
 	;
 
 point_or_arrow:
-	  T_STROP {
+	  T_MEMBACC {
 		symtyp = FMEMBER;
 		$$ = $1;
 	  }
 	;
 
 point:
-	  T_STROP {
+	  T_MEMBACC {
 		if ($1 != POINT) {
 			/* syntax error '%s' */
 			error(249, yytext);

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.121 src/usr.bin/xlint/lint1/scan.l:1.122
--- src/usr.bin/xlint/lint1/scan.l:1.121	Sun Jan 17 23:04:09 2021
+++ src/usr.bin/xlint/lint1/scan.l	Mon Jan 18 16:29:59 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.121 2021/01/17 23:04:09 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.122 2021/01/18 16:29:59 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.121 2021/01/17 23:04:09 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.122 2021/01/18 16:29:59 rillig Exp $");
 #endif
 
 #include 
@@ -139,8 +139,8 @@ TL	([fFlL]?[i]?)
 ">>"return operator(T_SHFTOP, SHR);
 "++"return operator(T_INCDEC, INC);
 "--"return operator(T_INCDEC, DEC);
-"->"return operator(T_STROP, ARROW);
-"."return operator(T_STROP, POINT);
+"->"return operator(T_MEMBACC, ARROW);
+"."return operator(T_MEMBACC, POINT);
 "+"return operator(T_ADDOP, PLUS);
 "-"return operator(T_ADDOP, MINUS);
 "*"return operator(T_ASTERISK, NOOP);



CVS commit: src/sys/sys

2021-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 18 15:29:31 UTC 2021

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

Log Message:
NetBSD 9.99.78 -- signature of device_compatible_match() changed.


To generate a diff of this commit:
cvs rdiff -u -r1.681 -r1.682 src/sys/sys/param.h

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

Modified files:

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.681 src/sys/sys/param.h:1.682
--- src/sys/sys/param.h:1.681	Sat Dec  5 18:17:01 2020
+++ src/sys/sys/param.h	Mon Jan 18 15:29:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.681 2020/12/05 18:17:01 thorpej Exp $	*/
+/*	$NetBSD: param.h,v 1.682 2021/01/18 15:29:31 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999007700	/* NetBSD 9.99.77 */
+#define	__NetBSD_Version__	999007800	/* NetBSD 9.99.78 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys

2021-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 18 15:28:21 UTC 2021

Modified Files:
src/sys/dev/i2c: at24cxx.c axppmic.c ds1307.c fan53555.c i2c.c i2cvar.h
m41st84.c pcagpio.c pcai2cmux.c rkpmic.c
src/sys/dev/spi: spi.c
src/sys/kern: subr_autoconf.c
src/sys/sys: device.h

Log Message:
Change the device_compatible_match() function to only perform the match.
Introduce a device_compatible_lookup() function to return an entry based
on the same matching criteria (a'la of_search_compatible()).

Update iic_compatible_match() to reflect the above change, and introduce
iic_compatible_lookup().  This pattern is less awkward to use.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/i2c/at24cxx.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/i2c/axppmic.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/i2c/ds1307.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/i2c/fan53555.c
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/i2c/i2c.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/i2c/i2cvar.h
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/i2c/m41st84.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/i2c/pcagpio.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/i2c/pcai2cmux.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/i2c/rkpmic.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/spi/spi.c
cvs rdiff -u -r1.274 -r1.275 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.160 -r1.161 src/sys/sys/device.h

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

Modified files:

Index: src/sys/dev/i2c/at24cxx.c
diff -u src/sys/dev/i2c/at24cxx.c:1.37 src/sys/dev/i2c/at24cxx.c:1.38
--- src/sys/dev/i2c/at24cxx.c:1.37	Sun Jan 17 21:56:20 2021
+++ src/sys/dev/i2c/at24cxx.c	Mon Jan 18 15:28:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: at24cxx.c,v 1.37 2021/01/17 21:56:20 thorpej Exp $	*/
+/*	$NetBSD: at24cxx.c,v 1.38 2021/01/18 15:28:21 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.37 2021/01/17 21:56:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.38 2021/01/18 15:28:21 thorpej Exp $");
 
 #include 
 #include 
@@ -182,7 +182,7 @@ seeprom_attach(device_t parent, device_t
 		sc->sc_size = (device_cfdata(self)->cf_flags << 7);
 
 	if (sc->sc_size <= 0 && ia->ia_ncompat > 0) {
-		if (iic_compatible_match(ia, compat_data, ))
+		if ((dce = iic_compatible_lookup(ia, compat_data)) != NULL)
 			sc->sc_size = dce->value;
 	}
 

Index: src/sys/dev/i2c/axppmic.c
diff -u src/sys/dev/i2c/axppmic.c:1.30 src/sys/dev/i2c/axppmic.c:1.31
--- src/sys/dev/i2c/axppmic.c:1.30	Sun Jan 17 21:56:20 2021
+++ src/sys/dev/i2c/axppmic.c	Mon Jan 18 15:28:21 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: axppmic.c,v 1.30 2021/01/17 21:56:20 thorpej Exp $ */
+/* $NetBSD: axppmic.c,v 1.31 2021/01/18 15:28:21 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2014-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.30 2021/01/17 21:56:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.31 2021/01/18 15:28:21 thorpej Exp $");
 
 #include 
 #include 
@@ -949,7 +949,7 @@ axppmic_attach(device_t parent, device_t
 	uint8_t irq_mask, val;
 	int error;
 
-	(void) iic_compatible_match(ia, compat_data, );
+	dce = iic_compatible_lookup(ia, compat_data);
 	KASSERT(dce != NULL);
 	c = dce->data;
 

Index: src/sys/dev/i2c/ds1307.c
diff -u src/sys/dev/i2c/ds1307.c:1.35 src/sys/dev/i2c/ds1307.c:1.36
--- src/sys/dev/i2c/ds1307.c:1.35	Sun Jan 17 21:56:20 2021
+++ src/sys/dev/i2c/ds1307.c	Mon Jan 18 15:28:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ds1307.c,v 1.35 2021/01/17 21:56:20 thorpej Exp $	*/
+/*	$NetBSD: ds1307.c,v 1.36 2021/01/18 15:28:21 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.35 2021/01/17 21:56:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.36 2021/01/18 15:28:21 thorpej Exp $");
 
 #include 
 #include 
@@ -255,7 +255,7 @@ dsrtc_model_by_compat(const struct i2c_a
 	const struct dsrtc_model *dm = NULL;
 	const struct device_compatible_entry *dce;
 
-	if (iic_compatible_match(ia, compat_data, ))
+	if ((dce = iic_compatible_lookup(ia, compat_data)) != NULL)
 		dm = dce->data;
 
 	return dm;

Index: src/sys/dev/i2c/fan53555.c
diff -u src/sys/dev/i2c/fan53555.c:1.6 src/sys/dev/i2c/fan53555.c:1.7
--- src/sys/dev/i2c/fan53555.c:1.6	Sun Jan 17 21:56:20 2021
+++ src/sys/dev/i2c/fan53555.c	Mon Jan 18 15:28:21 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: fan53555.c,v 1.6 2021/01/17 21:56:20 thorpej Exp $ */
+/* $NetBSD: fan53555.c,v 1.7 2021/01/18 15:28:21 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fan53555.c,v 1.6 2021/01/17 21:56:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fan53555.c,v 1.7 2021/01/18 15:28:21 thorpej Exp $");
 
 #include 
 #include 
@@ -310,7 +310,7 @@ fan53555_attach(device_t 

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

2021-01-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan 18 13:29:37 UTC 2021

Modified Files:
src/sys/arch/arm/sunxi: sunxi_gpio.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arm/sunxi/sunxi_gpio.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_gpio.c
diff -u src/sys/arch/arm/sunxi/sunxi_gpio.c:1.31 src/sys/arch/arm/sunxi/sunxi_gpio.c:1.32
--- src/sys/arch/arm/sunxi/sunxi_gpio.c:1.31	Mon Jan 18 02:35:49 2021
+++ src/sys/arch/arm/sunxi/sunxi_gpio.c	Mon Jan 18 13:29:37 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_gpio.c,v 1.31 2021/01/18 02:35:49 thorpej Exp $ */
+/* $NetBSD: sunxi_gpio.c,v 1.32 2021/01/18 13:29:37 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_soc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.31 2021/01/18 02:35:49 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.32 2021/01/18 13:29:37 skrll Exp $");
 
 #include 
 #include 
@@ -86,7 +86,7 @@ static const struct device_compatible_en
 #ifdef SOC_SUN5I_A13
 	{ .compat = "allwinner,sun5i-a13-pinctrl",
 	  .data = _a13_padconf },
-	{ .compat = "nextthing,gr8-pinctrl",	
+	{ .compat = "nextthing,gr8-pinctrl",
 	  .data = _a13_padconf },
 #endif
 #ifdef SOC_SUN6I_A31
@@ -469,7 +469,7 @@ sunxi_intr_enable(struct sunxi_gpio_soft
 {
 	uint32_t val;
 	struct sunxi_gpio_eint *eint;
-	
+
 	if (pin_def->functions[pin_def->eint_func] == NULL ||
 	strcmp(pin_def->functions[pin_def->eint_func], "irq") != 0)
 		return NULL;



CVS commit: src/sys/dev/pci/ixgbe

2021-01-18 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Jan 18 09:09:04 UTC 2021

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
Fix ixg(4) Rx interrupt stall when Rx buffers are exhausted.

Current ixgbe_rxeof() implementation calls ixgbe_refresh_mbufs()(and
ixgbe_getjcl()) after ixgbe_rx_input()(and if_percpuq_enqueue()).
And ixg(4) uses its own m_ext structure.  That causes Rx interrupt
stall when Rx buffers are exhausted.  e.g. TCP iperf3 with large
windows size.  Furthermore, Rx descriptor problem has occurred
after stoppping the load.

To fix that problem, ixgbe_rxeof() must call ixgbe_getjcl() before
ixgbe_rx_input(), and must discard the new packet when ixgbe_getjcl()
fails.

By the way, ixg(4) should use MCLGET() instead of own m_ext structure.

ok'ed by msaitoh@n.o, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/pci/ixgbe/ix_txrx.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/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.63 src/sys/dev/pci/ixgbe/ix_txrx.c:1.64
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.63	Fri Apr 17 02:21:25 2020
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Mon Jan 18 09:09:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.63 2020/04/17 02:21:25 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.64 2021/01/18 09:09:04 knakahara Exp $ */
 
 /**
 
@@ -1818,6 +1818,7 @@ ixgbe_rxeof(struct ix_queue *que)
 
 	for (i = rxr->next_to_check; count != 0;) {
 		struct mbuf *sendmp, *mp;
+		struct mbuf *newmp;
 		u32 rsc, ptype;
 		u16 len;
 		u16 vtag = 0;
@@ -1860,6 +1861,15 @@ ixgbe_rxeof(struct ix_queue *que)
 			goto next_desc;
 		}
 
+		/* pre-alloc new mbuf */
+		newmp = ixgbe_getjcl(>jcl_head, M_NOWAIT, MT_DATA, M_PKTHDR,
+		rxr->mbuf_sz);
+		if (newmp == NULL) {
+			rxr->rx_discarded.ev_count++;
+			ixgbe_rx_discard(rxr, i);
+			goto next_desc;
+		}
+
 		bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
 		rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
 
@@ -1908,7 +1918,8 @@ ixgbe_rxeof(struct ix_queue *que)
 		 */
 		sendmp = rbuf->fmp;
 		if (sendmp != NULL) {  /* secondary frag */
-			rbuf->buf = rbuf->fmp = NULL;
+			rbuf->buf = newmp;
+			rbuf->fmp = NULL;
 			mp->m_flags &= ~M_PKTHDR;
 			sendmp->m_pkthdr.len += mp->m_len;
 		} else {
@@ -1927,10 +1938,13 @@ ixgbe_rxeof(struct ix_queue *que)
 	sendmp->m_len = len;
 	rxr->rx_copies.ev_count++;
 	rbuf->flags |= IXGBE_RX_COPY;
+
+	m_freem(newmp);
 }
 			}
 			if (sendmp == NULL) {
-rbuf->buf = rbuf->fmp = NULL;
+rbuf->buf = newmp;
+rbuf->fmp = NULL;
 sendmp = mp;
 			}
 



CVS commit: src/sys/dev/pci

2021-01-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan 18 08:29:33 UTC 2021

Modified Files:
src/sys/dev/pci: if_ena.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/pci/if_ena.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/if_ena.c
diff -u src/sys/dev/pci/if_ena.c:1.25 src/sys/dev/pci/if_ena.c:1.26
--- src/sys/dev/pci/if_ena.c:1.25	Mon Aug  3 19:44:06 2020
+++ src/sys/dev/pci/if_ena.c	Mon Jan 18 08:29:32 2021
@@ -36,7 +36,7 @@
 #if 0
 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.25 2020/08/03 19:44:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.26 2021/01/18 08:29:32 skrll Exp $");
 
 #include 
 #include 
@@ -2514,7 +2514,7 @@ ena_update_hwassist(struct ena_adapter *
 
 	if ((cap & IFCAP_CSUM_TCPv6_Tx) != 0)
 		flags |= M_CSUM_TCPv6;
-	
+
 	if ((cap & IFCAP_CSUM_UDPv6_Tx) != 0)
 		flags |= M_CSUM_UDPv6;