CVS commit: src/share/mk

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 05:22:50 UTC 2021

Modified Files:
src/share/mk: bsd.kmodule.mk

Log Message:
On MIPS if we compile C files as N64, compile assembly with the same ABI.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/share/mk/bsd.kmodule.mk

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

Modified files:

Index: src/share/mk/bsd.kmodule.mk
diff -u src/share/mk/bsd.kmodule.mk:1.75 src/share/mk/bsd.kmodule.mk:1.76
--- src/share/mk/bsd.kmodule.mk:1.75	Tue Mar 23 13:22:40 2021
+++ src/share/mk/bsd.kmodule.mk	Mon Mar 29 05:22:49 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.kmodule.mk,v 1.75 2021/03/23 13:22:40 simonb Exp $
+#	$NetBSD: bsd.kmodule.mk,v 1.76 2021/03/29 05:22:49 simonb Exp $
 
 # We are not building this with PIE
 MKPIE=no
@@ -57,9 +57,11 @@ CFLAGS+=	-fno-pic
 CFLAGS+=	-fPIC -Wa,-fno-pic
 .elif ${MACHINE_ARCH} == "mips64eb" && !defined(BSD_MK_COMPAT_FILE)
 CFLAGS+=	-mabi=64
+AFLAGS+=	-mabi=64
 LDFLAGS+=	-Wl,-m,elf64btsmip
 .elif ${MACHINE_ARCH} == "mips64el" && !defined(BSD_MK_COMPAT_FILE)
 CFLAGS+=	-mabi=64
+AFLAGS+=	-mabi=64
 LDFLAGS+=	-Wl,-m,elf64ltsmip
 .endif
 



CVS commit: src/external/cddl/osnet/lib/libdtrace

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 05:18:02 UTC 2021

Modified Files:
src/external/cddl/osnet/lib/libdtrace: Makefile

Log Message:
Compile MIPS specific code.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/external/cddl/osnet/lib/libdtrace/Makefile

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

Modified files:

Index: src/external/cddl/osnet/lib/libdtrace/Makefile
diff -u src/external/cddl/osnet/lib/libdtrace/Makefile:1.28 src/external/cddl/osnet/lib/libdtrace/Makefile:1.29
--- src/external/cddl/osnet/lib/libdtrace/Makefile:1.28	Tue Mar 17 01:36:29 2020
+++ src/external/cddl/osnet/lib/libdtrace/Makefile	Mon Mar 29 05:18:02 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.28 2020/03/17 01:36:29 fox Exp $
+#	$NetBSD: Makefile,v 1.29 2021/03/29 05:18:02 simonb Exp $
 
 # $FreeBSD: head/cddl/lib/libdtrace/Makefile 314654 2017-03-04 11:30:04Z ngie $
 
@@ -115,6 +115,9 @@ CPPFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/
 .elif ${MACHINE_CPU} == "arm"
 CPPFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/arm
 .PATH:		${.CURDIR}/../../dist/lib/libdtrace/arm
+.elif ${MACHINE_CPU} == "mips"
+CPPFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/mips
+.PATH:		${.CURDIR}/../../dist/lib/libdtrace/mips
 .endif
 COPTS.dt_link.c		+= ${GCC_NO_FORMAT_TRUNCATION}
 



CVS commit: src/external/cddl/osnet/dev

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 05:17:09 UTC 2021

Added Files:
src/external/cddl/osnet/dev/dtrace/mips: dtrace_asm.S dtrace_isa.c
dtrace_subr.c regset.h
src/external/cddl/osnet/dev/fbt/mips: fbt_isa.c fbt_isa.h

Log Message:
Work in progress dtrace for MIPS.  MIPS support mostly copied from
FreeBSD, with NetBSD-specific changes largely based on aarch64 dtrace
support.  Working well enough for system call tracing.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/cddl/osnet/dev/dtrace/mips/dtrace_asm.S \
src/external/cddl/osnet/dev/dtrace/mips/dtrace_isa.c \
src/external/cddl/osnet/dev/dtrace/mips/dtrace_subr.c \
src/external/cddl/osnet/dev/dtrace/mips/regset.h
cvs rdiff -u -r0 -r1.1 src/external/cddl/osnet/dev/fbt/mips/fbt_isa.c \
src/external/cddl/osnet/dev/fbt/mips/fbt_isa.h

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

Added files:

Index: src/external/cddl/osnet/dev/dtrace/mips/dtrace_asm.S
diff -u /dev/null src/external/cddl/osnet/dev/dtrace/mips/dtrace_asm.S:1.1
--- /dev/null	Mon Mar 29 05:17:09 2021
+++ src/external/cddl/osnet/dev/dtrace/mips/dtrace_asm.S	Mon Mar 29 05:17:09 2021
@@ -0,0 +1,233 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ * $FreeBSD$
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#define _ASM
+#define _LOCORE
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+.setnoreorder   # Noreorder is default style!
+
+/*
+ * Primitives
+ */
+
+.text
+
+/*
+void dtrace_membar_producer(void)
+*/
+LEAF(dtrace_membar_producer)
+	j	ra
+	nop
+END(dtrace_membar_producer)
+
+/*
+void dtrace_membar_consumer(void)
+*/
+LEAF(dtrace_membar_consumer)
+	j	ra
+	nop
+END(dtrace_membar_consumer)
+
+/*
+dtrace_icookie_t dtrace_interrupt_disable(void)
+*/
+LEAF(dtrace_interrupt_disable)
+	mfc0	t0, MIPS_COP_0_STATUS
+	move	v0, t0
+	and	v0, v0, MIPS_SR_INT_IE
+	and	t0, t0, ~MIPS_SR_INT_IE
+	mtc0	t0, MIPS_COP_0_STATUS
+	j	ra
+	nop
+END(dtrace_interrupt_disable)
+
+/*
+void dtrace_interrupt_enable(dtrace_icookie_t cookie)
+*/
+LEAF(dtrace_interrupt_enable)
+	mfc0	t0, MIPS_COP_0_STATUS
+	beqz	a0, not_enabled
+	or	t0, t0, MIPS_SR_INT_IE
+	mtc0	t0, MIPS_COP_0_STATUS
+not_enabled:
+	j	ra
+	nop
+END(dtrace_interrupt_enable)
+
+/*
+uint32_t dtrace_cas32(uint32_t *target, uint32_t cmp, uint32_t new)
+*/
+LEAF(dtrace_cas32)
+1:
+	move	t1, a2
+	ll	t0, 0(a0)
+	bne	t0, a1, 2f
+	nop
+	sc	t1, 0(a0)
+	beqz	t1, 1b
+	nop
+2:	move	v0, t0
+	j	ra
+	nop
+END(dtrace_cas32)
+
+/*
+void *
+dtrace_casptr(void *target, void *cmp, void *new)
+*/
+LEAF(dtrace_casptr)
+1:
+	move	t1, a2
+	PTR_LL	t0, 0(a0)
+	bne	t0, a1, 2f
+	nop
+	PTR_SC	t1, 0(a0)
+	beqz	t1, 1b
+	nop
+2:	move	v0, t0
+	j	ra
+	nop
+END(dtrace_casptr)
+
+
+/*
+uintptr_t
+dtrace_fulword(void *addr)
+*/
+LEAF(dtrace_fulword)
+END(dtrace_fulword)
+
+/*
+uint8_t
+dtrace_fuword8_nocheck(void *addr)
+*/
+LEAF(dtrace_fuword8_nocheck)
+	lbu	v0, 0(a0)
+	j	ra
+	nop
+END(dtrace_fuword8_nocheck)
+
+/*
+uint16_t
+dtrace_fuword16_nocheck(void *addr)
+*/
+LEAF(dtrace_fuword16_nocheck)
+	lhu	v0, 0(a0)
+	j	ra
+	nop
+END(dtrace_fuword16_nocheck)
+
+/*
+uint32_t
+dtrace_fuword32_nocheck(void *addr)
+*/
+LEAF(dtrace_fuword32_nocheck)
+	lw	v0, 0(a0)
+	j	ra
+	nop
+END(dtrace_fuword32_nocheck)
+
+/*
+uint64_t
+dtrace_fuword64_nocheck(void *addr)
+*/
+LEAF(dtrace_fuword64_nocheck)
+#if defined(__mips_n64) || defined(__mips_n32)
+	ld	v0, 0(a0)
+#else
+	lw	v1,4(a0)
+	lw	v0,0(a0)
+#endif
+	j	ra
+	nop
+END(dtrace_fuword64_nocheck)
+
+/*
+XXX: unoptimized
+void
+dtrace_copy(uintptr_t src, uintptr_t dest, size_t size)
+*/
+LEAF(dtrace_copy)
+1:
+	beqz	a2, 2f
+	nop
+	lbu	t0, 0(a0)
+	sb	t0, 0(a1)
+	PTR_ADDU	a0, a0, 1
+	PTR_ADDU	a1, a1, 1
+	INT_SUBU	a2, a2, 1
+	j	1b
+	nop
+2:
+	j	ra
+	nop
+END(dtrace_copy)
+
+/*
+XXX: Unoptimized. Check for flags on page boundaries only(?)
+void
+dtrace_copystr(uintptr_t uaddr, uintptr_t kaddr, size_t size,
+volatile uint16_t *flags)
+*/
+LEAF(dtrace_copystr)
+1:
+	lbu	t0, 0(a0)
+	sb	t0, 

CVS commit: src/external/cddl/osnet/dev/cyclic/mips

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 03:27:38 UTC 2021

Added Files:
src/external/cddl/osnet/dev/cyclic/mips: cyclic_machdep.c

Log Message:
Add cyclic_machdep.c for MIPS

The code is identical to i386's one.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/external/cddl/osnet/dev/cyclic/mips/cyclic_machdep.c

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

Added files:

Index: src/external/cddl/osnet/dev/cyclic/mips/cyclic_machdep.c
diff -u /dev/null src/external/cddl/osnet/dev/cyclic/mips/cyclic_machdep.c:1.1
--- /dev/null	Mon Mar 29 03:27:38 2021
+++ src/external/cddl/osnet/dev/cyclic/mips/cyclic_machdep.c	Mon Mar 29 03:27:38 2021
@@ -0,0 +1,148 @@
+/*	$NetBSD: cyclic_machdep.c,v 1.1 2021/03/29 03:27:38 simonb Exp $	*/
+
+/*-
+ * Copyright 2006-2008 John Birrell 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: head/sys/cddl/dev/cyclic/i386/cyclic_machdep.c 222813 2011-06-07 08:46:13Z attilio $
+ *
+ */
+
+static void enable(cyb_arg_t);
+static void disable(cyb_arg_t);
+static void reprogram(cyb_arg_t, hrtime_t);
+static void xcall(cyb_arg_t, cpu_t *, cyc_func_t, void *);
+
+static cyc_backend_t	be	= {
+	NULL,		/* cyb_configure */
+	NULL,		/* cyb_unconfigure */
+	enable,
+	disable,
+	reprogram,
+	xcall,
+	NULL		/* cyb_arg_t cyb_arg */
+};
+
+static void
+cyclic_ap_start(void *dummy)
+{
+	/* Initialise the rest of the CPUs. */
+	cyclic_mp_init();
+}
+
+SYSINIT(cyclic_ap_start, SI_SUB_SMP, SI_ORDER_ANY, cyclic_ap_start, NULL);
+
+/*
+ *  Machine dependent cyclic subsystem initialisation.
+ */
+static void
+cyclic_machdep_init(void)
+{
+	/* Register the cyclic backend. */
+	cyclic_init();
+#ifdef __NetBSD__
+	cyclic_ap_start(NULL);
+#endif
+}
+
+static void
+cyclic_machdep_uninit(void)
+{
+	int i;
+
+	for (i = 0; i <= mp_maxid; i++)
+		/* Reset the cyclic clock callback hook. */
+		cyclic_clock_func[i] = NULL;
+
+	/* De-register the cyclic backend. */
+	cyclic_uninit();
+}
+
+static hrtime_t exp_due[MAXCPU];
+
+/*
+ * This function is the one registered by the machine dependent
+ * initialiser as the callback for high speed timer events.
+ */
+static void
+cyclic_clock(struct clockframe *frame)
+{
+	cpu_t *c = _cpu[cpu_number()];
+
+	if (c->cpu_cyclic != NULL && gethrtime() >= exp_due[cpu_number()]) {
+		if (TRAPF_USERMODE(frame)) {
+			c->cpu_profile_pc = 0;
+			c->cpu_profile_upc = TRAPF_PC(frame);
+		} else {
+			c->cpu_profile_pc = TRAPF_PC(frame);
+			c->cpu_profile_upc = 0;
+		}
+
+		c->cpu_intr_actv = 1;
+
+		/* Fire any timers that are due. */
+		cyclic_fire(c);
+
+		c->cpu_intr_actv = 0;
+	}
+}
+
+static void enable(cyb_arg_t arg)
+{
+	/* Register the cyclic clock callback function. */
+	cyclic_clock_func[cpu_number()] = cyclic_clock;
+}
+
+static void disable(cyb_arg_t arg)
+{
+	/* Reset the cyclic clock callback function. */
+	cyclic_clock_func[cpu_number()] = NULL;
+}
+
+static void reprogram(cyb_arg_t arg, hrtime_t exp)
+{
+	exp_due[cpu_number()] = exp;
+}
+
+#ifdef __NetBSD__
+static void xcall_func(void *arg0, void *arg1)
+{
+	cyc_func_t func;
+
+	func = arg0;
+	(*func)(arg1);
+}
+#endif
+
+static void xcall(cyb_arg_t arg, cpu_t *c, cyc_func_t func, void *param)
+{
+#ifdef __NetBSD__
+	uint64_t xc;
+
+	xc = xc_unicast(XC_HIGHPRI, xcall_func, func, param, cpu_lookup(c->cpuid));
+	xc_wait(xc);
+#else
+	smp_rendezvous_cpus((cpumask_t) (1 << c->cpuid),
+	smp_no_rendevous_barrier, func, smp_no_rendevous_barrier, param);
+#endif
+}



CVS commit: src/sys/arch/mips/mips

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 03:22:18 UTC 2021

Modified Files:
src/sys/arch/mips/mips: trap.c

Log Message:
(Very) minimal kernel support for dtrace on MIPS; enough to system call
tracing to work for example.


To generate a diff of this commit:
cvs rdiff -u -r1.259 -r1.260 src/sys/arch/mips/mips/trap.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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.259 src/sys/arch/mips/mips/trap.c:1.260
--- src/sys/arch/mips/mips/trap.c:1.259	Wed Mar 17 11:05:37 2021
+++ src/sys/arch/mips/mips/trap.c	Mon Mar 29 03:22:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.259 2021/03/17 11:05:37 simonb Exp $	*/
+/*	$NetBSD: trap.c,v 1.260 2021/03/29 03:22:17 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,10 +39,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.259 2021/03/17 11:05:37 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.260 2021/03/29 03:22:17 simonb Exp $");
 
 #include "opt_cputype.h"	/* which mips CPU levels do we support? */
 #include "opt_ddb.h"
+#include "opt_dtrace.h"
 #include "opt_kgdb.h"
 #include "opt_multiprocessor.h"
 
@@ -804,6 +805,16 @@ mips_singlestep(struct lwp *l)
 	return 0;
 }
 
+#ifdef KDTRACE_HOOKS
+#include 
+
+/* Not used for now, but needed for dtrace/fbt modules */
+dtrace_doubletrap_func_t	dtrace_doubletrap_func = NULL;
+dtrace_trap_func_t		dtrace_trap_func = NULL;
+
+int(* dtrace_invop_jump_addr)(struct trapframe *);
+#endif /* KDTRACE_HOOKS */
+
 #ifdef TRAP_SIGDEBUG
 static void
 frame_dump(const struct trapframe *tf, struct pcb *pcb)
@@ -863,4 +874,4 @@ sigdebug(const struct trapframe *tf, con
 	e);
 	frame_dump(tf, lwp_getpcb(l));
 }
-#endif
+#endif /* TRAP_SIGDEBUG */



CVS commit: src/sys/arch/mips

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 03:09:42 UTC 2021

Modified Files:
src/sys/arch/mips/include: db_machdep.h
src/sys/arch/mips/mips: mips_stacktrace.c

Log Message:
Expose kdbpeek() and kdbrpeek() for dtrace.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/mips/include/db_machdep.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/mips/mips_stacktrace.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/mips/include/db_machdep.h
diff -u src/sys/arch/mips/include/db_machdep.h:1.36 src/sys/arch/mips/include/db_machdep.h:1.37
--- src/sys/arch/mips/include/db_machdep.h:1.36	Mon Mar 29 03:07:33 2021
+++ src/sys/arch/mips/include/db_machdep.h	Mon Mar 29 03:09:41 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.36 2021/03/29 03:07:33 simonb Exp $ */
+/* $NetBSD: db_machdep.h,v 1.37 2021/03/29 03:09:41 simonb Exp $ */
 
 /*
  * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
@@ -99,6 +99,12 @@ db_set_ddb_regs(int type, struct reg *re
 	ddb_regs = *regs;
 }
 
+/*
+ * Helper functions for fetching 32-bit and 64-bit kernel memory.
+ */
+bool		kdbpeek(vaddr_t, unsigned *);
+mips_reg_t	kdbrpeek(vaddr_t addr, size_t n);
+
 
 /*
  * Constants for KGDB.

Index: src/sys/arch/mips/mips/mips_stacktrace.c
diff -u src/sys/arch/mips/mips/mips_stacktrace.c:1.7 src/sys/arch/mips/mips/mips_stacktrace.c:1.8
--- src/sys/arch/mips/mips/mips_stacktrace.c:1.7	Thu Sep 24 03:17:18 2020
+++ src/sys/arch/mips/mips/mips_stacktrace.c	Mon Mar 29 03:09:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_stacktrace.c,v 1.7 2020/09/24 03:17:18 mrg Exp $	*/
+/*	$NetBSD: mips_stacktrace.c,v 1.8 2021/03/29 03:09:42 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mips_stacktrace.c,v 1.7 2020/09/24 03:17:18 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_stacktrace.c,v 1.8 2021/03/29 03:09:42 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -191,7 +191,7 @@ static const struct { void *addr; const 
 };
 
 
-static bool
+bool
 kdbpeek(vaddr_t addr, unsigned *valp)
 {
 	if (addr & 3) {
@@ -211,7 +211,7 @@ kdbpeek(vaddr_t addr, unsigned *valp)
 	}
 }
 
-static mips_reg_t
+mips_reg_t
 kdbrpeek(vaddr_t addr, size_t n)
 {
 	mips_reg_t rc = 0;



CVS commit: src/sys/arch/mips/include

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 03:07:33 UTC 2021

Modified Files:
src/sys/arch/mips/include: db_machdep.h

Log Message:
Move the cpu_reset_address() declaration inside #ifdef _KERNEL, add a
comment.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/mips/include/db_machdep.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/arch/mips/include/db_machdep.h
diff -u src/sys/arch/mips/include/db_machdep.h:1.35 src/sys/arch/mips/include/db_machdep.h:1.36
--- src/sys/arch/mips/include/db_machdep.h:1.35	Mon Mar 29 03:03:48 2021
+++ src/sys/arch/mips/include/db_machdep.h	Mon Mar 29 03:07:33 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.35 2021/03/29 03:03:48 simonb Exp $ */
+/* $NetBSD: db_machdep.h,v 1.36 2021/03/29 03:07:33 simonb Exp $ */
 
 /*
  * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
@@ -128,10 +128,15 @@ bool ddb_running_on_any_cpu_p(void);
 void db_resume_others(void);
 void db_mips_stack_trace(void *, void *, void (*pr)(const char *, ...));
 
-extern void (*cpu_reset_address)(void);
 
 #ifdef _KERNEL
 /*
+ * Optional function to perform machine- or cpu-specific reset.
+ * Called from ddb "machine reset".
+ */
+extern void (*cpu_reset_address)(void);
+
+/*
  * We have machine-dependent commands.
  */
 #define	DB_MACHINE_COMMANDS



CVS commit: src/sys/arch/mips/include

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 03:03:48 UTC 2021

Modified Files:
src/sys/arch/mips/include: db_machdep.h

Log Message:
Whitespace nits.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/mips/include/db_machdep.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/arch/mips/include/db_machdep.h
diff -u src/sys/arch/mips/include/db_machdep.h:1.34 src/sys/arch/mips/include/db_machdep.h:1.35
--- src/sys/arch/mips/include/db_machdep.h:1.34	Wed Feb 10 07:19:54 2021
+++ src/sys/arch/mips/include/db_machdep.h	Mon Mar 29 03:03:48 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.34 2021/02/10 07:19:54 simonb Exp $ */
+/* $NetBSD: db_machdep.h,v 1.35 2021/03/29 03:03:48 simonb Exp $ */
 
 /*
  * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
@@ -83,11 +83,10 @@ extern db_regs_t	ddb_regs;	/* register s
 #define	IS_WATCHPOINT_TRAP(type, code)	(0)	/* XXX mips3 watchpoint */
 
 /*
- * Interface to  disassembly (shared with mdb)
+ * Interface to disassembly (shared with mdb)
  */
 db_addr_t	db_disasm_insn(int insn, db_addr_t loc, bool altfmt);
 
-
 /*
  * Entrypoints to DDB for kernel, keyboard drivers, init hook
  */



CVS commit: src/sys/fs/nfs

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 02:13:38 UTC 2021

Modified Files:
src/sys/fs/nfs/client: nfs_clbio.c
src/sys/fs/nfs/server: nfs_nfsdport.c

Log Message:
Don't use legacy VM types.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/fs/nfs/client/nfs_clbio.c
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/nfs/server/nfs_nfsdport.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/fs/nfs/client/nfs_clbio.c
diff -u src/sys/fs/nfs/client/nfs_clbio.c:1.6 src/sys/fs/nfs/client/nfs_clbio.c:1.7
--- src/sys/fs/nfs/client/nfs_clbio.c:1.6	Tue Sep 29 03:02:19 2020
+++ src/sys/fs/nfs/client/nfs_clbio.c	Mon Mar 29 02:13:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_clbio.c,v 1.6 2020/09/29 03:02:19 msaitoh Exp $	*/
+/*	$NetBSD: nfs_clbio.c,v 1.7 2021/03/29 02:13:37 simonb Exp $	*/
 /*-
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -35,7 +35,7 @@
 
 #include 
 /* __FBSDID("FreeBSD: head/sys/fs/nfsclient/nfs_clbio.c 304026 2016-08-12 22:44:59Z rmacklem "); */
-__RCSID("$NetBSD: nfs_clbio.c,v 1.6 2020/09/29 03:02:19 msaitoh Exp $");
+__RCSID("$NetBSD: nfs_clbio.c,v 1.7 2021/03/29 02:13:37 simonb Exp $");
 
 #include 
 #include 
@@ -77,7 +77,7 @@ ncl_getpages(struct vop_getpages_args *a
 	int i, error, nextoff, size, toff, count, npages;
 	struct uio uio;
 	struct iovec iov;
-	vm_offset_t kva;
+	vaddr_t kva;
 	struct buf *bp;
 	struct vnode *vp;
 	struct thread *td;
@@ -137,7 +137,7 @@ ncl_getpages(struct vop_getpages_args *a
 	 */
 	bp = getpbuf(_pbuf_freecnt);
 
-	kva = (vm_offset_t) bp->b_data;
+	kva = (vaddr_t) bp->b_data;
 	pmap_qenter(kva, pages, npages);
 	PCPU_INC(cnt.v_vnodein);
 	PCPU_ADD(cnt.v_vnodepgsin, npages);
@@ -221,7 +221,7 @@ ncl_putpages(struct vop_putpages_args *a
 {
 	struct uio uio;
 	struct iovec iov;
-	vm_offset_t kva;
+	vaddr_t kva;
 	struct buf *bp;
 	int iomode, must_commit, i, error, npages, count;
 	off_t offset;
@@ -283,7 +283,7 @@ ncl_putpages(struct vop_putpages_args *a
 	 */
 	bp = getpbuf(_pbuf_freecnt);
 
-	kva = (vm_offset_t) bp->b_data;
+	kva = (vaddr_t) bp->b_data;
 	pmap_qenter(kva, pages, npages);
 	PCPU_INC(cnt.v_vnodeout);
 	PCPU_ADD(cnt.v_vnodepgsout, count);

Index: src/sys/fs/nfs/server/nfs_nfsdport.c
diff -u src/sys/fs/nfs/server/nfs_nfsdport.c:1.3 src/sys/fs/nfs/server/nfs_nfsdport.c:1.4
--- src/sys/fs/nfs/server/nfs_nfsdport.c:1.3	Mon Sep  3 16:29:34 2018
+++ src/sys/fs/nfs/server/nfs_nfsdport.c	Mon Mar 29 02:13:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_nfsdport.c,v 1.3 2018/09/03 16:29:34 riastradh Exp $	*/
+/*	$NetBSD: nfs_nfsdport.c,v 1.4 2021/03/29 02:13:38 simonb Exp $	*/
 /*-
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -34,7 +34,7 @@
 
 #include 
 /* __FBSDID("FreeBSD: head/sys/fs/nfsserver/nfs_nfsdport.c 308212 2016-11-02 12:43:15Z kib "); */
-__RCSID("$NetBSD: nfs_nfsdport.c,v 1.3 2018/09/03 16:29:34 riastradh Exp $");
+__RCSID("$NetBSD: nfs_nfsdport.c,v 1.4 2021/03/29 02:13:38 simonb Exp $");
 
 #if 0
 #include 
@@ -136,7 +136,7 @@ nfsrv_sequential_heuristic(struct uio *u
 
 	/* Locate best candidate. */
 	try = 32;
-	hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC;
+	hi = ((int)(vaddr_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC;
 	nh = [hi];
 	while (try--) {
 		if (nfsheur[hi].nh_vp == vp) {



CVS commit: src/sys/arch/mips/include

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 02:07:43 UTC 2021

Modified Files:
src/sys/arch/mips/include: types.h

Log Message:
Provide vm_offset_t and vm_size_t typedefs - used by dtrace.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/mips/include/types.h

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

Modified files:

Index: src/sys/arch/mips/include/types.h
diff -u src/sys/arch/mips/include/types.h:1.74 src/sys/arch/mips/include/types.h:1.75
--- src/sys/arch/mips/include/types.h:1.74	Sat Jan 23 19:38:53 2021
+++ src/sys/arch/mips/include/types.h	Mon Mar 29 02:07:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.74 2021/01/23 19:38:53 christos Exp $	*/
+/*	$NetBSD: types.h,v 1.75 2021/03/29 02:07:43 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -98,6 +98,9 @@ typedef __uint32_t	vsize_t;
 #define	PRIdVSIZE	PRId32
 #endif
 
+typedef	vaddr_t	vm_offset_t;	/* deprecated (cddl/FreeBSD compat) */
+typedef	vsize_t	vm_size_t;	/* deprecated (cddl/FreeBSD compat) */
+
 
 typedef int		mips_prid_t;
 /* Make sure this is signed; we need pointers to be sign-extended. */



CVS commit: src

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 01:57:09 UTC 2021

Modified Files:
src/distrib/sets/lists/comp: stl.mi
src/external/cddl/osnet/lib: Makefile

Log Message:
Don't build or install /usr/lib/dtrace/drti.o - currently not used, may
be one day...


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/distrib/sets/lists/comp/stl.mi
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/lib/Makefile

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

Modified files:

Index: src/distrib/sets/lists/comp/stl.mi
diff -u src/distrib/sets/lists/comp/stl.mi:1.7 src/distrib/sets/lists/comp/stl.mi:1.8
--- src/distrib/sets/lists/comp/stl.mi:1.7	Thu Aug 27 15:32:00 2020
+++ src/distrib/sets/lists/comp/stl.mi	Mon Mar 29 01:57:09 2021
@@ -1,7 +1,7 @@
-# $NetBSD: stl.mi,v 1.7 2020/08/27 15:32:00 riastradh Exp $
+# $NetBSD: stl.mi,v 1.8 2021/03/29 01:57:09 simonb Exp $
 ./usr/lib/crtbegin.ocomp-c-lib	compatfile
 ./usr/lib/crtend.ocomp-c-lib	compatfile
 ./usr/lib/crti.ocomp-c-lib	compatfile
 ./usr/lib/crtn.ocomp-c-lib	compatfile
-./usr/lib/dtrace/drti.ocomp-c-lib	dtrace
+./usr/lib/dtrace/drti.ocomp-c-lib	dtrace,obsolete
 ./usr/lib/sysident.ocomp-c-lib	compatfile

Index: src/external/cddl/osnet/lib/Makefile
diff -u src/external/cddl/osnet/lib/Makefile:1.9 src/external/cddl/osnet/lib/Makefile:1.10
--- src/external/cddl/osnet/lib/Makefile:1.9	Mon May 28 21:05:08 2018
+++ src/external/cddl/osnet/lib/Makefile	Mon Mar 29 01:57:09 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2018/05/28 21:05:08 chs Exp $
+#	$NetBSD: Makefile,v 1.10 2021/03/29 01:57:09 simonb Exp $
 #
 #
 
@@ -6,7 +6,8 @@
 
 .if (defined(MKDTRACE) && ${MKDTRACE} != "no")
 SUBDIR+=	libdtrace
-SUBDIR+=	drti
+# drti.o is not (yet) used
+# SUBDIR+=	drti
 .endif
 .if ${MKCTF:Uno} != "no"
 SUBDIR+=	libctf



CVS commit: src

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 01:48:29 UTC 2021

Modified Files:
src/distrib/sets/lists/comp: ad.mips
src/sys/arch/mips/include: Makefile

Log Message:
Install , now needed for dtrace.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/distrib/sets/lists/comp/ad.mips
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/mips/include/Makefile

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

Modified files:

Index: src/distrib/sets/lists/comp/ad.mips
diff -u src/distrib/sets/lists/comp/ad.mips:1.86 src/distrib/sets/lists/comp/ad.mips:1.87
--- src/distrib/sets/lists/comp/ad.mips:1.86	Mon Sep  7 00:19:04 2020
+++ src/distrib/sets/lists/comp/ad.mips	Mon Mar 29 01:48:29 2021
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips,v 1.86 2020/09/07 00:19:04 mrg Exp $
+# $NetBSD: ad.mips,v 1.87 2021/03/29 01:48:29 simonb Exp $
 -./usr/lib/64/libgomp.a
 -./usr/lib/64/libgomp.so
 -./usr/lib/64/libgomp.so.1
@@ -55,6 +55,7 @@
 ./usr/include/mips/endian_machdep.h		comp-c-include
 ./usr/include/mips/fenv.h			comp-c-include
 ./usr/include/mips/float.h			comp-c-include
+./usr/include/mips/frame.h			comp-c-include
 ./usr/include/mips/ieee.h			comp-c-include
 ./usr/include/mips/ieeefp.h			comp-c-include
 ./usr/include/mips/int_const.h			comp-c-include

Index: src/sys/arch/mips/include/Makefile
diff -u src/sys/arch/mips/include/Makefile:1.34 src/sys/arch/mips/include/Makefile:1.35
--- src/sys/arch/mips/include/Makefile:1.34	Thu Jul 12 10:46:45 2018
+++ src/sys/arch/mips/include/Makefile	Mon Mar 29 01:48:29 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.34 2018/07/12 10:46:45 maxv Exp $
+#	$NetBSD: Makefile,v 1.35 2021/03/29 01:48:29 simonb Exp $
 
 INCSDIR= /usr/include/mips
 
@@ -6,7 +6,7 @@ INCS=	ansi.h asm.h \
 	bswap.h \
 	cachectl.h cdefs.h cpu.h cpuregs.h \
 	ecoff_machdep.h elf_machdep.h endian.h endian_machdep.h \
-	fenv.h float.h \
+	fenv.h float.h frame.h \
 	ieee.h ieeefp.h \
 	int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
 	kcore.h kdbparam.h \



CVS commit: src/sys/arch/mips/include

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 01:47:46 UTC 2021

Modified Files:
src/sys/arch/mips/include: cpu.h

Log Message:
Include #include  to get lwp_trapframe() definition.
Needed for dtrace.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/mips/include/cpu.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/arch/mips/include/cpu.h
diff -u src/sys/arch/mips/include/cpu.h:1.131 src/sys/arch/mips/include/cpu.h:1.132
--- src/sys/arch/mips/include/cpu.h:1.131	Mon Aug 17 03:19:35 2020
+++ src/sys/arch/mips/include/cpu.h	Mon Mar 29 01:47:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.131 2020/08/17 03:19:35 mrg Exp $	*/
+/*	$NetBSD: cpu.h,v 1.132 2021/03/29 01:47:45 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -53,6 +53,8 @@
 #include "opt_multiprocessor.h"
 #endif
 
+#include 
+
 #include 
 #include 
 #include 



CVS commit: src/sys/arch/mips/include

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 01:46:26 UTC 2021

Modified Files:
src/sys/arch/mips/include: frame.h

Log Message:
Add an lwp_trapframe() interface to return an LWP's user trapframe.
Needed by dtrace.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/include/frame.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/arch/mips/include/frame.h
diff -u src/sys/arch/mips/include/frame.h:1.11 src/sys/arch/mips/include/frame.h:1.12
--- src/sys/arch/mips/include/frame.h:1.11	Wed Mar 24 05:35:05 2021
+++ src/sys/arch/mips/include/frame.h	Mon Mar 29 01:46:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.11 2021/03/24 05:35:05 simonb Exp $	*/
+/*	$NetBSD: frame.h,v 1.12 2021/03/29 01:46:26 simonb Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -42,6 +42,8 @@
 #include 
 
 void *getframe(struct lwp *, int, int *);
+#define	lwp_trapframe(l)	((l)->l_md.md_utf)
+
 #if defined(COMPAT_16) || defined(COMPAT_ULTRIX)
 void sendsig_sigcontext(const ksiginfo_t *, const sigset_t *);
 #endif



CVS commit: src/external/cddl/osnet/sys/sys

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 01:43:18 UTC 2021

Modified Files:
src/external/cddl/osnet/sys/sys: mutex_impl.h

Log Message:
Don't define mtx_owner here.  mtx_owner is always available, and not
all architecutres use the same structure for a kernel mutex.

OK thorpej@


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/sys/sys/mutex_impl.h

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

Modified files:

Index: src/external/cddl/osnet/sys/sys/mutex_impl.h
diff -u src/external/cddl/osnet/sys/sys/mutex_impl.h:1.1 src/external/cddl/osnet/sys/sys/mutex_impl.h:1.2
--- src/external/cddl/osnet/sys/sys/mutex_impl.h:1.1	Sun Feb 21 01:46:36 2010
+++ src/external/cddl/osnet/sys/sys/mutex_impl.h	Mon Mar 29 01:43:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex_impl.h,v 1.1 2010/02/21 01:46:36 darran Exp $	*/
+/*	$NetBSD: mutex_impl.h,v 1.2 2021/03/29 01:43:18 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -35,7 +35,6 @@
 #define	__MUTEX_PRIVATE
 #include 
 
-#define	mtx_owner 		u.mtxa_owner
 #define	MUTEX_THREAD		((uintptr_t)-16L)
 #define	MUTEX_OWNER(mtx)	\
 	((mtx)->mtx_owner & MUTEX_THREAD)



CVS commit: src/external/gpl3/gcc/dist/gcc/config/mips

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 01:33:12 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/mips: mips.c netbsd.h netbsd64.h

Log Message:
Don't override TARGET_ASM_OUTPUT_SOURCE_FILENAME on MIPS for NetBSD -
use the default which includes a '.file "filename"' as the first name so
that the FILE symbols type is set to the real source file name.  Needed
to make ctfconvert work.

OK mrg@.
XXX needs to be fed back to GNU.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/gcc/dist/gcc/config/mips/mips.c
cvs rdiff -u -r1.14 -r1.15 \
src/external/gpl3/gcc/dist/gcc/config/mips/netbsd.h
cvs rdiff -u -r1.4 -r1.5 \
src/external/gpl3/gcc/dist/gcc/config/mips/netbsd64.h

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/mips/mips.c
diff -u src/external/gpl3/gcc/dist/gcc/config/mips/mips.c:1.11 src/external/gpl3/gcc/dist/gcc/config/mips/mips.c:1.12
--- src/external/gpl3/gcc/dist/gcc/config/mips/mips.c:1.11	Sat Sep  5 09:12:26 2020
+++ src/external/gpl3/gcc/dist/gcc/config/mips/mips.c	Mon Mar 29 01:33:12 2021
@@ -9488,7 +9488,7 @@ mips_output_external (FILE *file, tree d
 
 /* Implement TARGET_ASM_OUTPUT_SOURCE_FILENAME.  */
 
-static void
+static void ATTRIBUTE_UNUSED
 mips_output_filename (FILE *stream, const char *name)
 {
   /* If we are emitting DWARF-2, let dwarf2out handle the ".file"
@@ -22744,8 +22744,10 @@ mips_starting_frame_offset (void)
 #undef TARGET_TRAMPOLINE_INIT
 #define TARGET_TRAMPOLINE_INIT mips_trampoline_init
 
+#ifndef MIPS_USE_GCC_DEFAULT_OUTPUT_SOURCE_FILENAME
 #undef TARGET_ASM_OUTPUT_SOURCE_FILENAME
 #define TARGET_ASM_OUTPUT_SOURCE_FILENAME mips_output_filename
+#endif	/* MIPS_USE_GCC_DEFAULT_OUTPUT_SOURCE_FILENAME */
 
 #undef TARGET_SHIFT_TRUNCATION_MASK
 #define TARGET_SHIFT_TRUNCATION_MASK mips_shift_truncation_mask

Index: src/external/gpl3/gcc/dist/gcc/config/mips/netbsd.h
diff -u src/external/gpl3/gcc/dist/gcc/config/mips/netbsd.h:1.14 src/external/gpl3/gcc/dist/gcc/config/mips/netbsd.h:1.15
--- src/external/gpl3/gcc/dist/gcc/config/mips/netbsd.h:1.14	Sat Sep  5 09:12:26 2020
+++ src/external/gpl3/gcc/dist/gcc/config/mips/netbsd.h	Mon Mar 29 01:33:12 2021
@@ -229,3 +229,5 @@ along with GCC; see the file COPYING3.  
 
 #undef TARGET_WRITABLE_EH_FRAME
 #define TARGET_WRITABLE_EH_FRAME 0
+
+#define	MIPS_USE_GCC_DEFAULT_OUTPUT_SOURCE_FILENAME

Index: src/external/gpl3/gcc/dist/gcc/config/mips/netbsd64.h
diff -u src/external/gpl3/gcc/dist/gcc/config/mips/netbsd64.h:1.4 src/external/gpl3/gcc/dist/gcc/config/mips/netbsd64.h:1.5
--- src/external/gpl3/gcc/dist/gcc/config/mips/netbsd64.h:1.4	Sat Mar  1 09:44:50 2014
+++ src/external/gpl3/gcc/dist/gcc/config/mips/netbsd64.h	Mon Mar 29 01:33:12 2021
@@ -45,3 +45,5 @@ Boston, MA 02110-1301, USA.  */
%{mips32} %{mips32r2} %{mips64} %{mips64r2} \
%{bestGnum} %{call_shared} %{no_archive} %{exact_version} \
%(netbsd_link_spec)"
+
+#define	MIPS_USE_GCC_DEFAULT_OUTPUT_SOURCE_FILENAME



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 20:41:04 UTC 2021

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

Log Message:
No need to pass interface attribute or locators to config_found().


To generate a diff of this commit:
cvs rdiff -u -r1.7.4.2 -r1.7.4.3 src/sys/dev/pci/mfii.c
cvs rdiff -u -r1.27.2.2 -r1.27.2.3 src/sys/dev/pci/mpii.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/mfii.c
diff -u src/sys/dev/pci/mfii.c:1.7.4.2 src/sys/dev/pci/mfii.c:1.7.4.3
--- src/sys/dev/pci/mfii.c:1.7.4.2	Mon Mar 22 16:23:45 2021
+++ src/sys/dev/pci/mfii.c	Sun Mar 28 20:41:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.7.4.2 2021/03/22 16:23:45 thorpej Exp $ */
+/* $NetBSD: mfii.c,v 1.7.4.3 2021/03/28 20:41:04 thorpej Exp $ */
 /* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.7.4.2 2021/03/22 16:23:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.7.4.3 2021/03/28 20:41:04 thorpej Exp $");
 
 #include "bio.h"
 
@@ -988,13 +988,11 @@ static int
 mfii_rescan(device_t self, const char *ifattr, const int *locators)
 {
 	struct mfii_softc *sc = device_private(self);
+
 	if (sc->sc_child != NULL)
 		return 0;
 
-	sc->sc_child = config_found(self, >sc_chan, scsiprint,
-	CFARG_IATTR, ifattr,
-	CFARG_LOCATORS, locators,
-	CFARG_EOL);
+	sc->sc_child = config_found(self, >sc_chan, scsiprint, CFARG_EOL);
 	return 0;
 }
 

Index: src/sys/dev/pci/mpii.c
diff -u src/sys/dev/pci/mpii.c:1.27.2.2 src/sys/dev/pci/mpii.c:1.27.2.3
--- src/sys/dev/pci/mpii.c:1.27.2.2	Mon Mar 22 16:23:45 2021
+++ src/sys/dev/pci/mpii.c	Sun Mar 28 20:41:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.27.2.2 2021/03/22 16:23:45 thorpej Exp $ */
+/* $NetBSD: mpii.c,v 1.27.2.3 2021/03/28 20:41:04 thorpej Exp $ */
 /*	$OpenBSD: mpii.c,v 1.115 2018/08/14 05:22:21 jmatthew Exp $	*/
 /*
  * Copyright (c) 2010, 2012 Mike Belopuhov
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.27.2.2 2021/03/22 16:23:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.27.2.3 2021/03/28 20:41:04 thorpej Exp $");
 
 #include "bio.h"
 
@@ -726,10 +726,7 @@ mpii_rescan(device_t self, const char *i
 	if (sc->sc_child != NULL)
 		return 0;
 
-	sc->sc_child = config_found(self, >sc_chan, scsiprint,
-	CFARG_IATTR, ifattr,
-	CFARG_LOCATORS, locators,
-	CFARG_EOL);
+	sc->sc_child = config_found(self, >sc_chan, scsiprint, CFARG_EOL);
 
 	return 0;
 }



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 20:40:30 UTC 2021

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

Log Message:
No need to pass interface attribute or locators to config_search().


To generate a diff of this commit:
cvs rdiff -u -r1.64.10.4 -r1.64.10.5 src/sys/dev/gpio/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/dev/gpio/gpio.c
diff -u src/sys/dev/gpio/gpio.c:1.64.10.4 src/sys/dev/gpio/gpio.c:1.64.10.5
--- src/sys/dev/gpio/gpio.c:1.64.10.4	Sun Mar 21 18:03:32 2021
+++ src/sys/dev/gpio/gpio.c	Sun Mar 28 20:40:30 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gpio.c,v 1.64.10.4 2021/03/21 18:03:32 thorpej Exp $ */
+/* $NetBSD: gpio.c,v 1.64.10.5 2021/03/28 20:40:30 thorpej Exp $ */
 /*	$OpenBSD: gpio.c,v 1.6 2006/01/14 12:33:49 grange Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.64.10.4 2021/03/21 18:03:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.64.10.5 2021/03/28 20:40:30 thorpej Exp $");
 
 /*
  * General Purpose Input/Output framework.
@@ -192,8 +192,6 @@ gpio_rescan(device_t self, const char *i
 
 	config_search(self, NULL,
 	CFARG_SUBMATCH, gpio_search,
-	CFARG_IATTR, ifattr,
-	CFARG_LOCATORS, locators,
 	CFARG_EOL);
 
 	return 0;



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 20:39:10 UTC 2021

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

Log Message:
- Unwrap a line.
- No need to be explcit about interface attribute.


To generate a diff of this commit:
cvs rdiff -u -r1.94.70.2 -r1.94.70.3 src/sys/dev/pcmcia/pcmcia.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/pcmcia/pcmcia.c
diff -u src/sys/dev/pcmcia/pcmcia.c:1.94.70.2 src/sys/dev/pcmcia/pcmcia.c:1.94.70.3
--- src/sys/dev/pcmcia/pcmcia.c:1.94.70.2	Mon Mar 22 16:23:46 2021
+++ src/sys/dev/pcmcia/pcmcia.c	Sun Mar 28 20:39:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcmcia.c,v 1.94.70.2 2021/03/22 16:23:46 thorpej Exp $	*/
+/*	$NetBSD: pcmcia.c,v 1.94.70.3 2021/03/28 20:39:10 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2004 Charles M. Hannum.  All rights reserved.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcmcia.c,v 1.94.70.2 2021/03/22 16:23:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcmcia.c,v 1.94.70.3 2021/03/28 20:39:10 thorpej Exp $");
 
 #include "opt_pcmciaverbose.h"
 
@@ -214,8 +214,7 @@ done:
 }
 
 int
-pcmcia_rescan(device_t self, const char *ifattr,
-const int *locators)
+pcmcia_rescan(device_t self, const char *ifattr, const int *locators)
 {
 	struct pcmcia_softc *sc = device_private(self);
 	struct pcmcia_function *pf;
@@ -248,7 +247,6 @@ pcmcia_rescan(device_t self, const char 
 
 		pf->child = config_found(self, , pcmcia_print,
 		CFARG_SUBMATCH, config_stdsubmatch,
-		CFARG_IATTR, ifattr,
 		CFARG_LOCATORS, locs,
 		CFARG_EOL);
 	}



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 20:38:47 UTC 2021

Modified Files:
src/sys/dev/scsipi [thorpej-cfargs]: scsiconf.c

Log Message:
Unwrap a line.


To generate a diff of this commit:
cvs rdiff -u -r1.290.4.2 -r1.290.4.3 src/sys/dev/scsipi/scsiconf.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/scsipi/scsiconf.c
diff -u src/sys/dev/scsipi/scsiconf.c:1.290.4.2 src/sys/dev/scsipi/scsiconf.c:1.290.4.3
--- src/sys/dev/scsipi/scsiconf.c:1.290.4.2	Sun Mar 21 17:35:49 2021
+++ src/sys/dev/scsipi/scsiconf.c	Sun Mar 28 20:38:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsiconf.c,v 1.290.4.2 2021/03/21 17:35:49 thorpej Exp $	*/
+/*	$NetBSD: scsiconf.c,v 1.290.4.3 2021/03/28 20:38:47 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.290.4.2 2021/03/21 17:35:49 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.290.4.3 2021/03/28 20:38:47 thorpej Exp $");
 
 #include 
 #include 
@@ -433,8 +433,7 @@ ret:
 }
 
 static int
-scsibusrescan(device_t sc, const char *ifattr,
-const int *locators)
+scsibusrescan(device_t sc, const char *ifattr, const int *locators)
 {
 
 	KASSERT(ifattr && !strcmp(ifattr, "scsibus"));



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 20:38:04 UTC 2021

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

Log Message:
Correct the names of the arguments passed to the rescan function.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.14.1 src/sys/dev/pci/mlx_pci.c
cvs rdiff -u -r1.108.10.2 -r1.108.10.3 src/sys/dev/pci/twe.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/mlx_pci.c
diff -u src/sys/dev/pci/mlx_pci.c:1.27 src/sys/dev/pci/mlx_pci.c:1.27.14.1
--- src/sys/dev/pci/mlx_pci.c:1.27	Sun Dec  9 11:14:02 2018
+++ src/sys/dev/pci/mlx_pci.c	Sun Mar 28 20:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mlx_pci.c,v 1.27 2018/12/09 11:14:02 jdolecek Exp $	*/
+/*	$NetBSD: mlx_pci.c,v 1.27.14.1 2021/03/28 20:38:04 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mlx_pci.c,v 1.27 2018/12/09 11:14:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mlx_pci.c,v 1.27.14.1 2021/03/28 20:38:04 thorpej Exp $");
 
 #include 
 #include 
@@ -145,7 +145,7 @@ static struct mlx_pci_ident {
 };
 
 static int
-mlx_pci_rescan(device_t self, const char *attr, const int *flag)
+mlx_pci_rescan(device_t self, const char *ifattr, const int *locs)
 {
 
 	return mlx_configure(device_private(self), 1);

Index: src/sys/dev/pci/twe.c
diff -u src/sys/dev/pci/twe.c:1.108.10.2 src/sys/dev/pci/twe.c:1.108.10.3
--- src/sys/dev/pci/twe.c:1.108.10.2	Mon Mar 22 16:23:46 2021
+++ src/sys/dev/pci/twe.c	Sun Mar 28 20:38:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: twe.c,v 1.108.10.2 2021/03/22 16:23:46 thorpej Exp $	*/
+/*	$NetBSD: twe.c,v 1.108.10.3 2021/03/28 20:38:04 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.108.10.2 2021/03/22 16:23:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.108.10.3 2021/03/28 20:38:04 thorpej Exp $");
 
 #include 
 #include 
@@ -451,7 +451,7 @@ twe_attach(device_t parent, device_t sel
 	twe_describe_controller(sc);
 
 	/* Find and attach RAID array units. */
-	twe_rescan(self, "twe", 0);
+	twe_rescan(self, NULL, NULL);
 
 	/* ...and finally, enable interrupts. */
 	twe_outl(sc, TWE_REG_CTL, TWE_CTL_CLEAR_ATTN_INTR |
@@ -482,7 +482,7 @@ twe_attach(device_t parent, device_t sel
 }
 
 static int
-twe_rescan(device_t self, const char *attr, const int *flags)
+twe_rescan(device_t self, const char *ifattr, const int *locs)
 {
 	struct twe_softc *sc;
 	int i;



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 20:36:40 UTC 2021

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

Log Message:
Correct the names of the arguments passed to the rescan function.


To generate a diff of this commit:
cvs rdiff -u -r1.65.10.2 -r1.65.10.3 src/sys/dev/pci/amr.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/amr.c
diff -u src/sys/dev/pci/amr.c:1.65.10.2 src/sys/dev/pci/amr.c:1.65.10.3
--- src/sys/dev/pci/amr.c:1.65.10.2	Mon Mar 22 16:23:45 2021
+++ src/sys/dev/pci/amr.c	Sun Mar 28 20:36:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: amr.c,v 1.65.10.2 2021/03/22 16:23:45 thorpej Exp $	*/
+/*	$NetBSD: amr.c,v 1.65.10.3 2021/03/28 20:36:40 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.65.10.2 2021/03/22 16:23:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.65.10.3 2021/03/28 20:36:40 thorpej Exp $");
 
 #include 
 #include 
@@ -511,7 +511,7 @@ amr_attach(device_t parent, device_t sel
 }
 
 static int
-amr_rescan(device_t self, const char *attr, const int *flags)
+amr_rescan(device_t self, const char *ifattr, const int *ulocs)
 {
 	int j;
 	int locs[AMRCF_NLOCS];
@@ -531,7 +531,7 @@ amr_rescan(device_t self, const char *at
 		amr->amr_drive[j].al_dv =
 		config_found(amr->amr_dv, , amr_print,
  CFARG_SUBMATCH, config_stdsubmatch,
- CFARG_IATTR, attr,
+ CFARG_IATTR, ifattr,
  CFARG_LOCATORS, locs,
  CFARG_EOL);
 	}



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 20:36:16 UTC 2021

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

Log Message:
Correct the names of the arguments passed to the rescan function.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.14.1 src/sys/dev/pci/aac_pci.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/aac_pci.c
diff -u src/sys/dev/pci/aac_pci.c:1.40 src/sys/dev/pci/aac_pci.c:1.40.14.1
--- src/sys/dev/pci/aac_pci.c:1.40	Sun Dec  9 11:14:01 2018
+++ src/sys/dev/pci/aac_pci.c	Sun Mar 28 20:36:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: aac_pci.c,v 1.40 2018/12/09 11:14:01 jdolecek Exp $	*/
+/*	$NetBSD: aac_pci.c,v 1.40.14.1 2021/03/28 20:36:16 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aac_pci.c,v 1.40 2018/12/09 11:14:01 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aac_pci.c,v 1.40.14.1 2021/03/28 20:36:16 thorpej Exp $");
 
 #include 
 #include 
@@ -617,7 +617,7 @@ aac_pci_attach(device_t parent, device_t
 
 /* ARGSUSED */
 static int
-aac_pci_rescan(device_t self, const char *attr, const int *flags)
+aac_pci_rescan(device_t self, const char *ifattr, const int *locs)
 {
 
 	return aac_devscan(device_private(self));



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 20:35:58 UTC 2021

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

Log Message:
lint: add assertions for aggregate initialization

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.173 src/usr.bin/xlint/lint1/init.c:1.174
--- src/usr.bin/xlint/lint1/init.c:1.173	Sun Mar 28 19:53:58 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 20:35:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.173 2021/03/28 19:53:58 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.174 2021/03/28 20:35:58 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.173 2021/03/28 19:53:58 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.174 2021/03/28 20:35:58 rillig Exp $");
 #endif
 
 #include 
@@ -535,6 +535,18 @@ brace_level_debug(const struct brace_lev
 #define brace_level_debug(level) do { } while (false)
 #endif
 
+static void
+brace_level_assert_struct_or_union(const struct brace_level *level)
+{
+	lint_assert(is_struct_or_union(level->bl_type->t_tspec));
+}
+
+static void
+brace_level_assert_array(const struct brace_level *level)
+{
+	lint_assert(level->bl_type->t_tspec == ARRAY);
+}
+
 static type_t *
 brace_level_subtype(struct brace_level *level)
 {
@@ -548,6 +560,8 @@ brace_level_subtype(struct brace_level *
 static void
 brace_level_set_array_dimension(struct brace_level *level, int dim)
 {
+	brace_level_assert_array(level);
+
 	debug_step("setting the array size to %d", dim);
 	level->bl_type->t_dim = dim;
 	debug_indent();
@@ -559,6 +573,7 @@ brace_level_next_member(struct brace_lev
 {
 	const sym_t *m;
 
+	brace_level_assert_struct_or_union(level);
 	do {
 		m = level->bl_next_member = level->bl_next_member->s_next;
 		/* XXX: can this assertion be made to fail? */
@@ -575,7 +590,7 @@ brace_level_look_up_member(const struct 
 	const type_t *tp = level->bl_type;
 	const sym_t *m;
 
-	lint_assert(is_struct_or_union(tp->t_tspec));
+	brace_level_assert_struct_or_union(level);
 
 	for (m = tp->t_str->sou_first_member; m != NULL; m = m->s_next) {
 		if (m->s_bitfield && m->s_name == unnamed)
@@ -613,6 +628,8 @@ brace_level_look_up_first_member_unnamed
 {
 	sym_t *m;
 
+	brace_level_assert_struct_or_union(level);
+
 	for (m = level->bl_type->t_str->sou_first_member;
 	 m != NULL; m = m->s_next) {
 		if (m->s_bitfield && m->s_name == unnamed)
@@ -632,6 +649,8 @@ brace_level_look_up_first_member_unnamed
 static bool
 brace_level_push_array(struct brace_level *level)
 {
+	brace_level_assert_array(level);
+
 	if (level->bl_enclosing->bl_seen_named_member) {
 		level->bl_brace = true;
 		debug_step("ARRAY, seen named member, needs closing brace");



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 20:35:57 UTC 2021

Modified Files:
src/sys/dev/isa [thorpej-cfargs]: pcppi.c

Log Message:
pcppi_scan(): No need to pass interface attribute or locators to
config_search().


To generate a diff of this commit:
cvs rdiff -u -r1.45.22.2 -r1.45.22.3 src/sys/dev/isa/pcppi.c

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

Modified files:

Index: src/sys/dev/isa/pcppi.c
diff -u src/sys/dev/isa/pcppi.c:1.45.22.2 src/sys/dev/isa/pcppi.c:1.45.22.3
--- src/sys/dev/isa/pcppi.c:1.45.22.2	Sun Mar 21 19:06:19 2021
+++ src/sys/dev/isa/pcppi.c	Sun Mar 28 20:35:57 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppi.c,v 1.45.22.2 2021/03/21 19:06:19 thorpej Exp $ */
+/* $NetBSD: pcppi.c,v 1.45.22.3 2021/03/28 20:35:57 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcppi.c,v 1.45.22.2 2021/03/21 19:06:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcppi.c,v 1.45.22.3 2021/03/28 20:35:57 thorpej Exp $");
 
 #include "attimer.h"
 
@@ -247,8 +247,6 @@ pcppi_rescan(device_t self, const char *
 
 	config_search(sc->sc_dv, ,
 	CFARG_SUBMATCH, pcppisearch,
-	CFARG_IATTR, ifattr,
-	CFARG_LOCATORS, locators,
 	CFARG_EOL);
 
 	return 0;



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 20:34:44 UTC 2021

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

Log Message:
- Use designated initializers for the wildcard[] array in isaattach().
- No need to be explicit about interface attribute.


To generate a diff of this commit:
cvs rdiff -u -r1.138.76.3 -r1.138.76.4 src/sys/dev/isa/isa.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/isa/isa.c
diff -u src/sys/dev/isa/isa.c:1.138.76.3 src/sys/dev/isa/isa.c:1.138.76.4
--- src/sys/dev/isa/isa.c:1.138.76.3	Mon Mar 22 16:23:45 2021
+++ src/sys/dev/isa/isa.c	Sun Mar 28 20:34:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa.c,v 1.138.76.3 2021/03/22 16:23:45 thorpej Exp $	*/
+/*	$NetBSD: isa.c,v 1.138.76.4 2021/03/28 20:34:44 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa.c,v 1.138.76.3 2021/03/22 16:23:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa.c,v 1.138.76.4 2021/03/28 20:34:44 thorpej Exp $");
 
 #include 
 #include 
@@ -86,9 +86,13 @@ isaattach(device_t parent, device_t self
 	struct isa_softc *sc = device_private(self);
 	struct isabus_attach_args *iba = aux;
 	static const int wildcard[ISACF_NLOCS] = {
-		ISACF_PORT_DEFAULT, ISACF_SIZE_DEFAULT,
-		ISACF_IOMEM_DEFAULT, ISACF_IOSIZ_DEFAULT,
-		ISACF_IRQ_DEFAULT, ISACF_DRQ_DEFAULT, ISACF_DRQ2_DEFAULT
+		[ISACF_PORT]  = ISACF_PORT_DEFAULT,
+		[ISACF_SIZE]  = ISACF_SIZE_DEFAULT,
+		[ISACF_IOMEM] = ISACF_IOMEM_DEFAULT,
+		[ISACF_IOSIZ] = ISACF_IOSIZ_DEFAULT,
+		[ISACF_IRQ]   = ISACF_IRQ_DEFAULT,
+		[ISACF_DRQ]   = ISACF_DRQ_DEFAULT,
+		[ISACF_DRQ2]  = ISACF_DRQ2_DEFAULT,
 	};
 
 	TAILQ_INIT(>sc_knowndevs);
@@ -132,7 +136,7 @@ isaattach(device_t parent, device_t self
 		isa_free_knowndevs(sc);
 
 	/* Attach all indirect-config children. */
-	isarescan(self, "isa", wildcard);
+	isarescan(self, NULL, wildcard);
 
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");
@@ -188,7 +192,6 @@ isarescan(device_t self, const char *ifa
 
 	config_search(self, NULL,
 	CFARG_SUBMATCH, isasearch,
-	CFARG_IATTR, ifattr,
 	CFARG_LOCATORS, locs,
 	CFARG_EOL);
 	return (0);



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 20:33:47 UTC 2021

Modified Files:
src/sys/dev/ic [thorpej-cfargs]: nvme.c

Log Message:
- In nvme_rescan(), pass the locators used for matching to config_found()
  and use config_stdsubmatch().
- No need to be explicit about interface attribute, because we carry
  only one.


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.1 -r1.54.2.2 src/sys/dev/ic/nvme.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/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.54.2.1 src/sys/dev/ic/nvme.c:1.54.2.2
--- src/sys/dev/ic/nvme.c:1.54.2.1	Sun Mar 21 21:09:12 2021
+++ src/sys/dev/ic/nvme.c	Sun Mar 28 20:33:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.54.2.1 2021/03/21 21:09:12 thorpej Exp $	*/
+/*	$NetBSD: nvme.c,v 1.54.2.2 2021/03/28 20:33:46 thorpej Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.54.2.1 2021/03/21 21:09:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.54.2.2 2021/03/28 20:33:46 thorpej Exp $");
 
 #include 
 #include 
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.5
 #include 
 
 #include "ioconf.h"
+#include "locators.h"
 
 #define	B4_CHK_RDY_DELAY_MS	2300	/* workaround controller bug */
 
@@ -447,7 +448,7 @@ nvme_attach(struct nvme_softc *sc)
 	/* probe subdevices */
 	sc->sc_namespaces = kmem_zalloc(sizeof(*sc->sc_namespaces) * sc->sc_nn,
 	KM_SLEEP);
-	nvme_rescan(sc->sc_dev, "nvme", );
+	nvme_rescan(sc->sc_dev, NULL, NULL);
 
 	return 0;
 
@@ -467,7 +468,7 @@ free_admin_q:
 }
 
 int
-nvme_rescan(device_t self, const char *attr, const int *flags)
+nvme_rescan(device_t self, const char *ifattr, const int *locs)
 {
 	struct nvme_softc *sc = device_private(self);
 	struct nvme_attach_args naa;
@@ -475,7 +476,7 @@ nvme_rescan(device_t self, const char *a
 	struct nvme_namespace *ns;
 	uint64_t cap;
 	int ioq_entries = nvme_ioq_size;
-	int i;
+	int i, mlocs[NVMECF_NLOCS];
 	int error;
 
 	cap = nvme_read8(sc, NVME_CAP);
@@ -511,13 +512,18 @@ nvme_rescan(device_t self, const char *a
 			continue;
 		}
 
+		mlocs[NVMECF_NSID] = i;
+
 		memset(, 0, sizeof(naa));
 		naa.naa_nsid = i;
 		naa.naa_qentries = (ioq_entries - 1) * sc->sc_nq;
 		naa.naa_maxphys = sc->sc_mdts;
 		naa.naa_typename = sc->sc_modelname;
-		sc->sc_namespaces[i - 1].dev = config_found(sc->sc_dev, ,
-		nvme_print, CFARG_EOL);
+		sc->sc_namespaces[i - 1].dev =
+		config_found(sc->sc_dev, , nvme_print,
+ CFARG_SUBMATCH, config_stdsubmatch,
+ CFARG_LOCATORS, mlocs,
+ CFARG_EOL);
 	}
 	return 0;
 }



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 20:31:05 UTC 2021

Modified Files:
src/sys/dev/ic [thorpej-cfargs]: mfi.c

Log Message:
No need to pass interface or locators to config_found() in mfi_rescan().


To generate a diff of this commit:
cvs rdiff -u -r1.63.10.2 -r1.63.10.3 src/sys/dev/ic/mfi.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/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.63.10.2 src/sys/dev/ic/mfi.c:1.63.10.3
--- src/sys/dev/ic/mfi.c:1.63.10.2	Mon Mar 22 16:23:45 2021
+++ src/sys/dev/ic/mfi.c	Sun Mar 28 20:31:05 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.63.10.2 2021/03/22 16:23:45 thorpej Exp $ */
+/* $NetBSD: mfi.c,v 1.63.10.3 2021/03/28 20:31:05 thorpej Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.63.10.2 2021/03/22 16:23:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.63.10.3 2021/03/28 20:31:05 thorpej Exp $");
 
 #include "bio.h"
 
@@ -909,10 +909,7 @@ mfi_rescan(device_t self, const char *if
 	if (sc->sc_child != NULL)
 		return 0;
 
-	sc->sc_child = config_found(self, >sc_chan, scsiprint,
-	CFARG_IATTR, ifattr,
-	CFARG_LOCATORS, locators,
-	CFARG_EOL);
+	sc->sc_child = config_found(self, >sc_chan, scsiprint, CFARG_EOL);
 
 	return 0;
 }



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 20:30:14 UTC 2021

Modified Files:
src/sys/dev/ic [thorpej-cfargs]: cac.c

Log Message:
Correct the names of the arguments passed to cac_rescan(), and update
a local variable to avoid a name collision.  Also, no need to be explcit
about our interface attribute, since we carry only one.


To generate a diff of this commit:
cvs rdiff -u -r1.61.10.2 -r1.61.10.3 src/sys/dev/ic/cac.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/ic/cac.c
diff -u src/sys/dev/ic/cac.c:1.61.10.2 src/sys/dev/ic/cac.c:1.61.10.3
--- src/sys/dev/ic/cac.c:1.61.10.2	Mon Mar 22 16:23:45 2021
+++ src/sys/dev/ic/cac.c	Sun Mar 28 20:30:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cac.c,v 1.61.10.2 2021/03/22 16:23:45 thorpej Exp $	*/
+/*	$NetBSD: cac.c,v 1.61.10.3 2021/03/28 20:30:14 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2006, 2007 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.61.10.2 2021/03/22 16:23:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.61.10.3 2021/03/28 20:30:14 thorpej Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "bio.h"
@@ -217,11 +217,11 @@ cac_init(struct cac_softc *sc, const cha
 }
 
 int
-cac_rescan(device_t self, const char *attr, const int *flags)
+cac_rescan(device_t self, const char *attr, const int *locs)
 {
 	struct cac_softc *sc;
 	struct cac_attach_args caca;
-	int locs[CACCF_NLOCS];
+	int mlocs[CACCF_NLOCS];
 	int i;
 
 	sc = device_private(self);
@@ -230,12 +230,11 @@ cac_rescan(device_t self, const char *at
 			continue;
 		caca.caca_unit = i;
 
-		locs[CACCF_UNIT] = i;
+		mlocs[CACCF_UNIT] = i;
 
 		if (config_found(self, , cac_print,
  CFARG_SUBMATCH, config_stdsubmatch,
- CFARG_IATTR, attr,
- CFARG_LOCATORS, locs,
+ CFARG_LOCATORS, mlocs,
  CFARG_EOL) != NULL)
 			sc->sc_unitmask |= 1 << i;
 	}



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 20:25:44 UTC 2021

Modified Files:
src/sys/dev/ic [thorpej-cfargs]: apple_smc.c

Log Message:
This driver only has a single interface attribute, so no need to be expicit
about it.  That interface attribute has no locators, so don't pass them
to config_search().


To generate a diff of this commit:
cvs rdiff -u -r1.6.50.1 -r1.6.50.2 src/sys/dev/ic/apple_smc.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/ic/apple_smc.c
diff -u src/sys/dev/ic/apple_smc.c:1.6.50.1 src/sys/dev/ic/apple_smc.c:1.6.50.2
--- src/sys/dev/ic/apple_smc.c:1.6.50.1	Sat Mar 20 19:33:40 2021
+++ src/sys/dev/ic/apple_smc.c	Sun Mar 28 20:25:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: apple_smc.c,v 1.6.50.1 2021/03/20 19:33:40 thorpej Exp $	*/
+/*	$NetBSD: apple_smc.c,v 1.6.50.2 2021/03/28 20:25:44 thorpej Exp $	*/
 
 /*
  * Apple System Management Controller
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apple_smc.c,v 1.6.50.1 2021/03/20 19:33:40 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apple_smc.c,v 1.6.50.2 2021/03/28 20:25:44 thorpej Exp $");
 
 #include 
 #include 
@@ -81,7 +81,7 @@ apple_smc_attach(struct apple_smc_tag *s
 #endif
 
 	/* Attach any children.  */
-(void)apple_smc_rescan(smc, APPLE_SMC_BUS, NULL);
+(void)apple_smc_rescan(smc, NULL, NULL);
 }
 
 int
@@ -110,8 +110,6 @@ apple_smc_rescan(struct apple_smc_tag *s
 	/* Let autoconf(9) do the work of finding new children.  */
 	config_search(smc->smc_dev, smc,
 	CFARG_SUBMATCH, apple_smc_search,
-	CFARG_IATTR, APPLE_SMC_BUS,
-	CFARG_LOCATORS, locators,
 	CFARG_EOL);
 	return 0;
 }



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 20:02:29 UTC 2021

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

Log Message:
"iic" only has a single interface attribute, so no need to be explicit.


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

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

Modified files:

Index: src/sys/dev/i2c/i2c.c
diff -u src/sys/dev/i2c/i2c.c:1.77.2.4 src/sys/dev/i2c/i2c.c:1.77.2.5
--- src/sys/dev/i2c/i2c.c:1.77.2.4	Mon Mar 22 16:23:44 2021
+++ src/sys/dev/i2c/i2c.c	Sun Mar 28 20:02:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2c.c,v 1.77.2.4 2021/03/22 16:23:44 thorpej Exp $	*/
+/*	$NetBSD: i2c.c,v 1.77.2.5 2021/03/28 20:02:29 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.77.2.4 2021/03/22 16:23:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.77.2.5 2021/03/28 20:02:29 thorpej Exp $");
 
 #include 
 #include 
@@ -382,7 +382,6 @@ iic_rescan(device_t self, const char *if
 {
 	config_search(self, NULL,
 	CFARG_SUBMATCH, iic_search,
-	CFARG_IATTR, ifattr,
 	CFARG_LOCATORS, locators,
 	CFARG_EOL);
 	return 0;



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 19:57:51 UTC 2021

Modified Files:
src/sys/dev/eisa [thorpej-cfargs]: mlx_eisa.c

Log Message:
Correct names of arguments passed to rescan function.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.2.1 src/sys/dev/eisa/mlx_eisa.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/eisa/mlx_eisa.c
diff -u src/sys/dev/eisa/mlx_eisa.c:1.27 src/sys/dev/eisa/mlx_eisa.c:1.27.2.1
--- src/sys/dev/eisa/mlx_eisa.c:1.27	Wed Jan 27 04:35:15 2021
+++ src/sys/dev/eisa/mlx_eisa.c	Sun Mar 28 19:57:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mlx_eisa.c,v 1.27 2021/01/27 04:35:15 thorpej Exp $	*/
+/*	$NetBSD: mlx_eisa.c,v 1.27.2.1 2021/03/28 19:57:50 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mlx_eisa.c,v 1.27 2021/01/27 04:35:15 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mlx_eisa.c,v 1.27.2.1 2021/03/28 19:57:50 thorpej Exp $");
 
 #include 
 #include 
@@ -190,7 +190,7 @@ mlx_eisa_attach(device_t parent, device_
 }
 
 static int
-mlx_eisa_rescan(device_t self, const char *attr, const int *flag)
+mlx_eisa_rescan(device_t self, const char *ifattr, const int *locs)
 {
 
 	return mlx_configure(device_private(self), 1);



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 19:55:37 UTC 2021

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

Log Message:
audio only has one interface attribute, so no need to be explcit about it.
audio also doesn't have locators, so don't pass any to config_search().


To generate a diff of this commit:
cvs rdiff -u -r1.91.2.3 -r1.91.2.4 src/sys/dev/audio/audio.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.91.2.3 src/sys/dev/audio/audio.c:1.91.2.4
--- src/sys/dev/audio/audio.c:1.91.2.3	Sun Mar 21 21:09:09 2021
+++ src/sys/dev/audio/audio.c	Sun Mar 28 19:55:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.91.2.3 2021/03/21 21:09:09 thorpej Exp $	*/
+/*	$NetBSD: audio.c,v 1.91.2.4 2021/03/28 19:55:37 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.91.2.3 2021/03/21 21:09:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.91.2.4 2021/03/28 19:55:37 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -,7 +,7 @@ audioattach(device_t parent, device_t se
 	audio_mlog_init();
 #endif
 
-	audiorescan(self, "audio", NULL);
+	audiorescan(self, NULL, NULL);
 	sc->sc_exlock = 0;
 	return;
 
@@ -1416,8 +1416,6 @@ audiorescan(device_t self, const char *i
 
 	config_search(sc->sc_dev, NULL,
 	CFARG_SUBMATCH, audiosearch,
-	CFARG_IATTR, ifattr,
-	CFARG_LOCATORS, locators,
 	CFARG_EOL);
 
 	return 0;



CVS commit: src

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 19:53:58 UTC 2021

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

Log Message:
lint: add test for assertion failure in initialization

The 'cnt = level->bl_type->t_tspec == STRUCT ? 2 : 1;' in
initialization_push_struct_or_union is obviously wrong since not every
struct has exactly 1 remaining member after the first member that has an
initializer with designation.

This bug started its life in init.c 1.12 from 2002-10-21, a little over
18 years ago.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tests/usr.bin/xlint/lint1/d_c99_init.c
cvs rdiff -u -r1.172 -r1.173 src/usr.bin/xlint/lint1/init.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/d_c99_init.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.18 src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.19
--- src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.18	Sun Mar 28 18:48:32 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_init.c	Sun Mar 28 19:53:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_c99_init.c,v 1.18 2021/03/28 18:48:32 rillig Exp $	*/
+/*	$NetBSD: d_c99_init.c,v 1.19 2021/03/28 19:53:58 rillig Exp $	*/
 # 3 "d_c99_init.c"
 
 /*
@@ -243,3 +243,24 @@ char message_with_suffix[] = {
 	/* expect+1: too many array initializers */
 	'\n',
 };
+
+struct ten {
+	int i0;
+	int i1;
+	int i2;
+	int i3;
+	int i4;
+	int i5;
+	int i6;
+	int i7;
+	int i8;
+	int i9;
+};
+
+struct ten ten = {
+	.i3 = 3,
+	4,
+	// FIXME: assertion "level->bl_type->t_tspec == ARRAY" failed in brace_level_extend_if_array_of_unknown_size
+	// 5,
+	// 6,
+};

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.172 src/usr.bin/xlint/lint1/init.c:1.173
--- src/usr.bin/xlint/lint1/init.c:1.172	Sun Mar 28 19:30:08 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 19:53:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.172 2021/03/28 19:30:08 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.173 2021/03/28 19:53:58 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.172 2021/03/28 19:30:08 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.173 2021/03/28 19:53:58 rillig Exp $");
 #endif
 
 #include 
@@ -589,8 +589,8 @@ brace_level_look_up_member(const struct 
 
 /* TODO: merge duplicate code */
 static sym_t *
-brace_level_look_up_member_named(struct brace_level *level, const char *name,
- int *count)
+brace_level_look_up_first_member_named(struct brace_level *level,
+   const char *name, int *count)
 {
 	sym_t *m;
 
@@ -609,7 +609,7 @@ brace_level_look_up_member_named(struct 
 
 /* TODO: merge duplicate code */
 static sym_t *
-brace_level_look_up_member_unnamed(struct brace_level *level, int *count)
+brace_level_look_up_first_member_unnamed(struct brace_level *level, int *count)
 {
 	sym_t *m;
 
@@ -830,10 +830,10 @@ initialization_push_struct_or_union(stru
 	level->bl_seen_named_member ? ", seen named member" : "");
 
 	if (in->designation.head != NULL)
-		m = brace_level_look_up_member_named(level,
+		m = brace_level_look_up_first_member_named(level,
 		in->designation.head->name, );
 	else
-		m = brace_level_look_up_member_unnamed(level, );
+		m = brace_level_look_up_first_member_unnamed(level, );
 
 	if (in->designation.head != NULL) {
 		if (m == NULL) {



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 19:53:09 UTC 2021

Modified Files:
src/sys/dev/ata [thorpej-cfargs]: ata_raid.c

Log Message:
Correct names of arguments passed to rescan function.


To generate a diff of this commit:
cvs rdiff -u -r1.43.4.2 -r1.43.4.3 src/sys/dev/ata/ata_raid.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/ata/ata_raid.c
diff -u src/sys/dev/ata/ata_raid.c:1.43.4.2 src/sys/dev/ata/ata_raid.c:1.43.4.3
--- src/sys/dev/ata/ata_raid.c:1.43.4.2	Mon Mar 22 16:23:44 2021
+++ src/sys/dev/ata/ata_raid.c	Sun Mar 28 19:53:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata_raid.c,v 1.43.4.2 2021/03/22 16:23:44 thorpej Exp $	*/
+/*	$NetBSD: ata_raid.c,v 1.43.4.3 2021/03/28 19:53:09 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.43.4.2 2021/03/22 16:23:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.43.4.3 2021/03/28 19:53:09 thorpej Exp $");
 
 #include 
 #include 
@@ -114,7 +114,7 @@ ataraidattach(int count)
 
 /* ARGSUSED */
 static int
-ataraid_rescan(device_t self, const char *attr, const int *flags)
+ataraid_rescan(device_t self, const char *ifattr, const int *locs)
 {
 
 	finalize_done = 0;



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 19:50:05 UTC 2021

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

Log Message:
"" is not a valid interface attribute, so don't pass it to spkr_rescan()
(luckily it wasn't used anyway).


To generate a diff of this commit:
cvs rdiff -u -r1.17.14.1 -r1.17.14.2 src/sys/dev/spkr.c

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

Modified files:

Index: src/sys/dev/spkr.c
diff -u src/sys/dev/spkr.c:1.17.14.1 src/sys/dev/spkr.c:1.17.14.2
--- src/sys/dev/spkr.c:1.17.14.1	Sun Mar 21 21:09:09 2021
+++ src/sys/dev/spkr.c	Sun Mar 28 19:50:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: spkr.c,v 1.17.14.1 2021/03/21 21:09:09 thorpej Exp $	*/
+/*	$NetBSD: spkr.c,v 1.17.14.2 2021/03/28 19:50:05 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1990 Eric S. Raymond (e...@snark.thyrsus.com)
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.17.14.1 2021/03/21 21:09:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.17.14.2 2021/03/28 19:50:05 thorpej Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "wsmux.h"
@@ -375,7 +375,7 @@ spkr_attach(device_t self, void (*tone)(
 	sc->sc_inbuf = NULL;
 	sc->sc_wsbelldev = NULL;
 
-	spkr_rescan(self, "", NULL);
+	spkr_rescan(self, NULL, NULL);
 }
 
 int



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

2021-03-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 28 19:42:59 UTC 2021

Modified Files:
src/sys/arch/x86/pci/imcsmb [thorpej-cfargs]: imc.c imcsmb.c

Log Message:
- The third argument passed to the rescan function is a locs array, not
  a pointer to flags.
- imc and imcsmb each carry only a single interface attribute, so no
  need to be explicit.


To generate a diff of this commit:
cvs rdiff -u -r1.2.16.1 -r1.2.16.2 src/sys/arch/x86/pci/imcsmb/imc.c
cvs rdiff -u -r1.3.10.1 -r1.3.10.2 src/sys/arch/x86/pci/imcsmb/imcsmb.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/x86/pci/imcsmb/imc.c
diff -u src/sys/arch/x86/pci/imcsmb/imc.c:1.2.16.1 src/sys/arch/x86/pci/imcsmb/imc.c:1.2.16.2
--- src/sys/arch/x86/pci/imcsmb/imc.c:1.2.16.1	Tue Mar 23 07:14:51 2021
+++ src/sys/arch/x86/pci/imcsmb/imc.c	Sun Mar 28 19:42:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: imc.c,v 1.2.16.1 2021/03/23 07:14:51 thorpej Exp $ */
+/* $NetBSD: imc.c,v 1.2.16.2 2021/03/28 19:42:59 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.2.16.1 2021/03/23 07:14:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.2.16.2 2021/03/28 19:42:59 thorpej Exp $");
 
 #include 
 #include 
@@ -206,7 +206,7 @@ imc_attach(device_t parent, device_t sel
 {
 	struct imc_softc *sc = device_private(self);
 	struct pci_attach_args *pa = aux;
-	int flags, i;
+	int i;
 
 	sc->sc_dev = self;
 	sc->sc_pci_tag = pa->pa_tag;
@@ -222,22 +222,19 @@ imc_attach(device_t parent, device_t sel
 		}
 	}
 
-	flags = 0;
-
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");
 
-	imc_rescan(self, "imc", );
+	imc_rescan(self, NULL, NULL);
 }
 
 /* Create the imcsmbX children */
 
 static int
-imc_rescan(device_t self, const char * ifattr, const int *flags)
+imc_rescan(device_t self, const char *ifattr, const int *locs)
 {
 	struct imc_softc *sc = device_private(self);
 	struct imc_attach_args imca;
-	device_t child;
 	int unit;
 
 	for (unit = 0; unit < 2; unit++) {
@@ -248,13 +245,8 @@ imc_rescan(device_t self, const char * i
 		imca.ia_regs = _regs[unit];
 		imca.ia_pci_tag = sc->sc_pci_tag;
 		imca.ia_pci_chipset_tag = sc->sc_pci_chipset_tag;
-		child = config_found(self, , NULL, CFARG_EOL);
-
-		if (child == NULL) {
-			aprint_debug_dev(self, "Child %d imcsmb not added\n",
-			unit);
-		}
-		sc->sc_smbchild[unit] = child;
+		sc->sc_smbchild[unit] =
+		config_found(self, , NULL, CFARG_EOL);
 	}
 
 	return 0;

Index: src/sys/arch/x86/pci/imcsmb/imcsmb.c
diff -u src/sys/arch/x86/pci/imcsmb/imcsmb.c:1.3.10.1 src/sys/arch/x86/pci/imcsmb/imcsmb.c:1.3.10.2
--- src/sys/arch/x86/pci/imcsmb/imcsmb.c:1.3.10.1	Tue Mar 23 01:29:32 2021
+++ src/sys/arch/x86/pci/imcsmb/imcsmb.c	Sun Mar 28 19:42:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: imcsmb.c,v 1.3.10.1 2021/03/23 01:29:32 thorpej Exp $ */
+/* $NetBSD: imcsmb.c,v 1.3.10.2 2021/03/28 19:42:59 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imcsmb.c,v 1.3.10.1 2021/03/23 01:29:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imcsmb.c,v 1.3.10.2 2021/03/28 19:42:59 thorpej Exp $");
 
 #include 
 #include 
@@ -138,7 +138,7 @@ imcsmb_attach(device_t parent, device_t 
 }
 
 static int
-imcsmb_rescan(device_t self, const char *ifattr, const int *flags)
+imcsmb_rescan(device_t self, const char *ifattr, const int *locs)
 {
 	struct imcsmb_softc *sc = device_private(self);
 	struct i2cbus_attach_args iba;
@@ -155,7 +155,7 @@ imcsmb_rescan(device_t self, const char 
 
 	memset(, 0, sizeof(iba));
 	iba.iba_tag = >sc_i2c_tag;
-	sc->sc_smbus = config_found_ia(self, ifattr, , iicbus_print);
+	sc->sc_smbus = config_found(self, , iicbus_print, CFARG_EOL);
 
 	if (sc->sc_smbus == NULL) {
 		aprint_normal_dev(self, "no child found\n");



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 19:30:08 UTC 2021

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

Log Message:
lint: split complicated function for looking up struct members

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.171 src/usr.bin/xlint/lint1/init.c:1.172
--- src/usr.bin/xlint/lint1/init.c:1.171	Sun Mar 28 18:33:27 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 19:30:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.171 2021/03/28 18:33:27 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.172 2021/03/28 19:30:08 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.171 2021/03/28 18:33:27 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.172 2021/03/28 19:30:08 rillig Exp $");
 #endif
 
 #include 
@@ -589,8 +589,8 @@ brace_level_look_up_member(const struct 
 
 /* TODO: merge duplicate code */
 static sym_t *
-brace_level_look_up_member_bloated(struct brace_level *level,
-			   const struct designator *dr, int *count)
+brace_level_look_up_member_named(struct brace_level *level, const char *name,
+ int *count)
 {
 	sym_t *m;
 
@@ -598,25 +598,25 @@ brace_level_look_up_member_bloated(struc
 	 m != NULL; m = m->s_next) {
 		if (m->s_bitfield && m->s_name == unnamed)
 			continue;
-		/*
-		 * TODO: split into separate functions:
-		 *
-		 * look_up_array_next
-		 * look_up_array_designator
-		 * look_up_struct_next
-		 * look_up_struct_designator
-		 */
-		if (dr != NULL) {
-			/* XXX: this log entry looks unnecessarily verbose */
-			debug_step("have member '%s', want member '%s'",
-			m->s_name, dr->name);
-			if (strcmp(m->s_name, dr->name) == 0) {
-(*count)++;
-break;
-			} else
-continue;
-		}
+		if (strcmp(m->s_name, name) != 0)
+			continue;
+		(*count)++;
+		break;
+	}
 
+	return m;
+}
+
+/* TODO: merge duplicate code */
+static sym_t *
+brace_level_look_up_member_unnamed(struct brace_level *level, int *count)
+{
+	sym_t *m;
+
+	for (m = level->bl_type->t_str->sou_first_member;
+	 m != NULL; m = m->s_next) {
+		if (m->s_bitfield && m->s_name == unnamed)
+			continue;
 		/* XXX: What is this code for? */
 		if (++(*count) == 1) {
 			level->bl_next_member = m;
@@ -812,10 +812,6 @@ initialization_set_error(struct initiali
 static bool
 initialization_push_struct_or_union(struct initialization *in)
 {
-	/*
-	 * TODO: remove unnecessary 'const' for variables in functions that
-	 * fit on a single screen.  Keep it for larger functions.
-	 */
 	struct brace_level *level = in->brace_level;
 	int cnt;
 	sym_t *m;
@@ -833,8 +829,11 @@ initialization_push_struct_or_union(stru
 	type_name(level->bl_type),
 	level->bl_seen_named_member ? ", seen named member" : "");
 
-	m = brace_level_look_up_member_bloated(level,
-	in->designation.head, );
+	if (in->designation.head != NULL)
+		m = brace_level_look_up_member_named(level,
+		in->designation.head->name, );
+	else
+		m = brace_level_look_up_member_unnamed(level, );
 
 	if (in->designation.head != NULL) {
 		if (m == NULL) {



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 18:48:32 UTC 2021

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

Log Message:
tests/lint: add tests for initialization


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/usr.bin/xlint/lint1/d_c99_init.c
cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/d_c99_init.exp

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/d_c99_init.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.17 src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.18
--- src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.17	Sun Mar 28 14:01:50 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_init.c	Sun Mar 28 18:48:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_c99_init.c,v 1.17 2021/03/28 14:01:50 rillig Exp $	*/
+/*	$NetBSD: d_c99_init.c,v 1.18 2021/03/28 18:48:32 rillig Exp $	*/
 # 3 "d_c99_init.c"
 
 /*
@@ -34,6 +34,9 @@ struct_initialization_via_assignment(any
 
 // See init_using_expr, initstack_string.
 char static_duration[] = "static duration";
+signed char static_duration_signed[] = "static duration";
+unsigned char static_duration_unsigned[] = "static duration";
+int static_duration_wchar[] = L"static duration";
 
 // See init_using_expr.
 void
@@ -44,13 +47,25 @@ initialization_by_braced_string(void)
 }
 
 void
-initialization_with_redundant_braces(any arg)
+initialization_by_redundantly_braced_string(void)
+{
+	any local =  "hello" ;
+	use();
+}
+
+/*
+ * Only scalar expressions and string literals may be enclosed by additional
+ * braces.  Since 'arg' is a struct, this is a compile-time error.
+ */
+void
+initialization_with_too_many_braces(any arg)
 {
 	any local = { arg };	/* expect: 185 */
 	use();
 }
 
-// Some of the following examples are mentioned in init.c.
+// Some of the following examples are mentioned in the introduction comment
+// in init.c.
 
 int number = 12345;
 
@@ -217,4 +232,14 @@ struct ends_with_unnamed_bit_field {
 	23456,
 };
 
-// See d_struct_init_nested.c for a more complicated example.
+char prefixed_message[] = {
+	'E', ':', ' ',
+	/* expect+1: illegal combination of integer (char) and pointer */
+	"message\n",
+};
+
+char message_with_suffix[] = {
+	"message",
+	/* expect+1: too many array initializers */
+	'\n',
+};

Index: src/tests/usr.bin/xlint/lint1/d_c99_init.exp
diff -u src/tests/usr.bin/xlint/lint1/d_c99_init.exp:1.13 src/tests/usr.bin/xlint/lint1/d_c99_init.exp:1.14
--- src/tests/usr.bin/xlint/lint1/d_c99_init.exp:1.13	Sun Mar 28 14:01:50 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_init.exp	Sun Mar 28 18:48:32 2021
@@ -1,5 +1,7 @@
 d_c99_init.c(23): error: too many initializers [174]
-d_c99_init.c(49): error: cannot initialize 'pointer to const void' from 'struct any' [185]
-d_c99_init.c(65): error: too many array initializers, expected 3 [173]
-d_c99_init.c(130): error: syntax error 'named member must only be used with struct/union' [249]
-d_c99_init.c(217): error: too many struct/union initializers [172]
+d_c99_init.c(63): error: cannot initialize 'pointer to const void' from 'struct any' [185]
+d_c99_init.c(80): error: too many array initializers, expected 3 [173]
+d_c99_init.c(145): error: syntax error 'named member must only be used with struct/union' [249]
+d_c99_init.c(232): error: too many struct/union initializers [172]
+d_c99_init.c(238): warning: illegal combination of integer (char) and pointer (pointer to char) [183]
+d_c99_init.c(244): error: too many array initializers, expected 8 [173]



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 18:33:27 UTC 2021

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

Log Message:
lint: inline variable in initialization_init_array_using_string

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.170 src/usr.bin/xlint/lint1/init.c:1.171
--- src/usr.bin/xlint/lint1/init.c:1.170	Sun Mar 28 18:28:22 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 18:33:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.170 2021/03/28 18:28:22 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.171 2021/03/28 18:33:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.170 2021/03/28 18:28:22 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.171 2021/03/28 18:33:27 rillig Exp $");
 #endif
 
 #include 
@@ -1179,7 +1179,6 @@ static bool
 initialization_init_array_using_string(struct initialization *in, tnode_t *tn)
 {
 	struct brace_level *level;
-	int	len;
 	strg_t	*strg;
 
 	if (tn->tn_op != STRING)
@@ -1213,12 +1212,9 @@ initialization_init_array_using_string(s
 	} else
 		goto nope;
 
-	/* Get length without trailing NUL character. */
-	len = strg->st_len;
-
 	if (level->bl_array_of_unknown_size) {
 		level->bl_array_of_unknown_size = false;
-		level->bl_type->t_dim = len + 1;
+		level->bl_type->t_dim = (int)(strg->st_len + 1);
 		setcomplete(level->bl_type, true);
 	} else {
 		/*
@@ -1226,7 +1222,7 @@ initialization_init_array_using_string(s
 		 * initialized
 		 */
 		/* XXX: double-check for off-by-one error */
-		if (level->bl_type->t_dim < len) {
+		if (level->bl_type->t_dim < (int)strg->st_len) {
 			/* non-null byte ignored in string initializer */
 			warning(187);
 		}



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 18:28:22 UTC 2021

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

Log Message:
lint: clean up initialization_init_array_using_string

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.169 src/usr.bin/xlint/lint1/init.c:1.170
--- src/usr.bin/xlint/lint1/init.c:1.169	Sun Mar 28 18:21:28 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 18:28:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.169 2021/03/28 18:21:28 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.170 2021/03/28 18:28:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.169 2021/03/28 18:21:28 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.170 2021/03/28 18:28:22 rillig Exp $");
 #endif
 
 #include 
@@ -1166,7 +1166,7 @@ is_string_array(const type_t *tp, tspec_
 {
 	tspec_t st;
 
-	if (tp->t_tspec != ARRAY)
+	if (tp == NULL || tp->t_tspec != ARRAY)
 		return false;
 	st = tp->t_subt->t_tspec;
 	return t == CHAR
@@ -1186,7 +1186,6 @@ initialization_init_array_using_string(s
 		return false;
 
 	debug_enter();
-	initialization_debug(in);
 
 	level = in->brace_level;
 	strg = tn->tn_string;
@@ -1195,42 +1194,24 @@ initialization_init_array_using_string(s
 	 * Check if we have an array type which can be initialized by
 	 * the string.
 	 */
-	if (level->bl_subtype != NULL && level->bl_subtype->t_tspec == ARRAY) {
+	if (is_string_array(level->bl_subtype, strg->st_tspec)) {
 		debug_step("subtype is an array");
-		if (!is_string_array(level->bl_subtype, strg->st_tspec)) {
-			debug_leave();
-			return false;
-		}
 
 		/* Put the array at top of stack */
 		initialization_push(in);
 		level = in->brace_level;
 
-		/* TODO: what if both bl_type and bl_subtype are ARRAY? */
-
-	} else if (level->bl_type != NULL && level->bl_type->t_tspec == ARRAY) {
+	} else if (is_string_array(level->bl_type, strg->st_tspec)) {
 		debug_step("type is an array");
-		if (!is_string_array(level->bl_type, strg->st_tspec)) {
-			debug_leave();
-			return false;
-		}
 
 		/*
-		 * TODO: is this really not needed in the branch above this
-		 * one?
-		 */
-		/*
 		 * If the array is already partly initialized, we are
 		 * wrong here.
 		 */
-		if (level->bl_remaining != level->bl_type->t_dim) {
-			debug_leave();
-			return false;
-		}
-	} else {
-		debug_leave();
-		return false;
-	}
+		if (level->bl_remaining != level->bl_type->t_dim)
+			goto nope;
+	} else
+		goto nope;
 
 	/* Get length without trailing NUL character. */
 	len = strg->st_len;
@@ -1263,6 +1244,9 @@ initialization_init_array_using_string(s
 	initialization_debug(in);
 	debug_leave();
 	return true;
+nope:
+	debug_leave();
+	return false;
 }
 
 /*



CVS commit: [netbsd-9] src/doc

2021-03-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 28 18:23:56 UTC 2021

Modified Files:
src/doc [netbsd-9]: CHANGES-9.2

Log Message:
Amment ticket #1237 for additional pullups


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.61 -r1.1.2.62 src/doc/CHANGES-9.2

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

Modified files:

Index: src/doc/CHANGES-9.2
diff -u src/doc/CHANGES-9.2:1.1.2.61 src/doc/CHANGES-9.2:1.1.2.62
--- src/doc/CHANGES-9.2:1.1.2.61	Sat Mar 27 14:38:15 2021
+++ src/doc/CHANGES-9.2	Sun Mar 28 18:23:56 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.61 2021/03/27 14:38:15 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.62 2021/03/28 18:23:56 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -2298,6 +2298,572 @@ crypto/external/bsd/openssl/dist/tools/c
 crypto/external/bsd/openssl/dist/util/libcrypto.num up to 1.1.1.10
 crypto/external/bsd/openssl/dist/util/mkrc.pl   up to 1.1.1.6
 crypto/external/bsd/openssl/dist/util/perl/TLSProxy/Message.pm up to 1.1.1.5
+crypto/external/bsd/openssl/include/openssl/opensslconf.h up to 1.9
+crypto/external/bsd/openssl/lib/libcrypto/crypto.inc up to 1.10
+crypto/external/bsd/openssl/lib/libcrypto/evp.inc up to 1.10
+crypto/external/bsd/openssl/lib/libcrypto/arch/aarch64/aesv8-armx.S up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/arch/aarch64/chacha-armv8.S up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/arch/aarch64/crypto.inc up to 1.5
+crypto/external/bsd/openssl/lib/libcrypto/arch/aarch64/poly1305-armv8.S up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/arch/aarch64/sha1-armv8.S up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/arch/aarch64/sha512-armv8.S up to 1.4
+crypto/external/bsd/openssl/lib/libcrypto/arch/alpha/crypto.inc up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/arch/arm/aesv8-armx.S up to 1.5
+crypto/external/bsd/openssl/lib/libcrypto/arch/arm/chacha-armv8.S up to 1.4
+crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc up to 1.11
+crypto/external/bsd/openssl/lib/libcrypto/arch/arm/ecp_nistz256-armv4.S up to 1.5
+crypto/external/bsd/openssl/lib/libcrypto/arch/arm/modes.inc up to 1.5
+crypto/external/bsd/openssl/lib/libcrypto/arch/arm/poly1305-armv8.S up to 1.4
+crypto/external/bsd/openssl/lib/libcrypto/arch/arm/sha1-armv8.S up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/arch/arm/sha512-armv8.S up to 1.5
+crypto/external/bsd/openssl/lib/libcrypto/arch/i386/crypto.inc up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/arch/mips/mips.S up to 1.4
+crypto/external/bsd/openssl/lib/libcrypto/arch/mips/mips64.S up to 1.5
+crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/crypto.inc up to 1.4
+crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/keccak1600p8-ppc.S up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/sha.inc up to 1.5
+crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/crypto.inc up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/keccak1600-ppc64.S up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/keccak1600p8-ppc.S up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/sha.inc up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/aes.inc up to 1.6
+crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/bn.inc up to 1.2
+crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/crypto.inc up to 1.13
+crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/modes.inc up to 1.4
+crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/crypto.inc up to 1.8
+crypto/external/bsd/openssl/lib/libcrypto/arch/vax/crypto.inc up to 1.4
+crypto/external/bsd/openssl/lib/libcrypto/arch/x86_64/crypto.inc up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/man/ADMISSIONS.3 up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/man/ASN1_INTEGER_get_int64.3 up to 1.4
+crypto/external/bsd/openssl/lib/libcrypto/man/ASN1_ITEM_lookup.3 up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/man/ASN1_OBJECT_new.3 up to 1.20
+crypto/external/bsd/openssl/lib/libcrypto/man/ASN1_STRING_TABLE_add.3 up to 1.3
+crypto/external/bsd/openssl/lib/libcrypto/man/ASN1_STRING_length.3 up to 1.20
+crypto/external/bsd/openssl/lib/libcrypto/man/ASN1_STRING_new.3 up to 1.20
+crypto/external/bsd/openssl/lib/libcrypto/man/ASN1_STRING_print_ex.3 up to 1.20
+crypto/external/bsd/openssl/lib/libcrypto/man/ASN1_TIME_set.3 up to 1.5
+crypto/external/bsd/openssl/lib/libcrypto/man/ASN1_TYPE_get.3 up to 1.4
+crypto/external/bsd/openssl/lib/libcrypto/man/ASN1_generate_nconf.3 up to 1.20
+crypto/external/bsd/openssl/lib/libcrypto/man/ASYNC_WAIT_CTX_new.3 up to 1.4
+crypto/external/bsd/openssl/lib/libcrypto/man/ASYNC_start_job.3 up to 1.4
+crypto/external/bsd/openssl/lib/libcrypto/man/BF_encrypt.3 up to 1.4
+crypto/external/bsd/openssl/lib/libcrypto/man/BIO_ADDR.3 up to 1.4
+crypto/external/bsd/openssl/lib/libcrypto/man/BIO_ADDRINFO.3 

CVS commit: [netbsd-9] src/crypto/external/bsd/openssl

2021-03-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 28 18:21:52 UTC 2021

Modified Files:
src/crypto/external/bsd/openssl/include/openssl [netbsd-9]:
opensslconf.h
src/crypto/external/bsd/openssl/lib/libcrypto [netbsd-9]: crypto.inc
evp.inc
src/crypto/external/bsd/openssl/lib/libcrypto/arch/aarch64 [netbsd-9]:
aesv8-armx.S chacha-armv8.S crypto.inc poly1305-armv8.S
sha1-armv8.S sha512-armv8.S
src/crypto/external/bsd/openssl/lib/libcrypto/arch/alpha [netbsd-9]:
crypto.inc
src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm [netbsd-9]:
aesv8-armx.S chacha-armv8.S crypto.inc ecp_nistz256-armv4.S
modes.inc poly1305-armv8.S sha1-armv8.S sha512-armv8.S
src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386 [netbsd-9]:
crypto.inc
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips [netbsd-9]:
mips.S mips64.S
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc [netbsd-9]:
crypto.inc keccak1600p8-ppc.S sha.inc
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64 [netbsd-9]:
crypto.inc keccak1600-ppc64.S keccak1600p8-ppc.S sha.inc
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc [netbsd-9]:
aes.inc bn.inc crypto.inc modes.inc
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64 [netbsd-9]:
crypto.inc
src/crypto/external/bsd/openssl/lib/libcrypto/arch/vax [netbsd-9]:
crypto.inc
src/crypto/external/bsd/openssl/lib/libcrypto/arch/x86_64 [netbsd-9]:
crypto.inc
src/crypto/external/bsd/openssl/lib/libcrypto/man [netbsd-9]:
ADMISSIONS.3 ASN1_INTEGER_get_int64.3 ASN1_ITEM_lookup.3
ASN1_OBJECT_new.3 ASN1_STRING_TABLE_add.3 ASN1_STRING_length.3
ASN1_STRING_new.3 ASN1_STRING_print_ex.3 ASN1_TIME_set.3
ASN1_TYPE_get.3 ASN1_generate_nconf.3 ASYNC_WAIT_CTX_new.3
ASYNC_start_job.3 BF_encrypt.3 BIO_ADDR.3 BIO_ADDRINFO.3
BIO_connect.3 BIO_ctrl.3 BIO_f_base64.3 BIO_f_buffer.3
BIO_f_cipher.3 BIO_f_md.3 BIO_f_null.3 BIO_f_ssl.3 BIO_find_type.3
BIO_get_data.3 BIO_get_ex_new_index.3 BIO_meth_new.3 BIO_new.3
BIO_new_CMS.3 BIO_parse_hostserv.3 BIO_printf.3 BIO_push.3
BIO_read.3 BIO_s_accept.3 BIO_s_bio.3 BIO_s_connect.3 BIO_s_fd.3
BIO_s_file.3 BIO_s_mem.3 BIO_s_null.3 BIO_s_socket.3
BIO_set_callback.3 BIO_should_retry.3 BN_BLINDING_new.3
BN_CTX_new.3 BN_CTX_start.3 BN_add.3 BN_add_word.3 BN_bn2bin.3
BN_cmp.3 BN_copy.3 BN_generate_prime.3 BN_mod_inverse.3
BN_mod_mul_montgomery.3 BN_mod_mul_reciprocal.3 BN_new.3
BN_num_bytes.3 BN_rand.3 BN_security_bits.3 BN_set_bit.3 BN_swap.3
BN_zero.3 BUF_MEM_new.3 CMS_add0_cert.3 CMS_add1_recipient_cert.3
CMS_add1_signer.3 CMS_compress.3 CMS_decrypt.3 CMS_encrypt.3
CMS_final.3 CMS_get0_RecipientInfos.3 CMS_get0_SignerInfos.3
CMS_get0_type.3 CMS_get1_ReceiptRequest.3 CMS_sign.3
CMS_sign_receipt.3 CMS_uncompress.3 CMS_verify.3
CMS_verify_receipt.3 CONF_modules_free.3 CONF_modules_load_file.3
CRYPTO_THREAD_run_once.3 CRYPTO_get_ex_new_index.3
CTLOG_STORE_get0_log_by_id.3 CTLOG_STORE_new.3 CTLOG_new.3
CT_POLICY_EVAL_CTX_new.3 DEFINE_STACK_OF.3 DES_random_key.3
DH_generate_key.3 DH_generate_parameters.3 DH_get0_pqg.3
DH_get_1024_160.3 DH_meth_new.3 DH_new.3 DH_new_by_nid.3
DH_set_method.3 DH_size.3 DSA_SIG_new.3 DSA_do_sign.3 DSA_dup_DH.3
DSA_generate_key.3 DSA_generate_parameters.3 DSA_get0_pqg.3
DSA_meth_new.3 DSA_new.3 DSA_set_method.3 DSA_sign.3 DSA_size.3
DTLS_get_data_mtu.3 DTLS_set_timer_cb.3 DTLSv1_listen.3
ECDSA_SIG_new.3 ECPKParameters_print.3 EC_GFp_simple_method.3
EC_GROUP_copy.3 EC_GROUP_new.3 EC_KEY_get_enc_flags.3 EC_KEY_new.3
EC_POINT_add.3 EC_POINT_new.3 ENGINE_add.3 ERR_GET_LIB.3
ERR_clear_error.3 ERR_error_string.3 ERR_get_error.3
ERR_load_crypto_strings.3 ERR_load_strings.3 ERR_print_errors.3
ERR_put_error.3 ERR_remove_state.3 ERR_set_mark.3 EVP_BytesToKey.3
EVP_CIPHER_CTX_get_cipher_data.3 EVP_CIPHER_meth_new.3
EVP_DigestInit.3 EVP_DigestSignInit.3 EVP_DigestVerifyInit.3
EVP_EncodeInit.3 EVP_EncryptInit.3 EVP_MD_meth_new.3 EVP_OpenInit.3
EVP_PKEY_ASN1_METHOD.3 EVP_PKEY_CTX_ctrl.3 EVP_PKEY_CTX_new.3
EVP_PKEY_CTX_set1_pbe_pass.3 EVP_PKEY_CTX_set_hkdf_md.3
EVP_PKEY_CTX_set_rsa_pss_keygen_md.3 EVP_PKEY_CTX_set_scrypt_N.3
EVP_PKEY_CTX_set_tls1_prf_md.3 EVP_PKEY_asn1_get_count.3
EVP_PKEY_cmp.3 EVP_PKEY_decrypt.3 

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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 18:21:29 UTC 2021

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

Log Message:
lint: clean up initialization_expr

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.168 src/usr.bin/xlint/lint1/init.c:1.169
--- src/usr.bin/xlint/lint1/init.c:1.168	Sun Mar 28 18:18:22 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 18:21:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.168 2021/03/28 18:18:22 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.169 2021/03/28 18:21:28 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.168 2021/03/28 18:18:22 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.169 2021/03/28 18:21:28 rillig Exp $");
 #endif
 
 #include 
@@ -1354,21 +1354,20 @@ initialization_expr(struct initializatio
 
 	if (initialization_init_array_using_string(in, tn)) {
 		debug_step("after initializing the string:");
-		/* XXX: why not clean up the initstack here already? */
-		goto done_initstack;
+		goto done_debug;
 	}
 
 	initialization_next_nobrace(in, tn);
 	if (in->initerr || tn == NULL)
-		goto done_initstack;
-
-	in->brace_level->bl_remaining--;
-	debug_step("%d elements remaining", in->brace_level->bl_remaining);
+		goto done_debug;
 
 	/* Using initsym here is better than nothing. */
 	check_init_expr(sclass, in->brace_level->bl_type, in->initsym, tn);
 
-done_initstack:
+	in->brace_level->bl_remaining--;
+	debug_step("%d elements remaining", in->brace_level->bl_remaining);
+
+done_debug:
 	initialization_debug(in);
 
 done:



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 18:18:22 UTC 2021

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

Log Message:
lint: extract duplicate code to is_string_array

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.167 src/usr.bin/xlint/lint1/init.c:1.168
--- src/usr.bin/xlint/lint1/init.c:1.167	Sun Mar 28 18:01:57 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 18:18:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.167 2021/03/28 18:01:57 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.168 2021/03/28 18:18:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.167 2021/03/28 18:01:57 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.168 2021/03/28 18:18:22 rillig Exp $");
 #endif
 
 #include 
@@ -1161,11 +1161,23 @@ initialization_add_designator_subscript(
 	debug_leave();
 }
 
+static bool
+is_string_array(const type_t *tp, tspec_t t)
+{
+	tspec_t st;
+
+	if (tp->t_tspec != ARRAY)
+		return false;
+	st = tp->t_subt->t_tspec;
+	return t == CHAR
+	? st == CHAR || st == UCHAR || st == SCHAR
+	: st == WCHAR;
+}
+
 /* Initialize a character array or wchar_t array with a string literal. */
 static bool
 initialization_init_array_using_string(struct initialization *in, tnode_t *tn)
 {
-	tspec_t	t;
 	struct brace_level *level;
 	int	len;
 	strg_t	*strg;
@@ -1184,15 +1196,11 @@ initialization_init_array_using_string(s
 	 * the string.
 	 */
 	if (level->bl_subtype != NULL && level->bl_subtype->t_tspec == ARRAY) {
-		debug_step("subt array");
-		t = level->bl_subtype->t_subt->t_tspec;
-		if (!((strg->st_tspec == CHAR &&
-		   (t == CHAR || t == UCHAR || t == SCHAR)) ||
-		  (strg->st_tspec == WCHAR && t == WCHAR))) {
+		debug_step("subtype is an array");
+		if (!is_string_array(level->bl_subtype, strg->st_tspec)) {
 			debug_leave();
 			return false;
 		}
-		/* XXX: duplicate code, see below */
 
 		/* Put the array at top of stack */
 		initialization_push(in);
@@ -1201,15 +1209,11 @@ initialization_init_array_using_string(s
 		/* TODO: what if both bl_type and bl_subtype are ARRAY? */
 
 	} else if (level->bl_type != NULL && level->bl_type->t_tspec == ARRAY) {
-		debug_step("type array");
-		t = level->bl_type->t_subt->t_tspec;
-		if (!((strg->st_tspec == CHAR &&
-		   (t == CHAR || t == UCHAR || t == SCHAR)) ||
-		  (strg->st_tspec == WCHAR && t == WCHAR))) {
+		debug_step("type is an array");
+		if (!is_string_array(level->bl_type, strg->st_tspec)) {
 			debug_leave();
 			return false;
 		}
-		/* XXX: duplicate code, see above */
 
 		/*
 		 * TODO: is this really not needed in the branch above this



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 18:01:57 UTC 2021

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

Log Message:
lint: add is_struct_or_union

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.166 src/usr.bin/xlint/lint1/init.c:1.167
--- src/usr.bin/xlint/lint1/init.c:1.166	Sun Mar 28 16:28:15 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 18:01:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.166 2021/03/28 16:28:15 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.167 2021/03/28 18:01:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.166 2021/03/28 16:28:15 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.167 2021/03/28 18:01:57 rillig Exp $");
 #endif
 
 #include 
@@ -321,6 +321,13 @@ debug_leave(const char *func)
 #endif
 
 
+static bool
+is_struct_or_union(tspec_t t)
+{
+	return t == STRUCT || t == UNION;
+}
+
+
 /* In traditional C, bit-fields can be initialized only by integer constants. */
 static void
 check_bit_field_init(const tnode_t *ln, tspec_t lt, tspec_t rt)
@@ -568,7 +575,7 @@ brace_level_look_up_member(const struct 
 	const type_t *tp = level->bl_type;
 	const sym_t *m;
 
-	lint_assert(tp->t_tspec == STRUCT || tp->t_tspec == UNION);
+	lint_assert(is_struct_or_union(tp->t_tspec));
 
 	for (m = tp->t_str->sou_first_member; m != NULL; m = m->s_next) {
 		if (m->s_bitfield && m->s_name == unnamed)
@@ -678,7 +685,7 @@ brace_level_check_too_many_initializers(
 	if (t == ARRAY) {
 		/* too many array initializers, expected %d */
 		error(173, level->bl_type->t_dim);
-	} else if (t == STRUCT || t == UNION) {
+	} else if (is_struct_or_union(t)) {
 		/* too many struct/union initializers */
 		error(172);
 	} else {
@@ -940,8 +947,7 @@ initialization_pop_item_named(struct ini
 	 */
 	debug_step("initializing named member '%s'", name);
 
-	if (level->bl_type->t_tspec != STRUCT &&
-	level->bl_type->t_tspec != UNION) {
+	if (!is_struct_or_union(level->bl_type->t_tspec)) {
 		/* syntax error '%s' */
 		error(249, "named member must only be used with struct/union");
 		initialization_set_error(in);



CVS commit: src/share/misc

2021-03-28 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sun Mar 28 17:52:09 UTC 2021

Modified Files:
src/share/misc: acronyms.comp

Log Message:
DRM


To generate a diff of this commit:
cvs rdiff -u -r1.321 -r1.322 src/share/misc/acronyms.comp

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

Modified files:

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.321 src/share/misc/acronyms.comp:1.322
--- src/share/misc/acronyms.comp:1.321	Fri Feb 12 08:56:04 2021
+++ src/share/misc/acronyms.comp	Sun Mar 28 17:52:09 2021
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.321 2021/02/12 08:56:04 leot Exp $
+$NetBSD: acronyms.comp,v 1.322 2021/03/28 17:52:09 nia Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -446,6 +446,7 @@ DRAM	dynamic random access memory
 DRBG	deterministic random bit generator
 DRI	direct rendering infrastructure
 DRM	digital rights management
+DRM	direct rendering manager
 DRRS	display refresh rate switching
 DS	debug store
 DS	differentiated services



CVS commit: src/tests/lib/libc/sys

2021-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 28 17:30:01 UTC 2021

Modified Files:
src/tests/lib/libc/sys: t_sendrecv.c

Log Message:
yield so we can lose packets


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/sys/t_sendrecv.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/lib/libc/sys/t_sendrecv.c
diff -u src/tests/lib/libc/sys/t_sendrecv.c:1.7 src/tests/lib/libc/sys/t_sendrecv.c:1.8
--- src/tests/lib/libc/sys/t_sendrecv.c:1.7	Sun Mar 21 12:58:07 2021
+++ src/tests/lib/libc/sys/t_sendrecv.c	Sun Mar 28 13:30:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_sendrecv.c,v 1.7 2021/03/21 16:58:07 christos Exp $	*/
+/*	$NetBSD: t_sendrecv.c,v 1.8 2021/03/28 17:30:01 christos Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_sendrecv.c,v 1.7 2021/03/21 16:58:07 christos Exp $");
+__RCSID("$NetBSD: t_sendrecv.c,v 1.8 2021/03/28 17:30:01 christos Exp $");
 
 #include 
 #include 
@@ -40,6 +40,7 @@ __RCSID("$NetBSD: t_sendrecv.c,v 1.7 202
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -94,6 +95,8 @@ receiver(int sd)
 return;
 			if (p.seq != seq)
 printf("%ju != %ju\n", p.seq, seq);
+			if (seq % 10 == 0)
+sched_yield();
 			seq = p.seq + 1;
 		}
 //		printf("<<%zd %d %ju\n", n, errno, seq);



CVS commit: src/external/bsd/atf/dist/tools

2021-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 28 16:35:37 UTC 2021

Modified Files:
src/external/bsd/atf/dist/tools: fs.cpp fs.hpp test-program.cpp

Log Message:
If we are running the test as an unprivileged user, hand ownership of the
test directory to that user.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/atf/dist/tools/fs.cpp
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/atf/dist/tools/fs.hpp
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/tools/test-program.cpp

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

Modified files:

Index: src/external/bsd/atf/dist/tools/fs.cpp
diff -u src/external/bsd/atf/dist/tools/fs.cpp:1.4 src/external/bsd/atf/dist/tools/fs.cpp:1.5
--- src/external/bsd/atf/dist/tools/fs.cpp:1.4	Sat Nov 11 09:16:06 2017
+++ src/external/bsd/atf/dist/tools/fs.cpp	Sun Mar 28 12:35:37 2021
@@ -683,6 +683,17 @@ impl::rmdir(const path& p)
 }
 }
 
+void
+impl::change_ownership(const path& p, const std::pair < int, int >& user)
+{
+if (::chown(p.c_str(), user.first, user.second) == -1) {
+std::stringstream ss;
+ss << IMPL_NAME "::chown(" << p.str() << ", " << user.first << ", "
+   << user.second << ")";
+throw tools::system_error(ss.str(), "chown(2) failed", errno);
+}
+}
+
 impl::path
 impl::change_directory(const path& dir)
 {

Index: src/external/bsd/atf/dist/tools/fs.hpp
diff -u src/external/bsd/atf/dist/tools/fs.hpp:1.2 src/external/bsd/atf/dist/tools/fs.hpp:1.3
--- src/external/bsd/atf/dist/tools/fs.hpp:1.2	Mon Mar  9 16:34:52 2020
+++ src/external/bsd/atf/dist/tools/fs.hpp	Sun Mar 28 12:35:37 2021
@@ -368,6 +368,7 @@ void remove(const path&);
 void rmdir(const path&);
 
 tools::fs::path change_directory(const tools::fs::path&);
+void change_ownership(const tools::fs::path&, const std::pair< int, int >&);
 void cleanup(const tools::fs::path&);
 tools::fs::path get_current_dir(void);
 

Index: src/external/bsd/atf/dist/tools/test-program.cpp
diff -u src/external/bsd/atf/dist/tools/test-program.cpp:1.3 src/external/bsd/atf/dist/tools/test-program.cpp:1.4
--- src/external/bsd/atf/dist/tools/test-program.cpp:1.3	Wed Dec 30 17:23:38 2015
+++ src/external/bsd/atf/dist/tools/test-program.cpp	Sun Mar 28 12:35:37 2021
@@ -304,8 +304,10 @@ run_test_case_child(void* raw_params)
 
 const std::pair< int, int > user = tools::get_required_user(
 params->metadata, params->config);
-if (user.first != -1 && user.second != -1)
+if (user.first != -1 && user.second != -1) {
+tools::fs::change_ownership(params->workdir, user);
 tools::user::drop_privileges(user);
+}
 
 // The input 'tp' parameter may be relative and become invalid once
 // we change the current working directory.



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 16:28:15 UTC 2021

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

Log Message:
lint: extract brace_level_subtype

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.165 src/usr.bin/xlint/lint1/init.c:1.166
--- src/usr.bin/xlint/lint1/init.c:1.165	Sun Mar 28 16:19:21 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 16:28:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.165 2021/03/28 16:19:21 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.166 2021/03/28 16:28:15 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.165 2021/03/28 16:19:21 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.166 2021/03/28 16:28:15 rillig Exp $");
 #endif
 
 #include 
@@ -474,13 +474,15 @@ designation_shift_level(struct designati
 
 
 static struct brace_level *
-brace_level_new(type_t *type, type_t *subtype, int remaining)
+brace_level_new(type_t *type, type_t *subtype, int remaining,
+		struct brace_level *enclosing)
 {
 	struct brace_level *level = xcalloc(1, sizeof(*level));
 
 	level->bl_type = type;
 	level->bl_subtype = subtype;
 	level->bl_remaining = remaining;
+	level->bl_enclosing = enclosing;
 
 	return level;
 }
@@ -526,6 +528,16 @@ brace_level_debug(const struct brace_lev
 #define brace_level_debug(level) do { } while (false)
 #endif
 
+static type_t *
+brace_level_subtype(struct brace_level *level)
+{
+
+	if (level->bl_subtype != NULL)
+		return level->bl_subtype;
+
+	return level->bl_type;
+}
+
 static void
 brace_level_set_array_dimension(struct brace_level *level, int dim)
 {
@@ -776,7 +788,7 @@ initialization_init(struct initializatio
 		in->initsym->s_type = duptyp(in->initsym->s_type);
 	/* TODO: does 'duptyp' create a memory leak? */
 
-	in->brace_level = brace_level_new(NULL, in->initsym->s_type, 1);
+	in->brace_level = brace_level_new(NULL, in->initsym->s_type, 1, NULL);
 
 	initialization_debug(in);
 	debug_leave();
@@ -867,10 +879,8 @@ initialization_push(struct initializatio
 	level = in->brace_level;
 	lint_assert(level->bl_remaining > 0);
 
-	in->brace_level = brace_level_new(
-	level->bl_subtype != NULL ? level->bl_subtype : level->bl_type,
-	NULL, 0);
-	in->brace_level->bl_enclosing = level;
+	in->brace_level = brace_level_new(brace_level_subtype(level), NULL, 0,
+	level);
 	lint_assert(in->brace_level->bl_type != NULL);
 	lint_assert(in->brace_level->bl_type->t_tspec != FUNC);
 



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 16:19:21 UTC 2021

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

Log Message:
lint: extract initialization_end_brace_level

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.164 src/usr.bin/xlint/lint1/init.c:1.165
--- src/usr.bin/xlint/lint1/init.c:1.164	Sun Mar 28 15:39:25 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 16:19:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.164 2021/03/28 15:39:25 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.165 2021/03/28 16:19:21 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.164 2021/03/28 15:39:25 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.165 2021/03/28 16:19:21 rillig Exp $");
 #endif
 
 #include 
@@ -845,12 +845,20 @@ initialization_push_struct_or_union(stru
 	return false;
 }
 
+static void
+initialization_end_brace_level(struct initialization *in)
+{
+	struct brace_level *level = in->brace_level;
+	in->brace_level = level->bl_enclosing;
+	brace_level_free(level);
+}
+
 /* TODO: document me */
 /* TODO: think of a better name than 'push' */
 static void
 initialization_push(struct initialization *in)
 {
-	struct brace_level *level, *enclosing;
+	struct brace_level *level;
 
 	debug_enter();
 
@@ -897,10 +905,7 @@ again:
 		if (in->designation.head != NULL) {
 			debug_step("pop scalar");
 		pop:
-			/* TODO: extract this into end_initializer_level */
-			enclosing = in->brace_level->bl_enclosing;
-			brace_level_free(level);
-			in->brace_level = enclosing;
+			initialization_end_brace_level(in);
 			goto again;
 		}
 		/* The initialization stack now expects a single scalar. */



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 15:39:26 UTC 2021

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

Log Message:
lint: extract check_no_auto_aggregate

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.163 src/usr.bin/xlint/lint1/init.c:1.164
--- src/usr.bin/xlint/lint1/init.c:1.163	Sun Mar 28 14:13:18 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 15:39:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.163 2021/03/28 14:13:18 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.164 2021/03/28 15:39:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.163 2021/03/28 14:13:18 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.164 2021/03/28 15:39:25 rillig Exp $");
 #endif
 
 #include 
@@ -1032,6 +1032,22 @@ initialization_next_brace(struct initial
 }
 
 static void
+check_no_auto_aggregate(scl_t sclass, const struct brace_level *level)
+{
+	if (!tflag)
+		return;
+	if (!(sclass == AUTO || sclass == REG))
+		return;
+	if (!(level->bl_enclosing == NULL))
+		return;
+	if (is_scalar(level->bl_subtype->t_tspec))
+		return;
+
+	/* no automatic aggregate initialization in trad. C */
+	warning(188);
+}
+
+static void
 initialization_lbrace(struct initialization *in)
 {
 	if (in->initerr)
@@ -1040,13 +1056,7 @@ initialization_lbrace(struct initializat
 	debug_enter();
 	initialization_debug(in);
 
-	if ((in->initsym->s_scl == AUTO || in->initsym->s_scl == REG) &&
-	in->brace_level->bl_enclosing == NULL) {
-		if (tflag &&
-		!is_scalar(in->brace_level->bl_subtype->t_tspec))
-			/* no automatic aggregate initialization in trad. C */
-			warning(188);
-	}
+	check_no_auto_aggregate(in->initsym->s_scl, in->brace_level);
 
 	/*
 	 * Remove all entries which cannot be used for further initializers



CVS commit: src

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 15:36:37 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_050.exp msg_054.exp msg_081.exp
msg_082.exp msg_100.exp msg_186.exp msg_188.exp msg_189.c
msg_189.exp msg_219.exp
src/usr.bin/xlint/lint1: main1.c

Log Message:
lint: only define GCC builtins if -g is given

This removes 7 wrong warnings when running lint in -t mode.

Surprisingly, this added a warning that had not been there before in
msg_189.c.  This is because check_variable_usage skips the checks when
an error occurred before.  All diagnostics that happened were warnings,
but the -w option treats them as errors, see vwarning.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_050.exp \
src/tests/usr.bin/xlint/lint1/msg_054.exp \
src/tests/usr.bin/xlint/lint1/msg_081.exp \
src/tests/usr.bin/xlint/lint1/msg_082.exp \
src/tests/usr.bin/xlint/lint1/msg_100.exp \
src/tests/usr.bin/xlint/lint1/msg_189.c \
src/tests/usr.bin/xlint/lint1/msg_189.exp \
src/tests/usr.bin/xlint/lint1/msg_219.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_186.exp \
src/tests/usr.bin/xlint/lint1/msg_188.exp
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/xlint/lint1/main1.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_050.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_050.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_050.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_050.exp:1.2	Fri Jan  8 21:25:03 2021
+++ src/tests/usr.bin/xlint/lint1/msg_050.exp	Sun Mar 28 15:36:37 2021
@@ -1,9 +1,2 @@
-(1): warning: 'long double' is illegal in traditional C [266]
-(1): warning: function prototypes are illegal in traditional C [270]
-(2): warning: 'long double' is illegal in traditional C [266]
-(2): warning: function prototypes are illegal in traditional C [270]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: function prototypes are illegal in traditional C [270]
 msg_050.c(11): warning: a function is declared as an argument: f [50]
 msg_050.c(10): warning: argument f unused in function example [231]
Index: src/tests/usr.bin/xlint/lint1/msg_054.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_054.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_054.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_054.exp:1.2	Fri Jan  8 21:25:03 2021
+++ src/tests/usr.bin/xlint/lint1/msg_054.exp	Sun Mar 28 15:36:37 2021
@@ -1,8 +1 @@
-(1): warning: 'long double' is illegal in traditional C [266]
-(1): warning: function prototypes are illegal in traditional C [270]
-(2): warning: 'long double' is illegal in traditional C [266]
-(2): warning: function prototypes are illegal in traditional C [270]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: function prototypes are illegal in traditional C [270]
 msg_054.c(12): warning: trailing ',' prohibited in enum declaration [54]
Index: src/tests/usr.bin/xlint/lint1/msg_081.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_081.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_081.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_081.exp:1.2	Fri Jan  8 21:25:03 2021
+++ src/tests/usr.bin/xlint/lint1/msg_081.exp	Sun Mar 28 15:36:37 2021
@@ -1,8 +1 @@
-(1): warning: 'long double' is illegal in traditional C [266]
-(1): warning: function prototypes are illegal in traditional C [270]
-(2): warning: 'long double' is illegal in traditional C [266]
-(2): warning: function prototypes are illegal in traditional C [270]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: function prototypes are illegal in traditional C [270]
 msg_081.c(8): warning: \a undefined in traditional C [81]
Index: src/tests/usr.bin/xlint/lint1/msg_082.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_082.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_082.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_082.exp:1.2	Fri Jan  8 21:25:03 2021
+++ src/tests/usr.bin/xlint/lint1/msg_082.exp	Sun Mar 28 15:36:37 2021
@@ -1,8 +1 @@
-(1): warning: 'long double' is illegal in traditional C [266]
-(1): warning: function prototypes are illegal in traditional C [270]
-(2): warning: 'long double' is illegal in traditional C [266]
-(2): warning: function prototypes are illegal in traditional C [270]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: function prototypes are illegal in traditional C [270]
 msg_082.c(8): warning: \x undefined in traditional C [82]
Index: src/tests/usr.bin/xlint/lint1/msg_100.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_100.exp:1.2 

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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 15:12:20 UTC 2021

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

Log Message:
tests/lint: add test for struct initialization in traditional C


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

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_188.c
diff -u src/tests/usr.bin/xlint/lint1/msg_188.c:1.2 src/tests/usr.bin/xlint/lint1/msg_188.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_188.c:1.2	Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_188.c	Sun Mar 28 15:12:20 2021
@@ -1,7 +1,25 @@
-/*	$NetBSD: msg_188.c,v 1.2 2021/02/21 09:07:58 rillig Exp $	*/
+/*	$NetBSD: msg_188.c,v 1.3 2021/03/28 15:12:20 rillig Exp $	*/
 # 3 "msg_188.c"
 
-// Test for message: no automatic aggregate initialization in traditional C [188]
+/* Test for message: no automatic aggregate initialization in traditional C [188] */
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* lint1-flags: -tw */
+
+struct point {
+	int x;
+	int y;
+};
+
+struct point global = {
+	3,
+	4,
+};
+
+void
+function()
+{
+	struct point local = {	/* expect: 188 */
+		3,
+		4,
+	};
+}
Index: src/tests/usr.bin/xlint/lint1/msg_188.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_188.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_188.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_188.exp:1.2	Sun Mar 21 20:45:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_188.exp	Sun Mar 28 15:12:20 2021
@@ -1 +1,8 @@
-msg_188.c(6): error: syntax error ':' [249]
+(1): warning: 'long double' is illegal in traditional C [266]
+(1): warning: function prototypes are illegal in traditional C [270]
+(2): warning: 'long double' is illegal in traditional C [266]
+(2): warning: function prototypes are illegal in traditional C [270]
+(3): warning: 'long double' is illegal in traditional C [266]
+(3): warning: 'long double' is illegal in traditional C [266]
+(3): warning: function prototypes are illegal in traditional C [270]
+msg_188.c(21): warning: no automatic aggregate initialization in traditional C [188]



CVS commit: src/share/misc

2021-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 28 14:28:56 UTC 2021

Modified Files:
src/share/misc: style

Log Message:
Clarify and explain the rationale for parentheses in sizeof and return as
discussed.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/share/misc/style

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

Modified files:

Index: src/share/misc/style
diff -u src/share/misc/style:1.61 src/share/misc/style:1.62
--- src/share/misc/style:1.61	Sun Mar 28 10:16:16 2021
+++ src/share/misc/style	Sun Mar 28 10:28:56 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: style,v 1.61 2021/03/28 14:16:16 christos Exp $ */
+/* $NetBSD: style,v 1.62 2021/03/28 14:28:56 christos Exp $ */
 
 /*
  * The revision control tag appears first, with a blank line after it.
@@ -30,7 +30,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: style,v 1.61 2021/03/28 14:16:16 christos Exp $");
+__RCSID("$NetBSD: style,v 1.62 2021/03/28 14:28:56 christos Exp $");
 
 /*
  * VERY important single-line comments look like this.
@@ -351,10 +351,26 @@ function(int a1, int a2, float fl, int a
 	char fourteen, fifteen, sixteen;
 
 	/*
-	 * Casts and sizeof's are not followed by a space.  NULL is any
-	 * pointer type, and doesn't need to be cast, so use NULL instead
-	 * of (struct foo *)0 or (struct foo *)NULL.  Also, test pointers
-	 * against NULL.  I.e. use:
+	 * Casts and sizeof's are not followed by a space.
+	 *
+	 * We parenthesize sizeof expressions to clarify their precedence:
+	 *
+	 * 	sizeof(e) + 4
+	 * not:
+	 *	sizeof e + 4
+	 *
+	 * We don't put a space before the parenthesis so that it looks like
+	 * a function call. We always parenthesize the sizeof expression for
+	 * consistency.
+	 *
+	 * On the other hand, we don't parenthesize the return statement
+	 * because there is never a precedence ambiguity situation (it is
+	 * a single statement).
+	 *
+	 * NULL is any pointer type, and doesn't need to be cast, so use
+	 * NULL instead of (struct foo *)0 or (struct foo *)NULL.  Also,
+	 * test pointers against NULL because it indicates the type of the
+	 * expression to the user. I.e. use:
 	 *
 	 *	(p = f()) == NULL
 	 * not:



CVS commit: src/share/misc

2021-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 28 14:16:16 UTC 2021

Modified Files:
src/share/misc: style

Log Message:
- EXIT_FAILURE instead of 1
- %j instead of PRI for *intmax_t
- != -1 instead of < 0 for syscalls


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/share/misc/style

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

Modified files:

Index: src/share/misc/style
diff -u src/share/misc/style:1.60 src/share/misc/style:1.61
--- src/share/misc/style:1.60	Sun Nov 29 04:15:33 2020
+++ src/share/misc/style	Sun Mar 28 10:16:16 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: style,v 1.60 2020/11/29 09:15:33 rillig Exp $ */
+/* $NetBSD: style,v 1.61 2021/03/28 14:16:16 christos Exp $ */
 
 /*
  * The revision control tag appears first, with a blank line after it.
@@ -30,7 +30,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: style,v 1.60 2020/11/29 09:15:33 rillig Exp $");
+__RCSID("$NetBSD: style,v 1.61 2021/03/28 14:16:16 christos Exp $");
 
 /*
  * VERY important single-line comments look like this.
@@ -380,11 +380,13 @@ function(int a1, int a2, float fl, int a
 	 * the change needs to be done in one place.
 	 *
 	 * Use err/warn(3), don't roll your own!
+	 *
+	 * Prefer EXIT_FAILURE instead of random error codes.
 	 */
 	if ((four = malloc(sizeof(*four))) == NULL)
-		err(1, NULL);
+		err(EXIT_FAILURE, NULL);
 	if ((six = (int *)overflow()) == NULL)
-		errx(1, "Number overflowed.");
+		errx(EXIT_FAILURE, "Number overflowed.");
 
 	/* No parentheses are needed around the return value. */
 	return eight;
@@ -408,21 +410,21 @@ dirinfo(const char *p, struct stat *sb, 
 	_DIAGASSERT(p != NULL);
 	_DIAGASSERT(filedesc != -1);
 
-	if (stat(p, sb) < 0)
-		err(1, "Unable to stat %s", p);
+	/* Prefer checking syscalls against -1 instead of < 0 */
+	if (stat(p, sb) == -1)
+		err(EXIT_FAILURE, "Unable to stat %s", p);
 
 	/*
-	 * To printf quantities that might be larger than "long", include
-	 * , cast quantities to intmax_t or uintmax_t and use
-	 * PRI?MAX constants.
+	 * To printf quantities that might be larger than "long",
+	 * cast quantities to intmax_t or uintmax_t and use %j
 	 */
-	(void)printf("The size of %s is %" PRIdMAX " (%#" PRIxMAX ")\n", p,
+	(void)printf("The size of %s is %jd (%#ju)\n", p,
 	(intmax_t)sb->st_size, (uintmax_t)sb->st_size);
 
 	/*
-	 * To printf quantities of known bit-width, use the corresponding
-	 * defines (generally only done within NetBSD for quantities that
-	 * exceed 32-bits).
+	 * To printf quantities of known bit-width, include  and
+	 * use the corresponding defines (generally only done within NetBSD
+	 * for quantities that exceed 32-bits).
 	 */
 	(void)printf("%s uses %" PRId64 " blocks and has flags %#" PRIx32 "\n",
 	p, sb->st_blocks, sb->st_flags);



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 14:13:18 UTC 2021

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

Log Message:
lint: clean up type handling in initialization

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.162 src/usr.bin/xlint/lint1/init.c:1.163
--- src/usr.bin/xlint/lint1/init.c:1.162	Sun Mar 28 14:01:49 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 14:13:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.162 2021/03/28 14:01:49 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.163 2021/03/28 14:13:18 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.162 2021/03/28 14:01:49 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.163 2021/03/28 14:13:18 rillig Exp $");
 #endif
 
 #include 
@@ -859,11 +859,10 @@ initialization_push(struct initializatio
 	level = in->brace_level;
 	lint_assert(level->bl_remaining > 0);
 
-	in->brace_level = xcalloc(1, sizeof *in->brace_level);
+	in->brace_level = brace_level_new(
+	level->bl_subtype != NULL ? level->bl_subtype : level->bl_type,
+	NULL, 0);
 	in->brace_level->bl_enclosing = level;
-	in->brace_level->bl_type = level->bl_subtype;
-	if (in->brace_level->bl_type == NULL)
-		in->brace_level->bl_type = level->bl_type;
 	lint_assert(in->brace_level->bl_type != NULL);
 	lint_assert(in->brace_level->bl_type->t_tspec != FUNC);
 



CVS commit: src

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 14:01:50 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile d_c99_init.c d_c99_init.exp
msg_176.c t_integration.sh
src/usr.bin/xlint/lint1: err.c init.c
Removed Files:
src/tests/usr.bin/xlint/lint1: msg_176.exp

Log Message:
lint: remove wrong warning about wrong initializer type

The following code is valid:

int valid = {{{ 3 }}};

C90 3.5.7 and C99 6.7.8 both say that the "initializer for a scalar
shall be a single expression, optionally enclosed in braces".  They
don't put any upper bound on the amount of braces, not even in the
"Translation limits" section.


To generate a diff of this commit:
cvs rdiff -u -r1.1033 -r1.1034 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.36 -r1.37 src/tests/usr.bin/xlint/lint1/Makefile \
src/tests/usr.bin/xlint/lint1/t_integration.sh
cvs rdiff -u -r1.16 -r1.17 src/tests/usr.bin/xlint/lint1/d_c99_init.c
cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/xlint/lint1/d_c99_init.exp
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_176.c
cvs rdiff -u -r1.2 -r0 src/tests/usr.bin/xlint/lint1/msg_176.exp
cvs rdiff -u -r1.96 -r1.97 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.161 -r1.162 src/usr.bin/xlint/lint1/init.c

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1033 src/distrib/sets/lists/tests/mi:1.1034
--- src/distrib/sets/lists/tests/mi:1.1033	Tue Mar 23 21:19:08 2021
+++ src/distrib/sets/lists/tests/mi	Sun Mar 28 14:01:49 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1033 2021/03/23 21:19:08 rillig Exp $
+# $NetBSD: mi,v 1.1034 2021/03/28 14:01:49 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6532,7 +6532,7 @@
 ./usr/tests/usr.bin/xlint/lint1/msg_175.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_175.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_176.c			tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/xlint/lint1/msg_176.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_176.exp			tests-obsolete		obsolete
 ./usr/tests/usr.bin/xlint/lint1/msg_177.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_177.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_178.c			tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.36 src/tests/usr.bin/xlint/lint1/Makefile:1.37
--- src/tests/usr.bin/xlint/lint1/Makefile:1.36	Tue Mar 23 21:19:08 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Sun Mar 28 14:01:50 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.36 2021/03/23 21:19:08 rillig Exp $
+# $NetBSD: Makefile,v 1.37 2021/03/28 14:01:50 rillig Exp $
 
 NOMAN=		# defined
 
@@ -98,7 +98,7 @@ FILES+=		d_type_question_colon.c
 FILES+=		d_typefun.c
 FILES+=		d_typename_as_var.c
 FILES+=		d_zero_sized_arrays.c
-FILES+=		${:U0 ${:U:range=340}:C,^.$,0&,:C,^..$,0&,:@msg@msg_${msg}.c msg_${msg}.exp@}
+FILES+=		${:U0 ${:U:range=340}:C,^.$,0&,:C,^..$,0&,:@msg@msg_${msg}.c msg_${msg}.exp@:Nmsg_176.exp}
 
 # Note: only works for adding tests.
 # To remove a test, the $$mi file must be edited manually.
Index: src/tests/usr.bin/xlint/lint1/t_integration.sh
diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.36 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.37
--- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.36	Sat Mar 27 13:59:18 2021
+++ src/tests/usr.bin/xlint/lint1/t_integration.sh	Sun Mar 28 14:01:50 2021
@@ -1,4 +1,4 @@
-# $NetBSD: t_integration.sh,v 1.36 2021/03/27 13:59:18 rillig Exp $
+# $NetBSD: t_integration.sh,v 1.37 2021/03/28 14:01:50 rillig Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -169,22 +169,19 @@ test_case d_long_double_int
 test_case all_messages
 all_messages_body()
 {
-	local srcdir ok msg base flags
+	local failed msg
 
-	srcdir="$(atf_get_srcdir)"
-	ok="true"
+	failed=""
 
 	for msg in $(seq 0 340); do
-		base="$(printf '%s/msg_%03d' "${srcdir}" "${msg}")"
-		flags="$(extract_flags "${base}.c")"
-
-		# shellcheck disable=SC2154 disable=SC2086
-		${Atf_Check} -s not-exit:0 -o "file:${base}.exp" -e empty \
-		${LINT1} ${flags} "${base}.c" /dev/null \
-		|| ok="false"
+		name="$(printf 'msg_%03d.c' "${msg}")"
+		check_lint1 "${name}" \
+		|| failed="$failed${failed:+ }$name"
 	done
 
-	atf_check "${ok}"
+	if [ "$failed" != "" ]; then
+		atf_check "false" "$failed"
+	fi
 }
 
 

Index: src/tests/usr.bin/xlint/lint1/d_c99_init.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.16 src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.17
--- src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.16	Sat Mar 27 

CVS commit: src/lib/libedit

2021-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 28 13:39:39 UTC 2021

Modified Files:
src/lib/libedit: filecomplete.c

Log Message:
Only unescape when we are quoting and don't add a space if we are quoting
(we already did) (Piotr Stefaniak)


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/lib/libedit/filecomplete.c

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

Modified files:

Index: src/lib/libedit/filecomplete.c
diff -u src/lib/libedit/filecomplete.c:1.66 src/lib/libedit/filecomplete.c:1.67
--- src/lib/libedit/filecomplete.c:1.66	Sun Mar 28 09:33:54 2021
+++ src/lib/libedit/filecomplete.c	Sun Mar 28 09:39:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: filecomplete.c,v 1.66 2021/03/28 13:33:54 christos Exp $	*/
+/*	$NetBSD: filecomplete.c,v 1.67 2021/03/28 13:39:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.66 2021/03/28 13:33:54 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.67 2021/03/28 13:39:39 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -667,7 +667,7 @@ fn_complete2(EditLine *el,
 	size_t len;
 	int what_to_do = '\t';
 	int retval = CC_NORM;
-	int do_unescape = attempted_completion_function == NULL? 1: 0;
+	int do_unescape = flags & FN_QUOTE_MATCH;
 
 	if (el->el_state.lastcmd == el->el_state.thiscmd)
 		what_to_do = '?';
@@ -736,7 +736,9 @@ fn_complete2(EditLine *el,
 		el_winsertstr(el,
 		ct_decode_string(completion, >el_scratch));
 
-		if (single_match && attempted_completion_function) {
+		if (single_match && attempted_completion_function &&
+		!(flags & FN_QUOTE_MATCH))
+		{
 			/*
 			 * We found an exact match. Add a space after
 			 * it, unless we do filename completion and the



CVS commit: src/lib/libedit

2021-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 28 13:38:10 UTC 2021

Modified Files:
src/lib/libedit: filecomplete.h

Log Message:
document the flag


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libedit/filecomplete.h

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

Modified files:

Index: src/lib/libedit/filecomplete.h
diff -u src/lib/libedit/filecomplete.h:1.12 src/lib/libedit/filecomplete.h:1.13
--- src/lib/libedit/filecomplete.h:1.12	Sat Mar 27 14:55:02 2021
+++ src/lib/libedit/filecomplete.h	Sun Mar 28 09:38:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: filecomplete.h,v 1.12 2021/03/27 18:55:02 christos Exp $	*/
+/*	$NetBSD: filecomplete.h,v 1.13 2021/03/28 13:38:10 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@ int fn_complete2(EditLine *,
 char **(*)(const char *, int, int),
 const wchar_t *, const wchar_t *, const char *(*)(const char *), size_t,
 int *, int *, int *, int *, unsigned int);
-#define FN_QUOTE_MATCH 1
+#define FN_QUOTE_MATCH 1		/* Quote the returned match */
 
 void fn_display_match_list(EditLine *, char **, size_t, size_t,
 	const char *(*)(const char *));



CVS commit: src/lib/libedit

2021-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 28 13:33:54 UTC 2021

Modified Files:
src/lib/libedit: filecomplete.c

Log Message:
Pass the unescaped filename the the append function so it has to do less work
(for example it can call stat(2) directly (Piotr Stefaniak)


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/lib/libedit/filecomplete.c

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

Modified files:

Index: src/lib/libedit/filecomplete.c
diff -u src/lib/libedit/filecomplete.c:1.65 src/lib/libedit/filecomplete.c:1.66
--- src/lib/libedit/filecomplete.c:1.65	Sat Mar 27 14:55:02 2021
+++ src/lib/libedit/filecomplete.c	Sun Mar 28 09:33:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: filecomplete.c,v 1.65 2021/03/27 18:55:02 christos Exp $	*/
+/*	$NetBSD: filecomplete.c,v 1.66 2021/03/28 13:33:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.65 2021/03/27 18:55:02 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.66 2021/03/28 13:33:54 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -291,7 +291,7 @@ escape_filename(EditLine * el, const cha
 
 	if (single_match && app_func) {
 		escaped_str[offset] = 0;
-		append_char = app_func(escaped_str);
+		append_char = app_func(filename);
 		/* we want to append space only if we are not inside quotes */
 		if (append_char[0] == ' ') {
 			if (!s_quoted && !d_quoted)



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 13:09:43 UTC 2021

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

Log Message:
lint: sprinkle const on function declarations

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.160 -r1.161 src/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.252 -r1.253 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.93 src/usr.bin/xlint/lint1/externs1.h:1.94
--- src/usr.bin/xlint/lint1/externs1.h:1.93	Sun Mar 28 10:09:34 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Sun Mar 28 13:09:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.93 2021/03/28 10:09:34 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.94 2021/03/28 13:09:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -82,7 +82,7 @@ extern	int64_t	xsign(int64_t, tspec_t, i
 extern	void	clear_warn_flags(void);
 extern	sym_t	*getsym(sbuf_t *);
 extern	void	cleanup(void);
-extern	sym_t	*pushdown(sym_t *);
+extern	sym_t	*pushdown(const sym_t *);
 extern	sym_t	*mktempsym(type_t *);
 extern	void	rmsym(sym_t *);
 extern	void	rmsyms(sym_t *);
@@ -208,10 +208,10 @@ extern	bool	is_typeok_bool_operand(const
 extern	bool	typeok(op_t, int, const tnode_t *, const tnode_t *);
 extern	tnode_t	*promote(op_t, bool, tnode_t *);
 extern	tnode_t	*convert(op_t, int, type_t *, tnode_t *);
-extern	void	convert_constant(op_t, int, type_t *, val_t *, val_t *);
-extern	tnode_t	*build_sizeof(type_t *);
-extern	tnode_t	*build_offsetof(type_t *, sym_t *);
-extern	tnode_t	*build_alignof(type_t *);
+extern	void	convert_constant(op_t, int, const type_t *, val_t *, val_t *);
+extern	tnode_t	*build_sizeof(const type_t *);
+extern	tnode_t	*build_offsetof(const type_t *, const sym_t *);
+extern	tnode_t	*build_alignof(const type_t *);
 extern	tnode_t	*cast(tnode_t *, type_t *);
 extern	tnode_t	*new_function_argument_node(tnode_t *, tnode_t *);
 extern	tnode_t	*new_function_call_node(tnode_t *, tnode_t *);
@@ -219,9 +219,9 @@ extern	val_t	*constant(tnode_t *, bool);
 extern	void	expr(tnode_t *, bool, bool, bool, bool);
 extern	void	check_expr_misc(const tnode_t *, bool, bool, bool,
 		bool, bool, bool);
-extern	bool	constant_addr(const tnode_t *, sym_t **, ptrdiff_t *);
+extern	bool	constant_addr(const tnode_t *, const sym_t **, ptrdiff_t *);
 extern	strg_t	*cat_strings(strg_t *, strg_t *);
-extern  int64_t type_size_in_bits(type_t *);
+extern  int64_t type_size_in_bits(const type_t *);
 #ifdef DEBUG
 extern	void	debug_node(const tnode_t *, int);
 #else

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.160 src/usr.bin/xlint/lint1/init.c:1.161
--- src/usr.bin/xlint/lint1/init.c:1.160	Sun Mar 28 11:08:01 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 13:09:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.160 2021/03/28 11:08:01 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.161 2021/03/28 13:09:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.160 2021/03/28 11:08:01 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.161 2021/03/28 13:09:43 rillig Exp $");
 #endif
 
 #include 
@@ -341,7 +341,7 @@ check_non_constant_initializer(const tno
 	if (tn == NULL || tn->tn_op == CON)
 		return;
 
-	sym_t *sym;
+	const sym_t *sym;
 	ptrdiff_t offs;
 	if (constant_addr(tn, , ))
 		return;

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.20 src/usr.bin/xlint/lint1/lex.c:1.21
--- src/usr.bin/xlint/lint1/lex.c:1.20	Sat Mar 27 12:42:22 2021
+++ src/usr.bin/xlint/lint1/lex.c	Sun Mar 28 13:09:43 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.20 2021/03/27 12:42:22 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.21 2021/03/28 13:09:43 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.20 2021/03/27 12:42:22 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.21 2021/03/28 13:09:43 rillig Exp $");
 #endif
 
 #include 
@@ -1577,7 +1577,7 @@ cleanup(void)
  * Create a new symbol with the name of an existing symbol.
  */
 sym_t *
-pushdown(sym_t *sym)
+pushdown(const sym_t *sym)
 {
 	int	h;
 	sym_t	*nsym;

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.252 src/usr.bin/xlint/lint1/tree.c:1.253
--- src/usr.bin/xlint/lint1/tree.c:1.252	Sat Mar 27 11:08:00 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sun Mar 28 13:09:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.252 2021/03/27 11:08:00 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.253 2021/03/28 13:09:43 rillig Exp $	*/
 
 /*

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

2021-03-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Mar 28 11:13:24 UTC 2021

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

Log Message:
Disable 1ofN distribution of SPIs by default. This is a workaround for an
issue in the USB stack -- signaling transfer complete on multiple PEs can
cause transfer completions to be processed out of order.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/cortex/gicv3.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/gicv3.c
diff -u src/sys/arch/arm/cortex/gicv3.c:1.43 src/sys/arch/arm/cortex/gicv3.c:1.44
--- src/sys/arch/arm/cortex/gicv3.c:1.43	Tue Feb 23 10:03:04 2021
+++ src/sys/arch/arm/cortex/gicv3.c	Sun Mar 28 11:13:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.c,v 1.43 2021/02/23 10:03:04 jmcneill Exp $ */
+/* $NetBSD: gicv3.c,v 1.44 2021/03/28 11:13:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -31,7 +31,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.43 2021/02/23 10:03:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.44 2021/03/28 11:13:24 jmcneill Exp $");
 
 #include 
 #include 
@@ -65,6 +65,13 @@ __KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.
 #define	GIC_PRIO_SHIFT_NS		4
 #define	GIC_PRIO_SHIFT_S		3
 
+/*
+ * Set to true if you want to use 1 of N interrupt distribution for SPIs
+ * when available. Disabled by default because it causes issues with the
+ * USB stack.
+ */
+bool gicv3_use_1ofn = false;
+
 static struct gicv3_softc *gicv3_softc;
 
 static inline uint32_t
@@ -195,7 +202,7 @@ gicv3_establish_irq(struct pic_softc *pi
 		 * If 1 of N SPI routing is supported, route MP-safe interrupts to all
 		 * participating PEs. Otherwise, just route to the primary PE.
 		 */
-		if (is->is_mpsafe && GIC_SUPPORTS_1OFN(sc)) {
+		if (is->is_mpsafe && GIC_SUPPORTS_1OFN(sc) && gicv3_use_1ofn) {
 			irouter = GICD_IROUTER_Interrupt_Routing_mode;
 		} else {
 			irouter = sc->sc_irouter[0];
@@ -498,7 +505,7 @@ gicv3_set_affinity(struct pic_softc *pic
 	const int set = kcpuset_countset(affinity);
 	if (set == 1) {
 		irouter = sc->sc_irouter[kcpuset_ffs(affinity) - 1];
-	} else if (set == ncpu && GIC_SUPPORTS_1OFN(sc)) {
+	} else if (set == ncpu && GIC_SUPPORTS_1OFN(sc) && gicv3_use_1ofn) {
 		irouter = GICD_IROUTER_Interrupt_Routing_mode;
 	} else {
 		return EINVAL;



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 11:08:01 UTC 2021

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

Log Message:
lint: move code for extending an array of unknown size further up

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.159 src/usr.bin/xlint/lint1/init.c:1.160
--- src/usr.bin/xlint/lint1/init.c:1.159	Sun Mar 28 10:58:18 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 11:08:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.159 2021/03/28 10:58:18 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.160 2021/03/28 11:08:01 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.159 2021/03/28 10:58:18 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.160 2021/03/28 11:08:01 rillig Exp $");
 #endif
 
 #include 
@@ -676,6 +676,34 @@ brace_level_check_too_many_initializers(
 	return false;
 }
 
+/* Extend an array of unknown size by one element */
+static void
+brace_level_extend_if_array_of_unknown_size(struct brace_level *level)
+{
+
+	if (level->bl_remaining != 0)
+		return;
+	/*
+	 * XXX: According to the function name, there should be a 'return' if
+	 * bl_array_of_unknown_size is false.  There's probably a test missing
+	 * for that case.
+	 */
+
+	/*
+	 * The only place where an incomplete array may appear is at the
+	 * outermost aggregate level of the object to be initialized.
+	 */
+	lint_assert(level->bl_enclosing->bl_enclosing == NULL);
+	lint_assert(level->bl_type->t_tspec == ARRAY);
+
+	debug_step("extending array of unknown size '%s'",
+	type_name(level->bl_type));
+	level->bl_remaining = 1;
+	level->bl_type->t_dim++;
+	setcomplete(level->bl_type, true);
+
+	debug_step("extended type is '%s'", type_name(level->bl_type));
+}
 
 
 static struct initialization *
@@ -817,36 +845,6 @@ initialization_push_struct_or_union(stru
 	return false;
 }
 
-/* Extend an array of unknown size by one element */
-static void
-initialization_extend_if_array_of_unknown_size(struct initialization *in)
-{
-	struct brace_level *level = in->brace_level;
-
-	if (level->bl_remaining != 0)
-		return;
-	/*
-	 * XXX: According to the function name, there should be a 'return' if
-	 * bl_array_of_unknown_size is false.  There's probably a test missing
-	 * for that case.
-	 */
-
-	/*
-	 * The only place where an incomplete array may appear is at the
-	 * outermost aggregate level of the object to be initialized.
-	 */
-	lint_assert(level->bl_enclosing->bl_enclosing == NULL);
-	lint_assert(level->bl_type->t_tspec == ARRAY);
-
-	debug_step("extending array of unknown size '%s'",
-	type_name(level->bl_type));
-	level->bl_remaining = 1;
-	level->bl_type->t_dim++;
-	setcomplete(level->bl_type, true);
-
-	debug_step("extended type is '%s'", type_name(level->bl_type));
-}
-
 /* TODO: document me */
 /* TODO: think of a better name than 'push' */
 static void
@@ -856,7 +854,7 @@ initialization_push(struct initializatio
 
 	debug_enter();
 
-	initialization_extend_if_array_of_unknown_size(in);
+	brace_level_extend_if_array_of_unknown_size(in->brace_level);
 
 	level = in->brace_level;
 	lint_assert(level->bl_remaining > 0);



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 10:58:18 UTC 2021

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

Log Message:
lint: move code for checking init expressions further up

It did not make sense to have this code between the code for the
designation and the brace level.  Since it is independent of all these
types, move it to the top.

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.158 src/usr.bin/xlint/lint1/init.c:1.159
--- src/usr.bin/xlint/lint1/init.c:1.158	Sun Mar 28 10:52:41 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 10:58:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.158 2021/03/28 10:52:41 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.159 2021/03/28 10:58:18 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.158 2021/03/28 10:52:41 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.159 2021/03/28 10:58:18 rillig Exp $");
 #endif
 
 #include 
@@ -321,79 +321,6 @@ debug_leave(const char *func)
 #endif
 
 
-static struct designator *
-designator_new(const char *name)
-{
-	struct designator *d = xcalloc(1, sizeof *d);
-	d->name = name;
-	return d;
-}
-
-static void
-designator_free(struct designator *d)
-{
-	free(d);
-}
-
-
-#ifdef DEBUG
-static void
-designation_debug(const struct designation *dn)
-{
-	const struct designator *p;
-
-	if (dn->head == NULL)
-		return;
-
-	debug_indent();
-	debug_printf("designation: ");
-	for (p = dn->head; p != NULL; p = p->next)
-		debug_printf(".%s", p->name);
-	debug_printf("\n");
-}
-#else
-#define designation_debug(dn) do { } while (false)
-#endif
-
-static void
-designation_add(struct designation *dn, struct designator *dr)
-{
-
-	if (dn->head != NULL) {
-		dn->tail->next = dr;
-		dn->tail = dr;
-	} else {
-		dn->head = dr;
-		dn->tail = dr;
-	}
-
-	designation_debug(dn);
-}
-
-/* TODO: add support for array subscripts, not only named members */
-/*
- * TODO: This function should not be necessary at all.  There is no need to
- *  remove the head of the list.
- */
-static void
-designation_shift_level(struct designation *dn)
-{
-	lint_assert(dn->head != NULL);
-
-	if (dn->head == dn->tail) {
-		designator_free(dn->head);
-		dn->head = NULL;
-		dn->tail = NULL;
-	} else {
-		struct designator *head = dn->head;
-		dn->head = dn->head->next;
-		designator_free(head);
-	}
-
-	designation_debug(dn);
-}
-
-
 /* In traditional C, bit-fields can be initialized only by integer constants. */
 static void
 check_bit_field_init(const tnode_t *ln, tspec_t lt, tspec_t rt)
@@ -473,6 +400,79 @@ check_init_expr(scl_t sclass, type_t *tp
 }
 
 
+static struct designator *
+designator_new(const char *name)
+{
+	struct designator *d = xcalloc(1, sizeof *d);
+	d->name = name;
+	return d;
+}
+
+static void
+designator_free(struct designator *d)
+{
+	free(d);
+}
+
+
+#ifdef DEBUG
+static void
+designation_debug(const struct designation *dn)
+{
+	const struct designator *p;
+
+	if (dn->head == NULL)
+		return;
+
+	debug_indent();
+	debug_printf("designation: ");
+	for (p = dn->head; p != NULL; p = p->next)
+		debug_printf(".%s", p->name);
+	debug_printf("\n");
+}
+#else
+#define designation_debug(dn) do { } while (false)
+#endif
+
+static void
+designation_add(struct designation *dn, struct designator *dr)
+{
+
+	if (dn->head != NULL) {
+		dn->tail->next = dr;
+		dn->tail = dr;
+	} else {
+		dn->head = dr;
+		dn->tail = dr;
+	}
+
+	designation_debug(dn);
+}
+
+/* TODO: add support for array subscripts, not only named members */
+/*
+ * TODO: This function should not be necessary at all.  There is no need to
+ *  remove the head of the list.
+ */
+static void
+designation_shift_level(struct designation *dn)
+{
+	lint_assert(dn->head != NULL);
+
+	if (dn->head == dn->tail) {
+		designator_free(dn->head);
+		dn->head = NULL;
+		dn->tail = NULL;
+	} else {
+		struct designator *head = dn->head;
+		dn->head = dn->head->next;
+		designator_free(head);
+	}
+
+	designation_debug(dn);
+}
+
+
 static struct brace_level *
 brace_level_new(type_t *type, type_t *subtype, int remaining)
 {



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 10:52:41 UTC 2021

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

Log Message:
lint: group functions according to their main object

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.157 src/usr.bin/xlint/lint1/init.c:1.158
--- src/usr.bin/xlint/lint1/init.c:1.157	Sun Mar 28 10:09:34 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 10:52:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.157 2021/03/28 10:09:34 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.158 2021/03/28 10:52:41 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.157 2021/03/28 10:09:34 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.158 2021/03/28 10:52:41 rillig Exp $");
 #endif
 
 #include 
@@ -394,6 +394,85 @@ designation_shift_level(struct designati
 }
 
 
+/* In traditional C, bit-fields can be initialized only by integer constants. */
+static void
+check_bit_field_init(const tnode_t *ln, tspec_t lt, tspec_t rt)
+{
+	if (tflag &&
+	is_integer(lt) &&
+	ln->tn_type->t_bitfield &&
+	!is_integer(rt)) {
+		/* bit-field initialization is illegal in traditional C */
+		warning(186);
+	}
+}
+
+static void
+check_non_constant_initializer(const tnode_t *tn, scl_t sclass)
+{
+	/* TODO: rename CON to CONSTANT to avoid ambiguity with CONVERT */
+	if (tn == NULL || tn->tn_op == CON)
+		return;
+
+	sym_t *sym;
+	ptrdiff_t offs;
+	if (constant_addr(tn, , ))
+		return;
+
+	if (sclass == AUTO || sclass == REG) {
+		/* non-constant initializer */
+		c99ism(177);
+	} else {
+		/* non-constant initializer */
+		error(177);
+	}
+}
+
+static void
+check_init_expr(scl_t sclass, type_t *tp, sym_t *sym, tnode_t *tn)
+{
+	tnode_t *ln;
+	tspec_t lt, rt;
+	struct mbl *tmem;
+
+	/* Create a temporary node for the left side. */
+	ln = tgetblk(sizeof *ln);
+	ln->tn_op = NAME;
+	ln->tn_type = tduptyp(tp);
+	ln->tn_type->t_const = false;
+	ln->tn_lvalue = true;
+	ln->tn_sym = sym;
+
+	tn = cconv(tn);
+
+	lt = ln->tn_type->t_tspec;
+	rt = tn->tn_type->t_tspec;
+
+	debug_step("typeok '%s', '%s'",
+	type_name(ln->tn_type), type_name(tn->tn_type));
+	if (!typeok(INIT, 0, ln, tn))
+		return;
+
+	/*
+	 * Preserve the tree memory. This is necessary because otherwise
+	 * expr() would free it.
+	 */
+	tmem = tsave();
+	expr(tn, true, false, true, false);
+	trestor(tmem);
+
+	check_bit_field_init(ln, lt, rt);
+
+	/*
+	 * XXX: Is it correct to do this conversion _after_ the typeok above?
+	 */
+	if (lt != rt || (tp->t_bitfield && tn->tn_op == CON))
+		tn = convert(INIT, 0, tp, tn);
+
+	check_non_constant_initializer(tn, sclass);
+}
+
+
 static struct brace_level *
 brace_level_new(type_t *type, type_t *subtype, int remaining)
 {
@@ -554,6 +633,50 @@ brace_level_push_array(struct brace_leve
 	return true;
 }
 
+/*
+ * If the removed element was a structure member, we must go
+ * to the next structure member.
+ *
+ * XXX: Nothing should ever be "removed" at this point.
+ *
+ * TODO: think of a better name than 'pop'
+ */
+static void
+brace_level_pop_item_unnamed(struct brace_level *level)
+{
+	if (level->bl_remaining > 0 && level->bl_type->t_tspec == STRUCT &&
+	!level->bl_seen_named_member) {
+		brace_level_next_member(level);
+		level->bl_subtype = level->bl_next_member->s_type;
+	}
+}
+
+static bool
+brace_level_check_too_many_initializers(struct brace_level *level)
+{
+	if (level->bl_remaining > 0)
+		return true;
+	/*
+	 * FIXME: even with named members, there can be too many initializers
+	 */
+	if (level->bl_array_of_unknown_size || level->bl_seen_named_member)
+		return true;
+
+	tspec_t t = level->bl_type->t_tspec;
+	if (t == ARRAY) {
+		/* too many array initializers, expected %d */
+		error(173, level->bl_type->t_dim);
+	} else if (t == STRUCT || t == UNION) {
+		/* too many struct/union initializers */
+		error(172);
+	} else {
+		/* too many initializers */
+		error(174);
+	}
+	return false;
+}
+
+
 
 static struct initialization *
 initialization_new(sym_t *sym)
@@ -603,124 +726,15 @@ initialization_debug(const struct initia
 #define initialization_debug(in) do { } while (false)
 #endif
 
-static void
-initialization_set_error(struct initialization *in)
-{
-	in->initerr = true;
-}
-
-/* XXX: unnecessary prototype since it is not recursive */
-static	bool	init_array_using_string(struct initialization *, tnode_t *);
-
-
-static struct initialization *
-current_init(void)
-{
-	lint_assert(init != NULL);
-	return init;
-}
-
-bool *
-current_initerr(void)
-{
-	return _init()->initerr;
-}
-
-sym_t **
-current_initsym(void)
-{
-	return _init()->initsym;
-}
-
-
-void
-begin_initialization(sym_t 

CVS commit: src/sys/arch

2021-03-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Mar 28 10:29:05 UTC 2021

Modified Files:
src/sys/arch/aarch64/aarch64: vm_machdep.c
src/sys/arch/arm/arm32: vm_machdep.c
src/sys/arch/x86/x86: vm_machdep.c

Log Message:
fix a comment that has been c'ed around and not updated


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/aarch64/vm_machdep.c
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/arm/arm32/vm_machdep.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/x86/x86/vm_machdep.c

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/vm_machdep.c
diff -u src/sys/arch/aarch64/aarch64/vm_machdep.c:1.10 src/sys/arch/aarch64/aarch64/vm_machdep.c:1.11
--- src/sys/arch/aarch64/aarch64/vm_machdep.c:1.10	Mon Mar  1 11:37:31 2021
+++ src/sys/arch/aarch64/aarch64/vm_machdep.c	Sun Mar 28 10:29:05 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.10 2021/03/01 11:37:31 jmcneill Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.11 2021/03/28 10:29:05 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.10 2021/03/01 11:37:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.11 2021/03/28 10:29:05 skrll Exp $");
 
 #include 
 #include 
@@ -227,8 +227,8 @@ vmapbuf(struct buf *bp, vsize_t len)
 	bp->b_data = (void *)(taddr + off);
 
 	/*
-	 * The region is locked, so we expect that pmap_pte() will return
-	 * non-NULL.
+	 * The region is locked, so we expect that pmap_extract() will return
+	 * true.
 	 */
 	while (len) {
 		(void)pmap_extract(vm_map_pmap(>b_proc->p_vmspace->vm_map),

Index: src/sys/arch/arm/arm32/vm_machdep.c
diff -u src/sys/arch/arm/arm32/vm_machdep.c:1.77 src/sys/arch/arm/arm32/vm_machdep.c:1.78
--- src/sys/arch/arm/arm32/vm_machdep.c:1.77	Sat Jun 20 07:10:36 2020
+++ src/sys/arch/arm/arm32/vm_machdep.c	Sun Mar 28 10:29:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.77 2020/06/20 07:10:36 skrll Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.78 2021/03/28 10:29:05 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.77 2020/06/20 07:10:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.78 2021/03/28 10:29:05 skrll Exp $");
 
 #include "opt_armfpe.h"
 #include "opt_cputypes.h"
@@ -223,8 +223,8 @@ vmapbuf(struct buf *bp, vsize_t len)
 	bp->b_data = (void *)(taddr + off);
 
 	/*
-	 * The region is locked, so we expect that pmap_pte() will return
-	 * non-NULL.
+	 * The region is locked, so we expect that pmap_extract() will return
+	 * true.
 	 */
 	while (len) {
 		(void) pmap_extract(pm, faddr, );

Index: src/sys/arch/x86/x86/vm_machdep.c
diff -u src/sys/arch/x86/x86/vm_machdep.c:1.44 src/sys/arch/x86/x86/vm_machdep.c:1.45
--- src/sys/arch/x86/x86/vm_machdep.c:1.44	Mon Nov 30 05:33:32 2020
+++ src/sys/arch/x86/x86/vm_machdep.c	Sun Mar 28 10:29:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.44 2020/11/30 05:33:32 msaitoh Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.45 2021/03/28 10:29:05 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.44 2020/11/30 05:33:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.45 2021/03/28 10:29:05 skrll Exp $");
 
 #include "opt_mtrr.h"
 
@@ -304,8 +304,8 @@ vmapbuf(struct buf *bp, vsize_t len)
 	taddr = uvm_km_alloc(phys_map, len, 0, UVM_KMF_VAONLY | UVM_KMF_WAITVA);
 	bp->b_data = (void *)(taddr + off);
 	/*
-	 * The region is locked, so we expect that pmap_pte() will return
-	 * non-NULL.
+	 * The region is locked, so we expect that pmap_extract() will return
+	 * true.
 	 * XXX: unwise to expect this in a multithreaded environment.
 	 * anything can happen to a pmap between the time we lock a
 	 * region, release the pmap lock, and then relock it for



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 10:09:34 UTC 2021

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

Log Message:
lint: rename public designator functions

Their previous names were too similar to the actual implementation
functions, which was confusing.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.204 -r1.205 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.92 -r1.93 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.156 -r1.157 src/usr.bin/xlint/lint1/init.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.204 src/usr.bin/xlint/lint1/cgram.y:1.205
--- src/usr.bin/xlint/lint1/cgram.y:1.204	Fri Mar 26 20:31:07 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Sun Mar 28 10:09:34 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.204 2021/03/26 20:31:07 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.205 2021/03/28 10:09:34 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.204 2021/03/26 20:31:07 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.205 2021/03/28 10:09:34 rillig Exp $");
 #endif
 
 #include 
@@ -1379,7 +1379,7 @@ range:
 
 designator:			/* C99 6.7.8 "Initialization" */
 	  T_LBRACK range T_RBRACK {
-		designation_add_subscript($2);
+		add_designator_subscript($2);
 		if (!Sflag)
 			/* array initializer with des.s is a C9X feature */
 			warning(321);
@@ -1388,7 +1388,7 @@ designator:			/* C99 6.7.8 "Initializati
 		if (!Sflag)
 			/* struct or union member name in initializer is ... */
 			warning(313);
-		designation_add_name($2);
+		add_designator_member($2);
 	  }
 	;
 
@@ -1402,7 +1402,7 @@ designation:			/* C99 6.7.8 "Initializat
 	| identifier T_COLON {
 		/* GCC style struct or union member name in initializer */
 		gnuism(315);
-		designation_add_name($1);
+		add_designator_member($1);
 	  }
 	;
 

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.92 src/usr.bin/xlint/lint1/externs1.h:1.93
--- src/usr.bin/xlint/lint1/externs1.h:1.92	Sat Mar 27 22:04:39 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Sun Mar 28 10:09:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.92 2021/03/27 22:04:39 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.93 2021/03/28 10:09:34 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -299,8 +299,8 @@ extern	void	initstack_init(void);
 extern	void	init_rbrace(void);
 extern	void	init_lbrace(void);
 extern	void	init_using_expr(tnode_t *);
-extern	void	designation_add_name(sbuf_t *);
-extern	void	designation_add_subscript(range_t);
+extern	void	add_designator_member(sbuf_t *);
+extern	void	add_designator_subscript(range_t);
 
 /*
  * emit.c

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.156 src/usr.bin/xlint/lint1/init.c:1.157
--- src/usr.bin/xlint/lint1/init.c:1.156	Sun Mar 28 10:05:19 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 10:09:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.156 2021/03/28 10:05:19 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.157 2021/03/28 10:09:34 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.156 2021/03/28 10:05:19 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.157 2021/03/28 10:09:34 rillig Exp $");
 #endif
 
 #include 
@@ -72,8 +72,8 @@ __RCSID("$NetBSD: init.c,v 1.156 2021/03
  *
  *	begin_initialization
  *		init_lbrace			for each '{'
- *		designation_add_name		for each '.member' before '='
- *		designation_add_subscript	for each '[123]' before '='
+ *		add_designator_member		for each '.member' before '='
+ *		add_designator_subscript	for each '[123]' before '='
  *		init_using_expr			for each expression
  *		init_rbrace			for each '}'
  *	end_initialization
@@ -655,10 +655,8 @@ end_initialization(void)
 	debug_step("end initialization");
 }
 
-
-
 void
-designation_add_name(sbuf_t *sb)
+add_designator_member(sbuf_t *sb)
 {
 	designation_add(_init()->designation,
 	designator_new(sb->sb_name));
@@ -685,7 +683,7 @@ static void initstack_pop_nobrace(struct
  * }
  */
 void
-designation_add_subscript(range_t range)
+add_designator_subscript(range_t range)
 {
 	struct initialization *in = current_init();
 	struct brace_level *level;



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 10:05:19 UTC 2021

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

Log Message:
lint: inline initsym

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.155 src/usr.bin/xlint/lint1/init.c:1.156
--- src/usr.bin/xlint/lint1/init.c:1.155	Sun Mar 28 10:03:02 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 10:05:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.155 2021/03/28 10:03:02 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.156 2021/03/28 10:05:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.155 2021/03/28 10:03:02 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.156 2021/03/28 10:05:19 rillig Exp $");
 #endif
 
 #include 
@@ -632,8 +632,6 @@ current_initsym(void)
 	return _init()->initsym;
 }
 
-#define initsym		(*current_initsym())
-
 
 void
 begin_initialization(sym_t *sym)
@@ -734,11 +732,11 @@ initstack_init(void)
 	 * If the type which is to be initialized is an incomplete array,
 	 * it must be duplicated.
 	 */
-	if (initsym->s_type->t_tspec == ARRAY && is_incomplete(initsym->s_type))
-		initsym->s_type = duptyp(initsym->s_type);
+	if (in->initsym->s_type->t_tspec == ARRAY && is_incomplete(in->initsym->s_type))
+		in->initsym->s_type = duptyp(in->initsym->s_type);
 	/* TODO: does 'duptyp' create a memory leak? */
 
-	in->brace_level = brace_level_new(NULL, initsym->s_type, 1);
+	in->brace_level = brace_level_new(NULL, in->initsym->s_type, 1);
 
 	initialization_debug(in);
 	debug_leave();
@@ -1138,7 +1136,7 @@ init_lbrace(void)
 	debug_enter();
 	initialization_debug(in);
 
-	if ((initsym->s_scl == AUTO || initsym->s_scl == REG) &&
+	if ((in->initsym->s_scl == AUTO || in->initsym->s_scl == REG) &&
 	in->brace_level->bl_enclosing == NULL) {
 		if (tflag &&
 		!is_scalar(in->brace_level->bl_subtype->t_tspec))
@@ -1218,14 +1216,14 @@ init_using_assign(struct initialization 
 {
 	tnode_t *ln, *tn;
 
-	if (initsym->s_type->t_tspec == ARRAY)
+	if (in->initsym->s_type->t_tspec == ARRAY)
 		return false;
 	if (in->brace_level->bl_enclosing != NULL)
 		return false;
 
 	debug_step("handing over to ASSIGN");
 
-	ln = new_name_node(initsym, 0);
+	ln = new_name_node(in->initsym, 0);
 	ln->tn_type = tduptyp(ln->tn_type);
 	ln->tn_type->t_const = false;
 
@@ -1249,7 +1247,7 @@ check_init_expr(struct initialization *i
 	ln->tn_type = tduptyp(in->brace_level->bl_type);
 	ln->tn_type->t_const = false;
 	ln->tn_lvalue = true;
-	ln->tn_sym = initsym;		/* better than nothing */
+	ln->tn_sym = in->initsym;		/* better than nothing */
 
 	tn = cconv(tn);
 
@@ -1296,7 +1294,7 @@ init_using_expr(tnode_t *tn)
 	if (in->initerr || tn == NULL)
 		goto done;
 
-	sclass = initsym->s_scl;
+	sclass = in->initsym->s_scl;
 	if ((sclass == AUTO || sclass == REG) && init_using_assign(in, tn))
 		goto done;
 



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 10:03:03 UTC 2021

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

Log Message:
lint: replace initstack_push_array with brace_level_push_array

The designator is no longer logged at this point because it is
irrelevant.

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.154 src/usr.bin/xlint/lint1/init.c:1.155
--- src/usr.bin/xlint/lint1/init.c:1.154	Sun Mar 28 09:57:31 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 10:03:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.154 2021/03/28 09:57:31 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.155 2021/03/28 10:03:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.154 2021/03/28 09:57:31 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.155 2021/03/28 10:03:02 rillig Exp $");
 #endif
 
 #include 
@@ -529,6 +529,31 @@ brace_level_look_up_member_bloated(struc
 	return m;
 }
 
+/* TODO: document me */
+/* TODO: think of a better name than 'push' */
+static bool
+brace_level_push_array(struct brace_level *level)
+{
+	if (level->bl_enclosing->bl_seen_named_member) {
+		level->bl_brace = true;
+		debug_step("ARRAY, seen named member, needs closing brace");
+	}
+
+	if (is_incomplete(level->bl_type) &&
+	level->bl_enclosing->bl_enclosing != NULL) {
+		/* initialization of an incomplete type */
+		error(175);
+		return false;
+	}
+
+	level->bl_subtype = level->bl_type->t_subt;
+	level->bl_array_of_unknown_size = is_incomplete(level->bl_type);
+	level->bl_remaining = level->bl_type->t_dim;
+	debug_step("type '%s' remaining %d",
+	type_name(level->bl_type), level->bl_remaining);
+	return true;
+}
+
 
 static struct initialization *
 initialization_new(sym_t *sym)
@@ -584,7 +609,6 @@ initialization_set_error(struct initiali
 	in->initerr = true;
 }
 
-
 /* XXX: unnecessary prototype since it is not recursive */
 static	bool	init_array_using_string(struct initialization *, tnode_t *);
 
@@ -876,33 +900,6 @@ extend_if_array_of_unknown_size(struct i
 	debug_step("extended type is '%s'", type_name(level->bl_type));
 }
 
-/* TODO: document me */
-/* TODO: think of a better name than 'push' */
-static void
-initstack_push_array(struct initialization *in)
-{
-	struct brace_level *level = in->brace_level;
-
-	if (level->bl_enclosing->bl_seen_named_member) {
-		level->bl_brace = true;
-		debug_step("ARRAY, seen named member, needs closing brace");
-	}
-
-	if (is_incomplete(level->bl_type) &&
-	level->bl_enclosing->bl_enclosing != NULL) {
-		/* initialization of an incomplete type */
-		error(175);
-		initialization_set_error(in);
-		return;
-	}
-
-	level->bl_subtype = level->bl_type->t_subt;
-	level->bl_array_of_unknown_size = is_incomplete(level->bl_type);
-	level->bl_remaining = level->bl_type->t_dim;
-	designation_debug(>designation);
-	debug_step("type '%s' remaining %d",
-	type_name(level->bl_type), level->bl_remaining);
-}
 
 
 /* TODO: document me */
@@ -997,7 +994,8 @@ again:
 			goto pop;
 		}
 
-		initstack_push_array(in);
+		if (!brace_level_push_array(level))
+			initialization_set_error(in);
 		break;
 
 	case UNION:



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 09:57:31 UTC 2021

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

Log Message:
lint: clean up debug logging, use consistent variable names

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.153 src/usr.bin/xlint/lint1/init.c:1.154
--- src/usr.bin/xlint/lint1/init.c:1.153	Sun Mar 28 09:51:16 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 09:57:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.153 2021/03/28 09:51:16 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.154 2021/03/28 09:57:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.153 2021/03/28 09:51:16 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.154 2021/03/28 09:57:31 rillig Exp $");
 #endif
 
 #include 
@@ -614,22 +614,22 @@ current_initsym(void)
 void
 begin_initialization(sym_t *sym)
 {
-	struct initialization *curr_init;
+	struct initialization *in;
 
 	debug_step("begin initialization of '%s'", type_name(sym->s_type));
-	curr_init = initialization_new(sym);
-	curr_init->next = init;
-	init = curr_init;
+	in = initialization_new(sym);
+	in->next = init;
+	init = in;
 }
 
 void
 end_initialization(void)
 {
-	struct initialization *curr_init;
+	struct initialization *in;
 
-	curr_init = init;
+	in = init;
 	init = init->next;
-	initialization_free(curr_init);
+	initialization_free(in);
 	debug_step("end initialization");
 }
 
@@ -885,11 +885,7 @@ initstack_push_array(struct initializati
 
 	if (level->bl_enclosing->bl_seen_named_member) {
 		level->bl_brace = true;
-		debug_step("ARRAY%s%s",
-		level->bl_brace ? ", needs closing brace" : "",
-		/* TODO: this is redundant, always true */
-		level->bl_enclosing->bl_seen_named_member
-			? ", seen named member" : "");
+		debug_step("ARRAY, seen named member, needs closing brace");
 	}
 
 	if (is_incomplete(level->bl_type) &&



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 09:51:16 UTC 2021

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

Log Message:
lint: omit unnecessary calls to current_init

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.152 src/usr.bin/xlint/lint1/init.c:1.153
--- src/usr.bin/xlint/lint1/init.c:1.152	Sun Mar 28 09:46:55 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 09:51:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.152 2021/03/28 09:46:55 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.153 2021/03/28 09:51:16 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.152 2021/03/28 09:46:55 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.153 2021/03/28 09:51:16 rillig Exp $");
 #endif
 
 #include 
@@ -714,17 +714,16 @@ initstack_init(void)
 		initsym->s_type = duptyp(initsym->s_type);
 	/* TODO: does 'duptyp' create a memory leak? */
 
-	current_init()->brace_level = brace_level_new(NULL, initsym->s_type, 1);
+	in->brace_level = brace_level_new(NULL, initsym->s_type, 1);
 
-	initialization_debug(current_init());
+	initialization_debug(in);
 	debug_leave();
 }
 
 /* TODO: document me */
 static void
-initstack_pop_item_named_member(const char *name)
+initstack_pop_item_named_member(struct initialization *in, const char *name)
 {
-	struct initialization *in = current_init();
 	struct brace_level *level = in->brace_level;
 	const sym_t *m;
 
@@ -801,11 +800,11 @@ initstack_pop_item(struct initialization
 	debug_step("%d elements remaining", level->bl_remaining);
 
 	if (in->designation.head != NULL && in->designation.head->name != NULL)
-		initstack_pop_item_named_member(in->designation.head->name);
+		initstack_pop_item_named_member(in, in->designation.head->name);
 	else
 		initstack_pop_item_unnamed(in);
 
-	initialization_debug(current_init());
+	initialization_debug(in);
 	debug_leave();
 }
 
@@ -1029,14 +1028,13 @@ again:
 		break;
 	}
 
-	initialization_debug(current_init());
+	initialization_debug(in);
 	debug_leave();
 }
 
 static void
-check_too_many_initializers(void)
+check_too_many_initializers(struct initialization *in)
 {
-	struct initialization *in = current_init();
 	const struct brace_level *level = in->brace_level;
 
 	if (level->bl_remaining > 0)
@@ -1080,7 +1078,7 @@ initstack_next_brace(struct initializati
 		initialization_set_error(in);
 	}
 	if (!in->initerr)
-		check_too_many_initializers();
+		check_too_many_initializers(in);
 	if (!in->initerr)
 		initstack_push(in);
 	if (!in->initerr) {
@@ -1092,7 +1090,7 @@ initstack_next_brace(struct initializati
 			: in->brace_level->bl_subtype));
 	}
 
-	initialization_debug(current_init());
+	initialization_debug(in);
 	debug_leave();
 }
 
@@ -1110,7 +1108,7 @@ initstack_next_nobrace(struct initializa
 	}
 
 	if (!in->initerr)
-		check_too_many_initializers();
+		check_too_many_initializers(in);
 
 	while (!in->initerr) {
 		struct brace_level *level = in->brace_level;
@@ -1130,7 +1128,7 @@ initstack_next_nobrace(struct initializa
 		initstack_push(in);
 	}
 
-	initialization_debug(current_init());
+	initialization_debug(in);
 	debug_leave();
 }
 
@@ -1222,13 +1220,13 @@ check_non_constant_initializer(const tno
  * single initializer expression without braces by delegating to ASSIGN.
  */
 static bool
-init_using_assign(tnode_t *rn)
+init_using_assign(struct initialization *in, tnode_t *rn)
 {
 	tnode_t *ln, *tn;
 
 	if (initsym->s_type->t_tspec == ARRAY)
 		return false;
-	if (current_init()->brace_level->bl_enclosing != NULL)
+	if (in->brace_level->bl_enclosing != NULL)
 		return false;
 
 	debug_step("handing over to ASSIGN");
@@ -1245,9 +1243,8 @@ init_using_assign(tnode_t *rn)
 }
 
 static void
-check_init_expr(tnode_t *tn, scl_t sclass)
+check_init_expr(struct initialization *in, tnode_t *tn, scl_t sclass)
 {
-	struct initialization *in = current_init();
 	tnode_t *ln;
 	tspec_t lt, rt;
 	struct mbl *tmem;
@@ -1297,7 +1294,7 @@ init_using_expr(tnode_t *tn)
 	scl_t	sclass;
 
 	debug_enter();
-	initialization_debug(current_init());
+	initialization_debug(in);
 	designation_debug(>designation);
 	debug_step("expr:");
 	debug_node(tn, debug_ind + 1);
@@ -1306,7 +1303,7 @@ init_using_expr(tnode_t *tn)
 		goto done;
 
 	sclass = initsym->s_scl;
-	if ((sclass == AUTO || sclass == REG) && init_using_assign(tn))
+	if ((sclass == AUTO || sclass == REG) && init_using_assign(in, tn))
 		goto done;
 
 	initstack_pop_nobrace(in);
@@ -1324,10 +1321,10 @@ init_using_expr(tnode_t *tn)
 	in->brace_level->bl_remaining--;
 	debug_step("%d elements remaining", in->brace_level->bl_remaining);
 
-	check_init_expr(tn, sclass);
+	check_init_expr(in, 

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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 09:46:55 UTC 2021

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

Log Message:
lint: move brace level functions further up

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.151 src/usr.bin/xlint/lint1/init.c:1.152
--- src/usr.bin/xlint/lint1/init.c:1.151	Sun Mar 28 09:43:28 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 09:46:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.151 2021/03/28 09:43:28 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.152 2021/03/28 09:46:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.151 2021/03/28 09:43:28 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.152 2021/03/28 09:46:55 rillig Exp $");
 #endif
 
 #include 
@@ -394,6 +394,24 @@ designation_shift_level(struct designati
 }
 
 
+static struct brace_level *
+brace_level_new(type_t *type, type_t *subtype, int remaining)
+{
+	struct brace_level *level = xcalloc(1, sizeof(*level));
+
+	level->bl_type = type;
+	level->bl_subtype = subtype;
+	level->bl_remaining = remaining;
+
+	return level;
+}
+
+static void
+brace_level_free(struct brace_level *level)
+{
+	free(level);
+}
+
 #ifdef DEBUG
 /*
  * TODO: only log the top of the stack after each modifying operation
@@ -429,6 +447,30 @@ brace_level_debug(const struct brace_lev
 #define brace_level_debug(level) do { } while (false)
 #endif
 
+static void
+brace_level_set_array_dimension(struct brace_level *level, int dim)
+{
+	debug_step("setting the array size to %d", dim);
+	level->bl_type->t_dim = dim;
+	debug_indent();
+	brace_level_debug(level);
+}
+
+static void
+brace_level_next_member(struct brace_level *level)
+{
+	const sym_t *m;
+
+	do {
+		m = level->bl_next_member = level->bl_next_member->s_next;
+		/* XXX: can this assertion be made to fail? */
+		lint_assert(m != NULL);
+	} while (m->s_bitfield && m->s_name == unnamed);
+
+	debug_indent();
+	brace_level_debug(level);
+}
+
 static const sym_t *
 brace_level_look_up_member(const struct brace_level *level, const char *name)
 {
@@ -505,7 +547,7 @@ initialization_free(struct initializatio
 
 	for (level = in->brace_level; level != NULL; level = next) {
 		next = level->bl_enclosing;
-		free(level);
+		brace_level_free(level);
 	}
 
 	free(in);
@@ -603,42 +645,6 @@ designation_add_name(sbuf_t *sb)
 /* TODO: Move the function body up here, to avoid the forward declaration. */
 static void initstack_pop_nobrace(struct initialization *);
 
-static struct brace_level *
-brace_level_new(type_t *type, type_t *subtype, int remaining)
-{
-	struct brace_level *level = xcalloc(1, sizeof(*level));
-
-	level->bl_type = type;
-	level->bl_subtype = subtype;
-	level->bl_remaining = remaining;
-
-	return level;
-}
-
-static void
-brace_level_set_array_dimension(struct brace_level *level, int dim)
-{
-	debug_step("setting the array size to %d", dim);
-	level->bl_type->t_dim = dim;
-	debug_indent();
-	brace_level_debug(level);
-}
-
-static void
-brace_level_next_member(struct brace_level *level)
-{
-	const sym_t *m;
-
-	do {
-		m = level->bl_next_member = level->bl_next_member->s_next;
-		/* XXX: can this assertion be made to fail? */
-		lint_assert(m != NULL);
-	} while (m->s_bitfield && m->s_name == unnamed);
-
-	debug_indent();
-	brace_level_debug(level);
-}
-
 /*
  * A sub-object of an array is initialized using a designator.  This does not
  * have to be an array element directly, it can also be used to initialize
@@ -786,7 +792,7 @@ initstack_pop_item(struct initialization
 	brace_level_debug(level);
 
 	in->brace_level = level->bl_enclosing;
-	free(level);
+	brace_level_free(level);
 	level = in->brace_level;
 	lint_assert(level != NULL);
 
@@ -1014,7 +1020,7 @@ again:
 	pop:
 			/* TODO: extract this into end_initializer_level */
 			enclosing = in->brace_level->bl_enclosing;
-			free(level);
+			brace_level_free(level);
 			in->brace_level = enclosing;
 			goto again;
 		}



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 09:43:28 UTC 2021

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

Log Message:
lint: clean up debug logging for initialization

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.150 src/usr.bin/xlint/lint1/init.c:1.151
--- src/usr.bin/xlint/lint1/init.c:1.150	Sun Mar 28 09:39:04 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 09:43:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.150 2021/03/28 09:39:04 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.151 2021/03/28 09:43:28 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.150 2021/03/28 09:39:04 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.151 2021/03/28 09:43:28 rillig Exp $");
 #endif
 
 #include 
@@ -307,13 +307,16 @@ debug_leave(const char *func)
 	printf("%*s- %s\n", 2 * --debug_ind, "", func);
 }
 
+#define debug_enter() (debug_enter)(__func__)
+#define debug_leave() (debug_leave)(__func__)
+
 #else
 
 #define debug_printf(fmt, ...)	do { } while (false)
 #define debug_indent()		do { } while (false)
-#define debug_enter(function)	do { } while (false)
+#define debug_enter()		do { } while (false)
 #define debug_step(fmt, ...)	do { } while (false)
-#define debug_leave(function)	do { } while (false)
+#define debug_leave()		do { } while (false)
 
 #endif
 
@@ -565,20 +568,6 @@ current_initsym(void)
 
 #define initsym		(*current_initsym())
 
-#ifndef DEBUG
-
-#define debug_designation()	do { } while (false)
-#define debug_brace_level(level) do { } while (false)
-#define debug_initstack()	do { } while (false)
-
-#else
-
-
-#define debug_enter() debug_enter(__func__)
-#define debug_leave() debug_leave(__func__)
-
-#endif
-
 
 void
 begin_initialization(sym_t *sym)



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 09:39:04 UTC 2021

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

Log Message:
lint: inline initerr in code for handling initializations

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.149 src/usr.bin/xlint/lint1/init.c:1.150
--- src/usr.bin/xlint/lint1/init.c:1.149	Sun Mar 28 09:34:45 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 09:39:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.149 2021/03/28 09:34:45 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.150 2021/03/28 09:39:04 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.149 2021/03/28 09:34:45 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.150 2021/03/28 09:39:04 rillig Exp $");
 #endif
 
 #include 
@@ -533,6 +533,13 @@ initialization_debug(const struct initia
 #define initialization_debug(in) do { } while (false)
 #endif
 
+static void
+initialization_set_error(struct initialization *in)
+{
+	in->initerr = true;
+}
+
+
 /* XXX: unnecessary prototype since it is not recursive */
 static	bool	init_array_using_string(struct initialization *, tnode_t *);
 
@@ -556,13 +563,6 @@ current_initsym(void)
 	return _init()->initsym;
 }
 
-static void
-set_initerr(void)
-{
-	current_init()->initerr = true;
-}
-
-#define initerr		(*current_initerr())
 #define initsym		(*current_initsym())
 
 #ifndef DEBUG
@@ -704,8 +704,9 @@ designation_add_subscript(range_t range)
 void
 initstack_init(void)
 {
+	struct initialization *in = current_init();
 
-	if (initerr)
+	if (in->initerr)
 		return;
 
 	debug_enter();
@@ -742,7 +743,7 @@ initstack_pop_item_named_member(const ch
 	level->bl_type->t_tspec != UNION) {
 		/* syntax error '%s' */
 		error(249, "named member must only be used with struct/union");
-		set_initerr();
+		initialization_set_error(in);
 		return;
 	}
 
@@ -901,7 +902,7 @@ initstack_push_array(struct initializati
 	level->bl_enclosing->bl_enclosing != NULL) {
 		/* initialization of an incomplete type */
 		error(175);
-		set_initerr();
+		initialization_set_error(in);
 		return;
 	}
 
@@ -930,7 +931,7 @@ initstack_push_struct_or_union(struct in
 	if (is_incomplete(level->bl_type)) {
 		/* initialization of an incomplete type */
 		error(175);
-		set_initerr();
+		initialization_set_error(in);
 		return false;
 	}
 
@@ -964,7 +965,7 @@ initstack_push_struct_or_union(struct in
 	if (cnt == 0) {
 		/* cannot init. struct/union with no named member */
 		error(179);
-		set_initerr();
+		initialization_set_error(in);
 		return false;
 	}
 	level->bl_remaining = level->bl_type->t_tspec == STRUCT ? cnt : 1;
@@ -1040,7 +1041,9 @@ again:
 static void
 check_too_many_initializers(void)
 {
-	const struct brace_level *level = current_init()->brace_level;
+	struct initialization *in = current_init();
+	const struct brace_level *level = in->brace_level;
+
 	if (level->bl_remaining > 0)
 		return;
 	/*
@@ -1060,7 +1063,7 @@ check_too_many_initializers(void)
 		/* too many initializers */
 		error(174);
 	}
-	set_initerr();
+	initialization_set_error(in);
 }
 
 /*
@@ -1079,13 +1082,13 @@ initstack_next_brace(struct initializati
 	is_scalar(in->brace_level->bl_type->t_tspec)) {
 		/* invalid initializer type %s */
 		error(176, type_name(in->brace_level->bl_type));
-		set_initerr();
+		initialization_set_error(in);
 	}
-	if (!initerr)
+	if (!in->initerr)
 		check_too_many_initializers();
-	if (!initerr)
+	if (!in->initerr)
 		initstack_push(in);
-	if (!initerr) {
+	if (!in->initerr) {
 		in->brace_level->bl_brace = true;
 		designation_debug(>designation);
 		debug_step("expecting type '%s'",
@@ -,10 +1114,10 @@ initstack_next_nobrace(struct initializa
 		/* XXX: maybe set initerr here */
 	}
 
-	if (!initerr)
+	if (!in->initerr)
 		check_too_many_initializers();
 
-	while (!initerr) {
+	while (!in->initerr) {
 		struct brace_level *level = in->brace_level;
 
 		if (tn->tn_type->t_tspec == STRUCT &&
@@ -1142,7 +1145,7 @@ init_lbrace(void)
 {
 	struct initialization *in = current_init();
 
-	if (initerr)
+	if (in->initerr)
 		return;
 
 	debug_enter();
@@ -1175,11 +1178,13 @@ init_lbrace(void)
 void
 init_rbrace(void)
 {
-	if (initerr)
+	struct initialization *in = current_init();
+
+	if (in->initerr)
 		return;
 
 	debug_enter();
-	initstack_pop_brace(current_init());
+	initstack_pop_brace(in);
 	debug_leave();
 }
 
@@ -1302,7 +1307,7 @@ init_using_expr(tnode_t *tn)
 	debug_step("expr:");
 	debug_node(tn, debug_ind + 1);
 
-	if (initerr || tn == NULL)
+	if (in->initerr || tn == NULL)
 		goto done;
 
 	sclass = initsym->s_scl;
@@ -1318,7 +1323,7 @@ init_using_expr(tnode_t *tn)
 	}
 
 	

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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 09:34:45 UTC 2021

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

Log Message:
lint: inline brace level in initialization

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.148 src/usr.bin/xlint/lint1/init.c:1.149
--- src/usr.bin/xlint/lint1/init.c:1.148	Sun Mar 28 09:20:51 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 09:34:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.148 2021/03/28 09:20:51 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.149 2021/03/28 09:34:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.148 2021/03/28 09:20:51 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.149 2021/03/28 09:34:45 rillig Exp $");
 #endif
 
 #include 
@@ -556,18 +556,6 @@ current_initsym(void)
 	return _init()->initsym;
 }
 
-static const struct brace_level *
-current_brace_level(void)
-{
-	return current_init()->brace_level;
-}
-
-static struct brace_level **
-current_brace_level_lvalue(void)
-{
-	return _init()->brace_level;
-}
-
 static void
 set_initerr(void)
 {
@@ -576,8 +564,6 @@ set_initerr(void)
 
 #define initerr		(*current_initerr())
 #define initsym		(*current_initsym())
-#define brace_level_rvalue	(current_brace_level())
-#define brace_level_lvalue	(*current_brace_level_lvalue())
 
 #ifndef DEBUG
 
@@ -641,12 +627,12 @@ brace_level_new(type_t *type, type_t *su
 }
 
 static void
-brace_level_set_array_dimension(int dim)
+brace_level_set_array_dimension(struct brace_level *level, int dim)
 {
 	debug_step("setting the array size to %d", dim);
-	brace_level_lvalue->bl_type->t_dim = dim;
+	level->bl_type->t_dim = dim;
 	debug_indent();
-	brace_level_debug(brace_level_rvalue);
+	brace_level_debug(level);
 }
 
 static void
@@ -684,6 +670,7 @@ brace_level_next_member(struct brace_lev
 void
 designation_add_subscript(range_t range)
 {
+	struct initialization *in = current_init();
 	struct brace_level *level;
 
 	debug_enter();
@@ -694,14 +681,14 @@ designation_add_subscript(range_t range)
 		range.lo, range.hi);
 
 	/* XXX: This call is wrong here, it must be somewhere else. */
-	initstack_pop_nobrace(current_init());
+	initstack_pop_nobrace(in);
 
-	level = brace_level_lvalue;
+	level = in->brace_level;
 	if (level->bl_array_of_unknown_size) {
 		/* No +1 here, extend_if_array_of_unknown_size will add it. */
 		int auto_dim = (int)range.hi;
 		if (auto_dim > level->bl_type->t_dim)
-			brace_level_set_array_dimension(auto_dim);
+			brace_level_set_array_dimension(level, auto_dim);
 	}
 
 	debug_leave();
@@ -731,7 +718,7 @@ initstack_init(void)
 		initsym->s_type = duptyp(initsym->s_type);
 	/* TODO: does 'duptyp' create a memory leak? */
 
-	brace_level_lvalue = brace_level_new(NULL, initsym->s_type, 1);
+	current_init()->brace_level = brace_level_new(NULL, initsym->s_type, 1);
 
 	initialization_debug(current_init());
 	debug_leave();
@@ -780,9 +767,9 @@ initstack_pop_item_named_member(const ch
 
 /* TODO: think of a better name than 'pop' */
 static void
-initstack_pop_item_unnamed(void)
+initstack_pop_item_unnamed(struct initialization *in)
 {
-	struct brace_level *level = brace_level_lvalue;
+	struct brace_level *level = in->brace_level;
 
 	/*
 	 * If the removed element was a structure member, we must go
@@ -803,14 +790,14 @@ initstack_pop_item(struct initialization
 
 	debug_enter();
 
-	level = brace_level_lvalue;
+	level = in->brace_level;
 	debug_indent();
 	debug_printf("popping: ");
 	brace_level_debug(level);
 
-	brace_level_lvalue = level->bl_enclosing;
+	in->brace_level = level->bl_enclosing;
 	free(level);
-	level = brace_level_lvalue;
+	level = in->brace_level;
 	lint_assert(level != NULL);
 
 	level->bl_remaining--;
@@ -820,7 +807,7 @@ initstack_pop_item(struct initialization
 	if (in->designation.head != NULL && in->designation.head->name != NULL)
 		initstack_pop_item_named_member(in->designation.head->name);
 	else
-		initstack_pop_item_unnamed();
+		initstack_pop_item_unnamed(in);
 
 	initialization_debug(current_init());
 	debug_leave();
@@ -838,7 +825,7 @@ initstack_pop_brace(struct initializatio
 	debug_enter();
 	initialization_debug(in);
 	do {
-		brace = brace_level_rvalue->bl_brace;
+		brace = in->brace_level->bl_brace;
 		/* TODO: improve wording of the debug message */
 		debug_step("loop brace=%d", brace);
 		initstack_pop_item(in);
@@ -866,9 +853,9 @@ initstack_pop_nobrace(struct initializat
 
 /* Extend an array of unknown size by one element */
 static void
-extend_if_array_of_unknown_size(void)
+extend_if_array_of_unknown_size(struct initialization *in)
 {
-	struct brace_level *level = brace_level_lvalue;
+	

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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 09:20:51 UTC 2021

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

Log Message:
lint: replace global variables with function parameters

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.147 src/usr.bin/xlint/lint1/init.c:1.148
--- src/usr.bin/xlint/lint1/init.c:1.147	Sun Mar 28 09:08:13 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 09:20:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.147 2021/03/28 09:08:13 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.148 2021/03/28 09:20:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.147 2021/03/28 09:08:13 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.148 2021/03/28 09:20:51 rillig Exp $");
 #endif
 
 #include 
@@ -534,7 +534,7 @@ initialization_debug(const struct initia
 #endif
 
 /* XXX: unnecessary prototype since it is not recursive */
-static	bool	init_array_using_string(tnode_t *);
+static	bool	init_array_using_string(struct initialization *, tnode_t *);
 
 
 static struct initialization *
@@ -556,18 +556,6 @@ current_initsym(void)
 	return _init()->initsym;
 }
 
-static struct designation *
-current_designation_mod(void)
-{
-	return _init()->designation;
-}
-
-static struct designation
-current_designation(void)
-{
-	return *current_designation_mod();
-}
-
 static const struct brace_level *
 current_brace_level(void)
 {
@@ -633,12 +621,12 @@ end_initialization(void)
 void
 designation_add_name(sbuf_t *sb)
 {
-	designation_add(current_designation_mod(),
+	designation_add(_init()->designation,
 	designator_new(sb->sb_name));
 }
 
 /* TODO: Move the function body up here, to avoid the forward declaration. */
-static void initstack_pop_nobrace(void);
+static void initstack_pop_nobrace(struct initialization *);
 
 static struct brace_level *
 brace_level_new(type_t *type, type_t *subtype, int remaining)
@@ -705,7 +693,8 @@ designation_add_subscript(range_t range)
 		debug_step("subscript range is %zu ... %zu",
 		range.lo, range.hi);
 
-	initstack_pop_nobrace();
+	/* XXX: This call is wrong here, it must be somewhere else. */
+	initstack_pop_nobrace(current_init());
 
 	level = brace_level_lvalue;
 	if (level->bl_array_of_unknown_size) {
@@ -752,7 +741,8 @@ initstack_init(void)
 static void
 initstack_pop_item_named_member(const char *name)
 {
-	struct brace_level *level = brace_level_lvalue;
+	struct initialization *in = current_init();
+	struct brace_level *level = in->brace_level;
 	const sym_t *m;
 
 	/*
@@ -775,7 +765,7 @@ initstack_pop_item_named_member(const ch
 		/* undefined struct/union member: %s */
 		error(101, name);
 
-		designation_shift_level(current_designation_mod());
+		designation_shift_level(>designation);
 		level->bl_seen_named_member = true;
 		return;
 	}
@@ -785,7 +775,7 @@ initstack_pop_item_named_member(const ch
 	/* XXX: why ++? */
 	level->bl_remaining++;
 	/* XXX: why is bl_seen_named_member not set? */
-	designation_shift_level(current_designation_mod());
+	designation_shift_level(>designation);
 }
 
 /* TODO: think of a better name than 'pop' */
@@ -807,10 +797,9 @@ initstack_pop_item_unnamed(void)
 
 /* TODO: think of a better name than 'pop' */
 static void
-initstack_pop_item(void)
+initstack_pop_item(struct initialization *in)
 {
 	struct brace_level *level;
-	struct designator *first_designator;
 
 	debug_enter();
 
@@ -828,9 +817,8 @@ initstack_pop_item(void)
 	lint_assert(level->bl_remaining >= 0);
 	debug_step("%d elements remaining", level->bl_remaining);
 
-	first_designator = current_designation().head;
-	if (first_designator != NULL && first_designator->name != NULL)
-		initstack_pop_item_named_member(first_designator->name);
+	if (in->designation.head != NULL && in->designation.head->name != NULL)
+		initstack_pop_item_named_member(in->designation.head->name);
 	else
 		initstack_pop_item_unnamed();
 
@@ -843,19 +831,19 @@ initstack_pop_item(void)
  * from the stack.
  */
 static void
-initstack_pop_brace(void)
+initstack_pop_brace(struct initialization *in)
 {
 	bool brace;
 
 	debug_enter();
-	initialization_debug(current_init());
+	initialization_debug(in);
 	do {
 		brace = brace_level_rvalue->bl_brace;
 		/* TODO: improve wording of the debug message */
 		debug_step("loop brace=%d", brace);
-		initstack_pop_item();
+		initstack_pop_item(in);
 	} while (!brace);
-	initialization_debug(current_init());
+	initialization_debug(in);
 	debug_leave();
 }
 
@@ -865,14 +853,14 @@ initstack_pop_brace(void)
  */
 /* TODO: think of a better name than 'pop' */
 static void
-initstack_pop_nobrace(void)
+initstack_pop_nobrace(struct initialization *in)
 

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

2021-03-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Mar 28 09:11:38 UTC 2021

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

Log Message:
Only target the boot cpu for real with SPI interrupts.  I tried to do
this back in 2014, but somehow I missed a spot.

This is a quick-and-dirty fix for the USB stack which expects transfer
completions to be in-order.  If interrupts happen across the CPUs then
this isn't guaranteed (yet).

kern/55243 panic at usb_transfer_complete() on raspberry pi 4


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/arm/cortex/gic.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/gic.c
diff -u src/sys/arch/arm/cortex/gic.c:1.46 src/sys/arch/arm/cortex/gic.c:1.47
--- src/sys/arch/arm/cortex/gic.c:1.46	Tue Feb 23 10:03:04 2021
+++ src/sys/arch/arm/cortex/gic.c	Sun Mar 28 09:11:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gic.c,v 1.46 2021/02/23 10:03:04 jmcneill Exp $	*/
+/*	$NetBSD: gic.c,v 1.47 2021/03/28 09:11:38 skrll Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.46 2021/02/23 10:03:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.47 2021/03/28 09:11:38 skrll Exp $");
 
 #include 
 #include 
@@ -517,7 +517,11 @@ armgic_cpu_init_targets(struct armgic_so
 		if (is != NULL && is->is_mpsafe) {
 			const u_int byte_shift = 8 * (irq & 3);
 			uint32_t targets = gicd_read(sc, targets_reg);
+#if 0
 			targets |= sc->sc_mptargets << byte_shift;
+#else
+			targets |= sc->sc_bptargets << byte_shift;
+#endif
 			gicd_write(sc, targets_reg, targets);
 		}
 	}



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 09:08:13 UTC 2021

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

Log Message:
lint: move more functions to the global-variables-free section

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.146 src/usr.bin/xlint/lint1/init.c:1.147
--- src/usr.bin/xlint/lint1/init.c:1.146	Sun Mar 28 08:30:22 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 09:08:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.146 2021/03/28 08:30:22 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.147 2021/03/28 09:08:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.146 2021/03/28 08:30:22 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.147 2021/03/28 09:08:13 rillig Exp $");
 #endif
 
 #include 
@@ -426,6 +426,64 @@ brace_level_debug(const struct brace_lev
 #define brace_level_debug(level) do { } while (false)
 #endif
 
+static const sym_t *
+brace_level_look_up_member(const struct brace_level *level, const char *name)
+{
+	const type_t *tp = level->bl_type;
+	const sym_t *m;
+
+	lint_assert(tp->t_tspec == STRUCT || tp->t_tspec == UNION);
+
+	for (m = tp->t_str->sou_first_member; m != NULL; m = m->s_next) {
+		if (m->s_bitfield && m->s_name == unnamed)
+			continue;
+		if (strcmp(m->s_name, name) == 0)
+			return m;
+	}
+
+	return NULL;
+}
+
+/* TODO: merge duplicate code */
+static sym_t *
+brace_level_look_up_member_bloated(struct brace_level *level,
+			   const struct designator *dr, int *count)
+{
+	sym_t *m;
+
+	for (m = level->bl_type->t_str->sou_first_member;
+	 m != NULL; m = m->s_next) {
+		if (m->s_bitfield && m->s_name == unnamed)
+			continue;
+		/*
+		 * TODO: split into separate functions:
+		 *
+		 * look_up_array_next
+		 * look_up_array_designator
+		 * look_up_struct_next
+		 * look_up_struct_designator
+		 */
+		if (dr != NULL) {
+			/* XXX: this log entry looks unnecessarily verbose */
+			debug_step("have member '%s', want member '%s'",
+			m->s_name, dr->name);
+			if (strcmp(m->s_name, dr->name) == 0) {
+(*count)++;
+break;
+			} else
+continue;
+		}
+
+		/* XXX: What is this code for? */
+		if (++(*count) == 1) {
+			level->bl_next_member = m;
+			level->bl_subtype = m->s_type;
+		}
+	}
+
+	return m;
+}
+
 
 static struct initialization *
 initialization_new(sym_t *sym)
@@ -594,24 +652,6 @@ brace_level_new(type_t *type, type_t *su
 	return level;
 }
 
-static const sym_t *
-brace_level_look_up_member(const char *name)
-{
-	const type_t *tp = current_brace_level()->bl_type;
-	const sym_t *m;
-
-	lint_assert(tp->t_tspec == STRUCT || tp->t_tspec == UNION);
-
-	for (m = tp->t_str->sou_first_member; m != NULL; m = m->s_next) {
-		if (m->s_bitfield && m->s_name == unnamed)
-			continue;
-		if (strcmp(m->s_name, name) == 0)
-			return m;
-	}
-
-	return NULL;
-}
-
 static void
 brace_level_set_array_dimension(int dim)
 {
@@ -729,7 +769,7 @@ initstack_pop_item_named_member(const ch
 		return;
 	}
 
-	m = brace_level_look_up_member(name);
+	m = brace_level_look_up_member(level, name);
 	if (m == NULL) {
 		/* TODO: add type information to the message */
 		/* undefined struct/union member: %s */
@@ -898,42 +938,6 @@ initstack_push_array(void)
 	type_name(level->bl_type), level->bl_remaining);
 }
 
-static sym_t *
-look_up_member(struct brace_level *level, int *count)
-{
-	sym_t *m;
-
-	for (m = level->bl_type->t_str->sou_first_member;
-	 m != NULL; m = m->s_next) {
-		if (m->s_bitfield && m->s_name == unnamed)
-			continue;
-		/*
-		 * TODO: split into separate functions:
-		 *
-		 * look_up_array_next
-		 * look_up_array_designator
-		 * look_up_struct_next
-		 * look_up_struct_designator
-		 */
-		if (current_designation().head != NULL) {
-			/* XXX: this log entry looks unnecessarily verbose */
-			debug_step("have member '%s', want member '%s'",
-			m->s_name, current_designation().head->name);
-			if (strcmp(m->s_name,
-			current_designation().head->name) == 0) {
-(*count)++;
-break;
-			} else
-continue;
-		}
-		if (++(*count) == 1) {
-			level->bl_next_member = m;
-			level->bl_subtype = m->s_type;
-		}
-	}
-
-	return m;
-}
 
 /* TODO: document me */
 /* TODO: think of a better name than 'push' */
@@ -961,7 +965,8 @@ initstack_push_struct_or_union(void)
 	type_name(level->bl_type),
 	level->bl_seen_named_member ? ", seen named member" : "");
 
-	m = look_up_member(level, );
+	m = brace_level_look_up_member_bloated(level,
+	current_designation().head, );
 
 	if (current_designation().head != NULL) {
 		if (m == NULL) {



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

2021-03-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 28 08:43:05 UTC 2021

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

Log Message:
Enable a few more filesystems


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

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

Modified files:

Index: src/sys/arch/macppc/conf/POWERMAC_G5
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.46 src/sys/arch/macppc/conf/POWERMAC_G5:1.47
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.46	Sun Mar 28 08:39:31 2021
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Sun Mar 28 08:43:05 2021
@@ -63,16 +63,16 @@ file-system 	TMPFS		# memory file system
 file-system 	KERNFS		# /kern
 file-system 	PROCFS		# /proc
 file-system 	NFS		# Network File System client
-#file-system 	CD9660		# ISO 9660 + Rock Ridge file system
-#file-system 	MSDOSFS		# MS-DOS file system
+file-system 	CD9660		# ISO 9660 + Rock Ridge file system
+file-system 	MSDOSFS		# MS-DOS file system
 file-system	PTYFS		# /dev/pts/N support
 #file-system	HFS		# experimental - Apple HFS+ (read-only)
 
 # File system options
-#options 	QUOTA		# legacy UFS quotas
-#options 	QUOTA2		# new, in-filesystem UFS quotas
+options 	QUOTA		# legacy UFS quotas
+options 	QUOTA2		# new, in-filesystem UFS quotas
 #options 	FFS_EI		# FFS Endian Independant support
-#options 	WAPBL		# File system journaling support
+options 	WAPBL		# File system journaling support
 #options 	UFS_DIRHASH	# UFS Large Directory Hashing - Experimental
 #options 	NFSSERVER	# Network File System server
 #options 	FFS_NO_SNAPSHOT	# ffs snapshots



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

2021-03-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 28 08:39:31 UTC 2021

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

Log Message:
Remove makeoptions DEBUG="-g" - we have better ways to achieve the same
(build.sh kernel.gdb= or MKKDEBUG=yes)


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

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

Modified files:

Index: src/sys/arch/macppc/conf/POWERMAC_G5
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.45 src/sys/arch/macppc/conf/POWERMAC_G5:1.46
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.45	Sun Mar 28 08:34:18 2021
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Sun Mar 28 08:39:31 2021
@@ -52,8 +52,6 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 options 	TRAP_PANICWAIT
 #options 	DDB_COMMANDONENTER="bt"
 
-makeoptions 	DEBUG="-g"	# compile full symbol table
-
 # Compatibility options
 include 	"conf/compat_netbsd70.config"
 #options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.



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

2021-03-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 28 08:34:18 UTC 2021

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

Log Message:
Add siisata


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

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

Modified files:

Index: src/sys/arch/macppc/conf/POWERMAC_G5
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.44 src/sys/arch/macppc/conf/POWERMAC_G5:1.45
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.44	Tue Mar  2 06:31:25 2021
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Sun Mar 28 08:34:18 2021
@@ -202,7 +202,9 @@ options 	RADEONFB_ALWAYS_ACCEL_PUTCHAR
 #pciide* at pci? dev ? function ? flags 0x	# GENERIC pciide driver
 wdc* 	at pci? dev ? function ?		# Kauai ATA
 svwsata* at pci? dev ? function ?		# ServerWorks SATA controllers
+siisata* at pci? dev ? function ?		# SiI SteelVine controllers
 #options 	ATADEBUG
+
 obio*	at pci? dev ? function ?
 zsc*	at obio?
 zstty*	at zsc? channel ?



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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 08:30:22 UTC 2021

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

Log Message:
lint: reorder code for handling initializations

First the primitives for debug logging, then the functions that do not
access any global variables, finally everything else.

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.145 src/usr.bin/xlint/lint1/init.c:1.146
--- src/usr.bin/xlint/lint1/init.c:1.145	Sun Mar 28 07:59:09 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 08:30:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.145 2021/03/28 07:59:09 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.146 2021/03/28 08:30:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.145 2021/03/28 07:59:09 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.146 2021/03/28 08:30:22 rillig Exp $");
 #endif
 
 #include 
@@ -318,106 +318,87 @@ debug_leave(const char *func)
 #endif
 
 
-/* XXX: unnecessary prototype since it is not recursive */
-static	bool	init_array_using_string(tnode_t *);
-
-
-static struct initialization *
-current_init(void)
+static struct designator *
+designator_new(const char *name)
 {
-	lint_assert(init != NULL);
-	return init;
+	struct designator *d = xcalloc(1, sizeof *d);
+	d->name = name;
+	return d;
 }
 
-bool *
-current_initerr(void)
+static void
+designator_free(struct designator *d)
 {
-	return _init()->initerr;
+	free(d);
 }
 
-sym_t **
-current_initsym(void)
-{
-	return _init()->initsym;
-}
 
-static struct designation *
-current_designation_mod(void)
-{
-	return _init()->designation;
-}
-
-static struct designation
-current_designation(void)
+#ifdef DEBUG
+static void
+designation_debug(const struct designation *dn)
 {
-	return *current_designation_mod();
-}
+	const struct designator *p;
 
-static const struct brace_level *
-current_brace_level(void)
-{
-	return current_init()->brace_level;
-}
+	if (dn->head == NULL)
+		return;
 
-static struct brace_level **
-current_brace_level_lvalue(void)
-{
-	return _init()->brace_level;
+	debug_indent();
+	debug_printf("designation: ");
+	for (p = dn->head; p != NULL; p = p->next)
+		debug_printf(".%s", p->name);
+	debug_printf("\n");
 }
+#else
+#define designation_debug(dn) do { } while (false)
+#endif
 
 static void
-free_initialization(struct initialization *in)
+designation_add(struct designation *dn, struct designator *dr)
 {
-	struct brace_level *level, *next;
 
-	for (level = in->brace_level; level != NULL; level = next) {
-		next = level->bl_enclosing;
-		free(level);
+	if (dn->head != NULL) {
+		dn->tail->next = dr;
+		dn->tail = dr;
+	} else {
+		dn->head = dr;
+		dn->tail = dr;
 	}
 
-	free(in);
+	designation_debug(dn);
 }
 
+/* TODO: add support for array subscripts, not only named members */
+/*
+ * TODO: This function should not be necessary at all.  There is no need to
+ *  remove the head of the list.
+ */
 static void
-set_initerr(void)
+designation_shift_level(struct designation *dn)
 {
-	current_init()->initerr = true;
-}
-
-#define initerr		(*current_initerr())
-#define initsym		(*current_initsym())
-#define brace_level_rvalue	(current_brace_level())
-#define brace_level_lvalue	(*current_brace_level_lvalue())
+	lint_assert(dn->head != NULL);
 
-#ifndef DEBUG
-
-#define debug_designation()	do { } while (false)
-#define debug_brace_level(level) do { } while (false)
-#define debug_initstack()	do { } while (false)
-
-#else
-
-static void
-debug_designation(void)
-{
-	const struct designator *head = current_designation().head, *p;
-	if (head == NULL)
-		return;
+	if (dn->head == dn->tail) {
+		designator_free(dn->head);
+		dn->head = NULL;
+		dn->tail = NULL;
+	} else {
+		struct designator *head = dn->head;
+		dn->head = dn->head->next;
+		designator_free(head);
+	}
 
-	debug_indent();
-	debug_printf("designation: ");
-	for (p = head; p != NULL; p = p->next)
-		debug_printf(".%s", p->name);
-	debug_printf("\n");
+	designation_debug(dn);
 }
 
+
+#ifdef DEBUG
 /*
  * TODO: only log the top of the stack after each modifying operation
  *
  * TODO: wrap all write accesses to brace_level in setter functions
  */
 static void
-debug_brace_level(const struct brace_level *level)
+brace_level_debug(const struct brace_level *level)
 {
 	if (level->bl_type != NULL)
 		debug_printf("type '%s'", type_name(level->bl_type));
@@ -441,27 +422,125 @@ debug_brace_level(const struct brace_lev
 
 	debug_printf(", remaining %d\n", level->bl_remaining);
 }
+#else
+#define brace_level_debug(level) do { } while (false)
+#endif
+
+
+static struct initialization *
+initialization_new(sym_t *sym)
+{
+	struct initialization *in = 

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

2021-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 28 07:59:09 UTC 2021

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

Log Message:
lint: move debug primitives to the top of the code

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.144 src/usr.bin/xlint/lint1/init.c:1.145
--- src/usr.bin/xlint/lint1/init.c:1.144	Sat Mar 27 23:18:37 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Mar 28 07:59:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.144 2021/03/27 23:18:37 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.145 2021/03/28 07:59:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.144 2021/03/27 23:18:37 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.145 2021/03/28 07:59:09 rillig Exp $");
 #endif
 
 #include 
@@ -257,8 +257,66 @@ struct initialization {
 	struct initialization *next;
 };
 
+
 static struct initialization *init;
 
+#ifdef DEBUG
+static int debug_ind = 0;
+#endif
+
+
+#ifdef DEBUG
+
+static void __printflike(1, 2)
+debug_printf(const char *fmt, ...)
+{
+	va_list va;
+
+	va_start(va, fmt);
+	vfprintf(stdout, fmt, va);
+	va_end(va);
+}
+
+static void
+debug_indent(void)
+{
+	debug_printf("%*s", 2 * debug_ind, "");
+}
+
+static void
+debug_enter(const char *func)
+{
+	printf("%*s+ %s\n", 2 * debug_ind++, "", func);
+}
+
+static void __printflike(1, 2)
+debug_step(const char *fmt, ...)
+{
+	va_list va;
+
+	debug_indent();
+	va_start(va, fmt);
+	vfprintf(stdout, fmt, va);
+	va_end(va);
+	printf("\n");
+}
+
+static void
+debug_leave(const char *func)
+{
+	printf("%*s- %s\n", 2 * --debug_ind, "", func);
+}
+
+#else
+
+#define debug_printf(fmt, ...)	do { } while (false)
+#define debug_indent()		do { } while (false)
+#define debug_enter(function)	do { } while (false)
+#define debug_step(fmt, ...)	do { } while (false)
+#define debug_leave(function)	do { } while (false)
+
+#endif
+
 
 /* XXX: unnecessary prototype since it is not recursive */
 static	bool	init_array_using_string(tnode_t *);
@@ -333,59 +391,12 @@ set_initerr(void)
 
 #ifndef DEBUG
 
-#define debug_printf(fmt, ...)	do { } while (false)
-#define debug_indent()		do { } while (false)
-#define debug_enter(a)		do { } while (false)
-#define debug_step(fmt, ...)	do { } while (false)
-#define debug_leave(a)		do { } while (false)
 #define debug_designation()	do { } while (false)
 #define debug_brace_level(level) do { } while (false)
 #define debug_initstack()	do { } while (false)
 
 #else
 
-static int debug_ind = 0;
-
-static void __printflike(1, 2)
-debug_printf(const char *fmt, ...)
-{
-	va_list va;
-
-	va_start(va, fmt);
-	vfprintf(stdout, fmt, va);
-	va_end(va);
-}
-
-static void
-debug_indent(void)
-{
-	debug_printf("%*s", 2 * debug_ind, "");
-}
-
-static void
-debug_enter(const char *func)
-{
-	printf("%*s+ %s\n", 2 * debug_ind++, "", func);
-}
-
-static void __printflike(1, 2)
-debug_step(const char *fmt, ...)
-{
-	va_list va;
-
-	printf("%*s", 2 * debug_ind, "");
-	va_start(va, fmt);
-	vfprintf(stdout, fmt, va);
-	va_end(va);
-	printf("\n");
-}
-
-static void
-debug_leave(const char *func)
-{
-	printf("%*s- %s\n", 2 * --debug_ind, "", func);
-}
-
 static void
 debug_designation(void)
 {



CVS commit: src/share/man/man9

2021-03-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Mar 28 07:42:06 UTC 2021

Modified Files:
src/share/man/man9: audio.9

Log Message:
Update documents.
- query_format has been mandatory (since at least Feb 2020).
- set_params has been replaced to set_format (since May 2019).


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/share/man/man9/audio.9

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/man9/audio.9
diff -u src/share/man/man9/audio.9:1.60 src/share/man/man9/audio.9:1.61
--- src/share/man/man9/audio.9:1.60	Sat Feb  6 13:55:40 2021
+++ src/share/man/man9/audio.9	Sun Mar 28 07:42:06 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.9,v 1.60 2021/02/06 13:55:40 nia Exp $
+.\"	$NetBSD: audio.9,v 1.61 2021/03/28 07:42:06 isaki Exp $
 .\"
 .\" Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -241,17 +241,13 @@ The
 and
 .Va rec
 structures contain the encoding parameters that should be set to the hardware.
-If the driver has query_format, all parameters on
-.Va play
-and/or
-.Va rec
-are chosen from formats returned by query_format.
+All of these parameters are chosen from formats returned by
+.Va query_format .
 Therefore
 .Va play
 and/or
 .Va rec
 are always settable.
-If the driver does not have query_format, the driver has to validate the format.
 If the hardware does not support
 .Dv AUDIO_ENCODING_SLINEAR_{NE,OE}:16 ,
 conversion information should be filled the
@@ -355,7 +351,7 @@ The return value also must be non-zero a
 It is called in the Attach or Closed phases.
 .It Dv int commit_settings(void *hdl)
 optional, is called after all calls to
-.Va set_params ,
+.Va set_format ,
 and
 .Va set_port ,
 are done.