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

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 22:59:49 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varname.exp varname.mk

Log Message:
make(1): document test for parsing of variable assignments


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varname.exp \
src/usr.bin/make/unit-tests/varname.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/varname.exp
diff -u src/usr.bin/make/unit-tests/varname.exp:1.7 src/usr.bin/make/unit-tests/varname.exp:1.8
--- src/usr.bin/make/unit-tests/varname.exp:1.7	Mon Nov  2 22:46:52 2020
+++ src/usr.bin/make/unit-tests/varname.exp	Mon Nov  2 22:59:48 2020
@@ -14,11 +14,9 @@ Var_Parse: ${:UVAR\(\(\(}=	try2 with VAR
 Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
 Result of ${:UVAR\(\(\(} is "VAR\(\(\(" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
 Global:.ALLTARGETS =  VAR(((=) VAR\(\(\(=
-make: "varname.mk" line 31: Need an operator
-Var_Parse: ${:UVAR\(\(\(}=	try3 with VARE_UNDEFERR|VARE_WANTRES
-Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
-Result of ${:UVAR\(\(\(} is "VAR\(\(\(" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
-make: "varname.mk" line 32: Need an operator
+make: "varname.mk" line 35: Need an operator
+Var_Parse: ${VARNAME} with VARE_WANTRES
+Global:VAR((( = try3
 Global:.MAKEFLAGS =  -r -k -d v -d
 Global:.MAKEFLAGS =  -r -k -d v -d 0
 make: Fatal errors encountered -- cannot continue
Index: src/usr.bin/make/unit-tests/varname.mk
diff -u src/usr.bin/make/unit-tests/varname.mk:1.7 src/usr.bin/make/unit-tests/varname.mk:1.8
--- src/usr.bin/make/unit-tests/varname.mk:1.7	Mon Nov  2 22:44:29 2020
+++ src/usr.bin/make/unit-tests/varname.mk	Mon Nov  2 22:59:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varname.mk,v 1.7 2020/11/02 22:44:29 rillig Exp $
+# $NetBSD: varname.mk,v 1.8 2020/11/02 22:59:48 rillig Exp $
 #
 # Tests for special variables, such as .MAKE or .PARSEDIR.
 # And for variable names in general.
@@ -28,8 +28,16 @@ ${VARNAME}=	3 open parentheses
 # balanced.  At the end of the line, there are still 3 levels open, which
 # means the variable name is not finished.
 ${:UVAR(((}=	try1
+# On the left-hand side of a variable assignments, the backslash is not parsed
+# as an escape character, therefore the parentheses still count to the nesting
+# level, which at the end of the line is still 3.  Therefore this is not a
+# variable assignment as well.
 ${:UVAR\(\(\(}=	try2
-${:UVAR\(\(\(}=	try3
+# To assign to a variable with an arbitrary name, the variable name has to
+# come from an external source, not the text that is parsed in the assignment
+# itself.  This is exactly the reason why further above, the indirect
+# ${VARNAME} works, while all other attempts fail.
+${VARNAME}=	try3
 
 .MAKEFLAGS: -d0
 



CVS commit: src/external/historical/nawk/dist

2020-11-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov  2 22:58:51 UTC 2020

Modified Files:
src/external/historical/nawk/dist: tran.c

Log Message:
>From wajap at github:
- eat whitespace in infnan checks
- set fval to 0 if we are not a floating point number


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/historical/nawk/dist/tran.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/historical/nawk/dist/tran.c
diff -u src/external/historical/nawk/dist/tran.c:1.14 src/external/historical/nawk/dist/tran.c:1.15
--- src/external/historical/nawk/dist/tran.c:1.14	Mon Aug 31 20:35:29 2020
+++ src/external/historical/nawk/dist/tran.c	Mon Nov  2 17:58:51 2020
@@ -399,11 +399,15 @@ static int checkstr(const char *s, const
 {
 	while (*s && tolower((unsigned char)*s) == *v)
 		s++, v++;
+	while (isspace((unsigned char)*s))
+		s++;
 	return !(*s || *v);
 }
 
 static int checkinfnan(const char *s)
 {
+	while (isspace((unsigned char)*s))
+		s++;
 	if (*s == '+' || *s == '-')
 		s++;
 	switch (tolower((unsigned char)*s)) {
@@ -427,6 +431,8 @@ Awkfloat getfval(Cell *vp)	/* get float 
 	if (!isnum(vp)) {	/* not a number */
 		if (checkinfnan(vp->sval))
 			vp->fval = atof(vp->sval);	/* best guess */
+		else
+			vp->fval = 0.0;
 		if (is_number(vp->sval) && !(vp->tval&CON)) {
 			vp->tval |= NUM;	/* make NUM only sparingly */
 		}



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 22:50:55 UTC 2020

Modified Files:
src/usr.bin/make: parse.c

Log Message:
make(1): fix undefined behavior in Parse_IsVar

Even though the pointer was out-of-bounds, a crash was unlikely in
practice, since typical C compilers don't check the pointers for invalid
values after each modification.  The memory it pointed to was not
accessed though.


To generate a diff of this commit:
cvs rdiff -u -r1.421 -r1.422 src/usr.bin/make/parse.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/make/parse.c
diff -u src/usr.bin/make/parse.c:1.421 src/usr.bin/make/parse.c:1.422
--- src/usr.bin/make/parse.c:1.421	Mon Nov  2 22:44:29 2020
+++ src/usr.bin/make/parse.c	Mon Nov  2 22:50:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.421 2020/11/02 22:44:29 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.422 2020/11/02 22:50:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.421 2020/11/02 22:44:29 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.422 2020/11/02 22:50:55 rillig Exp $");
 
 /* types and constants */
 
@@ -1832,7 +1832,6 @@ Parse_IsVar(const char *p, VarAssign *ou
 {
 VarAssignParsed pvar;
 const char *firstSpace = NULL;
-char ch;
 int level = 0;
 
 /* Skip to variable name */
@@ -1850,9 +1849,8 @@ Parse_IsVar(const char *p, VarAssign *ou
 #endif
 
 /* Scan for one of the assignment operators outside a variable expansion */
-/* FIXME: undefined behavior. In unit-tests/varname.mk:try1, at the end
- * of the loop, p already points to the next line. */
-while ((ch = *p++) != 0) {
+while (*p != '\0') {
+char ch = *p++;
 	if (ch == '(' || ch == '{') {
 	level++;
 	continue;



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

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 22:46:52 UTC 2020

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

Log Message:
make(1): fix line numbers in test output of varname.mk


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varname.exp

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

Modified files:

Index: src/usr.bin/make/unit-tests/varname.exp
diff -u src/usr.bin/make/unit-tests/varname.exp:1.6 src/usr.bin/make/unit-tests/varname.exp:1.7
--- src/usr.bin/make/unit-tests/varname.exp:1.6	Mon Nov  2 22:44:29 2020
+++ src/usr.bin/make/unit-tests/varname.exp	Mon Nov  2 22:46:52 2020
@@ -9,16 +9,16 @@ Applying ${:U...} to "" (VARE_UNDEFERR|V
 Result of ${:UVAR(((} is "VAR(((" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
 Global:.ALLTARGETS =  VAR(((=)
 No closing parenthesis in archive specification
-make: "varname.mk" line 29: Error in archive specification: "VAR"
+make: "varname.mk" line 30: Error in archive specification: "VAR"
 Var_Parse: ${:UVAR\(\(\(}=	try2 with VARE_UNDEFERR|VARE_WANTRES
 Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
 Result of ${:UVAR\(\(\(} is "VAR\(\(\(" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
 Global:.ALLTARGETS =  VAR(((=) VAR\(\(\(=
-make: "varname.mk" line 30: Need an operator
+make: "varname.mk" line 31: Need an operator
 Var_Parse: ${:UVAR\(\(\(}=	try3 with VARE_UNDEFERR|VARE_WANTRES
 Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
 Result of ${:UVAR\(\(\(} is "VAR\(\(\(" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
-make: "varname.mk" line 31: Need an operator
+make: "varname.mk" line 32: Need an operator
 Global:.MAKEFLAGS =  -r -k -d v -d
 Global:.MAKEFLAGS =  -r -k -d v -d 0
 make: Fatal errors encountered -- cannot continue



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 22:44:29 UTC 2020

Modified Files:
src/usr.bin/make: parse.c
src/usr.bin/make/unit-tests: varname.exp varname.mk

Log Message:
make(1): document undefined behavior in Parse_IsVar

Sigh.  If only C could be compiled in strict mode that detects these
out-of-bounds memory accesses.


To generate a diff of this commit:
cvs rdiff -u -r1.420 -r1.421 src/usr.bin/make/parse.c
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varname.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varname.mk

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

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.420 src/usr.bin/make/parse.c:1.421
--- src/usr.bin/make/parse.c:1.420	Sun Nov  1 00:24:57 2020
+++ src/usr.bin/make/parse.c	Mon Nov  2 22:44:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.420 2020/11/01 00:24:57 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.421 2020/11/02 22:44:29 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.420 2020/11/01 00:24:57 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.421 2020/11/02 22:44:29 rillig Exp $");
 
 /* types and constants */
 
@@ -1850,6 +1850,8 @@ Parse_IsVar(const char *p, VarAssign *ou
 #endif
 
 /* Scan for one of the assignment operators outside a variable expansion */
+/* FIXME: undefined behavior. In unit-tests/varname.mk:try1, at the end
+ * of the loop, p already points to the next line. */
 while ((ch = *p++) != 0) {
 	if (ch == '(' || ch == '{') {
 	level++;

Index: src/usr.bin/make/unit-tests/varname.exp
diff -u src/usr.bin/make/unit-tests/varname.exp:1.5 src/usr.bin/make/unit-tests/varname.exp:1.6
--- src/usr.bin/make/unit-tests/varname.exp:1.5	Mon Nov  2 22:29:48 2020
+++ src/usr.bin/make/unit-tests/varname.exp	Mon Nov  2 22:44:29 2020
@@ -9,16 +9,16 @@ Applying ${:U...} to "" (VARE_UNDEFERR|V
 Result of ${:UVAR(((} is "VAR(((" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
 Global:.ALLTARGETS =  VAR(((=)
 No closing parenthesis in archive specification
-make: "varname.mk" line 26: Error in archive specification: "VAR"
+make: "varname.mk" line 29: Error in archive specification: "VAR"
 Var_Parse: ${:UVAR\(\(\(}=	try2 with VARE_UNDEFERR|VARE_WANTRES
 Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
 Result of ${:UVAR\(\(\(} is "VAR\(\(\(" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
 Global:.ALLTARGETS =  VAR(((=) VAR\(\(\(=
-make: "varname.mk" line 27: Need an operator
+make: "varname.mk" line 30: Need an operator
 Var_Parse: ${:UVAR\(\(\(}=	try3 with VARE_UNDEFERR|VARE_WANTRES
 Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
 Result of ${:UVAR\(\(\(} is "VAR\(\(\(" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
-make: "varname.mk" line 28: Need an operator
+make: "varname.mk" line 31: Need an operator
 Global:.MAKEFLAGS =  -r -k -d v -d
 Global:.MAKEFLAGS =  -r -k -d v -d 0
 make: Fatal errors encountered -- cannot continue

Index: src/usr.bin/make/unit-tests/varname.mk
diff -u src/usr.bin/make/unit-tests/varname.mk:1.6 src/usr.bin/make/unit-tests/varname.mk:1.7
--- src/usr.bin/make/unit-tests/varname.mk:1.6	Mon Nov  2 22:29:48 2020
+++ src/usr.bin/make/unit-tests/varname.mk	Mon Nov  2 22:44:29 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varname.mk,v 1.6 2020/11/02 22:29:48 rillig Exp $
+# $NetBSD: varname.mk,v 1.7 2020/11/02 22:44:29 rillig Exp $
 #
 # Tests for special variables, such as .MAKE or .PARSEDIR.
 # And for variable names in general.
@@ -23,6 +23,10 @@ ${VARNAME}=	3 open parentheses
 
 # In the above test, the variable name is constructed indirectly.  Neither
 # of the following expressions produces the intended effect.
+#
+# This is not a variable assignment since the parentheses and braces are not
+# balanced.  At the end of the line, there are still 3 levels open, which
+# means the variable name is not finished.
 ${:UVAR(((}=	try1
 ${:UVAR\(\(\(}=	try2
 ${:UVAR\(\(\(}=	try3



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

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 22:29:48 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varname.exp varname.mk

Log Message:
make(1): fix test for parsing obscure variable names

I had forgotten the :U modifier.  Without that modifier, there's no
chance that the variable names would come out correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varname.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varname.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/varname.exp
diff -u src/usr.bin/make/unit-tests/varname.exp:1.4 src/usr.bin/make/unit-tests/varname.exp:1.5
--- src/usr.bin/make/unit-tests/varname.exp:1.4	Mon Nov  2 22:16:24 2020
+++ src/usr.bin/make/unit-tests/varname.exp	Mon Nov  2 22:29:48 2020
@@ -4,16 +4,21 @@ Global:VARNAME = VAR(((
 Var_Parse: ${VARNAME} with VARE_WANTRES
 Global:VAR((( = 3 open parentheses
 Var_Parse: ${VAR(((" != "3 open parentheses}}}" with VARE_WANTRES
-Var_Parse: ${VAR(((}=	try1 with VARE_UNDEFERR|VARE_WANTRES
-Global:.ALLTARGETS =  3
-Global:.ALLTARGETS =  3 open
-Global:.ALLTARGETS =  3 open parentheses=
+Var_Parse: ${:UVAR(((}=	try1 with VARE_UNDEFERR|VARE_WANTRES
+Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
+Result of ${:UVAR(((} is "VAR(((" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Global:.ALLTARGETS =  VAR(((=)
+No closing parenthesis in archive specification
+make: "varname.mk" line 26: Error in archive specification: "VAR"
+Var_Parse: ${:UVAR\(\(\(}=	try2 with VARE_UNDEFERR|VARE_WANTRES
+Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
+Result of ${:UVAR\(\(\(} is "VAR\(\(\(" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Global:.ALLTARGETS =  VAR(((=) VAR\(\(\(=
 make: "varname.mk" line 27: Need an operator
-Var_Parse: ${VAR\(\(\(}=	try2 with VARE_UNDEFERR|VARE_WANTRES
-Global:.ALLTARGETS =  3 open parentheses= =
+Var_Parse: ${:UVAR\(\(\(}=	try3 with VARE_UNDEFERR|VARE_WANTRES
+Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
+Result of ${:UVAR\(\(\(} is "VAR\(\(\(" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
 make: "varname.mk" line 28: Need an operator
-Var_Parse: ${VAR\(\(\(}=	try3 with VARE_UNDEFERR|VARE_WANTRES
-make: "varname.mk" line 29: Need an operator
 Global:.MAKEFLAGS =  -r -k -d v -d
 Global:.MAKEFLAGS =  -r -k -d v -d 0
 make: Fatal errors encountered -- cannot continue

Index: src/usr.bin/make/unit-tests/varname.mk
diff -u src/usr.bin/make/unit-tests/varname.mk:1.5 src/usr.bin/make/unit-tests/varname.mk:1.6
--- src/usr.bin/make/unit-tests/varname.mk:1.5	Mon Nov  2 22:16:24 2020
+++ src/usr.bin/make/unit-tests/varname.mk	Mon Nov  2 22:29:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varname.mk,v 1.5 2020/11/02 22:16:24 rillig Exp $
+# $NetBSD: varname.mk,v 1.6 2020/11/02 22:29:48 rillig Exp $
 #
 # Tests for special variables, such as .MAKE or .PARSEDIR.
 # And for variable names in general.
@@ -23,10 +23,9 @@ ${VARNAME}=	3 open parentheses
 
 # In the above test, the variable name is constructed indirectly.  Neither
 # of the following expressions produces the intended effect.
-# TODO: explain what happens in the parser here.
-${VAR(((}=	try1
-${VAR\(\(\(}=	try2
-${VAR\(\(\(}=	try3
+${:UVAR(((}=	try1
+${:UVAR\(\(\(}=	try2
+${:UVAR\(\(\(}=	try3
 
 .MAKEFLAGS: -d0
 



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

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 22:16:25 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varname.exp varname.mk

Log Message:
make(1): add tests for parsing ob obscure variable names


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varname.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varname.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/varname.exp
diff -u src/usr.bin/make/unit-tests/varname.exp:1.3 src/usr.bin/make/unit-tests/varname.exp:1.4
--- src/usr.bin/make/unit-tests/varname.exp:1.3	Sun Oct 18 08:47:54 2020
+++ src/usr.bin/make/unit-tests/varname.exp	Mon Nov  2 22:16:24 2020
@@ -1 +1,21 @@
-exit status 0
+Global:VAR{{{}}} = 3 braces
+Var_Parse: ${VAR{{{" != "3 braces" with VARE_WANTRES
+Global:VARNAME = VAR(((
+Var_Parse: ${VARNAME} with VARE_WANTRES
+Global:VAR((( = 3 open parentheses
+Var_Parse: ${VAR(((" != "3 open parentheses}}}" with VARE_WANTRES
+Var_Parse: ${VAR(((}=	try1 with VARE_UNDEFERR|VARE_WANTRES
+Global:.ALLTARGETS =  3
+Global:.ALLTARGETS =  3 open
+Global:.ALLTARGETS =  3 open parentheses=
+make: "varname.mk" line 27: Need an operator
+Var_Parse: ${VAR\(\(\(}=	try2 with VARE_UNDEFERR|VARE_WANTRES
+Global:.ALLTARGETS =  3 open parentheses= =
+make: "varname.mk" line 28: Need an operator
+Var_Parse: ${VAR\(\(\(}=	try3 with VARE_UNDEFERR|VARE_WANTRES
+make: "varname.mk" line 29: Need an operator
+Global:.MAKEFLAGS =  -r -k -d v -d
+Global:.MAKEFLAGS =  -r -k -d v -d 0
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1

Index: src/usr.bin/make/unit-tests/varname.mk
diff -u src/usr.bin/make/unit-tests/varname.mk:1.4 src/usr.bin/make/unit-tests/varname.mk:1.5
--- src/usr.bin/make/unit-tests/varname.mk:1.4	Sun Oct 18 08:47:54 2020
+++ src/usr.bin/make/unit-tests/varname.mk	Mon Nov  2 22:16:24 2020
@@ -1,8 +1,33 @@
-# $NetBSD: varname.mk,v 1.4 2020/10/18 08:47:54 rillig Exp $
+# $NetBSD: varname.mk,v 1.5 2020/11/02 22:16:24 rillig Exp $
 #
 # Tests for special variables, such as .MAKE or .PARSEDIR.
+# And for variable names in general.
 
-# TODO: Implementation
+.MAKEFLAGS: -dv
+
+# In variable names, braces are allowed, but they must be balanced.
+# Parentheses and braces may be mixed.
+VAR{{{}}}=	3 braces
+.if "${VAR{{{" != "3 braces"
+.  error
+.endif
+
+# In variable expressions, the parser works differently.  It doesn't treat
+# braces and parentheses equally, therefore the first closing brace already
+# marks the end of the variable name.
+VARNAME=	VAR(((
+${VARNAME}=	3 open parentheses
+.if "${VAR(((" != "3 open parentheses}}}"
+.  error
+.endif
+
+# In the above test, the variable name is constructed indirectly.  Neither
+# of the following expressions produces the intended effect.
+# TODO: explain what happens in the parser here.
+${VAR(((}=	try1
+${VAR\(\(\(}=	try2
+${VAR\(\(\(}=	try3
+
+.MAKEFLAGS: -d0
 
 all:
-	@:;



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

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 21:53:28 UTC 2020

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

Log Message:
make(1): remove obsolete POSTPROC.varname from unit tests

It was not needed anymore since 2020-10-18.


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

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

Modified files:

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.185 src/usr.bin/make/unit-tests/Makefile:1.186
--- src/usr.bin/make/unit-tests/Makefile:1.185	Mon Nov  2 20:43:27 2020
+++ src/usr.bin/make/unit-tests/Makefile	Mon Nov  2 21:53:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.185 2020/11/02 20:43:27 rillig Exp $
+# $NetBSD: Makefile,v 1.186 2020/11/02 21:53:28 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -439,7 +439,6 @@ SED_CMDS.varname-dot-shell+=	-e 's,\[/[^
 # Some tests need an additional round of postprocessing.
 POSTPROC.deptgt-suffixes= \
 			${TOOL_SED} -n -e '/^\#\*\*\* Suffixes/,/^\#\*/p'
-POSTPROC.varname=	${TOOL_SED} -n -e '/^MAGIC/p' -e '/^ORDER_/p'
 POSTPROC.varname-empty=	${TOOL_SED} -n -e '/^Var_Set/p' -e '/^out:/p'
 
 # Some tests reuse other tests, which makes them unnecessarily fragile.



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 21:34:40 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): fix error handling on parse errors in variable expressions

This change doesn't change any of the unit tests since the error
handling code is not yet complete, see the many "handle errors" in the
code.  Nevertheless, the "out_FALSE_res = VPR_PARSE_MSG" was wrong since
the error message was only printed in lint mode, not in default mode.


To generate a diff of this commit:
cvs rdiff -u -r1.651 -r1.652 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.651 src/usr.bin/make/var.c:1.652
--- src/usr.bin/make/var.c:1.651	Mon Nov  2 21:24:23 2020
+++ src/usr.bin/make/var.c	Mon Nov  2 21:34:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.651 2020/11/02 21:24:23 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.652 2020/11/02 21:34:40 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.651 2020/11/02 21:24:23 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.652 2020/11/02 21:34:40 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3544,7 +3544,7 @@ ParseVarname(const char **pp, char start
 return Buf_Destroy(&buf, FALSE);
 }
 
-static Boolean
+static VarParseResult
 ValidShortVarname(char varname, const char *start)
 {
 switch (varname) {
@@ -3555,11 +3555,11 @@ ValidShortVarname(char varname, const ch
 case '$':
 	break;			/* and continue below */
 default:
-	return TRUE;
+	return VPR_OK;
 }
 
 if (!DEBUG(LINT))
-	return FALSE;
+	return VPR_PARSE_SILENT;
 
 if (varname == '$')
 	Parse_Error(PARSE_FATAL,
@@ -3570,7 +3570,7 @@ ValidShortVarname(char varname, const ch
 	Parse_Error(PARSE_FATAL,
 		"Invalid variable name '%c', at \"%s\"", varname, start);
 
-return FALSE;
+return VPR_PARSE_MSG;
 }
 
 /* Parse a single-character variable name such as $V or $@.
@@ -3587,6 +3587,7 @@ ParseVarnameShort(
 ) {
 char name[2];
 Var *v;
+VarParseResult vpr;
 
 /*
  * If it's not bounded by braces of some sort, life is much simpler.
@@ -3594,10 +3595,11 @@ ParseVarnameShort(
  * value if it exists.
  */
 
-if (!ValidShortVarname(startc, *pp)) {
+vpr = ValidShortVarname(startc, *pp);
+if (vpr != VPR_OK) {
 	(*pp)++;
 	*out_FALSE_val = var_Error;
-	*out_FALSE_res = VPR_PARSE_MSG;
+	*out_FALSE_res = vpr;
 	return FALSE;
 }
 



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 21:24:23 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): improve local variable name in ParseVarname


To generate a diff of this commit:
cvs rdiff -u -r1.650 -r1.651 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.650 src/usr.bin/make/var.c:1.651
--- src/usr.bin/make/var.c:1.650	Mon Nov  2 21:15:00 2020
+++ src/usr.bin/make/var.c	Mon Nov  2 21:24:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.650 2020/11/02 21:15:00 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.651 2020/11/02 21:24:23 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.650 2020/11/02 21:15:00 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.651 2020/11/02 21:24:23 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3437,6 +3437,7 @@ out:
 return st.val;
 
 bad_modifier:
+/* XXX: The modifier end is only guessed. */
 Error("Bad modifier `:%.*s' for %s",
 	  (int)strcspn(mod, ":)}"), mod, st.v->name);
 
@@ -3527,12 +3528,12 @@ ParseVarname(const char **pp, char start
 
 	/* A variable inside a variable, expand. */
 	if (*p == '$') {
-	void *freeIt;
-	const char *rval;
-	(void)Var_Parse(&p, ctxt, eflags, &rval, &freeIt);
+	const char *nested_val;
+	void *nested_val_freeIt;
+	(void)Var_Parse(&p, ctxt, eflags, &nested_val, &nested_val_freeIt);
 	/* TODO: handle errors */
-	Buf_AddStr(&buf, rval);
-	free(freeIt);
+	Buf_AddStr(&buf, nested_val);
+	free(nested_val_freeIt);
 	} else {
 	Buf_AddByte(&buf, *p);
 	p++;



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 21:15:00 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): document that skipping a modifier on parse errors is risky


To generate a diff of this commit:
cvs rdiff -u -r1.649 -r1.650 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.649 src/usr.bin/make/var.c:1.650
--- src/usr.bin/make/var.c:1.649	Mon Nov  2 20:48:36 2020
+++ src/usr.bin/make/var.c	Mon Nov  2 21:15:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.649 2020/11/02 20:48:36 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.650 2020/11/02 21:15:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.649 2020/11/02 20:48:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.650 2020/11/02 21:15:00 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3391,6 +3391,9 @@ ApplyModifiers(
 
 	if (res == AMR_UNKNOWN) {
 	Error("Unknown modifier '%c'", *mod);
+	/* Guess the end of the current modifier.
+	 * XXX: Skipping the rest of the modifier hides errors and leads
+	 * to wrong results.  Parsing should rather stop here. */
 	for (p++; *p != ':' && *p != st.endc && *p != '\0'; p++)
 		continue;
 	st.newVal = var_Error;



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 20:50:24 UTC 2020

Modified Files:
src/usr.bin/make: compat.c

Log Message:
make(1): clean up CompatDeleteTarget and CompatInterrupt


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/usr.bin/make/compat.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/make/compat.c
diff -u src/usr.bin/make/compat.c:1.173 src/usr.bin/make/compat.c:1.174
--- src/usr.bin/make/compat.c:1.173	Sun Nov  1 17:47:26 2020
+++ src/usr.bin/make/compat.c	Mon Nov  2 20:50:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.173 2020/11/01 17:47:26 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.174 2020/11/02 20:50:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,15 +96,15 @@
 #include "pathnames.h"
 
 /*	"@(#)compat.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: compat.c,v 1.173 2020/11/01 17:47:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.174 2020/11/02 20:50:24 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
 static int compatSigno;
 
 /*
- * CompatDeleteTarget -- delete a failed, interrupted, or otherwise
- * duffed target if not inhibited by .PRECIOUS.
+ * CompatDeleteTarget -- delete the file of a failed, interrupted, or
+ * otherwise duffed target if not inhibited by .PRECIOUS.
  */
 static void
 CompatDeleteTarget(GNode *gn)
@@ -129,8 +129,6 @@ CompatDeleteTarget(GNode *gn)
 static void
 CompatInterrupt(int signo)
 {
-GNode   *gn;
-
 CompatDeleteTarget(curTarg);
 
 if (curTarg != NULL && !Targ_Precious(curTarg)) {
@@ -138,7 +136,7 @@ CompatInterrupt(int signo)
 	 * Run .INTERRUPT only if hit with interrupt signal
 	 */
 	if (signo == SIGINT) {
-	gn = Targ_FindNode(".INTERRUPT");
+	GNode *gn = Targ_FindNode(".INTERRUPT");
 	if (gn != NULL) {
 		Compat_Make(gn, gn);
 	}



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 20:48:36 UTC 2020

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: cmd-errors-lint.exp cmd-errors.exp

Log Message:
make(1): error out on unclosed expressions after the colon


To generate a diff of this commit:
cvs rdiff -u -r1.648 -r1.649 src/usr.bin/make/var.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cmd-errors-lint.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cmd-errors.exp

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

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.648 src/usr.bin/make/var.c:1.649
--- src/usr.bin/make/var.c:1.648	Mon Nov  2 19:07:09 2020
+++ src/usr.bin/make/var.c	Mon Nov  2 20:48:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.648 2020/11/02 19:07:09 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.649 2020/11/02 20:48:36 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.648 2020/11/02 19:07:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.649 2020/11/02 20:48:36 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3357,6 +3357,13 @@ ApplyModifiers(
 assert(val != NULL);
 
 p = *pp;
+
+if (*p == '\0' && endc != '\0') {
+	Error("Unclosed variable expression (expecting '%c') for \"%s\"",
+	  st.endc, st.v->name);
+	goto cleanup;
+}
+
 while (*p != '\0' && *p != endc) {
 
 	if (*p == '$') {

Index: src/usr.bin/make/unit-tests/cmd-errors-lint.exp
diff -u src/usr.bin/make/unit-tests/cmd-errors-lint.exp:1.1 src/usr.bin/make/unit-tests/cmd-errors-lint.exp:1.2
--- src/usr.bin/make/unit-tests/cmd-errors-lint.exp:1.1	Mon Nov  2 20:43:27 2020
+++ src/usr.bin/make/unit-tests/cmd-errors-lint.exp	Mon Nov  2 20:48:36 2020
@@ -1,6 +1,7 @@
 : undefined 
 make: Unclosed variable "UNCLOSED"
 : unclosed-variable 
+make: Unclosed variable expression (expecting '}') for "UNCLOSED"
 : unclosed-modifier 
 make: Unknown modifier 'Z'
 : unknown-modifier 

Index: src/usr.bin/make/unit-tests/cmd-errors.exp
diff -u src/usr.bin/make/unit-tests/cmd-errors.exp:1.2 src/usr.bin/make/unit-tests/cmd-errors.exp:1.3
--- src/usr.bin/make/unit-tests/cmd-errors.exp:1.2	Mon Nov  2 20:37:50 2020
+++ src/usr.bin/make/unit-tests/cmd-errors.exp	Mon Nov  2 20:48:36 2020
@@ -1,6 +1,7 @@
 : undefined 
 make: Unclosed variable "UNCLOSED"
 : unclosed-variable 
+make: Unclosed variable expression (expecting '}') for "UNCLOSED"
 : unclosed-modifier 
 make: Unknown modifier 'Z'
 : unknown-modifier 



CVS commit: src

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 20:43:27 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: cmd-errors-lint.exp cmd-errors-lint.mk

Log Message:
make(1): add test for parse errors in commands in lint mode (-dL)

The difference to non-lint mode is that the exit status is now 2 instead
of 0.


To generate a diff of this commit:
cvs rdiff -u -r1.958 -r1.959 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.184 -r1.185 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/cmd-errors-lint.exp \
src/usr.bin/make/unit-tests/cmd-errors-lint.mk

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.958 src/distrib/sets/lists/tests/mi:1.959
--- src/distrib/sets/lists/tests/mi:1.958	Mon Nov  2 20:20:42 2020
+++ src/distrib/sets/lists/tests/mi	Mon Nov  2 20:43:27 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.958 2020/11/02 20:20:42 rillig Exp $
+# $NetBSD: mi,v 1.959 2020/11/02 20:43:27 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4813,6 +4813,8 @@
 ./usr/tests/usr.bin/make/unit-tests/archive-suffix.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/archive.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/archive.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cmd-errors-lint.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cmd-errors-lint.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cmd-errors.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cmd-errors.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cmd-interrupt.exptests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.184 src/usr.bin/make/unit-tests/Makefile:1.185
--- src/usr.bin/make/unit-tests/Makefile:1.184	Mon Nov  2 20:40:10 2020
+++ src/usr.bin/make/unit-tests/Makefile	Mon Nov  2 20:43:27 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.184 2020/11/02 20:40:10 rillig Exp $
+# $NetBSD: Makefile,v 1.185 2020/11/02 20:43:27 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -38,6 +38,7 @@
 TESTS+=		archive
 TESTS+=		archive-suffix
 TESTS+=		cmd-errors
+TESTS+=		cmd-errors-lint
 TESTS+=		cmd-interrupt
 TESTS+=		cmdline
 TESTS+=		comment

Added files:

Index: src/usr.bin/make/unit-tests/cmd-errors-lint.exp
diff -u /dev/null src/usr.bin/make/unit-tests/cmd-errors-lint.exp:1.1
--- /dev/null	Mon Nov  2 20:43:27 2020
+++ src/usr.bin/make/unit-tests/cmd-errors-lint.exp	Mon Nov  2 20:43:27 2020
@@ -0,0 +1,8 @@
+: undefined 
+make: Unclosed variable "UNCLOSED"
+: unclosed-variable 
+: unclosed-modifier 
+make: Unknown modifier 'Z'
+: unknown-modifier 
+: end
+exit status 2
Index: src/usr.bin/make/unit-tests/cmd-errors-lint.mk
diff -u /dev/null src/usr.bin/make/unit-tests/cmd-errors-lint.mk:1.1
--- /dev/null	Mon Nov  2 20:43:27 2020
+++ src/usr.bin/make/unit-tests/cmd-errors-lint.mk	Mon Nov  2 20:43:27 2020
@@ -0,0 +1,32 @@
+# $NetBSD: cmd-errors-lint.mk,v 1.1 2020/11/02 20:43:27 rillig Exp $
+#
+# Demonstrate how errors in variable expansions affect whether the commands
+# are actually executed.
+
+.MAKEFLAGS: -dL
+
+all: undefined unclosed-variable unclosed-modifier unknown-modifier end
+
+# Undefined variables are not an error.  They expand to empty strings.
+undefined:
+	: $@ ${UNDEFINED}
+
+# XXX: As of 2020-11-01, this obvious syntax error is not detected.
+# XXX: As of 2020-11-01, this command is executed even though it contains
+# parse errors.
+unclosed-variable:
+	: $@ ${UNCLOSED
+
+# XXX: As of 2020-11-01, this obvious syntax error is not detected.
+# XXX: As of 2020-11-01, this command is executed even though it contains
+# parse errors.
+unclosed-modifier:
+	: $@ ${UNCLOSED:
+
+# XXX: As of 2020-11-01, this command is executed even though it contains
+# parse errors.
+unknown-modifier:
+	: $@ ${UNKNOWN:Z}
+
+end:
+	: $@



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

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 20:40:10 UTC 2020

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

Log Message:
make(1): remove debugging code from sync-mi


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

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

Modified files:

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.183 src/usr.bin/make/unit-tests/Makefile:1.184
--- src/usr.bin/make/unit-tests/Makefile:1.183	Mon Nov  2 20:20:42 2020
+++ src/usr.bin/make/unit-tests/Makefile	Mon Nov  2 20:40:10 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.183 2020/11/02 20:20:42 rillig Exp $
+# $NetBSD: Makefile,v 1.184 2020/11/02 20:40:10 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -548,7 +548,6 @@ sync-mi:
 	cat "$$mi" > "$$mi.tmp";	\
 	(cd "$$testsdir" && ls *.exp *.mk) | xargs printf "$$fmt" >> "$$mi.tmp"; \
 	distrib/sets/fmt-list "$$mi.tmp";\
-	echo $$?; \
 	mv "$$mi.tmp" "$$mi";		\
 	cvs diff "$$mi" || true
 



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

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 20:37:50 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: cmd-errors.exp cmd-errors.mk

Log Message:
make(1): add test for unclosed variable after a colon


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cmd-errors.exp \
src/usr.bin/make/unit-tests/cmd-errors.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/cmd-errors.exp
diff -u src/usr.bin/make/unit-tests/cmd-errors.exp:1.1 src/usr.bin/make/unit-tests/cmd-errors.exp:1.2
--- src/usr.bin/make/unit-tests/cmd-errors.exp:1.1	Mon Nov  2 20:20:42 2020
+++ src/usr.bin/make/unit-tests/cmd-errors.exp	Mon Nov  2 20:37:50 2020
@@ -1,5 +1,7 @@
 : undefined 
-: unclosed 
+make: Unclosed variable "UNCLOSED"
+: unclosed-variable 
+: unclosed-modifier 
 make: Unknown modifier 'Z'
 : unknown-modifier 
 : end
Index: src/usr.bin/make/unit-tests/cmd-errors.mk
diff -u src/usr.bin/make/unit-tests/cmd-errors.mk:1.1 src/usr.bin/make/unit-tests/cmd-errors.mk:1.2
--- src/usr.bin/make/unit-tests/cmd-errors.mk:1.1	Mon Nov  2 20:20:42 2020
+++ src/usr.bin/make/unit-tests/cmd-errors.mk	Mon Nov  2 20:37:50 2020
@@ -1,9 +1,9 @@
-# $NetBSD: cmd-errors.mk,v 1.1 2020/11/02 20:20:42 rillig Exp $
+# $NetBSD: cmd-errors.mk,v 1.2 2020/11/02 20:37:50 rillig Exp $
 #
 # Demonstrate how errors in variable expansions affect whether the commands
 # are actually executed.
 
-all: undefined unclosed unknown-modifier end
+all: undefined unclosed-variable unclosed-modifier unknown-modifier end
 
 # Undefined variables are not an error.  They expand to empty strings.
 undefined:
@@ -12,7 +12,13 @@ undefined:
 # XXX: As of 2020-11-01, this obvious syntax error is not detected.
 # XXX: As of 2020-11-01, this command is executed even though it contains
 # parse errors.
-unclosed:
+unclosed-variable:
+	: $@ ${UNCLOSED
+
+# XXX: As of 2020-11-01, this obvious syntax error is not detected.
+# XXX: As of 2020-11-01, this command is executed even though it contains
+# parse errors.
+unclosed-modifier:
 	: $@ ${UNCLOSED:
 
 # XXX: As of 2020-11-01, this command is executed even though it contains
@@ -22,3 +28,5 @@ unknown-modifier:
 
 end:
 	: $@
+
+# XXX: As of 2020-11-02, despite the parse errors, the exit status is 0.



CVS commit: src

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 20:20:43 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: cmd-errors.exp cmd-errors.mk

Log Message:
make(1): add test for parse errors in shell commands, compat mode


To generate a diff of this commit:
cvs rdiff -u -r1.957 -r1.958 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.182 -r1.183 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/cmd-errors.exp \
src/usr.bin/make/unit-tests/cmd-errors.mk

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.957 src/distrib/sets/lists/tests/mi:1.958
--- src/distrib/sets/lists/tests/mi:1.957	Mon Nov  2 20:16:26 2020
+++ src/distrib/sets/lists/tests/mi	Mon Nov  2 20:20:42 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.957 2020/11/02 20:16:26 rillig Exp $
+# $NetBSD: mi,v 1.958 2020/11/02 20:20:42 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4813,6 +4813,8 @@
 ./usr/tests/usr.bin/make/unit-tests/archive-suffix.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/archive.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/archive.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cmd-errors.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cmd-errors.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cmd-interrupt.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cmd-interrupt.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cmdline.exp	tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.182 src/usr.bin/make/unit-tests/Makefile:1.183
--- src/usr.bin/make/unit-tests/Makefile:1.182	Mon Nov  2 20:19:33 2020
+++ src/usr.bin/make/unit-tests/Makefile	Mon Nov  2 20:20:42 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.182 2020/11/02 20:19:33 rillig Exp $
+# $NetBSD: Makefile,v 1.183 2020/11/02 20:20:42 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -37,6 +37,7 @@
 # src/tests/usr.bin/make/t_make.sh as well.
 TESTS+=		archive
 TESTS+=		archive-suffix
+TESTS+=		cmd-errors
 TESTS+=		cmd-interrupt
 TESTS+=		cmdline
 TESTS+=		comment

Added files:

Index: src/usr.bin/make/unit-tests/cmd-errors.exp
diff -u /dev/null src/usr.bin/make/unit-tests/cmd-errors.exp:1.1
--- /dev/null	Mon Nov  2 20:20:43 2020
+++ src/usr.bin/make/unit-tests/cmd-errors.exp	Mon Nov  2 20:20:42 2020
@@ -0,0 +1,6 @@
+: undefined 
+: unclosed 
+make: Unknown modifier 'Z'
+: unknown-modifier 
+: end
+exit status 0
Index: src/usr.bin/make/unit-tests/cmd-errors.mk
diff -u /dev/null src/usr.bin/make/unit-tests/cmd-errors.mk:1.1
--- /dev/null	Mon Nov  2 20:20:43 2020
+++ src/usr.bin/make/unit-tests/cmd-errors.mk	Mon Nov  2 20:20:42 2020
@@ -0,0 +1,24 @@
+# $NetBSD: cmd-errors.mk,v 1.1 2020/11/02 20:20:42 rillig Exp $
+#
+# Demonstrate how errors in variable expansions affect whether the commands
+# are actually executed.
+
+all: undefined unclosed unknown-modifier end
+
+# Undefined variables are not an error.  They expand to empty strings.
+undefined:
+	: $@ ${UNDEFINED}
+
+# XXX: As of 2020-11-01, this obvious syntax error is not detected.
+# XXX: As of 2020-11-01, this command is executed even though it contains
+# parse errors.
+unclosed:
+	: $@ ${UNCLOSED:
+
+# XXX: As of 2020-11-01, this command is executed even though it contains
+# parse errors.
+unknown-modifier:
+	: $@ ${UNKNOWN:Z}
+
+end:
+	: $@



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

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 20:19:33 UTC 2020

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

Log Message:
make(1): handle errors when sync-mi fails because of a syntax error


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

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

Modified files:

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.181 src/usr.bin/make/unit-tests/Makefile:1.182
--- src/usr.bin/make/unit-tests/Makefile:1.181	Sun Nov  1 19:02:22 2020
+++ src/usr.bin/make/unit-tests/Makefile	Mon Nov  2 20:19:33 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.181 2020/11/01 19:02:22 rillig Exp $
+# $NetBSD: Makefile,v 1.182 2020/11/02 20:19:33 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -544,8 +544,11 @@ sync-mi:
 	cvs update "$$mi";		\
 	testsdir="usr.bin/make/unit-tests";\
 	fmt="./usr/tests/$$testsdir/%s\ttests-usr.bin-tests\tcompattestfile,atf\\n"; \
-	(cd "$$testsdir" && ls *.exp *.mk) | xargs printf "$$fmt" >> "$$mi"; \
-	distrib/sets/fmt-list "$$mi";	\
+	cat "$$mi" > "$$mi.tmp";	\
+	(cd "$$testsdir" && ls *.exp *.mk) | xargs printf "$$fmt" >> "$$mi.tmp"; \
+	distrib/sets/fmt-list "$$mi.tmp";\
+	echo $$?; \
+	mv "$$mi.tmp" "$$mi";		\
 	cvs diff "$$mi" || true
 
 .if exists(${TEST_MAKE})



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

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 20:16:26 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
remove extraneous tab, sort entries alphabetically (by fmt-list)


To generate a diff of this commit:
cvs rdiff -u -r1.956 -r1.957 src/distrib/sets/lists/tests/mi

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.956 src/distrib/sets/lists/tests/mi:1.957
--- src/distrib/sets/lists/tests/mi:1.956	Mon Nov  2 00:29:49 2020
+++ src/distrib/sets/lists/tests/mi	Mon Nov  2 20:16:26 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.956 2020/11/02 00:29:49 mrg Exp $
+# $NetBSD: mi,v 1.957 2020/11/02 20:16:26 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4552,6 +4552,17 @@
 ./usr/tests/usr.bin/cmp/Atffiletests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cmp/Kyuafile			tests-usr.bin-tests	compattestfile,atf,kyua
 ./usr/tests/usr.bin/cmp/t_cmptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/col		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/col/Atffile	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/col/hlf.in	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/col/hlf2.in	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/col/nl.in	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/col/nl2.in	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/col/nl3.in	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/col/rlf.in	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/col/rlf2.in	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/col/rlf3.in	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/col/t_col	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/configtests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/config/Atffile			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/config/Kyuafile			tests-usr.bin-tests	compattestfile,atf,kyua
@@ -4578,19 +4589,7 @@
 ./usr/tests/usr.bin/config/support/conf			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/config/support/conf/Makefile.kern.inc	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/config/support/conf/files			tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/config/t_confi	g			tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/col		tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/col/Atffile	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/col/hlf.in	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/col/hlf2.in	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/col/nl.in	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/col/nl2.in	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/col/nl3.in	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/col/rlf.in	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/col/rlf2.in	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/col/rlf3.in	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/col/t_col	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/config/t_configtests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/config/t_config			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cpio	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cpio/Atffiletests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/cpio/Kyuafiletests-usr.bin-tests	compattestfile,atf,kyua



CVS commit: src/distrib/sets

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 20:14:02 UTC 2020

Modified Files:
src/distrib/sets: fmt-list

Log Message:
when formatting a file list, exit on errors

This is needed to regenerate distrib/sets/lists/tests/mi for adding
another test in usr.bin/make.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/sets/fmt-list

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

Modified files:

Index: src/distrib/sets/fmt-list
diff -u src/distrib/sets/fmt-list:1.2 src/distrib/sets/fmt-list:1.3
--- src/distrib/sets/fmt-list:1.2	Tue Sep  8 19:11:30 2020
+++ src/distrib/sets/fmt-list	Mon Nov  2 20:14:01 2020
@@ -1,5 +1,5 @@
 #! /usr/bin/lua
--- $NetBSD: fmt-list,v 1.2 2020/09/08 19:11:30 rillig Exp $
+-- $NetBSD: fmt-list,v 1.3 2020/11/02 20:14:01 rillig Exp $
 
 --[[
 
@@ -411,7 +411,7 @@ local function format_list(fname, write_
 for _, err in ipairs(errors) do
   print(err)
 end
-return
+return false
   end
 
   normalize(entries)
@@ -419,18 +419,23 @@ local function format_list(fname, write_
   if write_back then
 write_list(fname, head, entries)
   end
+  return true
 end
 
 
 local function main(arg)
+  local seen_error = false
   local write_back = true
   for _, fname in ipairs(arg) do
 if fname == "-n" then
   write_back = false
 else
-  format_list(fname, write_back)
+  if not format_list(fname, write_back) then
+seen_error = true
+  end
 end
   end
+  return not seen_error
 end
 
-main(arg)
+os.exit(main(arg))



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 19:07:10 UTC 2020

Modified Files:
src/usr.bin/make: arch.c cond.c var.c
src/usr.bin/make/unit-tests: include-sub.mk

Log Message:
make(1): remove word "Ptr" from variable names

Whether or not a variable is a pointer is obvious from the context.
Since the introduction of function prototypes in C90, this information
is checked by the compiler and no longer needs to be encoded in the
variable names.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/usr.bin/make/arch.c
cvs rdiff -u -r1.173 -r1.174 src/usr.bin/make/cond.c
cvs rdiff -u -r1.647 -r1.648 src/usr.bin/make/var.c
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/include-sub.mk

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

Modified files:

Index: src/usr.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.152 src/usr.bin/make/arch.c:1.153
--- src/usr.bin/make/arch.c:1.152	Mon Nov  2 18:24:42 2020
+++ src/usr.bin/make/arch.c	Mon Nov  2 19:07:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.152 2020/11/02 18:24:42 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.153 2020/11/02 19:07:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.152 2020/11/02 18:24:42 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.153 2020/11/02 19:07:09 rillig Exp $");
 
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
@@ -189,18 +189,18 @@ ArchFree(void *ap)
  *	on the given list.
  *
  * Input:
- *	linePtr		Pointer to start of specification
+ *	pp		Pointer to start of specification, updated
  *	nodeLst		Lst on which to place the nodes
  *	ctxt		Context in which to expand variables
  *
  * Results:
- *	TRUE if it was a valid specification. The linePtr is updated
+ *	TRUE if it was a valid specification. The pp is updated
  *	to point to the first non-space after the archive spec. The
  *	nodes for the members are placed on the given list.
  *---
  */
 Boolean
-Arch_ParseArchive(char **linePtr, GNodeList *nodeLst, GNode *ctxt)
+Arch_ParseArchive(char **pp, GNodeList *nodeLst, GNode *ctxt)
 {
 char *cp;			/* Pointer into line */
 GNode *gn;			/* New node */
@@ -211,7 +211,7 @@ Arch_ParseArchive(char **linePtr, GNodeL
 Boolean subLibName;		/* TRUE if libName should have/had
  * variable substitution performed on it */
 
-libName = *linePtr;
+libName = *pp;
 
 subLibName = FALSE;
 
@@ -394,9 +394,9 @@ Arch_ParseArchive(char **linePtr, GNodeL
 free(libName_freeIt);
 
 cp++;			/* skip the ')' */
-/* We promised that linePtr would be set up at the next non-space. */
+/* We promised that pp would be set up at the next non-space. */
 pp_skip_whitespace(&cp);
-*linePtr = cp;
+*pp = cp;
 return TRUE;
 }
 
@@ -433,8 +433,8 @@ ArchStatMember(const char *archive, cons
 	member = lastSlash + 1;
 
 for (ln = archives->first; ln != NULL; ln = ln->next) {
-	const Arch *archPtr = ln->datum;
-	if (strcmp(archPtr->name, archive) == 0)
+	const Arch *a = ln->datum;
+	if (strcmp(a->name, archive) == 0)
 	break;
 }
 
@@ -694,7 +694,7 @@ ArchSVR4Entry(Arch *ar, char *name, size
  *	archive		Path to the archive
  *	member		Name of member. If it is a path, only the last
  *			component is used.
- *	arhPtr		Pointer to header structure to be filled in
+ *	out_arh		Archive header to be filled in
  *	mode		The mode for opening the stream
  *
  * Results:
@@ -704,7 +704,7 @@ ArchSVR4Entry(Arch *ar, char *name, size
  *---
  */
 static FILE *
-ArchFindMember(const char *archive, const char *member, struct ar_hdr *arhPtr,
+ArchFindMember(const char *archive, const char *member, struct ar_hdr *out_arh,
 	   const char *mode)
 {
 FILE *arch;			/* Stream to archive */
@@ -736,13 +736,13 @@ ArchFindMember(const char *archive, cons
 	member = lastSlash + 1;
 
 len = tlen = strlen(member);
-if (len > sizeof(arhPtr->ar_name)) {
-	tlen = sizeof(arhPtr->ar_name);
+if (len > sizeof(out_arh->ar_name)) {
+	tlen = sizeof(out_arh->ar_name);
 }
 
-while (fread((char *)arhPtr, sizeof(struct ar_hdr), 1, arch) == 1) {
+while (fread((char *)out_arh, sizeof(struct ar_hdr), 1, arch) == 1) {
 
-	if (strncmp(arhPtr->ar_fmag, ARFMAG, sizeof(arhPtr->ar_fmag)) != 0) {
+	if (strncmp(out_arh->ar_fmag, ARFMAG, sizeof(out_arh->ar_fmag)) != 0) {
 	/*
 	 * The header is bogus, so the archive is bad
 	 * and there's no way we can recover...
@@ -751,7 +751,7 @@ ArchFindMember(const char *archive, cons
 	return NULL;
 	}
 
-	if (strncmp(member, arhPtr->ar_name, tlen) == 0) {
+	if (strncmp(member, out_arh->ar_name, tlen) == 0) {
 	/*
 	 * If the member's name doesn't take up the entire 'name' field,
 

CVS commit: src/sys/rump/dev/lib/libpci

2020-11-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov  2 18:58:06 UTC 2020

Modified Files:
src/sys/rump/dev/lib/libpci: rumpdev_bus_dma.c

Log Message:
PR/55777: Ruslan Nikolaev: use MIN() from  instead of min()


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/rump/dev/lib/libpci/rumpdev_bus_dma.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/rump/dev/lib/libpci/rumpdev_bus_dma.c
diff -u src/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c:1.9 src/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c:1.10
--- src/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c:1.9	Sat Sep  5 12:30:12 2020
+++ src/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c	Mon Nov  2 13:58:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpdev_bus_dma.c,v 1.9 2020/09/05 16:30:12 riastradh Exp $	*/
+/*	$NetBSD: rumpdev_bus_dma.c,v 1.10 2020/11/02 18:58:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 Antti Kantee
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpdev_bus_dma.c,v 1.9 2020/09/05 16:30:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpdev_bus_dma.c,v 1.10 2020/11/02 18:58:06 christos Exp $");
 
 #include 
 #include 
@@ -192,7 +192,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t,
 		sgsize = PAGE_SIZE - ((u_long)vaddr & PGOFSET);
 		if (buflen < sgsize)
 			sgsize = buflen;
-		sgsize = min(sgsize, map->dm_maxsegsz);
+		sgsize = MIN(sgsize, map->dm_maxsegsz);
 
 		/*
 		 * Make sure we don't cross any boundaries.



CVS commit: src/sys

2020-11-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov  2 18:56:16 UTC 2020

Modified Files:
src/sys/kern: init_sysent.c syscalls.c syscalls_autoload.c
systrace_args.c
src/sys/rump: rump.sysmap
src/sys/rump/include/rump: rump_syscalls.h
src/sys/rump/librump/rumpkern: rump_syscalls.c
src/sys/sys: syscall.h syscallargs.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.336 -r1.337 src/sys/kern/init_sysent.c
cvs rdiff -u -r1.324 -r1.325 src/sys/kern/syscalls.c
cvs rdiff -u -r1.40 -r1.41 src/sys/kern/syscalls_autoload.c
cvs rdiff -u -r1.43 -r1.44 src/sys/kern/systrace_args.c
cvs rdiff -u -r1.8 -r1.9 src/sys/rump/rump.sysmap
cvs rdiff -u -r1.123 -r1.124 src/sys/rump/include/rump/rump_syscalls.h
cvs rdiff -u -r1.154 -r1.155 src/sys/rump/librump/rumpkern/rump_syscalls.c
cvs rdiff -u -r1.318 -r1.319 src/sys/sys/syscall.h
cvs rdiff -u -r1.302 -r1.303 src/sys/sys/syscallargs.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/kern/init_sysent.c
diff -u src/sys/kern/init_sysent.c:1.336 src/sys/kern/init_sysent.c:1.337
--- src/sys/kern/init_sysent.c:1.336	Thu Aug 13 20:55:02 2020
+++ src/sys/kern/init_sysent.c	Mon Nov  2 13:56:16 2020
@@ -1,14 +1,14 @@
-/* $NetBSD: init_sysent.c,v 1.336 2020/08/14 00:55:02 riastradh Exp $ */
+/* $NetBSD: init_sysent.c,v 1.337 2020/11/02 18:56:16 christos Exp $ */
 
 /*
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.306 2020/08/14 00:53:16 riastradh Exp
+ * created from	NetBSD: syscalls.master,v 1.307 2020/11/02 18:55:12 christos Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.336 2020/08/14 00:55:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.337 2020/11/02 18:56:16 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"

Index: src/sys/kern/syscalls.c
diff -u src/sys/kern/syscalls.c:1.324 src/sys/kern/syscalls.c:1.325
--- src/sys/kern/syscalls.c:1.324	Thu Aug 13 20:55:02 2020
+++ src/sys/kern/syscalls.c	Mon Nov  2 13:56:16 2020
@@ -1,14 +1,14 @@
-/* $NetBSD: syscalls.c,v 1.324 2020/08/14 00:55:02 riastradh Exp $ */
+/* $NetBSD: syscalls.c,v 1.325 2020/11/02 18:56:16 christos Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.306 2020/08/14 00:53:16 riastradh Exp
+ * created from	NetBSD: syscalls.master,v 1.307 2020/11/02 18:55:12 christos Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.324 2020/08/14 00:55:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.325 2020/11/02 18:56:16 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #ifdef _KERNEL_OPT

Index: src/sys/kern/syscalls_autoload.c
diff -u src/sys/kern/syscalls_autoload.c:1.40 src/sys/kern/syscalls_autoload.c:1.41
--- src/sys/kern/syscalls_autoload.c:1.40	Wed Jun 10 23:45:30 2020
+++ src/sys/kern/syscalls_autoload.c	Mon Nov  2 13:56:16 2020
@@ -1,14 +1,14 @@
-/* $NetBSD: syscalls_autoload.c,v 1.40 2020/06/11 03:45:30 dholland Exp $ */
+/* $NetBSD: syscalls_autoload.c,v 1.41 2020/11/02 18:56:16 christos Exp $ */
 
 /*
  * System call autoload table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.305 2020/05/16 18:31:50 christos Exp
+ * created from	NetBSD: syscalls.master,v 1.307 2020/11/02 18:55:12 christos Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.40 2020/06/11 03:45:30 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.41 2020/11/02 18:56:16 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"

Index: src/sys/kern/systrace_args.c
diff -u src/sys/kern/systrace_args.c:1.43 src/sys/kern/systrace_args.c:1.44
--- src/sys/kern/systrace_args.c:1.43	Thu Aug 13 20:55:02 2020
+++ src/sys/kern/systrace_args.c	Mon Nov  2 13:56:16 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: systrace_args.c,v 1.43 2020/08/14 00:55:02 riastradh Exp $ */
+/* $NetBSD: systrace_args.c,v 1.44 2020/11/02 18:56:16 christos Exp $ */
 
 /*
  * System call argument to DTrace register array converstion.

Index: src/sys/rump/rump.sysmap
diff -u src/sys/rump/rump.sysmap:1.8 src/sys/rump/rump.sysmap:1.9
--- src/sys/rump/rump.sysmap:1.8	Thu Aug 13 20:55:03 2020
+++ src/sys/rump/rump.sysmap	Mon Nov  2 13:56:16 2020
@@ -214,6 +214,7 @@
 477  sys_clock_nanosleepclock_nanosleeprump___sysimpl_clock_nanosleep
 479  sys_posix_fallocateposix_fallocaterump___sysimpl_posix_fallocate
 480  sys_fdiscard   fdiscard   rump___sysimpl_fdiscard
+482  sys_clock_getcpuclockid2 clock_getcpuclockid2 rump___sysimpl_clock_getcpuclockid2
 483  sys___getvfsstat90 __getvfsstat90 rump___sysimpl_getvfsstat90
 484  sys___statvfs190   __statvfs190   rump___sysimpl_statvfs190
 485  sys___fstatvfs190   

CVS commit: src/sys/kern

2020-11-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov  2 18:55:12 UTC 2020

Modified Files:
src/sys/kern: syscalls.master

Log Message:
PR/55777: Ruslan Nikolaev: Make clock_getcpuclockid2 accessible from rump


To generate a diff of this commit:
cvs rdiff -u -r1.306 -r1.307 src/sys/kern/syscalls.master

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/syscalls.master
diff -u src/sys/kern/syscalls.master:1.306 src/sys/kern/syscalls.master:1.307
--- src/sys/kern/syscalls.master:1.306	Thu Aug 13 20:53:16 2020
+++ src/sys/kern/syscalls.master	Mon Nov  2 13:55:12 2020
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.306 2020/08/14 00:53:16 riastradh Exp $
+	$NetBSD: syscalls.master,v 1.307 2020/11/02 18:55:12 christos Exp $
 
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
 
@@ -1011,7 +1011,7 @@
 481	STD		{ int|sys||wait6(idtype_t idtype, id_t id, \
 			int *status, int options, struct wrusage *wru, \
 			siginfo_t *info); }
-482	STD		{ int|sys||clock_getcpuclockid2(idtype_t idtype, \
+482	STD	RUMP	{ int|sys||clock_getcpuclockid2(idtype_t idtype, \
 			id_t id, clockid_t *clock_id); }
 483	STD	RUMP	{ int|sys|90|getvfsstat(struct statvfs *buf, \
 			size_t bufsize, int flags); }



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 18:24:42 UTC 2020

Modified Files:
src/usr.bin/make: arch.c

Log Message:
make(1): use freeIt pattern in Arch_ParseArchive

This makes the memory management more obvious than before, where the
status of the variable libName depended on subLibName.


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/usr.bin/make/arch.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/make/arch.c
diff -u src/usr.bin/make/arch.c:1.151 src/usr.bin/make/arch.c:1.152
--- src/usr.bin/make/arch.c:1.151	Sat Oct 31 18:41:07 2020
+++ src/usr.bin/make/arch.c	Mon Nov  2 18:24:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.151 2020/10/31 18:41:07 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.152 2020/11/02 18:24:42 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.151 2020/10/31 18:41:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.152 2020/11/02 18:24:42 rillig Exp $");
 
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
@@ -205,6 +205,7 @@ Arch_ParseArchive(char **linePtr, GNodeL
 char *cp;			/* Pointer into line */
 GNode *gn;			/* New node */
 char *libName;		/* Library-part of specification */
+char *libName_freeIt = NULL;
 char *memName;		/* Member-part of specification */
 char saveChar;		/* Ending delimiter of member-name */
 Boolean subLibName;		/* TRUE if libName should have/had
@@ -225,6 +226,7 @@ Arch_ParseArchive(char **linePtr, GNodeL
 	const char *result;
 	Boolean isError;
 
+	/* XXX: is expanded twice: once here and once below */
 	(void)Var_Parse(&nested_p, ctxt, VARE_UNDEFERR|VARE_WANTRES,
 			&result, &result_freeIt);
 	/* TODO: handle errors */
@@ -243,6 +245,7 @@ Arch_ParseArchive(char **linePtr, GNodeL
 if (subLibName) {
 	(void)Var_Subst(libName, ctxt, VARE_UNDEFERR|VARE_WANTRES, &libName);
 	/* TODO: handle errors */
+	libName_freeIt = libName;
 }
 
 
@@ -388,12 +391,7 @@ Arch_ParseArchive(char **linePtr, GNodeL
 	*cp = saveChar;
 }
 
-/*
- * If substituted libName, free it now, since we need it no longer.
- */
-if (subLibName) {
-	free(libName);
-}
+free(libName_freeIt);
 
 cp++;			/* skip the ')' */
 /* We promised that linePtr would be set up at the next non-space. */



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 18:15:12 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): fix wording of a comment in var.c

The "why again" could be easily misunderstood, it was ambiguous.


To generate a diff of this commit:
cvs rdiff -u -r1.646 -r1.647 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.646 src/usr.bin/make/var.c:1.647
--- src/usr.bin/make/var.c:1.646	Mon Nov  2 17:55:26 2020
+++ src/usr.bin/make/var.c	Mon Nov  2 18:15:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.646 2020/11/02 17:55:26 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.647 2020/11/02 18:15:12 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.646 2020/11/02 17:55:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.647 2020/11/02 18:15:12 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3291,7 +3291,7 @@ ApplyModifiersIndirect(
 
 	free(mods_freeIt);
 	/* XXX: apply_mods doesn't sound like "not interested". */
-	/* XXX: Why is the indirect modifier parsed again by
+	/* XXX: Why is the indirect modifier parsed once more by
 	 * apply_mods?  If any, p should be advanced to nested_p. */
 	return AMIR_APPLY_MODS;
 }



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 17:55:26 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): add a comment where to fix the STOP/STORE test from varmod.mk


To generate a diff of this commit:
cvs rdiff -u -r1.645 -r1.646 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.645 src/usr.bin/make/var.c:1.646
--- src/usr.bin/make/var.c:1.645	Mon Nov  2 17:00:33 2020
+++ src/usr.bin/make/var.c	Mon Nov  2 17:55:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.645 2020/11/02 17:00:33 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.646 2020/11/02 17:55:26 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.645 2020/11/02 17:00:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.646 2020/11/02 17:55:26 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3417,6 +3417,7 @@ ApplyModifiers(
 	Parse_Error(PARSE_FATAL,
 			"Missing delimiter ':' after modifier \"%.*s\"",
 			(int)(p - mod), mod);
+	/* TODO: propagate parse error to the enclosing expression */
 	}
 }
 out:



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

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 17:30:22 UTC 2020

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

Log Message:
make(1): add test for the :P modifier, which does not fall back


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/varmod.exp
diff -u src/usr.bin/make/unit-tests/varmod.exp:1.2 src/usr.bin/make/unit-tests/varmod.exp:1.3
--- src/usr.bin/make/unit-tests/varmod.exp:1.2	Sun Sep 13 07:42:20 2020
+++ src/usr.bin/make/unit-tests/varmod.exp	Mon Nov  2 17:30:22 2020
@@ -1,6 +1,8 @@
 make: "varmod.mk" line 42: To escape a dollar, use \$, not $$, at "$$:L} != """
 make: "varmod.mk" line 42: Invalid variable name ':', at "$:L} != """
 make: "varmod.mk" line 47: Dollar followed by nothing
+make: "varmod.mk" line 56: Missing delimiter ':' after modifier "P"
+make: "varmod.mk" line 57: Unknown directive "error"
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/varmod.mk
diff -u src/usr.bin/make/unit-tests/varmod.mk:1.3 src/usr.bin/make/unit-tests/varmod.mk:1.4
--- src/usr.bin/make/unit-tests/varmod.mk:1.3	Sun Sep 13 07:42:20 2020
+++ src/usr.bin/make/unit-tests/varmod.mk	Mon Nov  2 17:30:22 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod.mk,v 1.3 2020/09/13 07:42:20 rillig Exp $
+# $NetBSD: varmod.mk,v 1.4 2020/11/02 17:30:22 rillig Exp $
 #
 # Tests for variable modifiers, such as :Q, :S,from,to or :Ufallback.
 
@@ -48,4 +48,13 @@ DOLLAR2=	${:U\$}
 .  error
 .endif
 
+# The variable modifier :P does not fall back to the SysV modifier.
+# Therefore the modifier :P=RE generates a parse error.
+# XXX: The .error should not be reached since the variable expression is
+# malformed.
+VAR=	STOP
+.if ${VAR:P=RE} != "STORE"
+.  error
+.endif
+
 all: # nothing



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 17:00:33 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): format code in ApplyModifiersIndirect and ApplyModifiers


To generate a diff of this commit:
cvs rdiff -u -r1.644 -r1.645 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.644 src/usr.bin/make/var.c:1.645
--- src/usr.bin/make/var.c:1.644	Mon Nov  2 16:55:18 2020
+++ src/usr.bin/make/var.c	Mon Nov  2 17:00:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.644 2020/11/02 16:55:18 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.645 2020/11/02 17:00:33 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.644 2020/11/02 16:55:18 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.645 2020/11/02 17:00:33 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3264,11 +3264,11 @@ typedef enum ApplyModifiersIndirectResul
 } ApplyModifiersIndirectResult;
 
 /* While expanding a variable expression, expand and apply indirect
- * modifiers. */
+ * modifiers such as in ${VAR:${M_indirect}}. */
 static ApplyModifiersIndirectResult
 ApplyModifiersIndirect(
 	ApplyModifiersState *const st,
-	const char **inout_p,
+	const char **const inout_p,
 	void **const out_freeIt
 ) {
 const char *p = *inout_p;
@@ -3302,7 +3302,8 @@ ApplyModifiersIndirect(
 if (mods[0] != '\0') {
 	const char *rval_pp = mods;
 	st->val = ApplyModifiers(&rval_pp, st->val, '\0', '\0', st->v,
-&st->exprFlags, st->ctxt, st->eflags, out_freeIt);
+ &st->exprFlags, st->ctxt, st->eflags,
+ out_freeIt);
 	if (st->val == var_Error
 	|| (st->val == varUndefined && !(st->eflags & VARE_UNDEFERR))
 	|| *rval_pp != '\0') {
@@ -3329,15 +3330,15 @@ ApplyModifiersIndirect(
 /* Apply any modifiers (such as :Mpattern or :@var@loop@ or :Q or ::=value). */
 static char *
 ApplyModifiers(
-const char **pp,		/* the parsing position, updated upon return */
+const char **const pp,	/* the parsing position, updated upon return */
 char *const val,		/* the current value of the expression */
 char const startc,		/* '(' or '{', or '\0' for indirect modifiers */
 char const endc,		/* ')' or '}', or '\0' for indirect modifiers */
-Var * const v,
-VarExprFlags *exprFlags,
-GNode * const ctxt,		/* for looking up and modifying variables */
+Var *const v,
+VarExprFlags *const exprFlags,
+GNode *const ctxt,		/* for looking up and modifying variables */
 VarEvalFlags const eflags,
-void ** const out_freeIt	/* free this after using the return value */
+void **const out_freeIt	/* free this after using the return value */
 ) {
 ApplyModifiersState st = {
 	startc, endc, v, ctxt, eflags,



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 16:55:18 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): merge variables p and nested_p in ApplyModifiersIndirect

When the code was still in ApplyModifiers, the variable nested_p was
necessary to distinguish the parsing position in the nested modifier
from the parsing position of the main expression.


To generate a diff of this commit:
cvs rdiff -u -r1.643 -r1.644 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.643 src/usr.bin/make/var.c:1.644
--- src/usr.bin/make/var.c:1.643	Mon Nov  2 16:48:49 2020
+++ src/usr.bin/make/var.c	Mon Nov  2 16:55:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.643 2020/11/02 16:48:49 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.644 2020/11/02 16:55:18 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.643 2020/11/02 16:48:49 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.644 2020/11/02 16:55:18 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3272,11 +3272,10 @@ ApplyModifiersIndirect(
 	void **const out_freeIt
 ) {
 const char *p = *inout_p;
-const char *nested_p = p;
 const char *mods;
 void *mods_freeIt;
 
-(void)Var_Parse(&nested_p, st->ctxt, st->eflags, &mods, &mods_freeIt);
+(void)Var_Parse(&p, st->ctxt, st->eflags, &mods, &mods_freeIt);
 /* TODO: handle errors */
 
 /*
@@ -3284,12 +3283,11 @@ ApplyModifiersIndirect(
  * interested.  This means the expression ${VAR:${M_1}${M_2}}
  * is not accepted, but ${VAR:${M_1}:${M_2}} is.
  */
-if (mods[0] != '\0' &&
-	*nested_p != '\0' && *nested_p != ':' && *nested_p != st->endc) {
+if (mods[0] != '\0' && *p != '\0' && *p != ':' && *p != st->endc) {
 	if (DEBUG(LINT))
 	Parse_Error(PARSE_FATAL,
 			"Missing delimiter ':' after indirect modifier \"%.*s\"",
-			(int)(nested_p - p), p);
+			(int)(p - *inout_p), *inout_p);
 
 	free(mods_freeIt);
 	/* XXX: apply_mods doesn't sound like "not interested". */
@@ -3299,9 +3297,7 @@ ApplyModifiersIndirect(
 }
 
 VAR_DEBUG3("Indirect modifier \"%s\" from \"%.*s\"\n",
-	   mods, (int)(size_t)(nested_p - p), p);
-
-p = nested_p;
+	   mods, (int)(p - *inout_p), *inout_p);
 
 if (mods[0] != '\0') {
 	const char *rval_pp = mods;



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 16:48:49 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): rename rval to mods in ApplyModifiersIndirect


To generate a diff of this commit:
cvs rdiff -u -r1.642 -r1.643 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.642 src/usr.bin/make/var.c:1.643
--- src/usr.bin/make/var.c:1.642	Mon Nov  2 16:38:47 2020
+++ src/usr.bin/make/var.c	Mon Nov  2 16:48:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.642 2020/11/02 16:38:47 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.643 2020/11/02 16:48:49 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.642 2020/11/02 16:38:47 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.643 2020/11/02 16:48:49 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3273,10 +3273,10 @@ ApplyModifiersIndirect(
 ) {
 const char *p = *inout_p;
 const char *nested_p = p;
-void *rval_freeIt;
-const char *rval;
+const char *mods;
+void *mods_freeIt;
 
-(void)Var_Parse(&nested_p, st->ctxt, st->eflags, &rval, &rval_freeIt);
+(void)Var_Parse(&nested_p, st->ctxt, st->eflags, &mods, &mods_freeIt);
 /* TODO: handle errors */
 
 /*
@@ -3284,14 +3284,14 @@ ApplyModifiersIndirect(
  * interested.  This means the expression ${VAR:${M_1}${M_2}}
  * is not accepted, but ${VAR:${M_1}:${M_2}} is.
  */
-if (rval[0] != '\0' &&
+if (mods[0] != '\0' &&
 	*nested_p != '\0' && *nested_p != ':' && *nested_p != st->endc) {
 	if (DEBUG(LINT))
 	Parse_Error(PARSE_FATAL,
 			"Missing delimiter ':' after indirect modifier \"%.*s\"",
 			(int)(nested_p - p), p);
 
-	free(rval_freeIt);
+	free(mods_freeIt);
 	/* XXX: apply_mods doesn't sound like "not interested". */
 	/* XXX: Why is the indirect modifier parsed again by
 	 * apply_mods?  If any, p should be advanced to nested_p. */
@@ -3299,23 +3299,23 @@ ApplyModifiersIndirect(
 }
 
 VAR_DEBUG3("Indirect modifier \"%s\" from \"%.*s\"\n",
-	   rval, (int)(size_t)(nested_p - p), p);
+	   mods, (int)(size_t)(nested_p - p), p);
 
 p = nested_p;
 
-if (rval[0] != '\0') {
-	const char *rval_pp = rval;
+if (mods[0] != '\0') {
+	const char *rval_pp = mods;
 	st->val = ApplyModifiers(&rval_pp, st->val, '\0', '\0', st->v,
 &st->exprFlags, st->ctxt, st->eflags, out_freeIt);
 	if (st->val == var_Error
 	|| (st->val == varUndefined && !(st->eflags & VARE_UNDEFERR))
 	|| *rval_pp != '\0') {
-	free(rval_freeIt);
+	free(mods_freeIt);
 	*inout_p = p;
 	return AMIR_OUT;	/* error already reported */
 	}
 }
-free(rval_freeIt);
+free(mods_freeIt);
 
 if (*p == ':')
 	p++;



CVS commit: src/usr.bin/make

2020-11-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  2 16:38:47 UTC 2020

Modified Files:
src/usr.bin/make: var.c

Log Message:
make(1): inline and rename variables in ApplyModifiersIndirect


To generate a diff of this commit:
cvs rdiff -u -r1.641 -r1.642 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.641 src/usr.bin/make/var.c:1.642
--- src/usr.bin/make/var.c:1.641	Sun Nov  1 23:17:40 2020
+++ src/usr.bin/make/var.c	Mon Nov  2 16:38:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.641 2020/11/01 23:17:40 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.642 2020/11/02 16:38:47 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.641 2020/11/01 23:17:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.642 2020/11/02 16:38:47 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3273,11 +3273,10 @@ ApplyModifiersIndirect(
 ) {
 const char *p = *inout_p;
 const char *nested_p = p;
-void *freeIt;
+void *rval_freeIt;
 const char *rval;
-char c;
 
-(void)Var_Parse(&nested_p, st->ctxt, st->eflags, &rval, &freeIt);
+(void)Var_Parse(&nested_p, st->ctxt, st->eflags, &rval, &rval_freeIt);
 /* TODO: handle errors */
 
 /*
@@ -3286,13 +3285,13 @@ ApplyModifiersIndirect(
  * is not accepted, but ${VAR:${M_1}:${M_2}} is.
  */
 if (rval[0] != '\0' &&
-	(c = *nested_p) != '\0' && c != ':' && c != st->endc) {
+	*nested_p != '\0' && *nested_p != ':' && *nested_p != st->endc) {
 	if (DEBUG(LINT))
 	Parse_Error(PARSE_FATAL,
 			"Missing delimiter ':' after indirect modifier \"%.*s\"",
 			(int)(nested_p - p), p);
 
-	free(freeIt);
+	free(rval_freeIt);
 	/* XXX: apply_mods doesn't sound like "not interested". */
 	/* XXX: Why is the indirect modifier parsed again by
 	 * apply_mods?  If any, p should be advanced to nested_p. */
@@ -3311,12 +3310,12 @@ ApplyModifiersIndirect(
 	if (st->val == var_Error
 	|| (st->val == varUndefined && !(st->eflags & VARE_UNDEFERR))
 	|| *rval_pp != '\0') {
-	free(freeIt);
+	free(rval_freeIt);
 	*inout_p = p;
 	return AMIR_OUT;	/* error already reported */
 	}
 }
-free(freeIt);
+free(rval_freeIt);
 
 if (*p == ':')
 	p++;



CVS commit: src/sys/net

2020-11-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Nov  2 12:14:59 UTC 2020

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

Log Message:
bridge: revert prior

It's of little use.
If we need to do this in the future, consider a sysctl to do it for all
interfaces in the bridge and not just the one being added.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/net/if_bridge.c

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

Modified files:

Index: src/sys/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.176 src/sys/net/if_bridge.c:1.177
--- src/sys/net/if_bridge.c:1.176	Sun Sep 27 19:16:28 2020
+++ src/sys/net/if_bridge.c	Mon Nov  2 12:14:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.176 2020/09/27 19:16:28 roy Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.177 2020/11/02 12:14:59 roy Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.176 2020/09/27 19:16:28 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.177 2020/11/02 12:14:59 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -904,13 +904,6 @@ bridge_ioctl_add(struct bridge_softc *sc
 	PSLIST_ENTRY_INIT(bif, bif_next);
 	psref_target_init(&bif->bif_psref, bridge_psref_class);
 
-	/*
-	 * Pretend that the link is down for domains.
-	 * This will detach any addresses assigned to the interface.
-	 */
-	if (ifs->if_link_state != LINK_STATE_DOWN)
-		if_domain_link_state_change(ifs, LINK_STATE_DOWN);
-
 	BRIDGE_LOCK(sc);
 
 	ifs->if_bridge = sc;
@@ -928,13 +921,6 @@ bridge_ioctl_add(struct bridge_softc *sc
 	else
 		bstp_stop(sc);
 
-	/*
-	 * If the link was not initially down then mark any detached addresses
-	 * as tentative and start Duplicate Address Detection for them.
-	 */
-	if (ifs->if_link_state != LINK_STATE_DOWN)
-		if_domain_link_state_change(ifs, ifs->if_link_state);
-
 out:
 	if_put(ifs, &psref);
 	if (error) {



CVS commit: src/sys/dev/pci

2020-11-02 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Nov  2 09:21:50 UTC 2020

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

Log Message:
Workaround for ihphy and atphy(ICH*/PCH*, 82580 and I350).

These phys stop DMA while link is down which causes device timeout.
Fix PR/kern 40981

Reviewed and tested by msaitoh@n.o, thanks.

XXX pullup-[89]


To generate a diff of this commit:
cvs rdiff -u -r1.694 -r1.695 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.694 src/sys/dev/pci/if_wm.c:1.695
--- src/sys/dev/pci/if_wm.c:1.694	Fri Oct 30 06:29:47 2020
+++ src/sys/dev/pci/if_wm.c	Mon Nov  2 09:21:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.694 2020/10/30 06:29:47 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.695 2020/11/02 09:21:50 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.694 2020/10/30 06:29:47 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.695 2020/11/02 09:21:50 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -384,7 +384,8 @@ struct wm_txqueue {
 	 * to manage Tx H/W queue's busy flag.
 	 */
 	int txq_flags;			/* flags for H/W queue, see below */
-#define	WM_TXQ_NO_SPACE	0x1
+#define	WM_TXQ_NO_SPACE		0x1
+#define	WM_TXQ_LINKDOWN_DISCARD	0x2
 
 	bool txq_stopping;
 
@@ -1044,6 +1045,9 @@ static void	wm_toggle_lanphypc_pch_lpt(s
 static int	wm_platform_pm_pch_lpt(struct wm_softc *, bool);
 static int	wm_pll_workaround_i210(struct wm_softc *);
 static void	wm_legacy_irq_quirk_spt(struct wm_softc *);
+static bool	wm_phy_need_linkdown_discard(struct wm_softc *);
+static void	wm_set_linkdown_discard(struct wm_softc *);
+static void	wm_clear_linkdown_discard(struct wm_softc *);
 
 #ifdef WM_DEBUG
 static int	wm_sysctl_debug(SYSCTLFN_PROTO);
@@ -3100,6 +3104,9 @@ alloc_retry:
 
 	sc->sc_txrx_use_workqueue = false;
 
+	if (wm_phy_need_linkdown_discard(sc))
+		wm_set_linkdown_discard(sc);
+
 	wm_init_sysctls(sc);
 
 	if (pmf_device_register(self, wm_suspend, wm_resume))
@@ -3483,6 +3490,49 @@ out:
 	return rc;
 }
 
+static bool
+wm_phy_need_linkdown_discard(struct wm_softc *sc)
+{
+
+	switch(sc->sc_phytype) {
+	case WMPHY_82577: /* ihphy */
+	case WMPHY_82578: /* atphy */
+	case WMPHY_82579: /* ihphy */
+	case WMPHY_I217: /* ihphy */
+	case WMPHY_82580: /* ihphy */
+	case WMPHY_I350: /* ihphy */
+		return true;
+	default:
+		return false;
+	}
+}
+
+static void
+wm_set_linkdown_discard(struct wm_softc *sc)
+{
+
+	for (int i = 0; i < sc->sc_nqueues; i++) {
+		struct wm_txqueue *txq = &sc->sc_queue[i].wmq_txq;
+
+		mutex_enter(txq->txq_lock);
+		txq->txq_flags |= WM_TXQ_LINKDOWN_DISCARD;
+		mutex_exit(txq->txq_lock);
+	}
+}
+
+static void
+wm_clear_linkdown_discard(struct wm_softc *sc)
+{
+
+	for (int i = 0; i < sc->sc_nqueues; i++) {
+		struct wm_txqueue *txq = &sc->sc_queue[i].wmq_txq;
+
+		mutex_enter(txq->txq_lock);
+		txq->txq_flags &= ~WM_TXQ_LINKDOWN_DISCARD;
+		mutex_exit(txq->txq_lock);
+	}
+}
+
 /*
  * wm_ioctl:		[ifnet interface function]
  *
@@ -3520,6 +3570,12 @@ wm_ioctl(struct ifnet *ifp, u_long cmd, 
 		}
 		WM_CORE_UNLOCK(sc);
 		error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
+		if (error == 0 && wm_phy_need_linkdown_discard(sc)) {
+			if (IFM_SUBTYPE(ifr->ifr_media) == IFM_NONE)
+wm_set_linkdown_discard(sc);
+			else
+wm_clear_linkdown_discard(sc);
+		}
 		break;
 	case SIOCINITIFADDR:
 		WM_CORE_LOCK(sc);
@@ -3534,8 +3590,17 @@ wm_ioctl(struct ifnet *ifp, u_long cmd, 
 			break;
 		}
 		WM_CORE_UNLOCK(sc);
+		if (((ifp->if_flags & IFF_UP) == 0) && wm_phy_need_linkdown_discard(sc))
+			wm_clear_linkdown_discard(sc);
 		/*FALLTHROUGH*/
 	default:
+		if (cmd == SIOCSIFFLAGS && wm_phy_need_linkdown_discard(sc)) {
+			if (((ifp->if_flags & IFF_UP) == 0) && ((ifr->ifr_flags & IFF_UP) != 0)) {
+wm_clear_linkdown_discard(sc);
+			} else if (((ifp->if_flags & IFF_UP) != 0) && ((ifr->ifr_flags & IFF_UP) == 0)) {
+wm_set_linkdown_discard(sc);
+			}
+		}
 #ifdef WM_MPSAFE
 		s = splnet();
 #endif
@@ -7674,6 +7739,16 @@ wm_select_txqueue(struct ifnet *ifp, str
 	return ((cpuid + ncpu - sc->sc_affinity_offset) % ncpu) % sc->sc_nqueues;
 }
 
+static inline bool
+wm_linkdown_discard(struct wm_txqueue *txq)
+{
+
+	if ((txq->txq_flags & WM_TXQ_LINKDOWN_DISCARD) != 0)
+		return true;
+
+	return false;
+}
+
 /*
  * wm_start:		[ifnet interface function]
  *
@@ -7767,6 +7842,23 @@ wm_send_common_locked(struct ifnet *ifp,
 	if ((txq->txq_flags & WM_TXQ_NO_SPACE) != 0)
 		return;
 
+	if (__predict_false(wm_linkdown_discard(txq))) {
+		do {
+			if (is_transmit)
+m0 = pcq_get(txq->txq_interq);
+			else
+IFQ_DEQUEUE(&ifp->if_snd, m0);
+			/*
+			 * increment successed packet counter as in the case
+			 * which the packet is discarded by link down PHY.

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

2020-11-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Nov  2 08:37:59 UTC 2020

Modified Files:
src/sys/arch/riscv/include: sysreg.h

Log Message:
Add SATP_MODE values


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/include/sysreg.h

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

Modified files:

Index: src/sys/arch/riscv/include/sysreg.h
diff -u src/sys/arch/riscv/include/sysreg.h:1.7 src/sys/arch/riscv/include/sysreg.h:1.8
--- src/sys/arch/riscv/include/sysreg.h:1.7	Mon Nov  2 08:36:54 2020
+++ src/sys/arch/riscv/include/sysreg.h	Mon Nov  2 08:37:59 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sysreg.h,v 1.7 2020/11/02 08:36:54 skrll Exp $ */
+/* $NetBSD: sysreg.h,v 1.8 2020/11/02 08:37:59 skrll Exp $ */
 
 /*
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -198,10 +198,13 @@ riscvreg_cycle_read(void)
 
 #ifdef _LP64
 #define SATP_MODE		__BITS(63,60)
+#define  SATP_MODE_SV39		8
+#define  SATP_MODE_SV48		9
 #define SATP_ASID		__BITS(59,44)
 #define SATP_PPN		__BITS(43,0)
 #else
 #define SATP_MODE		__BIT(31)
+#define  SATP_MODE_SV32		1
 #define SATP_ASID		__BITS(30,22)
 #define SATP_PPN		__BITS(21,0)
 #endif



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

2020-11-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Nov  2 08:36:54 UTC 2020

Modified Files:
src/sys/arch/riscv/include: sysreg.h

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/riscv/include/sysreg.h

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

Modified files:

Index: src/sys/arch/riscv/include/sysreg.h
diff -u src/sys/arch/riscv/include/sysreg.h:1.6 src/sys/arch/riscv/include/sysreg.h:1.7
--- src/sys/arch/riscv/include/sysreg.h:1.6	Sun Nov  1 21:09:48 2020
+++ src/sys/arch/riscv/include/sysreg.h	Mon Nov  2 08:36:54 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sysreg.h,v 1.6 2020/11/01 21:09:48 skrll Exp $ */
+/* $NetBSD: sysreg.h,v 1.7 2020/11/02 08:36:54 skrll Exp $ */
 
 /*
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -197,13 +197,13 @@ riscvreg_cycle_read(void)
 }
 
 #ifdef _LP64
-#define SATP_MODE	__BITS(63,60)
-#define SATP_ASID	__BITS(59,44)
-#define SATP_PPN	__BITS(43,0)
+#define SATP_MODE		__BITS(63,60)
+#define SATP_ASID		__BITS(59,44)
+#define SATP_PPN		__BITS(43,0)
 #else
-#define SATP_MODE	__BIT(31)
-#define SATP_ASID	__BITS(30,22)
-#define SATP_PPN	__BITS(21,0)
+#define SATP_MODE		__BIT(31)
+#define SATP_ASID		__BITS(30,22)
+#define SATP_PPN		__BITS(21,0)
 #endif
 
 static inline uint32_t