CVS commit: src/sys/dev/ic

2022-04-16 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 16 23:20:47 UTC 2022

Modified Files:
src/sys/dev/ic: dwc_eqos.c

Log Message:
eqos: Freeze counters to prevent unhandled interrupts


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/dwc_eqos.c

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



CVS commit: src/sys/dev/ic

2022-04-16 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 16 23:20:47 UTC 2022

Modified Files:
src/sys/dev/ic: dwc_eqos.c

Log Message:
eqos: Freeze counters to prevent unhandled interrupts


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/dwc_eqos.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/dwc_eqos.c
diff -u src/sys/dev/ic/dwc_eqos.c:1.5 src/sys/dev/ic/dwc_eqos.c:1.6
--- src/sys/dev/ic/dwc_eqos.c:1.5	Sun Feb 13 18:29:15 2022
+++ src/sys/dev/ic/dwc_eqos.c	Sat Apr 16 23:20:47 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos.c,v 1.5 2022/02/13 18:29:15 riastradh Exp $ */
+/* $NetBSD: dwc_eqos.c,v 1.6 2022/04/16 23:20:47 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.5 2022/02/13 18:29:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.6 2022/04/16 23:20:47 jmcneill Exp $");
 
 #include 
 #include 
@@ -565,6 +565,12 @@ eqos_init_locked(struct eqos_softc *sc)
 	val |= GMAC_DMA_CHAN0_RX_CONTROL_START;
 	WR4(sc, GMAC_DMA_CHAN0_RX_CONTROL, val);
 
+	/* Disable counters */
+	WR4(sc, GMAC_MMC_CONTROL,
+	GMAC_MMC_CONTROL_CNTFREEZ |
+	GMAC_MMC_CONTROL_CNTPRST |
+	GMAC_MMC_CONTROL_CNTPRSTLVL);
+
 	/* Configure operation modes */
 	WR4(sc, GMAC_MTL_TXQ0_OPERATION_MODE,
 	GMAC_MTL_TXQ0_OPERATION_MODE_TSF |



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 22:21:10 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: ckbool.c op.h oper.c ops.def tree.c

Log Message:
lint: merge mod_t.m_test_context into m_requires_bool

These two flags mean exactly the same.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint1/ckbool.c
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/lint1/op.h
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/lint1/oper.c
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/xlint/lint1/ops.def
cvs rdiff -u -r1.432 -r1.433 src/usr.bin/xlint/lint1/tree.c

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



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 22:21:10 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: ckbool.c op.h oper.c ops.def tree.c

Log Message:
lint: merge mod_t.m_test_context into m_requires_bool

These two flags mean exactly the same.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint1/ckbool.c
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/lint1/op.h
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/lint1/oper.c
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/xlint/lint1/ops.def
cvs rdiff -u -r1.432 -r1.433 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/ckbool.c
diff -u src/usr.bin/xlint/lint1/ckbool.c:1.12 src/usr.bin/xlint/lint1/ckbool.c:1.13
--- src/usr.bin/xlint/lint1/ckbool.c:1.12	Sat Apr  9 15:43:41 2022
+++ src/usr.bin/xlint/lint1/ckbool.c	Sat Apr 16 22:21:10 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ckbool.c,v 1.12 2022/04/09 15:43:41 rillig Exp $ */
+/* $NetBSD: ckbool.c,v 1.13 2022/04/16 22:21:10 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include 
 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: ckbool.c,v 1.12 2022/04/09 15:43:41 rillig Exp $");
+__RCSID("$NetBSD: ckbool.c,v 1.13 2022/04/16 22:21:10 rillig Exp $");
 #endif
 
 #include 
@@ -156,7 +156,7 @@ typeok_scalar_strict_bool(op_t op, const
 	!typeok_strict_bool_binary_compatible(op, arg, ln, lt, rn, rt))
 		return false;
 
-	if (mp->m_requires_bool || op == QUEST) {
+	if (mp->m_requires_bool) {
 		bool binary = mp->m_binary;
 		bool lbool = is_typeok_bool_operand(ln);
 		bool ok = true;

Index: src/usr.bin/xlint/lint1/op.h
diff -u src/usr.bin/xlint/lint1/op.h:1.18 src/usr.bin/xlint/lint1/op.h:1.19
--- src/usr.bin/xlint/lint1/op.h:1.18	Sat Apr 16 21:14:33 2022
+++ src/usr.bin/xlint/lint1/op.h	Sat Apr 16 22:21:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: op.h,v 1.18 2022/04/16 21:14:33 rillig Exp $	*/
+/*	$NetBSD: op.h,v 1.19 2022/04/16 22:21:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -47,7 +47,6 @@ typedef	struct {
 	bool	m_requires_scalar: 1;
 	bool	m_fold_constant_operands: 1;
 	bool	m_value_context: 1;
-	bool	m_test_context: 1;
 	bool	m_balance_operands: 1;
 	bool	m_has_side_effect: 1;
 	bool	m_warn_if_left_unsigned_in_c90: 1;
@@ -66,7 +65,7 @@ extern const mod_t modtab[];
 #define op(name, repr, \
 		is_binary, is_logical, takes_bool, requires_bool, \
 		is_integer, is_complex, is_arithmetic, is_scalar, \
-		can_fold, is_value, is_test, balances_operands, \
+		can_fold, is_value, unused, balances_operands, \
 		side_effects, left_unsigned, right_unsigned, \
 		precedence_confusion, is_comparison, \
 		valid_on_enum, bad_on_enum, warn_if_eq) \

Index: src/usr.bin/xlint/lint1/oper.c
diff -u src/usr.bin/xlint/lint1/oper.c:1.10 src/usr.bin/xlint/lint1/oper.c:1.11
--- src/usr.bin/xlint/lint1/oper.c:1.10	Mon Aug  2 20:58:39 2021
+++ src/usr.bin/xlint/lint1/oper.c	Sat Apr 16 22:21:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: oper.c,v 1.10 2021/08/02 20:58:39 rillig Exp $	*/
+/*	$NetBSD: oper.c,v 1.11 2022/04/16 22:21:10 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@ const mod_t modtab[NOPS] =
 #define op(name, repr, \
 		is_binary, is_logical, takes_bool, requires_bool, \
 		is_integer, is_complex, is_arithmetic, is_scalar, \
-		can_fold, is_value, is_test, balances_operands, \
+		can_fold, is_value, unused, balances_operands, \
 		side_effects, left_unsigned, right_unsigned, \
 		precedence_confusion, is_comparison, \
 		valid_on_enum, bad_on_enum, warn_if_eq) \
@@ -48,7 +48,7 @@ const mod_t modtab[NOPS] =
 		is_integer	+ 0 > 0, is_complex		+ 0 > 0, \
 		is_arithmetic	+ 0 > 0, is_scalar		+ 0 > 0, \
 		can_fold	+ 0 > 0, is_value		+ 0 > 0, \
-		is_test		+ 0 > 0, balances_operands	+ 0 > 0, \
+		balances_operands + 0 > 0, \
 		side_effects	+ 0 > 0, left_unsigned		+ 0 > 0, \
 		right_unsigned	+ 0 > 0, precedence_confusion	+ 0 > 0, \
 		is_comparison	+ 0 > 0, valid_on_enum		+ 0 > 0, \

Index: src/usr.bin/xlint/lint1/ops.def
diff -u src/usr.bin/xlint/lint1/ops.def:1.27 src/usr.bin/xlint/lint1/ops.def:1.28
--- src/usr.bin/xlint/lint1/ops.def:1.27	Sat Apr 16 21:22:12 2022
+++ src/usr.bin/xlint/lint1/ops.def	Sat Apr 16 22:21:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ops.def,v 1.27 2022/04/16 21:22:12 rillig Exp $ */
+/*	$NetBSD: ops.def,v 1.28 2022/04/16 22:21:10 rillig Exp $ */
 
 begin_ops()
 
@@ -14,7 +14,7 @@ begin_ops()
  *	warn if left operand unsigned			  x	|
  *	has side effects	- - - - - - - - - - - - x	|
  *	balance operands			  x	|	|
- *	test contextx	|	|
+ *	(unused)x	|	|
  *	value context  x	|	|
  *	fold constant operands	- - - - - - - - x	|	|
  *	requires scalar			  x	|	|	|
@@ -26,11 +26,11 @@ begin_ops()
  *	logical			  x	|	|	|	|
  *	binary			x	|	|	|	|
  */
-/*	name	repr	

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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 21:22:12 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: ops.def

Log Message:
lint: clean up table with operator properties

Now that lint may use C99, make use of empty macro arguments.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/xlint/lint1/ops.def

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



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 21:22:12 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: ops.def

Log Message:
lint: clean up table with operator properties

Now that lint may use C99, make use of empty macro arguments.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/xlint/lint1/ops.def

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/ops.def
diff -u src/usr.bin/xlint/lint1/ops.def:1.26 src/usr.bin/xlint/lint1/ops.def:1.27
--- src/usr.bin/xlint/lint1/ops.def:1.26	Sat Apr 16 21:14:33 2022
+++ src/usr.bin/xlint/lint1/ops.def	Sat Apr 16 21:22:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ops.def,v 1.26 2022/04/16 21:14:33 rillig Exp $ */
+/*	$NetBSD: ops.def,v 1.27 2022/04/16 21:22:12 rillig Exp $ */
 
 begin_ops()
 
@@ -27,92 +27,92 @@ begin_ops()
  *	binary			x	|	|	|	|
  */
 /*	name	repr		b l b B i c a s f v t b s l r p c e e =	*/
-op(	NOOP,	"no-op",	-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
-op(	ARROW,	"->",		1,-,1,-,-,-,-,-,-,1,-,-,-,-,-,-,-,-,-,-)
-op(	POINT,	".",		1,-,1,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
-op(	NOT,	"!",		-,1,1,1,-,-,-,1,1,-,1,-,-,-,-,-,-,-,1,-)
-op(	COMPL,	"~",		-,-,-,-,-,1,-,-,1,1,-,-,-,-,-,-,-,-,1,1)
-op(	INC,	"++",		-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
-op(	DEC,	"--",		-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
-op(	INCBEF,	"++x",		-,-,-,-,-,-,-,1,-,-,-,-,1,-,-,-,-,-,1,-)
-op(	DECBEF,	"--x",		-,-,-,-,-,-,-,1,-,-,-,-,1,-,-,-,-,-,1,-)
-op(	INCAFT,	"x++",		-,-,-,-,-,-,-,1,-,-,-,-,1,-,-,-,-,-,1,-)
-op(	DECAFT,	"x--",		-,-,-,-,-,-,-,1,-,-,-,-,1,-,-,-,-,-,1,-)
-op(	UPLUS,	"+",		-,-,-,-,-,-,1,-,1,1,-,-,-,-,-,-,-,-,1,1)
-op(	UMINUS,	"-",		-,-,-,-,-,-,1,-,1,1,-,-,-,1,-,-,-,-,1,1)
-op(	INDIR,	"*",		-,-,-,-,-,-,-,-,-,1,-,-,-,-,-,-,-,-,-,-)
-op(	ADDR,	"&",		-,-,1,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-)
+op(	NOOP,	"no-op",	 , , , , , , , , , , , , , , , , , , , )
+op(	ARROW,	"->",		1, ,1, , , , , , ,1, , , , , , , , , , )
+op(	POINT,	".",		1, ,1, , , , , , , , , , , , , , , , , )
+op(	NOT,	"!",		 ,1,1,1, , , ,1,1, ,1, , , , , , , ,1, )
+op(	COMPL,	"~",		 , , , , ,1, , ,1,1, , , , , , , , ,1,1)
+op(	INC,	"++",		 , , , , , , , , , , , , , , , , , , , )
+op(	DEC,	"--",		 , , , , , , , , , , , , , , , , , , , )
+op(	INCBEF,	"++x",		 , , , , , , ,1, , , , ,1, , , , , ,1, )
+op(	DECBEF,	"--x",		 , , , , , , ,1, , , , ,1, , , , , ,1, )
+op(	INCAFT,	"x++",		 , , , , , , ,1, , , , ,1, , , , , ,1, )
+op(	DECAFT,	"x--",		 , , , , , , ,1, , , , ,1, , , , , ,1, )
+op(	UPLUS,	"+",		 , , , , , ,1, ,1,1, , , , , , , , ,1,1)
+op(	UMINUS,	"-",		 , , , , , ,1, ,1,1, , , ,1, , , , ,1,1)
+op(	INDIR,	"*",		 , , , , , , , , ,1, , , , , , , , , , )
+op(	ADDR,	"&",		 , ,1, , , , , , , , , , , , , , , , , )
 /* the operator 'arr[ind]' is translated to '*(arr + ind)' during parsing. */
 
 /*	name	repr		b l b B i c a s f v t b s l r p c e e = */
-op(	MULT,	"*",		1,-,-,-,-,-,1,-,1,1,-,1,-,-,1,-,-,-,1,1)
-op(	DIV,	"/",		1,-,-,-,-,-,1,-,1,1,-,1,-,1,1,-,-,-,1,1)
-op(	MOD,	"%",		1,-,-,-,1,-,-,-,1,1,-,1,-,1,1,-,-,-,1,1)
-op(	PLUS,	"+",		1,-,-,-,-,-,-,1,1,1,-,1,-,-,-,-,-,-,1,-)
-op(	MINUS,	"-",		1,-,-,-,-,-,-,1,1,1,-,1,-,-,-,-,-,-,1,-)
-op(	SHL,	"<<",		1,-,-,-,1,-,-,-,1,1,-,-,-,-,-,1,-,-,1,1)
-op(	SHR,	">>",		1,-,-,-,1,-,-,-,1,1,-,-,-,1,-,1,-,-,1,1)
-
-/*	name	repr		b l b B i c a s f v t b s l r p c e e = */
-op(	LT,	"<",		1,1,-,-,-,-,-,1,1,1,-,1,-,1,1,-,1,1,-,1)
-op(	LE,	"<=",		1,1,-,-,-,-,-,1,1,1,-,1,-,1,1,-,1,1,-,1)
-op(	GT,	">",		1,1,-,-,-,-,-,1,1,1,-,1,-,1,1,-,1,1,-,1)
-op(	GE,	">=",		1,1,-,-,-,-,-,1,1,1,-,1,-,1,1,-,1,1,-,1)
-op(	EQ,	"==",		1,1,1,-,-,-,-,1,1,1,-,1,-,-,-,-,1,1,-,1)
-op(	NE,	"!=",		1,1,1,-,-,-,-,1,1,1,-,1,-,-,-,-,1,1,-,1)
-
-/*	name	repr		b l b B i c a s f v t b s l r p c e e = */
-op(	BITAND,	"&",		1,-,1,-,1,-,-,-,1,1,-,1,-,-,-,1,-,-,1,-)
-op(	BITXOR,	"^",		1,-,1,-,1,-,-,-,1,1,-,1,-,-,-,1,-,-,1,-)
-op(	BITOR,	"|",		1,-,1,-,1,-,-,-,1,1,-,1,-,-,-,1,-,-,1,-)
-op(	LOGAND,	"&&",		1,1,1,1,-,-,-,1,1,-,1,-,-,-,-,-,-,-,1,-)
-op(	LOGOR,	"||",		1,1,1,1,-,-,-,1,1,-,1,-,-,-,-,1,-,-,1,-)
-op(	QUEST,	"?",		1,-,-,-,-,-,-,-,1,-,1,-,-,-,-,-,-,-,-,-)
-op(	COLON,	":",		1,-,1,-,-,-,-,-,-,1,-,1,-,-,-,-,-,1,-,-)
-
-/*	name	repr		b l b B i c a s f v t b s l r p c e e = */
-op(	ASSIGN,	"=",		1,-,1,-,-,-,-,-,-,-,-,-,1,-,-,-,-,1,-,-)
-op(	MULASS,	"*=",		1,-,-,-,-,-,1,-,-,-,-,-,1,-,-,-,-,-,1,-)
-op(	DIVASS,	"/=",		1,-,-,-,-,-,1,-,-,-,-,-,1,-,1,-,-,-,1,-)
-op(	MODASS,	"%=",		1,-,-,-,1,-,-,-,-,-,-,-,1,-,1,-,-,-,1,-)
-op(	ADDASS,	"+=",		1,-,-,-,-,-,-,1,-,-,-,-,1,-,-,-,-,-,1,-)
-op(	SUBASS,	"-=",		1,-,-,-,-,-,-,1,-,-,-,-,1,-,-,-,-,-,1,-)
-op(	SHLASS,	"<<=",		1,-,-,-,1,-,-,-,-,-,-,-,1,-,-,-,-,-,1,-)
-op(	SHRASS,	">>=",		1,-,-,-,1,-,-,-,-,-,-,-,1,-,-,-,-,-,1,-)
-op(	ANDASS,	"&=",		1,-,1,-,1,-,-,-,-,-,-,-,1,-,-,-,-,-,1,-)
-op(	XORASS,	"^=",		1,-,1,-,1,-,-,-,-,-,-,-,1,-,-,-,-,-,1,-)
-op(	ORASS,	"|=",		1,-,1,-,1,-,-,-,-,-,-,-,1,-,-,-,-,-,1,-)
-
-/*	name	

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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 21:14:33 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: op.h ops.def tree.c

Log Message:
lint: rename members of tnode_t to more closely match reality

The flags do not describe the left operand of the node but both, as for
most operators, either none or both operands are in test context or in
value context.

The one exception is the operator '?' from the '?:' conditional, for
which the left operand is in test context and the right operand is in
value context.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/xlint/lint1/op.h
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/lint1/ops.def
cvs rdiff -u -r1.431 -r1.432 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/op.h
diff -u src/usr.bin/xlint/lint1/op.h:1.17 src/usr.bin/xlint/lint1/op.h:1.18
--- src/usr.bin/xlint/lint1/op.h:1.17	Thu Aug 19 18:39:34 2021
+++ src/usr.bin/xlint/lint1/op.h	Sat Apr 16 21:14:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: op.h,v 1.17 2021/08/19 18:39:34 rillig Exp $	*/
+/*	$NetBSD: op.h,v 1.18 2022/04/16 21:14:33 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -46,8 +46,8 @@ typedef	struct {
 	bool	m_requires_arith: 1;
 	bool	m_requires_scalar: 1;
 	bool	m_fold_constant_operands: 1;
-	bool	m_left_value_context: 1;
-	bool	m_left_test_context: 1;
+	bool	m_value_context: 1;
+	bool	m_test_context: 1;
 	bool	m_balance_operands: 1;
 	bool	m_has_side_effect: 1;
 	bool	m_warn_if_left_unsigned_in_c90: 1;

Index: src/usr.bin/xlint/lint1/ops.def
diff -u src/usr.bin/xlint/lint1/ops.def:1.25 src/usr.bin/xlint/lint1/ops.def:1.26
--- src/usr.bin/xlint/lint1/ops.def:1.25	Fri Sep 10 20:02:50 2021
+++ src/usr.bin/xlint/lint1/ops.def	Sat Apr 16 21:14:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ops.def,v 1.25 2021/09/10 20:02:50 rillig Exp $ */
+/*	$NetBSD: ops.def,v 1.26 2022/04/16 21:14:33 rillig Exp $ */
 
 begin_ops()
 
@@ -14,8 +14,8 @@ begin_ops()
  *	warn if left operand unsigned			  x	|
  *	has side effects	- - - - - - - - - - - - x	|
  *	balance operands			  x	|	|
- *	left test context			x	|	|
- *	left value context			  x	|	|
+ *	test contextx	|	|
+ *	value context  x	|	|
  *	fold constant operands	- - - - - - - - x	|	|
  *	requires scalar			  x	|	|	|
  *	requires arithmetic		x	|	|	|

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.431 src/usr.bin/xlint/lint1/tree.c:1.432
--- src/usr.bin/xlint/lint1/tree.c:1.431	Sat Apr 16 20:57:10 2022
+++ src/usr.bin/xlint/lint1/tree.c	Sat Apr 16 21:14:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.431 2022/04/16 20:57:10 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.432 2022/04/16 21:14:33 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.431 2022/04/16 20:57:10 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.432 2022/04/16 21:14:33 rillig Exp $");
 #endif
 
 #include 
@@ -536,7 +536,7 @@ build_binary(tnode_t *ln, op_t op, bool 
 	 * Apply class conversions to the left operand, but only if its
 	 * value is needed or it is compared with zero.
 	 */
-	if (mp->m_left_value_context || mp->m_left_test_context)
+	if (mp->m_value_context || mp->m_test_context)
 		ln = cconv(ln);
 	/*
 	 * The right operand is almost always in a test or value context,
@@ -555,7 +555,7 @@ build_binary(tnode_t *ln, op_t op, bool 
 	if (mp->m_comparison)
 		check_integer_comparison(op, ln, rn);
 
-	if (mp->m_left_value_context || mp->m_left_test_context)
+	if (mp->m_value_context || mp->m_test_context)
 		ln = promote(op, false, ln);
 	if (mp->m_binary && op != ARROW && op != POINT &&
 	op != ASSIGN && op != RETURN && op != INIT) {
@@ -664,7 +664,7 @@ build_binary(tnode_t *ln, op_t op, bool 
 	 * it is compared with zero and if this operand is a constant.
 	 */
 	if (hflag && !constcond_flag &&
-	mp->m_left_test_context &&
+	mp->m_test_context &&
 	(ln->tn_op == CON ||
 	 ((mp->m_binary && op != QUEST) && rn->tn_op == CON)) &&
 	/* XXX: rn->tn_system_dependent should be checked as well */
@@ -676,7 +676,7 @@ build_binary(tnode_t *ln, op_t op, bool 
 	/* Fold if the operator requires it */
 	if (mp->m_fold_constant_operands) {
 		if (ln->tn_op == CON && (!mp->m_binary || rn->tn_op == CON)) {
-			if (mp->m_left_test_context) {
+			if (mp->m_test_context) {
 ntn = fold_test(ntn);
 			} else if (is_floating(ntn->tn_type->t_tspec)) {
 ntn = fold_float(ntn);
@@ -4172,8 +4172,8 @@ check_expr_misc(const tnode_t *tn, bool 
 	szof, fcall, vctx, tctx, retval_discarded, eqwarn))
 		return;
 
-	cvctx = mp->m_left_value_context;
-	ctctx = mp->m_left_test_context;
+	cvctx = mp->m_value_context;
+	ctctx = mp->m_test_context;
 	eq = mp->m_warn_if_operand_eq &&
 	 

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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 21:14:33 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: op.h ops.def tree.c

Log Message:
lint: rename members of tnode_t to more closely match reality

The flags do not describe the left operand of the node but both, as for
most operators, either none or both operands are in test context or in
value context.

The one exception is the operator '?' from the '?:' conditional, for
which the left operand is in test context and the right operand is in
value context.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/xlint/lint1/op.h
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/lint1/ops.def
cvs rdiff -u -r1.431 -r1.432 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 20:57:10 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_161.c msg_161.exp
src/usr.bin/xlint/lint1: lint1.h tree.c

Log Message:
lint: investigate why lint only warns about some constant conditions

Noticed in lex.c, in the macro kwdef, where lint complains about the
condition containing '||' but not about the conditions containing only
'>' or '=='.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_161.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_161.exp
cvs rdiff -u -r1.152 -r1.153 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.430 -r1.431 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_161.c
diff -u src/tests/usr.bin/xlint/lint1/msg_161.c:1.7 src/tests/usr.bin/xlint/lint1/msg_161.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_161.c:1.7	Sun Mar 21 15:44:57 2021
+++ src/tests/usr.bin/xlint/lint1/msg_161.c	Sat Apr 16 20:57:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_161.c,v 1.7 2021/03/21 15:44:57 rillig Exp $	*/
+/*	$NetBSD: msg_161.c,v 1.8 2022/04/16 20:57:10 rillig Exp $	*/
 # 3 "msg_161.c"
 
 // Test for message: constant in conditional context [161]
@@ -55,3 +55,22 @@ test_sizeof(void)
 	if (sizeof(int) < sizeof(char))
 		println("impossible");
 }
+
+const _Bool conditions[] = {
+	/* XXX: Why no warning here? */
+	13 < 13,
+	/* XXX: Why no warning here? */
+	0 < 0,
+	/* XXX: Why no warning here? */
+	0 != 0,
+	/* expect+1: warning: constant in conditional context [161] */
+	0 == 0 && 1 == 0,
+	/* expect+1: warning: constant in conditional context [161] */
+	1 == 0 || 2 == 1,
+	/* expect+2: warning: constant in conditional context [161] */
+	/* expect+1: error: non-constant initializer [177] */
+	0 == 0 && ""[0] == '\0',
+	/* expect+2: warning: constant in conditional context [161] */
+	/* expect+1: error: non-constant initializer [177] */
+	""[0] == '\0' && 0 == 0,
+};

Index: src/tests/usr.bin/xlint/lint1/msg_161.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_161.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_161.exp:1.7
--- src/tests/usr.bin/xlint/lint1/msg_161.exp:1.6	Sun Mar 21 15:44:57 2021
+++ src/tests/usr.bin/xlint/lint1/msg_161.exp	Sat Apr 16 20:57:10 2022
@@ -2,3 +2,9 @@ msg_161.c(11): warning: constant in cond
 msg_161.c(18): warning: constant in conditional context [161]
 msg_161.c(19): warning: statement not reached [193]
 msg_161.c(41): warning: constant in conditional context [161]
+msg_161.c(67): warning: constant in conditional context [161]
+msg_161.c(69): warning: constant in conditional context [161]
+msg_161.c(72): warning: constant in conditional context [161]
+msg_161.c(72): error: non-constant initializer [177]
+msg_161.c(75): warning: constant in conditional context [161]
+msg_161.c(75): error: non-constant initializer [177]

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.152 src/usr.bin/xlint/lint1/lint1.h:1.153
--- src/usr.bin/xlint/lint1/lint1.h:1.152	Sat Apr 16 19:18:17 2022
+++ src/usr.bin/xlint/lint1/lint1.h	Sat Apr 16 20:57:10 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.152 2022/04/16 19:18:17 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.153 2022/04/16 20:57:10 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -493,6 +493,7 @@ check_printf(const char *fmt, ...)
 
 #  define wrap_check_printf(func, msgid, args...)			\
 	({\
+		debug_step("%s:%d: %s", __FILE__, __LINE__, __func__);	\
 		check_printf(__CONCAT(MSG_, msgid), ##args);		\
 		(func)(msgid, ##args);	\
 		/* LINTED 129 */	\

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.430 src/usr.bin/xlint/lint1/tree.c:1.431
--- src/usr.bin/xlint/lint1/tree.c:1.430	Sat Apr 16 20:02:55 2022
+++ src/usr.bin/xlint/lint1/tree.c	Sat Apr 16 20:57:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.430 2022/04/16 20:02:55 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.431 2022/04/16 20:57:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.430 2022/04/16 20:02:55 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.431 2022/04/16 20:57:10 rillig Exp $");
 #endif
 
 #include 
@@ -534,7 +534,7 @@ build_binary(tnode_t *ln, op_t op, bool 
 
 	/*
 	 * Apply class conversions to the left operand, but only if its
-	 * value is needed or it is compared with null.
+	 * value is needed or it is compared with zero.
 	 */
 	if (mp->m_left_value_context || mp->m_left_test_context)
 		ln = cconv(ln);
@@ -549,21 +549,14 @@ build_binary(tnode_t *ln, op_t op, bool 
 	 * Print some warnings for comparisons of unsigned values with
 	 * constants lower than or equal to null. This must be done
 	 * before promote() because otherwise 

CVS commit: src

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 20:57:10 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_161.c msg_161.exp
src/usr.bin/xlint/lint1: lint1.h tree.c

Log Message:
lint: investigate why lint only warns about some constant conditions

Noticed in lex.c, in the macro kwdef, where lint complains about the
condition containing '||' but not about the conditions containing only
'>' or '=='.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_161.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_161.exp
cvs rdiff -u -r1.152 -r1.153 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.430 -r1.431 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 20:18:52 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: Makefile
src/usr.bin/xlint/lint1: README.md

Log Message:
lint: fix instructions for adding a new test


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/xlint/lint1/README.md

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/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.119 src/tests/usr.bin/xlint/lint1/Makefile:1.120
--- src/tests/usr.bin/xlint/lint1/Makefile:1.119	Fri Apr  8 21:29:29 2022
+++ src/tests/usr.bin/xlint/lint1/Makefile	Sat Apr 16 20:18:52 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.119 2022/04/08 21:29:29 rillig Exp $
+# $NetBSD: Makefile,v 1.120 2022/04/16 20:18:52 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	348		# see lint1/err.c
@@ -17,8 +17,6 @@ archsubdir.sh:
 	@echo archsubdir=${ARCHSUBDIR} >${.TARGET}
 
 FILESDIR=	${TESTSDIR}
-FILES+=		msg_259_c90.c
-FILES+=		msg_259_c90.exp
 FILES+=		c11_generic_expression.c
 FILES+=		c11_generic_expression.exp
 FILES+=		c90.c
@@ -30,14 +28,14 @@ FILES+=		c99_init_designator.c
 FILES+=		c99_init_designator.exp
 FILES+=		d_alignof.c
 FILES+=		d_bltinoffsetof.c
+FILES+=		d_c99_anon_struct.c
+FILES+=		d_c99_anon_union.c
 FILES+=		d_c99_bool.c
 FILES+=		d_c99_bool.exp
 FILES+=		d_c99_bool_strict.c
 FILES+=		d_c99_bool_strict.exp
 FILES+=		d_c99_bool_strict_syshdr.c
 FILES+=		d_c99_bool_strict_syshdr.exp
-FILES+=		d_c99_anon_struct.c
-FILES+=		d_c99_anon_union.c
 FILES+=		d_c99_complex_num.c
 FILES+=		d_c99_complex_split.c
 FILES+=		d_c99_complex_split.exp
@@ -217,14 +215,16 @@ FILES+=		lex_wide_char.exp
 FILES+=		lex_wide_string.c
 FILES+=		lex_wide_string.exp
 FILES+=		${MSG_FILES}
-FILES+=		msg_001_c90.c
-FILES+=		msg_001_c90.exp
 FILES+=		msg_000_c90.c
 FILES+=		msg_000_c90.exp
+FILES+=		msg_001_c90.c
+FILES+=		msg_001_c90.exp
 FILES+=		msg_132_ilp32.c
 FILES+=		msg_132_ilp32.exp
 FILES+=		msg_230_uchar.c
 FILES+=		msg_230_uchar.exp
+FILES+=		msg_259_c90.c
+FILES+=		msg_259_c90.exp
 FILES+=		msg_259_ilp32.c
 FILES+=		msg_259_ilp32.exp
 FILES+=		msg_272_c90.c

Index: src/usr.bin/xlint/lint1/README.md
diff -u src/usr.bin/xlint/lint1/README.md:1.3 src/usr.bin/xlint/lint1/README.md:1.4
--- src/usr.bin/xlint/lint1/README.md:1.3	Sat Apr 16 09:18:33 2022
+++ src/usr.bin/xlint/lint1/README.md	Sat Apr 16 20:18:51 2022
@@ -1,4 +1,4 @@
-[//]: # ($NetBSD: README.md,v 1.3 2022/04/16 09:18:33 rillig Exp $)
+[//]: # ($NetBSD: README.md,v 1.4 2022/04/16 20:18:51 rillig Exp $)
 
 # Introduction
 
@@ -168,8 +168,8 @@ Most other tests focus on a single featu
 
 ## Adding a new test
 
-1. Run `make -C tests/usr.bin/xlint/lint1 add-test NAME=test_name`.
-2. Sort the `FILES` lines in `tests/usr.bin/xlint/lint1/Makefile`.
+1. Run `make add-test NAME=test_name`.
+2. Sort the `FILES` lines in `../../tests/usr.bin/xlint/lint1/Makefile`.
 3. Make the test generate the desired diagnostics.
-4. Run `cd tests/usr.bin/xlint/lint1 && sh ./accept.sh test_name`.
-6. Run `cvs commit distrib/sets/lists/tests/mi tests/usr.bin/xlint`.
+4. Run `cd ../../tests/usr.bin/xlint/lint1 && sh ./accept.sh test_name`.
+5. Run `cd ../.. && cvs commit distrib/sets/lists/tests/mi tests/usr.bin/xlint`.



CVS commit: src

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 20:18:52 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: Makefile
src/usr.bin/xlint/lint1: README.md

Log Message:
lint: fix instructions for adding a new test


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/xlint/lint1/README.md

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



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 20:08:35 UTC 2022

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

Log Message:
lint: remove null marker from keyword table

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/usr.bin/xlint/lint1/lex.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/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.122 src/usr.bin/xlint/lint1/lex.c:1.123
--- src/usr.bin/xlint/lint1/lex.c:1.122	Sat Apr 16 20:02:55 2022
+++ src/usr.bin/xlint/lint1/lex.c	Sat Apr 16 20:08:35 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.122 2022/04/16 20:02:55 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.123 2022/04/16 20:08:35 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.122 2022/04/16 20:02:55 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.123 2022/04/16 20:08:35 rillig Exp $");
 #endif
 
 #include 
@@ -220,7 +220,6 @@ static const struct keyword {
 	kwdef_gcc_attr(	"warn_unused_result", T_AT_WARN_UNUSED_RESULT),
 	kwdef_gcc_attr(	"weak",		T_AT_WEAK),
 	kwdef_keyword(	"while",	T_WHILE),
-	kwdef(NULL, 0, 0, 0, 0, 0, 0, 0, 0),
 #undef kwdef
 #undef kwdef_token
 #undef kwdef_sclass
@@ -415,9 +414,10 @@ add_keyword(const struct keyword *kw, bo
 void
 initscan(void)
 {
-	const struct keyword *kw;
+	const struct keyword *kw, *end;
 
-	for (kw = keywords; kw->kw_name != NULL; kw++) {
+	end = keywords + sizeof(keywords) / sizeof(keywords[0]);
+	for (kw = keywords; kw != end; kw++) {
 		if ((kw->kw_c90 || kw->kw_c99) && tflag)
 			continue;
 		/* FIXME: C99 and GCC are independent. */



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 20:08:35 UTC 2022

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

Log Message:
lint: remove null marker from keyword table

No functional change.


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

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



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 20:02:55 UTC 2022

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

Log Message:
lint: prepare keyword table for C11

The C11 keywords had been listed as being C99 keywords.  Instead of
initializing the individual fields separately, merge them by specifying
the year of the standard in which they appeared.

No binary change, except for line numbers in assertions.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.429 -r1.430 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/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.121 src/usr.bin/xlint/lint1/lex.c:1.122
--- src/usr.bin/xlint/lint1/lex.c:1.121	Sat Apr 16 19:18:17 2022
+++ src/usr.bin/xlint/lint1/lex.c	Sat Apr 16 20:02:55 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.121 2022/04/16 19:18:17 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.122 2022/04/16 20:02:55 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.121 2022/04/16 19:18:17 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.122 2022/04/16 20:02:55 rillig Exp $");
 #endif
 
 #include 
@@ -67,24 +67,27 @@ pos_t	csrc_pos = { "", 1, 0 };
 bool in_gcc_attribute;
 bool in_system_header;
 
-#define kwdef(name, token, scl, tspec, tqual,	c90, c99, gcc, attr, deco) \
+/* Valid values for 'since' are 78, 90, 99, 11. */
+#define kwdef(name, token, scl, tspec, tqual,	since, gcc, attr, deco) \
 	{ \
 		name, token, scl, tspec, tqual, \
-		(c90) > 0, (c99) > 0, (gcc) > 0, (attr) > 0, \
+		(since) == 90, \
+		/* CONSTCOND */ (since) == 99 || (since) == 11, \
+		(gcc) > 0, (attr) > 0, \
 		((deco) & 1) != 0, ((deco) & 2) != 0, ((deco) & 4) != 0, \
 	}
-#define kwdef_token(name, token,		c90, c99, gcc, deco) \
-	kwdef(name, token, 0, 0, 0,		c90, c99, gcc, 0, deco)
-#define kwdef_sclass(name, sclass,		c90, c99, gcc, deco) \
-	kwdef(name, T_SCLASS, sclass, 0, 0,	c90, c99, gcc, 0, deco)
-#define kwdef_type(name, tspec,			c90, c99, gcc, deco) \
-	kwdef(name, T_TYPE, 0, tspec, 0,	c90, c99, gcc, 0, deco)
-#define kwdef_tqual(name, tqual,		c90, c99, gcc, deco) \
-	kwdef(name, T_QUAL, 0, 0, tqual,	c90, c99, gcc, 0, deco)
+#define kwdef_token(name, token,		since, gcc, deco) \
+	kwdef(name, token, 0, 0, 0,		since, gcc, 0, deco)
+#define kwdef_sclass(name, sclass,		since, gcc, deco) \
+	kwdef(name, T_SCLASS, sclass, 0, 0,	since, gcc, 0, deco)
+#define kwdef_type(name, tspec,			since, gcc, deco) \
+	kwdef(name, T_TYPE, 0, tspec, 0,	since, gcc, 0, deco)
+#define kwdef_tqual(name, tqual,		since, gcc, deco) \
+	kwdef(name, T_QUAL, 0, 0, tqual,	since, gcc, 0, deco)
 #define kwdef_keyword(name, token) \
-	kwdef(name, token, 0, 0, 0,		0, 0, 0, 0, 1)
+	kwdef(name, token, 0, 0, 0,		78, 0, 0, 1)
 #define kwdef_gcc_attr(name, token) \
-	kwdef(name, token, 0, 0, 0,		0, 0, 1, 1, 5)
+	kwdef(name, token, 0, 0, 0,		78, 1, 1, 5)
 
 /* During initialization, these keywords are written to the symbol table. */
 static const struct keyword {
@@ -97,7 +100,7 @@ static const struct keyword {
 	bool	kw_c90:1;	/* C90 keyword */
 	bool	kw_c99:1;	/* C99 keyword */
 	bool	kw_gcc:1;	/* GCC keyword */
-	bool	kw_attr:1;	/* GCC attribute, keyword */
+	bool	kw_attr:1;	/* GCC attribute */
 	bool	kw_plain:1;	/* 'name' */
 	bool	kw_leading:1;	/* '__name' */
 	bool	kw_both:1;	/* '__name__' */
@@ -106,23 +109,23 @@ static const struct keyword {
 	kwdef_keyword(	"_Alignas",	T_ALIGNAS),
 	kwdef_keyword(	"_Alignof",	T_ALIGNOF),
 	kwdef_gcc_attr(	"aligned",	T_AT_ALIGNED),
-	kwdef_token(	"__alignof__",	T_ALIGNOF,		0,0,0,1),
+	kwdef_token(	"__alignof__",	T_ALIGNOF,		78,0,1),
 	kwdef_gcc_attr(	"alloc_size",	T_AT_ALLOC_SIZE),
 	kwdef_gcc_attr(	"always_inline",T_AT_ALWAYS_INLINE),
-	kwdef_token(	"asm",		T_ASM,			0,0,1,7),
-	kwdef_token(	"attribute",	T_ATTRIBUTE,		0,0,1,6),
-	kwdef_sclass(	"auto",		AUTO,			0,0,0,1),
-	kwdef_type(	"_Bool",	BOOL,			0,1,0,1),
+	kwdef_token(	"asm",		T_ASM,			78,1,7),
+	kwdef_token(	"attribute",	T_ATTRIBUTE,		78,1,6),
+	kwdef_sclass(	"auto",		AUTO,			78,0,1),
+	kwdef_type(	"_Bool",	BOOL,			99,0,1),
 	kwdef_gcc_attr(	"bounded",	T_AT_BOUNDED),
 	kwdef_keyword(	"break",	T_BREAK),
 	kwdef_gcc_attr(	"buffer",	T_AT_BUFFER),
-	kwdef_token(	"__builtin_offsetof", T_BUILTIN_OFFSETOF, 0,0,1,1),
+	kwdef_token(	"__builtin_offsetof", T_BUILTIN_OFFSETOF, 78,1,1),
 	kwdef_keyword(	"case",		T_CASE),
-	kwdef_type(	"char",		CHAR,			0,0,0,1),
+	kwdef_type(	"char",		CHAR,			78,0,1),
 	kwdef_gcc_attr(	"cold",		T_AT_COLD),
 	kwdef_gcc_attr(	"common",	T_AT_COMMON),
-	kwdef_type(	"_Complex",	COMPLEX,		0,1,0,1),
-	kwdef_tqual(	"const",	CONST,			1,0,0,7),
+	kwdef_type(	"_Complex",	COMPLEX,		99,0,1),
+	kwdef_tqual(	"const",	CONST,			90,0,7),
 	kwdef_gcc_attr(	

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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 20:02:55 UTC 2022

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

Log Message:
lint: prepare keyword table for C11

The C11 keywords had been listed as being C99 keywords.  Instead of
initializing the individual fields separately, merge them by specifying
the year of the standard in which they appeared.

No binary change, except for line numbers in assertions.


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

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



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 19:18:17 UTC 2022

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

Log Message:
lint: migrate gflag to allow_gcc

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.277 -r1.278 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.161 -r1.162 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.155 -r1.156 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.151 -r1.152 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.428 -r1.429 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/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.277 src/usr.bin/xlint/lint1/decl.c:1.278
--- src/usr.bin/xlint/lint1/decl.c:1.277	Sun Apr 10 12:14:10 2022
+++ src/usr.bin/xlint/lint1/decl.c	Sat Apr 16 19:18:17 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.277 2022/04/10 12:14:10 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.278 2022/04/16 19:18:17 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.277 2022/04/10 12:14:10 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.278 2022/04/16 19:18:17 rillig Exp $");
 #endif
 
 #include 
@@ -1066,24 +1066,18 @@ check_bit_field_type(sym_t *dsym, type_t
 			/* bit-field of type plain 'int' has ... */
 			warning(344);
 		}
-	} else if (t != INT && t != UINT && t != BOOL) {
-		/*
-		 * Non-integer types are always illegal for bitfields,
-		 * regardless of BITFIELDTYPE. Integer types not dealt with
-		 * above are okay only if BITFIELDTYPE is in effect.
-		 */
-		if (!(bitfieldtype_ok || gflag) || !is_integer(t)) {
-			unsigned int sz;
-
-			/* illegal bit-field type '%s' */
-			warning(35, type_name(tp));
-			sz = tp->t_flen;
-			dsym->s_type = tp = block_dup_type(gettyp(t = INT));
-			if ((tp->t_flen = sz) > size_in_bits(t))
-tp->t_flen = size_in_bits(t);
-			*inout_t = t;
-			*inout_tp = tp;
-		}
+	} else if (!(t == INT || t == UINT || t == BOOL ||
+		 (is_integer(t) && (bitfieldtype_ok || allow_gcc {
+
+		/* illegal bit-field type '%s' */
+		warning(35, type_name(tp));
+
+		unsigned int sz = tp->t_flen;
+		dsym->s_type = tp = block_dup_type(gettyp(t = INT));
+		if ((tp->t_flen = sz) > size_in_bits(t))
+			tp->t_flen = size_in_bits(t);
+		*inout_t = t;
+		*inout_tp = tp;
 	}
 }
 
@@ -2645,23 +2639,21 @@ static bool
 check_prototype_declaration(sym_t *arg, sym_t *parg)
 {
 	type_t	*tp, *ptp;
-	bool	dowarn, msg;
+	bool	dowarn;
 
 	tp = arg->s_type;
 	ptp = parg->s_type;
 
-	msg = false;
 	dowarn = false;
 
 	if (!eqtype(tp, ptp, true, true, )) {
 		if (eqtype(tp, ptp, true, false, )) {
 			/* type does not match prototype: %s */
-			gnuism(58, arg->s_name);
-			msg = sflag || !gflag;
+			return gnuism(58, arg->s_name);
 		} else {
 			/* type does not match prototype: %s */
 			error(58, arg->s_name);
-			msg = true;
+			return true;
 		}
 	} else if (dowarn) {
 		if (sflag)
@@ -2670,10 +2662,10 @@ check_prototype_declaration(sym_t *arg, 
 		else
 			/* type does not match prototype: %s */
 			warning(58, arg->s_name);
-		msg = true;
+		return true;
 	}
 
-	return msg;
+	return false;
 }
 
 static void

Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.161 src/usr.bin/xlint/lint1/err.c:1.162
--- src/usr.bin/xlint/lint1/err.c:1.161	Sat Apr 16 15:55:10 2022
+++ src/usr.bin/xlint/lint1/err.c	Sat Apr 16 19:18:17 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.c,v 1.161 2022/04/16 15:55:10 rillig Exp $	*/
+/*	$NetBSD: err.c,v 1.162 2022/04/16 19:18:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.161 2022/04/16 15:55:10 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.162 2022/04/16 19:18:17 rillig Exp $");
 #endif
 
 #include 
@@ -649,14 +649,15 @@ void
 {
 	va_list	ap;
 
-	if (c11flag || gflag)
+	/* FIXME: C11 mode has nothing to do with GCC mode. */
+	if (c11flag || allow_gcc)
 		return;
 	va_start(ap, msgid);
 	verror_at(msgid, _pos, ap);
 	va_end(ap);
 }
 
-void
+bool
 (gnuism)(int msgid, ...)
 {
 	va_list	ap;
@@ -668,4 +669,5 @@ void
 	if (severity == 1)
 		vwarning_at(msgid, _pos, ap);
 	va_end(ap);
+	return severity > 0;
 }

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.155 src/usr.bin/xlint/lint1/externs1.h:1.156
--- src/usr.bin/xlint/lint1/externs1.h:1.155	Sat Apr 16 13:25:27 2022
+++ src/usr.bin/xlint/lint1/externs1.h	Sat Apr 16 19:18:17 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.155 2022/04/16 13:25:27 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.156 2022/04/16 19:18:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -64,13 

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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 19:18:17 UTC 2022

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

Log Message:
lint: migrate gflag to allow_gcc

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.277 -r1.278 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.161 -r1.162 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.155 -r1.156 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.151 -r1.152 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.428 -r1.429 src/usr.bin/xlint/lint1/tree.c

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



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 18:41:22 UTC 2022

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

Log Message:
tests/lint: fix tests on platforms other than x86_64

In msg_259_ilp32.c 1.6 from 2022-04-15, I removed the option -S from the
test in order to keep the message 259, but I forgot to fix the C99-style
comment as well.

In platform_int.c, the default lint option -S no longer generated
warning 259, so remove that option.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_259_ilp32.c
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/platform_int.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_259_ilp32.c
diff -u src/tests/usr.bin/xlint/lint1/msg_259_ilp32.c:1.6 src/tests/usr.bin/xlint/lint1/msg_259_ilp32.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_259_ilp32.c:1.6	Fri Apr 15 21:50:07 2022
+++ src/tests/usr.bin/xlint/lint1/msg_259_ilp32.c	Sat Apr 16 18:41:21 2022
@@ -1,7 +1,7 @@
-/*	$NetBSD: msg_259_ilp32.c,v 1.6 2022/04/15 21:50:07 rillig Exp $	*/
+/*	$NetBSD: msg_259_ilp32.c,v 1.7 2022/04/16 18:41:21 rillig Exp $	*/
 # 3 "msg_259_ilp32.c"
 
-// Test for message: argument #%d is converted from '%s' to '%s' due to prototype [259]
+/* Test for message: argument #%d is converted from '%s' to '%s' due to prototype [259] */
 
 /*
  * See also msg_259, which contains more examples for this warning.

Index: src/tests/usr.bin/xlint/lint1/platform_int.c
diff -u src/tests/usr.bin/xlint/lint1/platform_int.c:1.3 src/tests/usr.bin/xlint/lint1/platform_int.c:1.4
--- src/tests/usr.bin/xlint/lint1/platform_int.c:1.3	Sun Sep 26 14:52:37 2021
+++ src/tests/usr.bin/xlint/lint1/platform_int.c	Sat Apr 16 18:41:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: platform_int.c,v 1.3 2021/09/26 14:52:37 rillig Exp $	*/
+/*	$NetBSD: platform_int.c,v 1.4 2022/04/16 18:41:21 rillig Exp $	*/
 # 3 "platform_int.c"
 
 /*
@@ -6,7 +6,7 @@
  * int and ptr_diff is signed int.
  */
 
-/* lint1-extra-flags: -c -h -a -p -b -r -z */
+/* lint1-flags: -g -w -c -h -a -p -b -r -z */
 /* lint1-only-if: int */
 
 void to_size(typeof(sizeof(int)));



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 18:41:22 UTC 2022

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

Log Message:
tests/lint: fix tests on platforms other than x86_64

In msg_259_ilp32.c 1.6 from 2022-04-15, I removed the option -S from the
test in order to keep the message 259, but I forgot to fix the C99-style
comment as well.

In platform_int.c, the default lint option -S no longer generated
warning 259, so remove that option.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_259_ilp32.c
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/platform_int.c

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



CVS commit: src

2022-04-16 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr 16 18:15:23 UTC 2022

Modified Files:
src/etc/rc.d: swap1
src/games/trek/DOC: trekmanual.nr
src/lib/libc/gen: fixunsgen_ieee754.c
src/lib/libm/src: s_fminf.c
src/lib/librumphijack: hijack.c
src/sbin/newfs: newfs.c
src/sbin/newfs_ext2fs: newfs_ext2fs.c
src/share/me: tmac.e
src/sys/arch/luna68k/luna68k: disksubr.c
src/sys/arch/m68k/m68k: pmap_motorola.c
src/sys/arch/sgimips/include: bus_defs.h
src/sys/arch/sparc/sparc: locore.s
src/sys/crypto/blowfish: bf_locl.h
src/sys/dev/ic: mfi.c
src/sys/dev/pci: if_vioif.c
src/sys/dev/qbus: qd.c
src/sys/dev/usb: xhcireg.h
src/sys/dev/videomode: edid.c
src/sys/fs/udf: udf.h udf_strat_sequential.c
src/sys/kern: vfs_lockf.c
src/sys/net: pfkeyv2.h
src/tests/lib/libpthread: t_condwait.c
src/usr.sbin/sysinst: bsddisklabel.c

Log Message:
fix various typos in comments and log messages.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/etc/rc.d/swap1
cvs rdiff -u -r1.4 -r1.5 src/games/trek/DOC/trekmanual.nr
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/gen/fixunsgen_ieee754.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_fminf.c
cvs rdiff -u -r1.135 -r1.136 src/lib/librumphijack/hijack.c
cvs rdiff -u -r1.116 -r1.117 src/sbin/newfs/newfs.c
cvs rdiff -u -r1.10 -r1.11 src/sbin/newfs_ext2fs/newfs_ext2fs.c
cvs rdiff -u -r1.9 -r1.10 src/share/me/tmac.e
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/luna68k/luna68k/disksubr.c
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/m68k/m68k/pmap_motorola.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sgimips/include/bus_defs.h
cvs rdiff -u -r1.281 -r1.282 src/sys/arch/sparc/sparc/locore.s
cvs rdiff -u -r1.7 -r1.8 src/sys/crypto/blowfish/bf_locl.h
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/ic/mfi.c
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/pci/if_vioif.c
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/qbus/qd.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/usb/xhcireg.h
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/videomode/edid.c
cvs rdiff -u -r1.52 -r1.53 src/sys/fs/udf/udf.h
cvs rdiff -u -r1.16 -r1.17 src/sys/fs/udf/udf_strat_sequential.c
cvs rdiff -u -r1.74 -r1.75 src/sys/kern/vfs_lockf.c
cvs rdiff -u -r1.32 -r1.33 src/sys/net/pfkeyv2.h
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libpthread/t_condwait.c
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/sysinst/bsddisklabel.c

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

Modified files:

Index: src/etc/rc.d/swap1
diff -u src/etc/rc.d/swap1:1.13 src/etc/rc.d/swap1:1.14
--- src/etc/rc.d/swap1:1.13	Fri Oct 19 14:11:12 2018
+++ src/etc/rc.d/swap1	Sat Apr 16 18:15:20 2022
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: swap1,v 1.13 2018/10/19 14:11:12 martin Exp $
+# $NetBSD: swap1,v 1.14 2022/04/16 18:15:20 andvar Exp $
 #
 
 # PROVIDE: localswap
@@ -16,7 +16,7 @@ stop_cmd="swap1_stop"
 dev_free_tmpfs()
 {
 	# Generate a list of tmpfs filesystems that contain no device nodes,
-	# which can presumably be unmounted safetly at shutdown time.
+	# which can presumably be unmounted safely at shutdown time.
 	# Filenames are quoted and the list contains no unquoted newlines,
 	# so that the output can be reparsed as a single argument list.
 	mount -t tmpfs | while read -r line

Index: src/games/trek/DOC/trekmanual.nr
diff -u src/games/trek/DOC/trekmanual.nr:1.4 src/games/trek/DOC/trekmanual.nr:1.5
--- src/games/trek/DOC/trekmanual.nr:1.4	Wed Dec  8 23:38:51 2021
+++ src/games/trek/DOC/trekmanual.nr	Sat Apr 16 18:15:20 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: trekmanual.nr,v 1.4 2021/12/08 23:38:51 snj Exp $
+.\"	$NetBSD: trekmanual.nr,v 1.5 2022/04/16 18:15:20 andvar Exp $
 .br
 .po 10
 .if n \!.
@@ -675,7 +675,7 @@ and starsystems.
 .pp
 More than one request may be stated
 on a line
-by seperating them
+by separating them
 with semicolons.
 .bl "Dock at Starbase"
 Mnemonic: dock

Index: src/lib/libc/gen/fixunsgen_ieee754.c
diff -u src/lib/libc/gen/fixunsgen_ieee754.c:1.3 src/lib/libc/gen/fixunsgen_ieee754.c:1.4
--- src/lib/libc/gen/fixunsgen_ieee754.c:1.3	Sun Mar 25 19:53:41 2012
+++ src/lib/libc/gen/fixunsgen_ieee754.c	Sat Apr 16 18:15:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fixunsgen_ieee754.c,v 1.3 2012/03/25 19:53:41 christos Exp $	*/
+/*	$NetBSD: fixunsgen_ieee754.c,v 1.4 2022/04/16 18:15:20 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -36,7 +36,7 @@
 #include 
 
 #if !defined(FIXUNSNAME) && defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fixunsgen_ieee754.c,v 1.3 2012/03/25 19:53:41 christos Exp $");
+__RCSID("$NetBSD: fixunsgen_ieee754.c,v 1.4 2022/04/16 18:15:20 andvar Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -71,7 +71,7 @@ FIXUNSNAME(__fixunsgen)(int exp, bool si
 		return 0;
 
 	/*
-	 * This is simplier than it seems.  Basically we are constructing
+	 * This is simpler than it seems.  Basically we are 

CVS commit: src

2022-04-16 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr 16 18:15:23 UTC 2022

Modified Files:
src/etc/rc.d: swap1
src/games/trek/DOC: trekmanual.nr
src/lib/libc/gen: fixunsgen_ieee754.c
src/lib/libm/src: s_fminf.c
src/lib/librumphijack: hijack.c
src/sbin/newfs: newfs.c
src/sbin/newfs_ext2fs: newfs_ext2fs.c
src/share/me: tmac.e
src/sys/arch/luna68k/luna68k: disksubr.c
src/sys/arch/m68k/m68k: pmap_motorola.c
src/sys/arch/sgimips/include: bus_defs.h
src/sys/arch/sparc/sparc: locore.s
src/sys/crypto/blowfish: bf_locl.h
src/sys/dev/ic: mfi.c
src/sys/dev/pci: if_vioif.c
src/sys/dev/qbus: qd.c
src/sys/dev/usb: xhcireg.h
src/sys/dev/videomode: edid.c
src/sys/fs/udf: udf.h udf_strat_sequential.c
src/sys/kern: vfs_lockf.c
src/sys/net: pfkeyv2.h
src/tests/lib/libpthread: t_condwait.c
src/usr.sbin/sysinst: bsddisklabel.c

Log Message:
fix various typos in comments and log messages.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/etc/rc.d/swap1
cvs rdiff -u -r1.4 -r1.5 src/games/trek/DOC/trekmanual.nr
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/gen/fixunsgen_ieee754.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_fminf.c
cvs rdiff -u -r1.135 -r1.136 src/lib/librumphijack/hijack.c
cvs rdiff -u -r1.116 -r1.117 src/sbin/newfs/newfs.c
cvs rdiff -u -r1.10 -r1.11 src/sbin/newfs_ext2fs/newfs_ext2fs.c
cvs rdiff -u -r1.9 -r1.10 src/share/me/tmac.e
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/luna68k/luna68k/disksubr.c
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/m68k/m68k/pmap_motorola.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sgimips/include/bus_defs.h
cvs rdiff -u -r1.281 -r1.282 src/sys/arch/sparc/sparc/locore.s
cvs rdiff -u -r1.7 -r1.8 src/sys/crypto/blowfish/bf_locl.h
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/ic/mfi.c
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/pci/if_vioif.c
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/qbus/qd.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/usb/xhcireg.h
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/videomode/edid.c
cvs rdiff -u -r1.52 -r1.53 src/sys/fs/udf/udf.h
cvs rdiff -u -r1.16 -r1.17 src/sys/fs/udf/udf_strat_sequential.c
cvs rdiff -u -r1.74 -r1.75 src/sys/kern/vfs_lockf.c
cvs rdiff -u -r1.32 -r1.33 src/sys/net/pfkeyv2.h
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libpthread/t_condwait.c
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/sysinst/bsddisklabel.c

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



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 18:13:54 UTC 2022

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

Log Message:
lint: clean up keyword definitions for the lexer

There is only one specialized keyword that is also a GCC attribute, it's
"section".  All other keywords passed 0 in that macro argument.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/usr.bin/xlint/lint1/lex.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/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.119 src/usr.bin/xlint/lint1/lex.c:1.120
--- src/usr.bin/xlint/lint1/lex.c:1.119	Wed Apr 13 22:20:42 2022
+++ src/usr.bin/xlint/lint1/lex.c	Sat Apr 16 18:13:54 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.119 2022/04/13 22:20:42 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.120 2022/04/16 18:13:54 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.119 2022/04/13 22:20:42 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.120 2022/04/16 18:13:54 rillig Exp $");
 #endif
 
 #include 
@@ -73,14 +73,14 @@ bool in_system_header;
 		(c90) > 0, (c99) > 0, (gcc) > 0, (attr) > 0, \
 		((deco) & 1) != 0, ((deco) & 2) != 0, ((deco) & 4) != 0, \
 	}
-#define kwdef_token(name, token,		c90, c99, gcc, attr, deco) \
-	kwdef(name, token, 0, 0, 0,		c90, c99, gcc, attr, deco)
-#define kwdef_sclass(name, sclass,		c90, c99, gcc, attr, deco) \
-	kwdef(name, T_SCLASS, sclass, 0, 0,	c90, c99, gcc, attr, deco)
-#define kwdef_type(name, tspec,			c90, c99, gcc, attr, deco) \
-	kwdef(name, T_TYPE, 0, tspec, 0,	c90, c99, gcc, attr, deco)
-#define kwdef_tqual(name, tqual,		c90, c99, gcc, attr, deco) \
-	kwdef(name, T_QUAL, 0, 0, tqual,	c90, c99, gcc, attr, deco)
+#define kwdef_token(name, token,		c90, c99, gcc, deco) \
+	kwdef(name, token, 0, 0, 0,		c90, c99, gcc, 0, deco)
+#define kwdef_sclass(name, sclass,		c90, c99, gcc, deco) \
+	kwdef(name, T_SCLASS, sclass, 0, 0,	c90, c99, gcc, 0, deco)
+#define kwdef_type(name, tspec,			c90, c99, gcc, deco) \
+	kwdef(name, T_TYPE, 0, tspec, 0,	c90, c99, gcc, 0, deco)
+#define kwdef_tqual(name, tqual,		c90, c99, gcc, deco) \
+	kwdef(name, T_QUAL, 0, 0, tqual,	c90, c99, gcc, 0, deco)
 #define kwdef_keyword(name, token) \
 	kwdef(name, token, 0, 0, 0,		0, 0, 0, 0, 1)
 #define kwdef_gcc_attr(name, token) \
@@ -106,23 +106,23 @@ static const struct keyword {
 	kwdef_keyword(	"_Alignas",	T_ALIGNAS),
 	kwdef_keyword(	"_Alignof",	T_ALIGNOF),
 	kwdef_gcc_attr(	"aligned",	T_AT_ALIGNED),
-	kwdef_token(	"__alignof__",	T_ALIGNOF,		0,0,0,0,1),
+	kwdef_token(	"__alignof__",	T_ALIGNOF,		0,0,0,1),
 	kwdef_gcc_attr(	"alloc_size",	T_AT_ALLOC_SIZE),
 	kwdef_gcc_attr(	"always_inline",T_AT_ALWAYS_INLINE),
-	kwdef_token(	"asm",		T_ASM,			0,0,1,0,7),
-	kwdef_token(	"attribute",	T_ATTRIBUTE,		0,0,1,0,6),
-	kwdef_sclass(	"auto",		AUTO,			0,0,0,0,1),
-	kwdef_type(	"_Bool",	BOOL,			0,1,0,0,1),
+	kwdef_token(	"asm",		T_ASM,			0,0,1,7),
+	kwdef_token(	"attribute",	T_ATTRIBUTE,		0,0,1,6),
+	kwdef_sclass(	"auto",		AUTO,			0,0,0,1),
+	kwdef_type(	"_Bool",	BOOL,			0,1,0,1),
 	kwdef_gcc_attr(	"bounded",	T_AT_BOUNDED),
 	kwdef_keyword(	"break",	T_BREAK),
 	kwdef_gcc_attr(	"buffer",	T_AT_BUFFER),
-	kwdef_token(	"__builtin_offsetof", T_BUILTIN_OFFSETOF, 0,0,1,0,1),
+	kwdef_token(	"__builtin_offsetof", T_BUILTIN_OFFSETOF, 0,0,1,1),
 	kwdef_keyword(	"case",		T_CASE),
-	kwdef_type(	"char",		CHAR,			0,0,0,0,1),
+	kwdef_type(	"char",		CHAR,			0,0,0,1),
 	kwdef_gcc_attr(	"cold",		T_AT_COLD),
 	kwdef_gcc_attr(	"common",	T_AT_COMMON),
-	kwdef_type(	"_Complex",	COMPLEX,		0,1,0,0,1),
-	kwdef_tqual(	"const",	CONST,			1,0,0,0,7),
+	kwdef_type(	"_Complex",	COMPLEX,		0,1,0,1),
+	kwdef_tqual(	"const",	CONST,			1,0,0,7),
 	kwdef_gcc_attr(	"constructor",	T_AT_CONSTRUCTOR),
 	kwdef_keyword(	"continue",	T_CONTINUE),
 	kwdef_keyword(	"default",	T_DEFAULT),
@@ -131,29 +131,29 @@ static const struct keyword {
 	kwdef_gcc_attr(	"disable_sanitizer_instrumentation",
 	T_AT_DISABLE_SANITIZER_INSTRUMENTATION),
 	kwdef_keyword(	"do",		T_DO),
-	kwdef_type(	"double",	DOUBLE,			0,0,0,0,1),
+	kwdef_type(	"double",	DOUBLE,			0,0,0,1),
 	kwdef_keyword(	"else",		T_ELSE),
 	kwdef_keyword(	"enum",		T_ENUM),
-	kwdef_token(	"__extension__",T_EXTENSION,		0,0,1,0,1),
-	kwdef_sclass(	"extern",	EXTERN,			0,0,0,0,1),
+	kwdef_token(	"__extension__",T_EXTENSION,		0,0,1,1),
+	kwdef_sclass(	"extern",	EXTERN,			0,0,0,1),
 	kwdef_gcc_attr(	"fallthrough",	T_AT_FALLTHROUGH),
-	kwdef_type(	"float",	FLOAT,			0,0,0,0,1),
+	kwdef_type(	"float",	FLOAT,			0,0,0,1),
 	kwdef_keyword(	"for",		T_FOR),
 	kwdef_gcc_attr(	"format",	T_AT_FORMAT),
 	kwdef_gcc_attr(	"format_arg",	T_AT_FORMAT_ARG),
-	kwdef_token(	"_Generic",	T_GENERIC,		0,1,0,0,1),
+	kwdef_token(	"_Generic",	T_GENERIC,		0,1,0,1),
 	kwdef_gcc_attr(	

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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 18:13:54 UTC 2022

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

Log Message:
lint: clean up keyword definitions for the lexer

There is only one specialized keyword that is also a GCC attribute, it's
"section".  All other keywords passed 0 in that macro argument.

No binary change.


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

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



CVS commit: src/sys/arch

2022-04-16 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr 16 17:35:57 UTC 2022

Modified Files:
src/sys/arch/hpcmips/dev: plumvideo.c
src/sys/arch/playstation2/ee: sif.c

Log Message:
s/setted/set/


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/hpcmips/dev/plumvideo.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/playstation2/ee/sif.c

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



CVS commit: src/sys/arch

2022-04-16 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr 16 17:35:57 UTC 2022

Modified Files:
src/sys/arch/hpcmips/dev: plumvideo.c
src/sys/arch/playstation2/ee: sif.c

Log Message:
s/setted/set/


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/hpcmips/dev/plumvideo.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/playstation2/ee/sif.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/hpcmips/dev/plumvideo.c
diff -u src/sys/arch/hpcmips/dev/plumvideo.c:1.43 src/sys/arch/hpcmips/dev/plumvideo.c:1.44
--- src/sys/arch/hpcmips/dev/plumvideo.c:1.43	Sat Aug  7 16:18:54 2021
+++ src/sys/arch/hpcmips/dev/plumvideo.c	Sat Apr 16 17:35:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: plumvideo.c,v 1.43 2021/08/07 16:18:54 thorpej Exp $ */
+/*	$NetBSD: plumvideo.c,v 1.44 2022/04/16 17:35:57 andvar Exp $ */
 
 /*-
  * Copyright (c) 1999-2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plumvideo.c,v 1.43 2021/08/07 16:18:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plumvideo.c,v 1.44 2022/04/16 17:35:57 andvar Exp $");
 
 #undef PLUMVIDEODEBUG
 
@@ -356,7 +356,7 @@ plumvideo_init(struct plumvideo_softc *s
 	chip->vc_fbdepth = bpp;
 
 	/*
-	 * Get display size from WindowsCE setted.
+	 * Get display size from WindowsCE set.
 	 */
 	chip->vc_fbwidth = width = bootinfo->fb_width = 
 	plum_conf_read(regt, regh, PLUM_VIDEO_PLHPX_REG) + 1;

Index: src/sys/arch/playstation2/ee/sif.c
diff -u src/sys/arch/playstation2/ee/sif.c:1.11 src/sys/arch/playstation2/ee/sif.c:1.12
--- src/sys/arch/playstation2/ee/sif.c:1.11	Mon Jul 18 22:24:15 2016
+++ src/sys/arch/playstation2/ee/sif.c	Sat Apr 16 17:35:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sif.c,v 1.11 2016/07/18 22:24:15 maya Exp $	*/
+/*	$NetBSD: sif.c,v 1.12 2022/04/16 17:35:57 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sif.c,v 1.11 2016/07/18 22:24:15 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sif.c,v 1.12 2022/04/16 17:35:57 andvar Exp $");
 
 #include "debug_playstation2.h"
 
@@ -101,7 +101,7 @@ iopdma_allocate_buffer(struct iopdma_seg
 {
 	/* 
 	 * To avoid cache inconsistecy as the result of DMA(to memory), 
-	 * DMA buffer size is setted to multiple of CPU cache line size (64B)
+	 * DMA buffer size is set to multiple of CPU cache line size (64B)
 	 * and aligned to cache line.
 	 */
 	seg->size = ROUND64(size);



CVS commit: src/sys

2022-04-16 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr 16 17:34:35 UTC 2022

Modified Files:
src/sys/arch/arm/iomd: iomdreg.h
src/sys/dev/ic: aic79xx.c

Log Message:
s/strickly/strictly/


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/iomd/iomdreg.h
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/ic/aic79xx.c

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



CVS commit: src/sys

2022-04-16 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr 16 17:34:35 UTC 2022

Modified Files:
src/sys/arch/arm/iomd: iomdreg.h
src/sys/dev/ic: aic79xx.c

Log Message:
s/strickly/strictly/


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/iomd/iomdreg.h
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/ic/aic79xx.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/iomd/iomdreg.h
diff -u src/sys/arch/arm/iomd/iomdreg.h:1.4 src/sys/arch/arm/iomd/iomdreg.h:1.5
--- src/sys/arch/arm/iomd/iomdreg.h:1.4	Sun Dec 11 12:16:47 2005
+++ src/sys/arch/arm/iomd/iomdreg.h	Sat Apr 16 17:34:34 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: iomdreg.h,v 1.4 2005/12/11 12:16:47 christos Exp $	*/
+/*	$NetBSD: iomdreg.h,v 1.5 2022/04/16 17:34:34 andvar Exp $	*/
 
 /*
  * Copyright (c) 1994-1997 Mark Brinicombe.
@@ -201,7 +201,7 @@
 #define IOMD_SIZE	0x100	/* XXX - should be words ? */
 
 /*
- * Ok these mouse buttons are not strickly part of the iomd but
+ * Ok these mouse buttons are not strictly part of the iomd but
  * this register is required if the IOMD supports a quadrature mouse
  */
 

Index: src/sys/dev/ic/aic79xx.c
diff -u src/sys/dev/ic/aic79xx.c:1.65 src/sys/dev/ic/aic79xx.c:1.66
--- src/sys/dev/ic/aic79xx.c:1.65	Thu Apr  7 19:33:37 2022
+++ src/sys/dev/ic/aic79xx.c	Sat Apr 16 17:34:34 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: aic79xx.c,v 1.65 2022/04/07 19:33:37 andvar Exp $	*/
+/*	$NetBSD: aic79xx.c,v 1.66 2022/04/16 17:34:34 andvar Exp $	*/
 
 /*
  * Core routines and tables shareable across OS platforms.
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.65 2022/04/07 19:33:37 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.66 2022/04/16 17:34:34 andvar Exp $");
 
 #include 
 #include 
@@ -653,7 +653,7 @@ ahd_run_data_fifo(struct ahd_softc *ahd,
 			ahd_outb(ahd, SG_STATE, 0);
 
 			/*
-			 * Flush the data FIFO.  Strickly only
+			 * Flush the data FIFO.  Strictly only
 			 * necessary for Rev A parts.
 			 */
 			ahd_outb(ahd, DFCNTRL,



Re: CVS commit: src/sys/dev/raidframe

2022-04-16 Thread J. Hannken-Illjes
> On 16. Apr 2022, at 18:40, Andrius Varanavicius  wrote:
> 
> Module Name:  src
> Committed By: andvar
> Date: Sat Apr 16 16:40:54 UTC 2022
> 
> Modified Files:
>   src/sys/dev/raidframe: rf_netbsdkintf.c
> 
> Log Message:
> Fix mistake in error branch locking caused by previous changes.
> vput(vp) also unlocks vp, thus unlocking happens twice in error flow
> causing kernel to panic with failed assertion lktype != LK_NONE
> in vfs_vnode.c#778. Thanks riastradh with finding the issue.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.406 -r1.407 src/sys/dev/raidframe/rf_netbsdkintf.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.

Thanks, replacing vput() with vrele() would have been even better ...

--
J. Hannken-Illjes - hann...@mailbox.org


signature.asc
Description: Message signed with OpenPGP


CVS commit: src/sys/dev/raidframe

2022-04-16 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr 16 16:40:54 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Fix mistake in error branch locking caused by previous changes.
vput(vp) also unlocks vp, thus unlocking happens twice in error flow
causing kernel to panic with failed assertion lktype != LK_NONE
in vfs_vnode.c#778. Thanks riastradh with finding the issue.


To generate a diff of this commit:
cvs rdiff -u -r1.406 -r1.407 src/sys/dev/raidframe/rf_netbsdkintf.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/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.406 src/sys/dev/raidframe/rf_netbsdkintf.c:1.407
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.406	Sat Apr 16 07:57:33 2022
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sat Apr 16 16:40:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.406 2022/04/16 07:57:33 hannken Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.407 2022/04/16 16:40:54 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.406 2022/04/16 07:57:33 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.407 2022/04/16 16:40:54 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -2951,7 +2951,6 @@ rf_find_raid_components(void)
 
 			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 			error = VOP_OPEN(vp, FREAD | FSILENT, NOCRED);
-			VOP_UNLOCK(vp);
 
 			if (error) {
 /* "Who cares."  Continue looking
@@ -2960,6 +2959,7 @@ rf_find_raid_components(void)
 continue;
 			}
 
+			VOP_UNLOCK(vp);
 			error = getdisksize(vp, , );
 			if (error) {
 /*



CVS commit: src/sys/dev/raidframe

2022-04-16 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr 16 16:40:54 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Fix mistake in error branch locking caused by previous changes.
vput(vp) also unlocks vp, thus unlocking happens twice in error flow
causing kernel to panic with failed assertion lktype != LK_NONE
in vfs_vnode.c#778. Thanks riastradh with finding the issue.


To generate a diff of this commit:
cvs rdiff -u -r1.406 -r1.407 src/sys/dev/raidframe/rf_netbsdkintf.c

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



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 15:55:10 UTC 2022

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

Log Message:
lint: for gnuism and c99ism, calculate severity

Calculating the severity as a simple sum removes the condition sequence
'a && !b, or else a || !b', which can quickly become a brain twister,
especially when negations are involved.

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.160 src/usr.bin/xlint/lint1/err.c:1.161
--- src/usr.bin/xlint/lint1/err.c:1.160	Sat Apr 16 13:25:27 2022
+++ src/usr.bin/xlint/lint1/err.c	Sat Apr 16 15:55:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.c,v 1.160 2022/04/16 13:25:27 rillig Exp $	*/
+/*	$NetBSD: err.c,v 1.161 2022/04/16 15:55:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.160 2022/04/16 13:25:27 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.161 2022/04/16 15:55:10 rillig Exp $");
 #endif
 
 #include 
@@ -634,14 +634,13 @@ void
 (c99ism)(int msgid, ...)
 {
 	va_list	ap;
-	bool extensions_ok = Sflag || gflag;
+	int severity = (!allow_c99 && !allow_gcc ? 1 : 0) + (sflag ? 1 : 0);
 
 	va_start(ap, msgid);
-	if (sflag && !extensions_ok) {
+	if (severity == 2)
 		verror_at(msgid, _pos, ap);
-	} else if (sflag || !extensions_ok) {
+	if (severity == 1)
 		vwarning_at(msgid, _pos, ap);
-	}
 	va_end(ap);
 }
 
@@ -661,12 +660,12 @@ void
 (gnuism)(int msgid, ...)
 {
 	va_list	ap;
+	int severity = (!allow_gcc ? 1 : 0) + (sflag ? 1 : 0);
 
 	va_start(ap, msgid);
-	if (sflag && !gflag) {
+	if (severity == 2)
 		verror_at(msgid, _pos, ap);
-	} else if (sflag || !gflag) {
+	if (severity == 1)
 		vwarning_at(msgid, _pos, ap);
-	}
 	va_end(ap);
 }



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 15:55:10 UTC 2022

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

Log Message:
lint: for gnuism and c99ism, calculate severity

Calculating the severity as a simple sum removes the condition sequence
'a && !b, or else a || !b', which can quickly become a brain twister,
especially when negations are involved.

No functional change.


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

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



CVS commit: src/bin/sh

2022-04-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Apr 16 14:26:26 UTC 2022

Modified Files:
src/bin/sh: miscbltin.c

Log Message:
Redo the way the builtin cmd 'ulimit' getopt() (nextopt() really, but it
is essentially the same) arg string is generated, to lessen the chances
that the table of limits, and the arg string that allows limits to be
reported or set will get out of sync.   They weren't (as long as we didn't
grow an RLIMIT_SWAP) this is just tidier.

While here, reorder the limits table fields, and shrink a couple that
were needlessly wasteful, to save some space -- for most architectures
this should save 8 bytes per table entry (there are currently 13).
(Some minor code bloat offsets this slightly because of int type
promotions now required).

NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/bin/sh/miscbltin.c

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

Modified files:

Index: src/bin/sh/miscbltin.c
diff -u src/bin/sh/miscbltin.c:1.49 src/bin/sh/miscbltin.c:1.50
--- src/bin/sh/miscbltin.c:1.49	Sat Apr 16 14:23:36 2022
+++ src/bin/sh/miscbltin.c	Sat Apr 16 14:26:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: miscbltin.c,v 1.49 2022/04/16 14:23:36 kre Exp $	*/
+/*	$NetBSD: miscbltin.c,v 1.50 2022/04/16 14:26:26 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)miscbltin.c	8.4 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: miscbltin.c,v 1.49 2022/04/16 14:23:36 kre Exp $");
+__RCSID("$NetBSD: miscbltin.c,v 1.50 2022/04/16 14:26:26 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -316,53 +316,95 @@ umaskcmd(int argc, char **argv)
 struct limits {
 	const char *name;
 	const char *unit;
-	int	cmd;
-	int	factor;	/* multiply by to get rlim_{cur,max} values */
 	char	option;
+	int8_t	cmd;		/* all RLIMIT_xxx are <= 127 */
+	unsigned short factor;	/* multiply by to get rlim_{cur,max} values */
 };
 
+#define	OPTSTRING_BASE "HSa"
+
 static const struct limits limits[] = {
 #ifdef RLIMIT_CPU
-	{ "time",	"seconds",	RLIMIT_CPU,	   1, 't' },
+	{ "time",	"seconds",	't',	RLIMIT_CPU,	   1 },
+#define	OPTSTRING_t	OPTSTRING_BASE "t"
+#else
+#define	OPTSTRING_t	OPTSTRING_BASE
 #endif
 #ifdef RLIMIT_FSIZE
-	{ "file",	"blocks",	RLIMIT_FSIZE,	 512, 'f' },
+	{ "file",	"blocks",	'f',	RLIMIT_FSIZE,	 512 },
+#define	OPTSTRING_f	OPTSTRING_t "f"
+#else
+#define	OPTSTRING_f	OPTSTRING_t
 #endif
 #ifdef RLIMIT_DATA
-	{ "data",	"kbytes",	RLIMIT_DATA,	1024, 'd' },
+	{ "data",	"kbytes",	'd',	RLIMIT_DATA,	1024 },
+#define	OPTSTRING_d	OPTSTRING_f "d"
+#else
+#define	OPTSTRING_d	OPTSTRING_f
 #endif
 #ifdef RLIMIT_STACK
-	{ "stack",	"kbytes",	RLIMIT_STACK,	1024, 's' },
+	{ "stack",	"kbytes",	's',	RLIMIT_STACK,	1024 },
+#define	OPTSTRING_s	OPTSTRING_d "s"
+#else
+#define	OPTSTRING_s	OPTSTRING_d
 #endif
 #ifdef RLIMIT_CORE
-	{ "coredump",	"blocks",	RLIMIT_CORE,	 512, 'c' },
+	{ "coredump",	"blocks",	'c',	RLIMIT_CORE,	 512 },
+#define	OPTSTRING_c	OPTSTRING_s "c"
+#else
+#define	OPTSTRING_c	OPTSTRING_s
 #endif
 #ifdef RLIMIT_RSS
-	{ "memory",	"kbytes",	RLIMIT_RSS,	1024, 'm' },
+	{ "memory",	"kbytes",	'm',	RLIMIT_RSS,	1024 },
+#define	OPTSTRING_m	OPTSTRING_c "m"
+#else
+#define	OPTSTRING_m	OPTSTRING_c
 #endif
 #ifdef RLIMIT_MEMLOCK
-	{ "locked memory","kbytes",	RLIMIT_MEMLOCK, 1024, 'l' },
+	{ "locked memory","kbytes",	'l',	RLIMIT_MEMLOCK, 1024 },
+#define	OPTSTRING_l	OPTSTRING_m "l"
+#else
+#define	OPTSTRING_l	OPTSTRING_m
 #endif
 #ifdef RLIMIT_NTHR
-	{ "thread",	"threads",	RLIMIT_NTHR,   1, 'r' },
+	{ "thread",	"threads",	'r',	RLIMIT_NTHR,   1 },
+#define	OPTSTRING_r	OPTSTRING_l "r"
+#else
+#define	OPTSTRING_r	OPTSTRING_l
 #endif
 #ifdef RLIMIT_NPROC
-	{ "process",	"processes",	RLIMIT_NPROC,  1, 'p' },
+	{ "process",	"processes",	'p',	RLIMIT_NPROC,  1 },
+#define	OPTSTRING_p	OPTSTRING_r "p"
+#else
+#define	OPTSTRING_p	OPTSTRING_r
 #endif
 #ifdef RLIMIT_NOFILE
-	{ "nofiles",	"descriptors",	RLIMIT_NOFILE, 1, 'n' },
+	{ "nofiles",	"descriptors",	'n',	RLIMIT_NOFILE, 1 },
+#define	OPTSTRING_n	OPTSTRING_p "n"
+#else
+#define	OPTSTRING_n	OPTSTRING_p
 #endif
 #ifdef RLIMIT_VMEM
-	{ "vmemory",	"kbytes",	RLIMIT_VMEM,	1024, 'v' },
+	{ "vmemory",	"kbytes",	'v',	RLIMIT_VMEM,	1024 },
+#define	OPTSTRING_v	OPTSTRING_n "v"
+#else
+#define	OPTSTRING_v	OPTSTRING_n
 #endif
 #ifdef RLIMIT_SWAP
-	{ "swap",	"kbytes",	RLIMIT_SWAP,	1024, 'w' },
+	{ "swap",	"kbytes",	'w',	RLIMIT_SWAP,	1024 },
+#define	OPTSTRING_w	OPTSTRING_v "w"
+#else
+#define	OPTSTRING_w	OPTSTRING_v
 #endif
 #ifdef RLIMIT_SBSIZE
-	{ "sbsize",	"bytes",	RLIMIT_SBSIZE,	   1, 'b' },
+	{ "sbsize",	"bytes",	'b',	RLIMIT_SBSIZE,	   1 },
+#define	OPTSTRING_b	OPTSTRING_w "b"
+#else
+#define	OPTSTRING_b	OPTSTRING_w
 #endif
-	{ NULL,		NULL,		0,		   0,  '\0' }
+	{ NULL,		NULL,		'\0',	0,		   0 }
 };
+#define	OPTSTRING	OPTSTRING_b
 
 int
 ulimitcmd(int argc, char **argv)
@@ -377,7 +419,7 @@ ulimitcmd(int argc, char **argv)
 	struct 

CVS commit: src/bin/sh

2022-04-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Apr 16 14:26:26 UTC 2022

Modified Files:
src/bin/sh: miscbltin.c

Log Message:
Redo the way the builtin cmd 'ulimit' getopt() (nextopt() really, but it
is essentially the same) arg string is generated, to lessen the chances
that the table of limits, and the arg string that allows limits to be
reported or set will get out of sync.   They weren't (as long as we didn't
grow an RLIMIT_SWAP) this is just tidier.

While here, reorder the limits table fields, and shrink a couple that
were needlessly wasteful, to save some space -- for most architectures
this should save 8 bytes per table entry (there are currently 13).
(Some minor code bloat offsets this slightly because of int type
promotions now required).

NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/bin/sh/miscbltin.c

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



CVS commit: src/bin/sh

2022-04-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Apr 16 14:23:36 UTC 2022

Modified Files:
src/bin/sh: miscbltin.c

Log Message:
While doing the previous change, I noticed that when used in a
particularly perverse way, the error message for a bad octal
constant as the new umask value could incorrectly claim that the
-S option (which would need to be present to cause this issue)
was the detected bad value.   Fix that to report the actual
incorrect arg.

And while fiddling, also check for args to umask that are too big
to be sane mask values (the biggest permitted is 0) and use
mode_t as the mask variable type, rather than int.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/bin/sh/miscbltin.c

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

Modified files:

Index: src/bin/sh/miscbltin.c
diff -u src/bin/sh/miscbltin.c:1.48 src/bin/sh/miscbltin.c:1.49
--- src/bin/sh/miscbltin.c:1.48	Sat Apr 16 14:20:45 2022
+++ src/bin/sh/miscbltin.c	Sat Apr 16 14:23:36 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: miscbltin.c,v 1.48 2022/04/16 14:20:45 kre Exp $	*/
+/*	$NetBSD: miscbltin.c,v 1.49 2022/04/16 14:23:36 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)miscbltin.c	8.4 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: miscbltin.c,v 1.48 2022/04/16 14:20:45 kre Exp $");
+__RCSID("$NetBSD: miscbltin.c,v 1.49 2022/04/16 14:23:36 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -215,7 +215,7 @@ int
 umaskcmd(int argc, char **argv)
 {
 	char *ap;
-	int mask;
+	mode_t mask;
 	int i;
 	int symbolic_mode = 0;
 
@@ -265,13 +265,19 @@ umaskcmd(int argc, char **argv)
 		}
 	} else {
 		if (isdigit((unsigned char)*ap)) {
+			int range = 0;
+
 			mask = 0;
 			do {
 if (*ap >= '8' || *ap < '0')
 	error("Not a valid octal number: '%s'",
-	argv[1]);
+	*argptr);
 mask = (mask << 3) + (*ap - '0');
+if (mask & ~0)
+	range = 1;
 			} while (*++ap != '\0');
+			if (range)
+			error("Mask constant '%s' out of range", *argptr);
 			umask(mask);
 		} else {
 			void *set;



CVS commit: src/bin/sh

2022-04-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Apr 16 14:23:36 UTC 2022

Modified Files:
src/bin/sh: miscbltin.c

Log Message:
While doing the previous change, I noticed that when used in a
particularly perverse way, the error message for a bad octal
constant as the new umask value could incorrectly claim that the
-S option (which would need to be present to cause this issue)
was the detected bad value.   Fix that to report the actual
incorrect arg.

And while fiddling, also check for args to umask that are too big
to be sane mask values (the biggest permitted is 0) and use
mode_t as the mask variable type, rather than int.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/bin/sh/miscbltin.c

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



CVS commit: src/bin/sh

2022-04-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Apr 16 14:20:45 UTC 2022

Modified Files:
src/bin/sh: miscbltin.c mystring.c options.c parser.c

Log Message:
Avoid generating error messages implying that user errors are illegal.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/bin/sh/miscbltin.c
cvs rdiff -u -r1.18 -r1.19 src/bin/sh/mystring.c
cvs rdiff -u -r1.56 -r1.57 src/bin/sh/options.c
cvs rdiff -u -r1.177 -r1.178 src/bin/sh/parser.c

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



CVS commit: src/bin/sh

2022-04-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Apr 16 14:20:45 UTC 2022

Modified Files:
src/bin/sh: miscbltin.c mystring.c options.c parser.c

Log Message:
Avoid generating error messages implying that user errors are illegal.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/bin/sh/miscbltin.c
cvs rdiff -u -r1.18 -r1.19 src/bin/sh/mystring.c
cvs rdiff -u -r1.56 -r1.57 src/bin/sh/options.c
cvs rdiff -u -r1.177 -r1.178 src/bin/sh/parser.c

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

Modified files:

Index: src/bin/sh/miscbltin.c
diff -u src/bin/sh/miscbltin.c:1.47 src/bin/sh/miscbltin.c:1.48
--- src/bin/sh/miscbltin.c:1.47	Sun Dec 12 11:18:46 2021
+++ src/bin/sh/miscbltin.c	Sat Apr 16 14:20:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: miscbltin.c,v 1.47 2021/12/12 11:18:46 andvar Exp $	*/
+/*	$NetBSD: miscbltin.c,v 1.48 2022/04/16 14:20:45 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)miscbltin.c	8.4 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: miscbltin.c,v 1.47 2021/12/12 11:18:46 andvar Exp $");
+__RCSID("$NetBSD: miscbltin.c,v 1.48 2022/04/16 14:20:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -268,7 +268,8 @@ umaskcmd(int argc, char **argv)
 			mask = 0;
 			do {
 if (*ap >= '8' || *ap < '0')
-	error("Illegal number: %s", argv[1]);
+	error("Not a valid octal number: '%s'",
+	argv[1]);
 mask = (mask << 3) + (*ap - '0');
 			} while (*++ap != '\0');
 			umask(mask);

Index: src/bin/sh/mystring.c
diff -u src/bin/sh/mystring.c:1.18 src/bin/sh/mystring.c:1.19
--- src/bin/sh/mystring.c:1.18	Fri Jul 13 22:43:44 2018
+++ src/bin/sh/mystring.c	Sat Apr 16 14:20:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mystring.c,v 1.18 2018/07/13 22:43:44 kre Exp $	*/
+/*	$NetBSD: mystring.c,v 1.19 2022/04/16 14:20:45 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)mystring.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: mystring.c,v 1.18 2018/07/13 22:43:44 kre Exp $");
+__RCSID("$NetBSD: mystring.c,v 1.19 2022/04/16 14:20:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -117,7 +117,7 @@ number(const char *s)
 
 	if (!is_digit(*s) || ((n = strtoimax(s, , 10)), 
 	(ep == NULL || ep == s || *ep != '\0')))
-		error("Illegal number: '%s'", s);
+		error("Invalid number: '%s'", s);
 	if (n < INT_MIN || n > INT_MAX)
 		error("Number out of range: %s", s);
 	return (int)n;

Index: src/bin/sh/options.c
diff -u src/bin/sh/options.c:1.56 src/bin/sh/options.c:1.57
--- src/bin/sh/options.c:1.56	Tue Oct 26 00:05:38 2021
+++ src/bin/sh/options.c	Sat Apr 16 14:20:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.56 2021/10/26 00:05:38 kre Exp $	*/
+/*	$NetBSD: options.c,v 1.57 2022/04/16 14:20:45 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: options.c,v 1.56 2021/10/26 00:05:38 kre Exp $");
+__RCSID("$NetBSD: options.c,v 1.57 2022/04/16 14:20:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -325,7 +325,7 @@ minus_o(char *name, int val)
 #endif
 return;
 			}
-		error("Illegal option %co %s", "+-"[val], name);
+		error("Unknown option %co %s", "+-"[val], name);
 	}
 }
 
@@ -344,7 +344,7 @@ setoption(int flag, int val)
 #endif
 			return;
 		}
-	error("Illegal option %c%c", "+-"[val], flag);
+	error("Unknown option %c%c", "+-"[val], flag);
 	/* NOTREACHED */
 }
 
@@ -540,7 +540,7 @@ atend:
 s[1] = '\0';
 err |= setvarsafe("OPTARG", s, 0);
 			} else {
-outfmt(, "Illegal option -%c\n", c);
+outfmt(, "Unknown option -%c\n", c);
 (void) unsetvar("OPTARG", 0);
 			}
 			c = '?';
@@ -631,7 +631,7 @@ nextopt(const char *optstring)
 	c = *p++;
 	for (q = optstring ; *q != c ; ) {
 		if (*q == '\0')
-			error("Illegal option -%c", c);
+			error("Unknown option -%c", c);
 		if (*++q == ':')
 			q++;
 	}

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.177 src/bin/sh/parser.c:1.178
--- src/bin/sh/parser.c:1.177	Wed Dec  8 20:21:09 2021
+++ src/bin/sh/parser.c	Sat Apr 16 14:20:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.177 2021/12/08 20:21:09 andvar Exp $	*/
+/*	$NetBSD: parser.c,v 1.178 2022/04/16 14:20:45 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.177 2021/12/08 20:21:09 andvar Exp $");
+__RCSID("$NetBSD: parser.c,v 1.178 2022/04/16 14:20:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -795,7 +795,8 @@ parsefname(void)
 		 * So, leave it like this until the rest of the parser is fixed.
 		 */
 		if (!noexpand(wordtext))
-			synerror("Illegal eof marker for << redirection");
+			synerror("Unimplemented form of eof marker"
+			" for << redirection");
 
 		rmescapes(wordtext);
 		here->eofmark = wordtext;



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 14:06:11 UTC 2022

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

Log Message:
lint: clean up conditions for migration check between trad and C90

No functional change, as each of the conditions was effectively '!tflag
&& !sflag && !Sflag' (even if distributed over several statements).


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.427 src/usr.bin/xlint/lint1/tree.c:1.428
--- src/usr.bin/xlint/lint1/tree.c:1.427	Fri Apr 15 21:50:07 2022
+++ src/usr.bin/xlint/lint1/tree.c	Sat Apr 16 14:06:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.427 2022/04/15 21:50:07 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.428 2022/04/16 14:06:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.427 2022/04/15 21:50:07 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.428 2022/04/16 14:06:10 rillig Exp $");
 #endif
 
 #include 
@@ -944,24 +944,24 @@ typeok_shr(const mod_t *mp,
 			/* bitwise '%s' on signed value nonportable */
 			warning(120, mp->m_name);
 		}
-	} else if (!tflag && !sflag && !is_uinteger(olt) && is_uinteger(ort)) {
+	} else if (allow_trad && allow_c90 &&
+		   !is_uinteger(olt) && is_uinteger(ort)) {
 		/*
 		 * The left operand would become unsigned in
 		 * traditional C.
 		 */
-		if (hflag && !Sflag &&
-		(ln->tn_op != CON || ln->tn_val->v_quad < 0)) {
+		if (hflag && (ln->tn_op != CON || ln->tn_val->v_quad < 0)) {
 			/* semantics of '%s' change in ANSI C; use ... */
 			warning(118, mp->m_name);
 		}
-	} else if (!tflag && !sflag && !is_uinteger(olt) && !is_uinteger(ort) &&
+	} else if (allow_trad && allow_c90 &&
+		   !is_uinteger(olt) && !is_uinteger(ort) &&
 		   portable_size_in_bits(lt) < portable_size_in_bits(rt)) {
 		/*
-		 * In traditional C the left operand would be extended,
-		 * possibly with 1, and then shifted.
+		 * In traditional C the left operand would be extended
+		 * (possibly sign-extended) and then shifted.
 		 */
-		if (hflag && !Sflag &&
-		(ln->tn_op != CON || ln->tn_val->v_quad < 0)) {
+		if (hflag && (ln->tn_op != CON || ln->tn_val->v_quad < 0)) {
 			/* semantics of '%s' change in ANSI C; use ... */
 			warning(118, mp->m_name);
 		}
@@ -2077,7 +2077,7 @@ convert(op_t op, int arg, type_t *tp, tn
 	nt = tp->t_tspec;
 	ot = tn->tn_type->t_tspec;
 
-	if (!tflag && !sflag && !Sflag && op == FARG)
+	if (allow_trad && allow_c90 && op == FARG)
 		check_prototype_conversion(arg, nt, ot, tp, tn);
 
 	if (is_integer(nt) && is_integer(ot)) {



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 14:06:11 UTC 2022

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

Log Message:
lint: clean up conditions for migration check between trad and C90

No functional change, as each of the conditions was effectively '!tflag
&& !sflag && !Sflag' (even if distributed over several statements).


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

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



CVS commit: src

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 13:25:27 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_081.c msg_100.c msg_340.c
msg_340.exp
src/usr.bin/xlint/lint1: err.c externs1.h main1.c

Log Message:
lint: model C language levels in a future-compatible way

The options -t, -s and -S are confusing because they are used
inconsistently.  The option -S enables C99 features, but when using it
instead of -s, it also doesn't enable all checks required by C90 and
later.  Prepare fixing of these inconsistencies by replacing the flag
variables with language levels that can be extended in a
straight-forward way as new C standards arrive.

| option | allow_trad | allow_c90 | allow_c99 | allow_c11 |
|||---|---|---|
| -t | x  | - | - | - |
| (none) | x  | x | - | - |
| -s | -  | x | - | - |
| -S | -  | x | x | - |
| -Ac11  | -  | x | x | x |

Each usage of the old flag variables will be inspected and migrated
individually, to clean up the subtle variations in the conditions and to
provide a simpler model.

When lint was created in 1995, its focus was migrating traditional C
code to C90 code.  Lint does not help in migrating from C90 to C99 or
from C99 to C11 since there are only few silent changes, and simply
because nobody took the time to implement these migration aids.  If
necessary, such migration modes could be added separately.

There is a small functional change: when the option -s is combined with
either -S or -Ac11, lint now only keeps the last of these options.
Previously, these options could be combined, leading to a mixture of
language levels, halfway between C90, C99 and C11.  Especially combining
traditional C with C11 doesn't make sense, but xlint currently allows
it.

The 3 tests that accidentally specified multiple language levels have
been adjusted to a single language level.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_081.c \
src/tests/usr.bin/xlint/lint1/msg_100.c \
src/tests/usr.bin/xlint/lint1/msg_340.exp
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_340.c
cvs rdiff -u -r1.159 -r1.160 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.154 -r1.155 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.59 -r1.60 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_081.c
diff -u src/tests/usr.bin/xlint/lint1/msg_081.c:1.3 src/tests/usr.bin/xlint/lint1/msg_081.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_081.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_081.c	Sat Apr 16 13:25:27 2022
@@ -1,8 +1,8 @@
-/*	$NetBSD: msg_081.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_081.c,v 1.4 2022/04/16 13:25:27 rillig Exp $	*/
 # 3 "msg_081.c"
 
-// Test for message: \a undefined in traditional C [81]
+/* Test for message: \a undefined in traditional C [81] */
 
-/* lint1-flags: -Stw */
+/* lint1-flags: -tw */
 
 char str[] = "The bell\a rings";	/* expect: 81 */
Index: src/tests/usr.bin/xlint/lint1/msg_100.c
diff -u src/tests/usr.bin/xlint/lint1/msg_100.c:1.3 src/tests/usr.bin/xlint/lint1/msg_100.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_100.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_100.c	Sat Apr 16 13:25:27 2022
@@ -1,9 +1,9 @@
-/*	$NetBSD: msg_100.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_100.c,v 1.4 2022/04/16 13:25:27 rillig Exp $	*/
 # 3 "msg_100.c"
 
-// Test for message: unary + is illegal in traditional C [100]
+/* Test for message: unary + is illegal in traditional C [100] */
 
-/* lint1-flags: -Stw */
+/* lint1-flags: -tw */
 
 int
 unary_plus(int x)
Index: src/tests/usr.bin/xlint/lint1/msg_340.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_340.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_340.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_340.exp:1.3	Mon Jul  5 19:53:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_340.exp	Sat Apr 16 13:25:27 2022
@@ -1 +1 @@
-msg_340.c(16): error: initialization with '[a...b]' is a GCC extension [340]
+msg_340.c(16): warning: initialization with '[a...b]' is a GCC extension [340]

Index: src/tests/usr.bin/xlint/lint1/msg_340.c
diff -u src/tests/usr.bin/xlint/lint1/msg_340.c:1.2 src/tests/usr.bin/xlint/lint1/msg_340.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_340.c:1.2	Mon Jul  5 19:53:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_340.c	Sat Apr 16 13:25:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_340.c,v 1.2 2021/07/05 19:53:43 rillig Exp $	*/
+/*	$NetBSD: msg_340.c,v 1.3 2022/04/16 13:25:27 rillig Exp $	*/
 # 3 "msg_340.c"
 
 // Test for message: initialization with '[a...b]' is a GCC extension [340]
@@ 

CVS commit: src

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 13:25:27 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_081.c msg_100.c msg_340.c
msg_340.exp
src/usr.bin/xlint/lint1: err.c externs1.h main1.c

Log Message:
lint: model C language levels in a future-compatible way

The options -t, -s and -S are confusing because they are used
inconsistently.  The option -S enables C99 features, but when using it
instead of -s, it also doesn't enable all checks required by C90 and
later.  Prepare fixing of these inconsistencies by replacing the flag
variables with language levels that can be extended in a
straight-forward way as new C standards arrive.

| option | allow_trad | allow_c90 | allow_c99 | allow_c11 |
|||---|---|---|
| -t | x  | - | - | - |
| (none) | x  | x | - | - |
| -s | -  | x | - | - |
| -S | -  | x | x | - |
| -Ac11  | -  | x | x | x |

Each usage of the old flag variables will be inspected and migrated
individually, to clean up the subtle variations in the conditions and to
provide a simpler model.

When lint was created in 1995, its focus was migrating traditional C
code to C90 code.  Lint does not help in migrating from C90 to C99 or
from C99 to C11 since there are only few silent changes, and simply
because nobody took the time to implement these migration aids.  If
necessary, such migration modes could be added separately.

There is a small functional change: when the option -s is combined with
either -S or -Ac11, lint now only keeps the last of these options.
Previously, these options could be combined, leading to a mixture of
language levels, halfway between C90, C99 and C11.  Especially combining
traditional C with C11 doesn't make sense, but xlint currently allows
it.

The 3 tests that accidentally specified multiple language levels have
been adjusted to a single language level.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_081.c \
src/tests/usr.bin/xlint/lint1/msg_100.c \
src/tests/usr.bin/xlint/lint1/msg_340.exp
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_340.c
cvs rdiff -u -r1.159 -r1.160 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.154 -r1.155 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.59 -r1.60 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.



CVS commit: src/sys/dev/hdaudio

2022-04-16 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 16 12:25:10 UTC 2022

Modified Files:
src/sys/dev/hdaudio: hdaudiodevs.h hdaudiodevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/hdaudio/hdaudiodevs.h \
src/sys/dev/hdaudio/hdaudiodevs_data.h

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



CVS commit: src/sys/dev/hdaudio

2022-04-16 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 16 12:25:10 UTC 2022

Modified Files:
src/sys/dev/hdaudio: hdaudiodevs.h hdaudiodevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/hdaudio/hdaudiodevs.h \
src/sys/dev/hdaudio/hdaudiodevs_data.h

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

Modified files:

Index: src/sys/dev/hdaudio/hdaudiodevs.h
diff -u src/sys/dev/hdaudio/hdaudiodevs.h:1.6 src/sys/dev/hdaudio/hdaudiodevs.h:1.7
--- src/sys/dev/hdaudio/hdaudiodevs.h:1.6	Tue Jun 29 21:04:02 2021
+++ src/sys/dev/hdaudio/hdaudiodevs.h	Sat Apr 16 12:25:10 2022
@@ -1,10 +1,10 @@
-/*	$NetBSD: hdaudiodevs.h,v 1.6 2021/06/29 21:04:02 pgoyette Exp $	*/
+/*	$NetBSD: hdaudiodevs.h,v 1.7 2022/04/16 12:25:10 nia Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: hdaudiodevs,v 1.5 2020/04/29 07:24:53 nia Exp
+ *	NetBSD: hdaudiodevs,v 1.6 2022/04/16 12:24:06 nia Exp
  */
 
 /*
@@ -184,6 +184,14 @@
 #define	HDAUDIO_PRODUCT_INTEL_G45_HDMI_2	0x2802		/* G45 HDMI/2 */
 #define	HDAUDIO_PRODUCT_INTEL_G45_HDMI_3	0x2803		/* G45 HDMI/3 */
 #define	HDAUDIO_PRODUCT_INTEL_G45_HDMI_4	0x2804		/* G45 HDMI/4 */
+#define	HDAUDIO_PRODUCT_INTEL_HASWELL_HDMI	0x2807		/* HDMI/DP */
+#define	HDAUDIO_PRODUCT_INTEL_BROADWELL_HDMI	0x2808		/* HDMI/DP */
+#define	HDAUDIO_PRODUCT_INTEL_SKYLAKE_HDMI	0x2809		/* HDMI/DP */
+#define	HDAUDIO_PRODUCT_INTEL_BROXTON_HDMI	0x280a		/* HDMI/DP */
+#define	HDAUDIO_PRODUCT_INTEL_KABYLAKE_HDMI	0x280b		/* HDMI/DP */
+#define	HDAUDIO_PRODUCT_INTEL_CANNONLAKE_HDMI	0x280c		/* HDMI/DP */
+#define	HDAUDIO_PRODUCT_INTEL_GEMINILAKE_HDMI	0x280d		/* HDMI/DP */
+#define	HDAUDIO_PRODUCT_INTEL_ICELAKE_HDMI	0x280f		/* HDMI/DP */
 #define	HDAUDIO_PRODUCT_INTEL_G45_HDMI_FB	0x29fb		/* G45 HDMI/FB */
 
 /* Sigmatel */
Index: src/sys/dev/hdaudio/hdaudiodevs_data.h
diff -u src/sys/dev/hdaudio/hdaudiodevs_data.h:1.6 src/sys/dev/hdaudio/hdaudiodevs_data.h:1.7
--- src/sys/dev/hdaudio/hdaudiodevs_data.h:1.6	Tue Jun 29 21:04:02 2021
+++ src/sys/dev/hdaudio/hdaudiodevs_data.h	Sat Apr 16 12:25:10 2022
@@ -1,10 +1,10 @@
-/*	$NetBSD: hdaudiodevs_data.h,v 1.6 2021/06/29 21:04:02 pgoyette Exp $	*/
+/*	$NetBSD: hdaudiodevs_data.h,v 1.7 2022/04/16 12:25:10 nia Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: hdaudiodevs,v 1.5 2020/04/29 07:24:53 nia Exp
+ *	NetBSD: hdaudiodevs,v 1.6 2022/04/16 12:24:06 nia Exp
  */
 
 /*
@@ -282,6 +282,22 @@ static const uint32_t hdaudio_products[]
 	653, 671, 0,
 	HDAUDIO_VENDOR_INTEL, HDAUDIO_PRODUCT_INTEL_G45_HDMI_4, 
 	653, 678, 0,
+	HDAUDIO_VENDOR_INTEL, HDAUDIO_PRODUCT_INTEL_HASWELL_HDMI, 
+	152, 0,
+	HDAUDIO_VENDOR_INTEL, HDAUDIO_PRODUCT_INTEL_BROADWELL_HDMI, 
+	152, 0,
+	HDAUDIO_VENDOR_INTEL, HDAUDIO_PRODUCT_INTEL_SKYLAKE_HDMI, 
+	152, 0,
+	HDAUDIO_VENDOR_INTEL, HDAUDIO_PRODUCT_INTEL_BROXTON_HDMI, 
+	152, 0,
+	HDAUDIO_VENDOR_INTEL, HDAUDIO_PRODUCT_INTEL_KABYLAKE_HDMI, 
+	152, 0,
+	HDAUDIO_VENDOR_INTEL, HDAUDIO_PRODUCT_INTEL_CANNONLAKE_HDMI, 
+	152, 0,
+	HDAUDIO_VENDOR_INTEL, HDAUDIO_PRODUCT_INTEL_GEMINILAKE_HDMI, 
+	152, 0,
+	HDAUDIO_VENDOR_INTEL, HDAUDIO_PRODUCT_INTEL_ICELAKE_HDMI, 
+	152, 0,
 	HDAUDIO_VENDOR_INTEL, HDAUDIO_PRODUCT_INTEL_G45_HDMI_FB, 
 	653, 685, 0,
 	HDAUDIO_VENDOR_SIGMATEL, HDAUDIO_PRODUCT_SIGMATEL_STAC9230X, 
@@ -444,7 +460,7 @@ static const char hdaudio_words[] = { ".
 	"MCP89\0" /* 1 refs @ 134 */
 	"GT240\0" /* 1 refs @ 140 */
 	"GT5xx\0" /* 1 refs @ 146 */
-	"HDMI/DP\0" /* 1 refs @ 152 */
+	"HDMI/DP\0" /* 9 refs @ 152 */
 	"Tegra124\0" /* 1 refs @ 160 */
 	"MCP67\0" /* 1 refs @ 169 */
 	"MCP73\0" /* 1 refs @ 175 */



CVS commit: src/sys/dev/hdaudio

2022-04-16 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 16 12:24:06 UTC 2022

Modified Files:
src/sys/dev/hdaudio: hdaudiodevs

Log Message:
hdaudiodevs: Add some ~new Intel devices


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hdaudio/hdaudiodevs

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/hdaudio/hdaudiodevs
diff -u src/sys/dev/hdaudio/hdaudiodevs:1.5 src/sys/dev/hdaudio/hdaudiodevs:1.6
--- src/sys/dev/hdaudio/hdaudiodevs:1.5	Wed Apr 29 07:24:53 2020
+++ src/sys/dev/hdaudio/hdaudiodevs	Sat Apr 16 12:24:06 2022
@@ -1,4 +1,4 @@
-$NetBSD: hdaudiodevs,v 1.5 2020/04/29 07:24:53 nia Exp $
+$NetBSD: hdaudiodevs,v 1.6 2022/04/16 12:24:06 nia Exp $
 
 /*
  * Copyright (c) 2010 Jared D. McNeill 
@@ -177,6 +177,14 @@ product	INTEL		G45_HDMI_1	0x2801	G45 HDM
 product	INTEL		G45_HDMI_2	0x2802	G45 HDMI/2
 product	INTEL		G45_HDMI_3	0x2803	G45 HDMI/3
 product	INTEL		G45_HDMI_4	0x2804	G45 HDMI/4
+product	INTEL		HASWELL_HDMI	0x2807	HDMI/DP
+product	INTEL		BROADWELL_HDMI	0x2808	HDMI/DP
+product	INTEL		SKYLAKE_HDMI	0x2809	HDMI/DP
+product	INTEL		BROXTON_HDMI	0x280a	HDMI/DP
+product	INTEL		KABYLAKE_HDMI	0x280b	HDMI/DP
+product	INTEL		CANNONLAKE_HDMI	0x280c	HDMI/DP
+product	INTEL		GEMINILAKE_HDMI	0x280d	HDMI/DP
+product	INTEL		ICELAKE_HDMI	0x280f	HDMI/DP
 product	INTEL		G45_HDMI_FB	0x29fb	G45 HDMI/FB
 
 /* Sigmatel */



CVS commit: src/sys/dev/hdaudio

2022-04-16 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 16 12:24:06 UTC 2022

Modified Files:
src/sys/dev/hdaudio: hdaudiodevs

Log Message:
hdaudiodevs: Add some ~new Intel devices


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hdaudio/hdaudiodevs

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



CVS commit: src/sys/arch

2022-04-16 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 16 11:57:46 UTC 2022

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC

Log Message:
x86: Enable HDAUDIOVERBOSE (as on arm) in order for AUDIO_GETDEV
to return human-readable data.  Especially now that HDMI/DP audio
is enabled by default, it helps to be able to tell two devices
apart in audiocfg/aiomixer.


To generate a diff of this commit:
cvs rdiff -u -r1.594 -r1.595 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1237 -r1.1238 src/sys/arch/i386/conf/GENERIC

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



CVS commit: src/sys/arch

2022-04-16 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 16 11:57:46 UTC 2022

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC

Log Message:
x86: Enable HDAUDIOVERBOSE (as on arm) in order for AUDIO_GETDEV
to return human-readable data.  Especially now that HDMI/DP audio
is enabled by default, it helps to be able to tell two devices
apart in audiocfg/aiomixer.


To generate a diff of this commit:
cvs rdiff -u -r1.594 -r1.595 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1237 -r1.1238 src/sys/arch/i386/conf/GENERIC

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/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.594 src/sys/arch/amd64/conf/GENERIC:1.595
--- src/sys/arch/amd64/conf/GENERIC:1.594	Thu Mar 24 02:24:24 2022
+++ src/sys/arch/amd64/conf/GENERIC	Sat Apr 16 11:57:46 2022
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.594 2022/03/24 02:24:24 manu Exp $
+# $NetBSD: GENERIC,v 1.595 2022/04/16 11:57:46 nia Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.594 $"
+#ident		"GENERIC-$Revision: 1.595 $"
 
 maxusers	64		# estimated number of users
 
@@ -250,7 +250,7 @@ options 	PCIVERBOSE	# verbose PCI device
 #options 	PCMCIAVERBOSE	# verbose PCMCIA configuration messages
 options 	SCSIVERBOSE	# human readable SCSI error messages
 #options 	USBVERBOSE	# verbose USB device autoconfig messages
-#options 	HDAUDIOVERBOSE	# verbose HDAUDIO driver messages
+options 	HDAUDIOVERBOSE	# human readable HDAUDIO device names
 
 options 	NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM
 

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1237 src/sys/arch/i386/conf/GENERIC:1.1238
--- src/sys/arch/i386/conf/GENERIC:1.1237	Mon May 17 04:07:43 2021
+++ src/sys/arch/i386/conf/GENERIC	Sat Apr 16 11:57:46 2022
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1237 2021/05/17 04:07:43 yamaguchi Exp $
+# $NetBSD: GENERIC,v 1.1238 2022/04/16 11:57:46 nia Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1237 $"
+#ident		"GENERIC-$Revision: 1.1238 $"
 
 maxusers	64		# estimated number of users
 
@@ -211,7 +211,7 @@ options 	SCSIVERBOSE	# human readable SC
 #options 	PNPBIOSVERBOSE	# verbose PnP BIOS messages
 #options 	PNPBIOSDEBUG	# more fulsome PnP BIOS debugging messages
 #options 	MCAVERBOSE	# verbose MCA device autoconfig messages
-#options 	HDAUDIOVERBOSE	# verbose HDAUDIO driver messages
+options 	HDAUDIOVERBOSE	# human readable HDAUDIO device names
 
 options 	NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM
 



CVS commit: src/sys/dev

2022-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr 16 11:13:10 UTC 2022

Modified Files:
src/sys/dev: sequencer.c

Log Message:
sequencer(4): VOP_CLOSE requires vnode lock.

Reported-by: syzbot+877c50d819fea9403...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/sequencer.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/sequencer.c
diff -u src/sys/dev/sequencer.c:1.78 src/sys/dev/sequencer.c:1.79
--- src/sys/dev/sequencer.c:1.78	Sat Apr 16 11:13:01 2022
+++ src/sys/dev/sequencer.c	Sat Apr 16 11:13:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sequencer.c,v 1.78 2022/04/16 11:13:01 riastradh Exp $	*/
+/*	$NetBSD: sequencer.c,v 1.79 2022/04/16 11:13:10 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.78 2022/04/16 11:13:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.79 2022/04/16 11:13:10 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "sequencer.h"
@@ -1466,7 +1466,9 @@ midiseq_open(int unit, int flags)
 	if ((mi.props & MIDI_PROP_CAN_INPUT) == 0)
 	flags &= ~FREAD;
 	if ((flags & (FREAD|FWRITE)) == 0) {
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 		VOP_CLOSE(vp, oflags, kauth_cred_get());
+		VOP_UNLOCK(vp);
 		vrele(vp);
 	return NULL;
 	}



CVS commit: src/sys/dev

2022-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr 16 11:13:10 UTC 2022

Modified Files:
src/sys/dev: sequencer.c

Log Message:
sequencer(4): VOP_CLOSE requires vnode lock.

Reported-by: syzbot+877c50d819fea9403...@syzkaller.appspotmail.com


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

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



CVS commit: src/sys/dev

2022-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr 16 11:13:01 UTC 2022

Modified Files:
src/sys/dev: sequencer.c

Log Message:
sequencer(4): Convert some #if DIAGNOSTIC to assertions.


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

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



CVS commit: src/sys/dev

2022-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr 16 11:13:01 UTC 2022

Modified Files:
src/sys/dev: sequencer.c

Log Message:
sequencer(4): Convert some #if DIAGNOSTIC to assertions.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/sequencer.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/sequencer.c
diff -u src/sys/dev/sequencer.c:1.77 src/sys/dev/sequencer.c:1.78
--- src/sys/dev/sequencer.c:1.77	Sat Apr 16 11:12:21 2022
+++ src/sys/dev/sequencer.c	Sat Apr 16 11:13:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sequencer.c,v 1.77 2022/04/16 11:12:21 riastradh Exp $	*/
+/*	$NetBSD: sequencer.c,v 1.78 2022/04/16 11:13:01 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.77 2022/04/16 11:12:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.78 2022/04/16 11:13:01 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "sequencer.h"
@@ -243,12 +243,10 @@ sequencerget(int unit)
 {
 	struct sequencer_softc *sc;
 
-	if (unit < 0) {
-#ifdef DIAGNOSTIC
-		panic("%s: unit %d!", __func__, unit);
-#endif
+	KASSERTMSG(unit >= 0, "unit=%d", unit);
+
+	if (unit < 0)
 		return NULL;
-	}
 
 	mutex_enter(_lock);
 	LIST_FOREACH(sc, , sc_link) {
@@ -1305,12 +1303,7 @@ seq_do_fullsize(struct sequencer_softc *
 	struct sysex_info sysex;
 	u_int dev;
 
-#ifdef DIAGNOSTIC
-	if (sizeof(seq_event_rec) != SEQ_SYSEX_HDRSIZE) {
-		printf("seq_do_fullsize: sysex size ??\n");
-		return EINVAL;
-	}
-#endif
+	CTASSERT(sizeof(seq_event_rec) == SEQ_SYSEX_HDRSIZE);
 	memcpy(, b, sizeof(*b));
 	dev = sysex.device_no;
 	if (/* dev < 0 || */ dev >= sc->nmidi)



CVS commit: src/sys/dev

2022-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr 16 11:12:21 UTC 2022

Modified Files:
src/sys/dev: sequencer.c

Log Message:
sequencer(4): Sprinkle KNF.

- Sort includes.
- Nix trailing whitespace.
- No parens for return.
- Blank line between declarations and statements.
- Note MP bug with unit allocation.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/sequencer.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/sequencer.c
diff -u src/sys/dev/sequencer.c:1.76 src/sys/dev/sequencer.c:1.77
--- src/sys/dev/sequencer.c:1.76	Thu Mar 31 19:30:15 2022
+++ src/sys/dev/sequencer.c	Sat Apr 16 11:12:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sequencer.c,v 1.76 2022/03/31 19:30:15 pgoyette Exp $	*/
+/*	$NetBSD: sequencer.c,v 1.77 2022/04/16 11:12:21 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.76 2022/03/31 19:30:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.77 2022/04/16 11:12:21 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "sequencer.h"
@@ -63,27 +63,29 @@ __KERNEL_RCSID(0, "$NetBSD: sequencer.c,
 #endif
 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+
+#include 
 #include 
-#include 
+#include 
 #include 
+#include 
 #include 
-#include 
-#include 
-#include 
+#include 
 #include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -149,7 +151,8 @@ static void seq_timer_waitabs(struct seq
 static int seq_do_timing(struct sequencer_softc *, seq_event_t *);
 static int seq_do_local(struct sequencer_softc *, seq_event_t *);
 static int seq_do_sysex(struct sequencer_softc *, seq_event_t *);
-static int seq_do_fullsize(struct sequencer_softc *, seq_event_t *, struct uio *);
+static int seq_do_fullsize(struct sequencer_softc *, seq_event_t *,
+struct uio *);
 static int seq_input_event(struct sequencer_softc *, seq_event_t *);
 static int seq_drain(struct sequencer_softc *);
 static void seq_startoutput(struct sequencer_softc *);
@@ -168,7 +171,8 @@ static int midiseq_pgmchange(struct midi
 static int midiseq_chnpressure(struct midi_dev *, int, seq_event_t *);
 static int midiseq_ctlchange(struct midi_dev *, int, seq_event_t *);
 static int midiseq_pitchbend(struct midi_dev *, int, seq_event_t *);
-static int midiseq_loadpatch(struct midi_dev *, struct sysex_info *, struct uio *);
+static int midiseq_loadpatch(struct midi_dev *, struct sysex_info *,
+struct uio *);
 void midiseq_in(struct midi_dev *, u_char *, int);
 
 static dev_type_open(sequenceropen);
@@ -193,12 +197,14 @@ const struct cdevsw sequencer_cdevsw = {
 	.d_discard = nodiscard,
 	.d_flag = D_OTHER | D_MPSAFE
 };
-static LIST_HEAD(, sequencer_softc) sequencers = LIST_HEAD_INITIALIZER(sequencers);
+static LIST_HEAD(, sequencer_softc) sequencers =
+LIST_HEAD_INITIALIZER(sequencers);
 static kmutex_t sequencer_lock;
 
 static void
 sequencerdestroy(struct sequencer_softc *sc)
 {
+
 	callout_halt(>sc_callout, >lock);
 	callout_destroy(>sc_callout);
 	softint_disestablish(sc->sih);
@@ -214,6 +220,7 @@ static struct sequencer_softc *
 sequencercreate(int unit)
 {
 	struct sequencer_softc *sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
+
 	sc->sc_unit = unit;
 	callout_init(>sc_callout, CALLOUT_MPSAFE);
 	sc->sih = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
@@ -235,12 +242,14 @@ static struct sequencer_softc *
 sequencerget(int unit)
 {
 	struct sequencer_softc *sc;
+
 	if (unit < 0) {
 #ifdef DIAGNOSTIC
 		panic("%s: unit %d!", __func__, unit);
 #endif
 		return NULL;
 	}
+
 	mutex_enter(_lock);
 	LIST_FOREACH(sc, , sc_link) {
 		if (sc->sc_unit == unit) {
@@ -249,18 +258,26 @@ sequencerget(int unit)
 		}
 	}
 	mutex_exit(_lock);
+
+	/*
+	 * XXXSMP -- nothing excludes another thread from creating the
+	 * same unit here
+	 */
 	if ((sc = sequencercreate(unit)) == NULL)
 		return NULL;
+
 	mutex_enter(_lock);
 	LIST_INSERT_HEAD(, sc, sc_link);
 	mutex_exit(_lock);
+
 	return sc;
 }
 
 #ifdef notyet
-static void 
+static void
 sequencerput(struct sequencer_softc *sc)
 {
+
 	mutex_enter(_lock);
 	LIST_REMOVE(sc, sc_link);
 	mutex_exit(_lock);
@@ -271,6 +288,7 @@ sequencerput(struct sequencer_softc *sc)
 void
 sequencerattach(int n)
 {
+
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
 }
 
@@ -297,6 +315,7 @@ sequencer_enter(dev_t dev, struct sequen
 	/* First, find the device and take sc_lock. */
 	if ((sc = sequencerget(SEQUENCERUNIT(dev))) == NULL)
 		return ENXIO;
+
 	mutex_enter(>lock);
 	while (sc->dvlock) {
 		cv_wait(>lchan, >lock);
@@ -400,7 +419,7 @@ seq_drain(struct sequencer_softc *sc)
 	error = 0;
 

CVS commit: src/sys/dev

2022-04-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr 16 11:12:21 UTC 2022

Modified Files:
src/sys/dev: sequencer.c

Log Message:
sequencer(4): Sprinkle KNF.

- Sort includes.
- Nix trailing whitespace.
- No parens for return.
- Blank line between declarations and statements.
- Note MP bug with unit allocation.

No functional change intended.


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

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



CVS commit: src/usr.bin/telnet

2022-04-16 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 16 09:53:13 UTC 2022

Modified Files:
src/usr.bin/telnet: telnet.1

Log Message:
telnet.1: update state of the art on Single DES encryption


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/telnet/telnet.1

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

Modified files:

Index: src/usr.bin/telnet/telnet.1
diff -u src/usr.bin/telnet/telnet.1:1.36 src/usr.bin/telnet/telnet.1:1.37
--- src/usr.bin/telnet/telnet.1:1.36	Sat Dec 15 22:17:02 2018
+++ src/usr.bin/telnet/telnet.1	Sat Apr 16 09:53:13 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: telnet.1,v 1.36 2018/12/15 22:17:02 wiz Exp $
+.\"	$NetBSD: telnet.1,v 1.37 2022/04/16 09:53:13 nia Exp $
 .\"
 .\" Copyright (c) 1983, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)telnet.1	8.4 (Berkeley) 2/3/94
 .\"
-.Dd December 16, 2018
+.Dd April 16, 2022
 .Dt TELNET 1
 .Os
 .Sh NAME
@@ -350,9 +350,12 @@ The encrypt command manipulates the info
 .Dv TELNET ENCRYPT
 option.
 .Pp
-Note:  Because of export controls, the
-.Dv TELNET ENCRYPT
-option is not supported outside of the United States and Canada.
+.Bf -symbolic
+Note:  By modern standards the encryption provided by
+.Nm
+is weak and insecure.
+.Ef
+This option is provided for compatibility.
 .Pp
 Valid arguments for the encrypt command are:
 .Bl -tag -width Ar
@@ -1152,9 +1155,12 @@ The autoencrypt
 output (input) stream should be enabled as soon as
 possible.
 .Pp
-Note:  Because of export controls, the
-.Dv TELNET ENCRYPT
-option is not supported outside the United States and Canada.
+.Bf -symbolic
+Note:  By modern standards the encryption provided by
+.Nm
+is weak and insecure.
+.Ef
+This option is provided for compatibility.
 .It Ic autologin
 If the remote side supports the
 .Dv TELNET AUTHENTICATION



CVS commit: src/usr.bin/telnet

2022-04-16 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 16 09:53:13 UTC 2022

Modified Files:
src/usr.bin/telnet: telnet.1

Log Message:
telnet.1: update state of the art on Single DES encryption


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/telnet/telnet.1

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



CVS commit: src

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 09:22:25 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: accept.sh decl_enum.c msg_054.c
msg_054.exp
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: in C99 mode, allow trailing comma in enum declarations

Adjust the test to be run in C90 mode instead of traditional mode, since
traditional C didn't have enums.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/accept.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/decl_enum.c
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_054.c \
src/tests/usr.bin/xlint/lint1/msg_054.exp
cvs rdiff -u -r1.394 -r1.395 src/usr.bin/xlint/lint1/cgram.y

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/accept.sh
diff -u src/tests/usr.bin/xlint/lint1/accept.sh:1.8 src/tests/usr.bin/xlint/lint1/accept.sh:1.9
--- src/tests/usr.bin/xlint/lint1/accept.sh:1.8	Thu Aug 26 19:23:25 2021
+++ src/tests/usr.bin/xlint/lint1/accept.sh	Sat Apr 16 09:22:25 2022
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: accept.sh,v 1.8 2021/08/26 19:23:25 rillig Exp $
+# $NetBSD: accept.sh,v 1.9 2022/04/16 09:22:25 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -33,7 +33,8 @@
 
 set -eu
 
-. './t_integration.sh'
+: "${archsubdir:=$(make -v ARCHSUBDIR)}"
+. './t_integration.sh'		# for configure_test_case
 
 for pattern in "$@"; do
 	# shellcheck disable=SC2231

Index: src/tests/usr.bin/xlint/lint1/decl_enum.c
diff -u src/tests/usr.bin/xlint/lint1/decl_enum.c:1.2 src/tests/usr.bin/xlint/lint1/decl_enum.c:1.3
--- src/tests/usr.bin/xlint/lint1/decl_enum.c:1.2	Fri Apr  8 21:29:29 2022
+++ src/tests/usr.bin/xlint/lint1/decl_enum.c	Sat Apr 16 09:22:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl_enum.c,v 1.2 2022/04/08 21:29:29 rillig Exp $	*/
+/*	$NetBSD: decl_enum.c,v 1.3 2022/04/16 09:22:25 rillig Exp $	*/
 # 3 "decl_enum.c"
 
 /*
@@ -58,3 +58,8 @@ typedef int reveal_o1[-o1];
 typedef int reveal_o2[-o2];
 /* expect+1: error: negative array dimension (-10002) [20] */
 typedef int reveal_o3[-o3];
+
+/* Since C99, a trailing comma is allowed in an enum declaration. */
+enum trailing_comma {
+	constant,
+};

Index: src/tests/usr.bin/xlint/lint1/msg_054.c
diff -u src/tests/usr.bin/xlint/lint1/msg_054.c:1.3 src/tests/usr.bin/xlint/lint1/msg_054.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_054.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_054.c	Sat Apr 16 09:22:25 2022
@@ -1,12 +1,13 @@
-/*	$NetBSD: msg_054.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_054.c,v 1.4 2022/04/16 09:22:25 rillig Exp $	*/
 # 3 "msg_054.c"
 
 /* Test for message: trailing ',' prohibited in enum declaration [54] */
 
-/* lint1-flags: -tw */
+/* lint1-flags: -sw */
 
 enum color {
 	RED,
 	GREEN,
 	BLUE,
-};/* expect: 54 */
+};
+/* expect-1: error: trailing ',' prohibited in enum declaration [54] */
Index: src/tests/usr.bin/xlint/lint1/msg_054.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_054.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_054.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_054.exp:1.3	Sun Mar 28 15:36:37 2021
+++ src/tests/usr.bin/xlint/lint1/msg_054.exp	Sat Apr 16 09:22:25 2022
@@ -1 +1 @@
-msg_054.c(12): warning: trailing ',' prohibited in enum declaration [54]
+msg_054.c(12): error: trailing ',' prohibited in enum declaration [54]

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.394 src/usr.bin/xlint/lint1/cgram.y:1.395
--- src/usr.bin/xlint/lint1/cgram.y:1.394	Sun Apr 10 12:14:10 2022
+++ src/usr.bin/xlint/lint1/cgram.y	Sat Apr 16 09:22:25 2022
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.394 2022/04/10 12:14:10 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.395 2022/04/16 09:22:25 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.394 2022/04/10 12:14:10 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.395 2022/04/16 09:22:25 rillig Exp $");
 #endif
 
 #include 
@@ -1047,6 +1047,7 @@ type_struct_declarator:
 	  }
 	;
 
+/* K ---, C90 6.5.2.2, C99 6.7.2.2, C11 6.7.2.2 */
 enum_specifier:			/* C99 6.7.2.2 */
 	  enum gcc_attribute_list_opt identifier_sym {
 		$$ = mktag($3, ENUM, false, false);
@@ -1090,7 +1091,9 @@ enum_decl_lbrace:		/* helper for C99 6.7
 enums_with_opt_comma:		/* helper for C99 6.7.2.2 */
 	  enumerator_list
 	| enumerator_list T_COMMA {
-		if (sflag) {
+		if (Sflag) {
+			/* C99 6.7.2.2p1 allows trailing ',' */
+		} else if (sflag) {
 			/* trailing ',' prohibited in enum declaration */
 			error(54);
 		} else {



CVS commit: src

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 09:22:25 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: accept.sh decl_enum.c msg_054.c
msg_054.exp
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: in C99 mode, allow trailing comma in enum declarations

Adjust the test to be run in C90 mode instead of traditional mode, since
traditional C didn't have enums.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/accept.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/decl_enum.c
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_054.c \
src/tests/usr.bin/xlint/lint1/msg_054.exp
cvs rdiff -u -r1.394 -r1.395 src/usr.bin/xlint/lint1/cgram.y

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



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 09:20:01 UTC 2022

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

Log Message:
tests/lint: refine test for varargs function


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_084.c \
src/tests/usr.bin/xlint/lint1/msg_084.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_084.c
diff -u src/tests/usr.bin/xlint/lint1/msg_084.c:1.3 src/tests/usr.bin/xlint/lint1/msg_084.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_084.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_084.c	Sat Apr 16 09:20:01 2022
@@ -1,12 +1,18 @@
-/*	$NetBSD: msg_084.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_084.c,v 1.4 2022/04/16 09:20:01 rillig Exp $	*/
 # 3 "msg_084.c"
 
-// Test for message: ANSI C requires formal parameter before '...' [84]
+/* Test for message: ANSI C requires formal parameter before '...' [84] */
 
-void only_ellipsis(...)		/* expect: 84 */
+/* lint1-flags: -sw */
+
+/* expect+2: error: ANSI C requires formal parameter before '...' [84] */
+void
+only_ellipsis(...)
 {
 }
 
-void ok_ellipsis(const char *fmt, ...)	/* expect: 231 */
+char
+ok_ellipsis(const char *fmt, ...)
 {
+	return fmt[0];
 }
Index: src/tests/usr.bin/xlint/lint1/msg_084.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_084.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_084.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_084.exp:1.3	Fri Apr  9 20:12:01 2021
+++ src/tests/usr.bin/xlint/lint1/msg_084.exp	Sat Apr 16 09:20:01 2022
@@ -1,2 +1 @@
-msg_084.c(6): warning: ANSI C requires formal parameter before '...' [84]
-msg_084.c(10): warning: argument 'fmt' unused in function 'ok_ellipsis' [231]
+msg_084.c(10): error: ANSI C requires formal parameter before '...' [84]



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 09:20:01 UTC 2022

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

Log Message:
tests/lint: refine test for varargs function


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

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



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 09:18:33 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: README.md

Log Message:
lint: extend README


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/xlint/lint1/README.md

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



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

2022-04-16 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Apr 16 09:18:33 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: README.md

Log Message:
lint: extend README


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/xlint/lint1/README.md

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/README.md
diff -u src/usr.bin/xlint/lint1/README.md:1.2 src/usr.bin/xlint/lint1/README.md:1.3
--- src/usr.bin/xlint/lint1/README.md:1.2	Wed Apr 13 22:58:18 2022
+++ src/usr.bin/xlint/lint1/README.md	Sat Apr 16 09:18:33 2022
@@ -1,8 +1,17 @@
-[//]: # ($NetBSD: README.md,v 1.2 2022/04/13 22:58:18 rillig Exp $)
+[//]: # ($NetBSD: README.md,v 1.3 2022/04/16 09:18:33 rillig Exp $)
 
 # Introduction
 
-To learn how a specific message is triggered, read the corresponding unit
+Lint1 analyzes a single translation unit of C code.
+
+* It reads the output of the C preprocessor, comments are retained.
+* The lexer in `scan.l` and `lex.c` splits the input into tokens.
+* The parser in `cgram.y` creates types and expressions from the tokens.
+* It checks declarations in `decl.c`.
+* It checks initializations in `init.c`.
+* It checks types and expressions in `tree.c`.
+
+To see how a specific lint message is triggered, read the corresponding unit
 test in `tests/usr.bin/xlint/lint1/msg_???.c`.
 
 # Features
@@ -16,7 +25,8 @@ see the test `msg_135.c` for examples.
 ## Control flow analysis
 
 Lint roughly tracks the control flow inside a single function.
-It doesn't follow `goto` statements though.
+It doesn't follow `goto` statements precisely though,
+it rather assumes that each label is reachable.
 See the test `msg_193.c` for examples.
 
 ## Error handling
@@ -24,6 +34,7 @@ See the test `msg_193.c` for examples.
 Lint tries to continue parsing and checking even after seeing errors.
 This part of lint is not robust though, so expect some crashes here,
 as variables may not be properly initialized or be null pointers.
+The cleanup after handling a parse error is often incomplete.
 
 # Fundamental types
 
@@ -33,15 +44,17 @@ Each node has a type (`type_t`) and a fe
 
 ## type_t
 
-The basic types are `int`, `_Bool`, `unsigned long`, and so on.
-A basic type is created by `gettyp(INT)`.
-Derived types are created by `block_derive_pointer`,
+The elementary types are `int`, `_Bool`, `unsigned long`, `pointer` and so on,
+as defined in `tspec_t`.
+
+Actual types like `int`, `const char *` are created by `gettyp(INT)`,
+or by deriving new types from existing types, using `block_derive_pointer`,
 `block_derive_array` and `block_derive_function`.
 (See [below](#memory-management) for the meaning of the prefix `block_`.)
 
 After a type has been created, it should not be modified anymore.
 Ideally all references to types would be `const`, but that's a lot of work.
-Until that is implemented, before modifying a type,
+Before modifying a type,
 it needs to be copied using `block_dup_type` or `expr_dup_type`.
 
 ## tnode_t
@@ -59,8 +72,11 @@ Some examples for operators:
 | UPLUS| the unary operator `+tn_left`   |
 | PLUS | the binary operator `tn_left + tn_right`|
 | CALL | a function call, typically CALL(LOAD(NAME("function"))) |
+| ICALL| an indirect function call   |
 | CVT  | an implicit conversion or an explicit cast  |
 
+See `debug_node` for how to interpret the members of `tnode_t`.
+
 ## sym_t
 
 There is a single symbol table (`symtab`) for the whole translation unit.
@@ -98,18 +114,20 @@ See `expr_free_all`.
 | stp  | `type_t`  | the subtype of a pointer, array or function  |
 | tn   | `tnode_t` | a tree node, mostly used for expressions |
 | op   | `op_t`| an operator used in an expression|
-| ln   | `tnode_t` | the left-hand side operand of a binary operator  |
-| rn   | `tnode_t` | the right-hand side operand of a binary operator |
+| ln   | `tnode_t` | the left-hand operand of a binary operator   |
+| rn   | `tnode_t` | the right-hand operand of a binary operator  |
 | sym  | `sym_t`   | a symbol from the symbol table   |
 
-# Abbreviations
+# Abbreviations in variable names
 
-| Abbr | Expanded |
-|--|--|
-| l| left |
-| r| right|
-| st   | subtype  |
-| op   | operator |
+| Abbr | Expanded|
+|--|-|
+| l| left|
+| r| right   |
+| o| old (during type conversions)   |
+| n| new (during type conversions)   |
+| op   | operator|
+| arg  | the number of the argument, for diagnostics |
 
 # Debugging
 
@@ -151,4 +169,7 @@ Most other tests focus 

CVS commit: src/sys/ufs/ffs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 08:00:55 UTC 2022

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
Unlock vnode for VOP_IOCTL() and wapbl_flush().


To generate a diff of this commit:
cvs rdiff -u -r1.375 -r1.376 src/sys/ufs/ffs/ffs_vfsops.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/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.375 src/sys/ufs/ffs/ffs_vfsops.c:1.376
--- src/sys/ufs/ffs/ffs_vfsops.c:1.375	Sat Mar 19 13:53:33 2022
+++ src/sys/ufs/ffs/ffs_vfsops.c	Sat Apr 16 08:00:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.375 2022/03/19 13:53:33 hannken Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.376 2022/04/16 08:00:55 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.375 2022/03/19 13:53:33 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.376 2022/04/16 08:00:55 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -2480,7 +2480,9 @@ ffs_vfs_fsync(vnode_t *vp, int flags)
 		 * contains no dirty buffers that could be in the log.
 		 */
 		if (!LIST_EMPTY(>v_dirtyblkhd)) {
+			VOP_UNLOCK(vp);
 			error = wapbl_flush(mp->mnt_wapbl, 0);
+			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 			if (error)
 return error;
 		}
@@ -2499,8 +2501,10 @@ ffs_vfs_fsync(vnode_t *vp, int flags)
 	error = vflushbuf(vp, flags);
 	if (error == 0 && (flags & FSYNC_CACHE) != 0) {
 		i = 1;
+		VOP_UNLOCK(vp);
 		(void)VOP_IOCTL(vp, DIOCCACHESYNC, , FWRITE,
 		kauth_cred_get());
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	}
 
 	return error;



CVS commit: src/sys/ufs/ffs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 08:00:55 UTC 2022

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
Unlock vnode for VOP_IOCTL() and wapbl_flush().


To generate a diff of this commit:
cvs rdiff -u -r1.375 -r1.376 src/sys/ufs/ffs/ffs_vfsops.c

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



CVS commit: src/sys/ufs/ffs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:59:46 UTC 2022

Modified Files:
src/sys/ufs/ffs: ffs_snapshot.c

Log Message:
Take the link count from the inode.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/ufs/ffs/ffs_snapshot.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/ufs/ffs/ffs_snapshot.c
diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.153 src/sys/ufs/ffs/ffs_snapshot.c:1.154
--- src/sys/ufs/ffs/ffs_snapshot.c:1.153	Sun Dec  5 07:51:26 2021
+++ src/sys/ufs/ffs/ffs_snapshot.c	Sat Apr 16 07:59:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_snapshot.c,v 1.153 2021/12/05 07:51:26 msaitoh Exp $	*/
+/*	$NetBSD: ffs_snapshot.c,v 1.154 2022/04/16 07:59:46 hannken Exp $	*/
 
 /*
  * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.153 2021/12/05 07:51:26 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.154 2022/04/16 07:59:46 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -613,7 +613,6 @@ snapshot_copyfs(struct mount *mp, struct
 
 struct snapshot_expunge_ctx {
 	struct vnode *logvp;
-	struct lwp *l;
 	struct vnode *vp;
 	struct fs *copy_fs;
 };
@@ -621,7 +620,6 @@ struct snapshot_expunge_ctx {
 static bool
 snapshot_expunge_selector(void *cl, struct vnode *xvp)
 {
-	struct vattr vat;
 	struct snapshot_expunge_ctx *c = cl;
 	struct inode *xp;
 
@@ -639,8 +637,7 @@ snapshot_expunge_selector(void *cl, stru
 	if (xvp == c->logvp)
 		return true;
 
-	if (VOP_GETATTR(xvp, , c->l->l_cred) == 0 &&
-	vat.va_nlink > 0)
+	if (xp->i_nlink > 0)
 		return false;
 
 	if (ffs_checkfreefile(c->copy_fs, c->vp, xp->i_number))
@@ -664,7 +661,6 @@ snapshot_expunge(struct mount *mp, struc
 	daddr_t blkno, *blkp;
 	struct fs *fs = VFSTOUFS(mp)->um_fs;
 	struct inode *xp;
-	struct lwp *l = curlwp;
 	struct vnode *logvp = NULL, *xvp;
 	struct vnode_iterator *marker;
 	struct snapshot_expunge_ctx ctx;
@@ -688,7 +684,6 @@ snapshot_expunge(struct mount *mp, struc
 
 	vfs_vnode_iterator_init(mp, );
 	ctx.logvp = logvp;
-	ctx.l = l;
 	ctx.vp = vp;
 	ctx.copy_fs = copy_fs;
 	while ((xvp = vfs_vnode_iterator_next(marker, snapshot_expunge_selector,



CVS commit: src/sys/ufs/ffs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:59:46 UTC 2022

Modified Files:
src/sys/ufs/ffs: ffs_snapshot.c

Log Message:
Take the link count from the inode.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/ufs/ffs/ffs_snapshot.c

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



CVS commit: src/sys/kern

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:59:02 UTC 2022

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

Log Message:
Lock vnode for VOP_PATHCONF().


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/kern/sys_descrip.c

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

Modified files:

Index: src/sys/kern/sys_descrip.c
diff -u src/sys/kern/sys_descrip.c:1.39 src/sys/kern/sys_descrip.c:1.40
--- src/sys/kern/sys_descrip.c:1.39	Tue Mar 15 10:37:42 2022
+++ src/sys/kern/sys_descrip.c	Sat Apr 16 07:59:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_descrip.c,v 1.39 2022/03/15 10:37:42 riastradh Exp $	*/
+/*	$NetBSD: sys_descrip.c,v 1.40 2022/04/16 07:59:02 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_descrip.c,v 1.39 2022/03/15 10:37:42 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_descrip.c,v 1.40 2022/04/16 07:59:02 hannken Exp $");
 
 #include 
 #include 
@@ -595,7 +595,9 @@ sys_fpathconf(struct lwp *l, const struc
 		break;
 
 	case DTYPE_VNODE:
+		vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY);
 		error = VOP_PATHCONF(fp->f_vnode, SCARG(uap, name), retval);
+		VOP_UNLOCK(fp->f_vnode);
 		break;
 
 	case DTYPE_KQUEUE:



CVS commit: src/sys/kern

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:59:02 UTC 2022

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

Log Message:
Lock vnode for VOP_PATHCONF().


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/kern/sys_descrip.c

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



CVS commit: src/sys/fs/msdosfs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:58:21 UTC 2022

Modified Files:
src/sys/fs/msdosfs: msdosfs_vfsops.c

Log Message:
Lock vnode for vinvalbuf().


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/fs/msdosfs/msdosfs_vfsops.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/msdosfs/msdosfs_vfsops.c
diff -u src/sys/fs/msdosfs/msdosfs_vfsops.c:1.137 src/sys/fs/msdosfs/msdosfs_vfsops.c:1.138
--- src/sys/fs/msdosfs/msdosfs_vfsops.c:1.137	Sat Oct 23 16:58:17 2021
+++ src/sys/fs/msdosfs/msdosfs_vfsops.c	Sat Apr 16 07:58:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vfsops.c,v 1.137 2021/10/23 16:58:17 thorpej Exp $	*/
+/*	$NetBSD: msdosfs_vfsops.c,v 1.138 2022/04/16 07:58:21 hannken Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.137 2021/10/23 16:58:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.138 2022/04/16 07:58:21 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -472,7 +472,10 @@ msdosfs_mountfs(struct vnode *devvp, str
 	u_long fatbytes, fatblocksecs;
 
 	/* Flush out any old buffers remaining from a previous use. */
-	if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0)) != 0)
+	vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
+	error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0);
+	VOP_UNLOCK(devvp);
+	if (error)
 		return (error);
 
 	ronly = (mp->mnt_flag & MNT_RDONLY) != 0;



CVS commit: src/sys/fs/msdosfs

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:58:21 UTC 2022

Modified Files:
src/sys/fs/msdosfs: msdosfs_vfsops.c

Log Message:
Lock vnode for vinvalbuf().


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/fs/msdosfs/msdosfs_vfsops.c

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



CVS commit: src/sys/dev/raidframe

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:57:33 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Unlock vnode for VOP_IOCTL().


To generate a diff of this commit:
cvs rdiff -u -r1.405 -r1.406 src/sys/dev/raidframe/rf_netbsdkintf.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/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.405 src/sys/dev/raidframe/rf_netbsdkintf.c:1.406
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.405	Mon Mar 28 13:07:14 2022
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sat Apr 16 07:57:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.405 2022/03/28 13:07:14 wiz Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.406 2022/04/16 07:57:33 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.405 2022/03/28 13:07:14 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.406 2022/04/16 07:57:33 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -2951,6 +2951,7 @@ rf_find_raid_components(void)
 
 			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 			error = VOP_OPEN(vp, FREAD | FSILENT, NOCRED);
+			VOP_UNLOCK(vp);
 
 			if (error) {
 /* "Who cares."  Continue looking
@@ -2970,6 +2971,7 @@ rf_find_raid_components(void)
 	printf("RAIDframe: can't get disk size"
 	" for dev %s (%d)\n",
 	device_xname(dv), error);
+vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 vput(vp);
 continue;
@@ -2981,18 +2983,19 @@ rf_find_raid_components(void)
 if (error) {
 	printf("RAIDframe: can't get wedge info for "
 	"dev %s (%d)\n", device_xname(dv), error);
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 	vput(vp);
 	continue;
 }
 
 if (strcmp(dkw.dkw_ptype, DKW_PTYPE_RAIDFRAME) != 0) {
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 	vput(vp);
 	continue;
 }
 
-VOP_UNLOCK(vp);
 ac_list = rf_get_component(ac_list, dev, vp,
 device_xname(dv), dkw.dkw_size, numsecs, secsize);
 rf_part_found = 1; /*There is a raid component on this disk*/
@@ -3013,6 +3016,7 @@ rf_find_raid_components(void)
 
 			/* don't need this any more.  We'll allocate it again
 			   a little later if we really do... */
+			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 			VOP_CLOSE(vp, FREAD | FWRITE, NOCRED);
 			vput(vp);
 



CVS commit: src/sys/dev/raidframe

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:57:33 UTC 2022

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Unlock vnode for VOP_IOCTL().


To generate a diff of this commit:
cvs rdiff -u -r1.405 -r1.406 src/sys/dev/raidframe/rf_netbsdkintf.c

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



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

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:56:45 UTC 2022

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

Log Message:
Unlock vnode for VOP_IOCTL().


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

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.19 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.20
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.19	Sat Nov 28 22:53:06 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c	Sat Apr 16 07:56:45 2022
@@ -132,9 +132,7 @@ vdev_disk_flush(struct work *work, void 
 	KASSERT(vp == dvd->vd_vp);
 
 	cmd = 1;
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	error = VOP_IOCTL(vp, DIOCCACHESYNC, , FREAD|FWRITE, kcred);
-	VOP_UNLOCK(vp, 0);
 	bp->b_error = error;
 	vdev_disk_io_intr(bp);
 }



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

2022-04-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Apr 16 07:56:45 UTC 2022

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

Log Message:
Unlock vnode for VOP_IOCTL().


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

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