CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 10:27:22 UTC 2020

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

Log Message:
make(1): save a variable lookup when adding a read-only variable


To generate a diff of this commit:
cvs rdiff -u -r1.463 -r1.464 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.463 src/usr.bin/make/var.c:1.464
--- src/usr.bin/make/var.c:1.463	Sun Aug 23 09:28:52 2020
+++ src/usr.bin/make/var.c	Sun Aug 23 10:27:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.463 2020/08/23 09:28:52 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.464 2020/08/23 10:27:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.463 2020/08/23 09:28:52 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.464 2020/08/23 10:27:22 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.463 2020/08/23 09:28:52 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.464 2020/08/23 10:27:22 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -441,17 +441,18 @@ VarFreeEnv(Var *v, Boolean destroy)
 /* Add a new variable of the given name and value to the given context.
  * The name and val arguments are duplicated so they may safely be freed. */
 static void
-VarAdd(const char *name, const char *val, GNode *ctxt)
+VarAdd(const char *name, const char *val, GNode *ctxt, VarSet_Flags flags)
 {
 Var *v = bmake_malloc(sizeof(Var));
-
-size_t len = val != NULL ? strlen(val) : 0;
+size_t len = strlen(val);
 Hash_Entry *he;
 
 Buf_Init(>val, len + 1);
 Buf_AddBytes(>val, val, len);
 
 v->flags = 0;
+if (flags & VAR_SET_READONLY)
+	v->flags |= VAR_READONLY;
 
 he = Hash_CreateEntry(>context, name, NULL);
 Hash_SetValue(he, v);
@@ -818,11 +819,7 @@ Var_Set_with_flags(const char *name, con
 	 */
 	Var_Delete(name, VAR_GLOBAL);
 	}
-	VarAdd(name, val, ctxt);
-	if (flags & VAR_SET_READONLY) {
-	v = VarFind(name, ctxt, 0);
-	v->flags |= VAR_READONLY;
-	}
+	VarAdd(name, val, ctxt, flags);
 } else {
 	if ((v->flags & VAR_READONLY) && !(flags & VAR_SET_READONLY)) {
 	VAR_DEBUG("%s:%s = %s ignored (read-only)\n",



CVS commit: src/sys/crypto/chacha/arch/arm

2020-08-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 23 16:39:06 UTC 2020

Modified Files:
src/sys/crypto/chacha/arch/arm: chacha_neon_32.S

Log Message:
Adjust sp, not fp, to allocate a 32-byte temporary.

Costs another couple MOV instructions, but we can't skimp on this --
there's no red zone below sp for interrupts on arm, so we can't touch
anything there.  So just use fp to save sp and then adjust sp itself,
rather than using fp as a temporary register to point just below sp.

Should fix PR port-arm/55598 -- previously the ChaCha self-test
failed 33/1 trials triggered by sysctl during running system;
with the patch it has failed 0/1 trials.

(Presumably it happened more often at boot time, leading to 5/26
failures in the test bed, because we just enabled interrupts and some
devices are starting to deliver interrupts.)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/crypto/chacha/arch/arm/chacha_neon_32.S

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

Modified files:

Index: src/sys/crypto/chacha/arch/arm/chacha_neon_32.S
diff -u src/sys/crypto/chacha/arch/arm/chacha_neon_32.S:1.3 src/sys/crypto/chacha/arch/arm/chacha_neon_32.S:1.4
--- src/sys/crypto/chacha/arch/arm/chacha_neon_32.S:1.3	Sat Aug  8 14:47:01 2020
+++ src/sys/crypto/chacha/arch/arm/chacha_neon_32.S	Sun Aug 23 16:39:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: chacha_neon_32.S,v 1.3 2020/08/08 14:47:01 riastradh Exp $	*/
+/*	$NetBSD: chacha_neon_32.S,v 1.4 2020/08/23 16:39:06 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 
-RCSID("$NetBSD: chacha_neon_32.S,v 1.3 2020/08/08 14:47:01 riastradh Exp $")
+RCSID("$NetBSD: chacha_neon_32.S,v 1.4 2020/08/23 16:39:06 riastradh Exp $")
 
 	.fpu	neon
 
@@ -54,7 +54,7 @@ RCSID("$NetBSD: chacha_neon_32.S,v 1.3 2
  */
 
 .macro	ROUNDLD	a0,a1,a2,a3, b0,b1,b2,b3, c0,c1,c2,c3, d0,d1,d2,d3
-	vld1.8		{\c2-\c3}, [fp, :256]
+	vld1.8		{\c2-\c3}, [sp, :256]
 .endm
 
 .macro	ROUND	a0,a1,a2,a3, b0,b1,b2,b3, c0,c1,c2,c3, d0,d1,d2,d3, c0l, d0l,d0h,d1l,d1h,d2l,d2h,d3l,d3h
@@ -80,7 +80,7 @@ RCSID("$NetBSD: chacha_neon_32.S,v 1.3 2
 	vadd.u32	\c2, \c2, \d2
 	vadd.u32	\c3, \c3, \d3
 
-	vst1.8		{\c0-\c1}, [fp, :256]	/* free c0 and c1 as temps */
+	vst1.8		{\c0-\c1}, [sp, :256]	/* free c0 and c1 as temps */
 
 	veor		\c0, \b0, \c0
 	veor		\c1, \b1, \c1
@@ -118,7 +118,7 @@ RCSID("$NetBSD: chacha_neon_32.S,v 1.3 2
 	vtbl.8		\d3l, {\d3l}, \c0l
 	vtbl.8		\d3h, {\d3h}, \c0l
 
-	vld1.8		{\c0-\c1}, [fp, :256]	/* restore c0 and c1 */
+	vld1.8		{\c0-\c1}, [sp, :256]	/* restore c0 and c1 */
 
 	/* c += d; b ^= c; b <<<= 7 */
 	vadd.u32	\c2, \c2, \d2
@@ -126,7 +126,7 @@ RCSID("$NetBSD: chacha_neon_32.S,v 1.3 2
 	vadd.u32	\c0, \c0, \d0
 	vadd.u32	\c1, \c1, \d1
 
-	vst1.8		{\c2-\c3}, [fp, :256]	/* free c2 and c3 as temps */
+	vst1.8		{\c2-\c3}, [sp, :256]	/* free c2 and c3 as temps */
 
 	veor		\c2, \b2, \c2
 	veor		\c3, \b3, \c3
@@ -160,17 +160,18 @@ ENTRY(chacha_stream256_neon)
 	/* save callee-saves registers */
 	push	{r4, r5, r6, r7, r8, r10, fp, lr}
 	vpush	{d8-d15}
+	mov	fp, sp
 
 	/* r7 := .Lconstants - .Lconstants_addr, r6 := .Lconstants_addr */
 	ldr	r7, .Lconstants_addr
 	adr	r6, .Lconstants_addr
 
 	/* reserve space for two 128-bit/16-byte q registers */
-	sub	fp, sp, #0x20
-	bic	fp, fp, #0x1f	/* align */
+	sub	sp, sp, #0x20
+	bic	sp, sp, #0x1f	/* align */
 
 	/* get parameters */
-	add	ip, sp, #96
+	add	ip, fp, #96
 	add	r7, r7, r6	/* r7 := .Lconstants (= v0123) */
 	ldm	ip, {r4, r5}	/* r4 := const, r5 := nr */
 	ldm	r2, {r6, r8, r10}	/* (r6, r8, r10) := nonce[0:12) */
@@ -311,7 +312,7 @@ ENTRY(chacha_stream256_neon)
 	vadd.u32 q3, q3, q8
 	vadd.u32 q7, q7, q8
 
-	vld1.8	{q8-q9}, [fp, :256]	/* restore q8-q9 */
+	vld1.8	{q8-q9}, [sp, :256]	/* restore q8-q9 */
 
 	vst1.8	{q0-q1}, [r0]!
 	vld1.8	{q0}, [r3]	/* q0 := key[16:32) */
@@ -354,9 +355,10 @@ ENTRY(chacha_stream256_neon)
 	/* zero temporary space on the stack */
 	vmov.i32 q0, #0
 	vmov.i32 q1, #0
-	vst1.8	{q0-q1}, [fp, :256]
+	vst1.8	{q0-q1}, [sp, :256]
 
 	/* restore callee-saves registers and stack */
+	mov	sp, fp
 	vpop	{d8-d15}
 	pop	{r4, r5, r6, r7, r8, r10, fp, lr}
 	bx	lr
@@ -374,17 +376,18 @@ ENTRY(chacha_stream_xor256_neon)
 	/* save callee-saves registers */
 	push	{r4, r5, r6, r7, r8, r10, fp, lr}
 	vpush	{d8-d15}
+	mov	fp, sp
 
 	/* r7 := .Lconstants - .Lconstants_addr, r6 := .Lconstants_addr */
 	ldr	r7, .Lconstants_addr
 	adr	r6, .Lconstants_addr
 
 	/* reserve space for two 128-bit/16-byte q registers */
-	sub	fp, sp, #0x20
-	bic	fp, fp, #0x1f	/* align */
+	sub	sp, sp, #0x20
+	bic	sp, sp, #0x1f	/* align */
 
 	/* get parameters */
-	add	ip, sp, #96
+	add	ip, fp, #96
 	add	r7, r7, r6	/* r7 := .Lconstants (= v0123) */
 	ldm	ip, {r4, r5, ip}	/* r4 := key, r5 := const, ip := nr */
 	ldm	r3, {r6, r8, r10}	/* (r6, r8, r10) := nonce[0:12) */
@@ -475,7 +478,7 @@ 

CVS commit: src/sys/crypto/chacha/arch/arm

2020-08-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 23 16:39:06 UTC 2020

Modified Files:
src/sys/crypto/chacha/arch/arm: chacha_neon_32.S

Log Message:
Adjust sp, not fp, to allocate a 32-byte temporary.

Costs another couple MOV instructions, but we can't skimp on this --
there's no red zone below sp for interrupts on arm, so we can't touch
anything there.  So just use fp to save sp and then adjust sp itself,
rather than using fp as a temporary register to point just below sp.

Should fix PR port-arm/55598 -- previously the ChaCha self-test
failed 33/1 trials triggered by sysctl during running system;
with the patch it has failed 0/1 trials.

(Presumably it happened more often at boot time, leading to 5/26
failures in the test bed, because we just enabled interrupts and some
devices are starting to deliver interrupts.)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/crypto/chacha/arch/arm/chacha_neon_32.S

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



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 18:57:32 UTC 2020

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

Log Message:
make(1): make ArchStatMember ready for WARNS=6


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 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.



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 18:57:32 UTC 2020

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

Log Message:
make(1): make ArchStatMember ready for WARNS=6


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 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.94 src/usr.bin/make/arch.c:1.95
--- src/usr.bin/make/arch.c:1.94	Sun Aug 23 18:53:13 2020
+++ src/usr.bin/make/arch.c	Sun Aug 23 18:57:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.94 2020/08/23 18:53:13 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.95 2020/08/23 18:57:32 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.94 2020/08/23 18:53:13 rillig Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.95 2020/08/23 18:57:32 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.94 2020/08/23 18:53:13 rillig Exp $");
+__RCSID("$NetBSD: arch.c,v 1.95 2020/08/23 18:57:32 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -528,7 +528,7 @@ ArchStatMember(const char *archive, cons
 {
 #define AR_MAX_NAME_LEN	(sizeof(arh.ar_name)-1)
 FILE *	  arch;	  /* Stream to archive */
-int		  size;   /* Size of archive member */
+size_t	  size;   /* Size of archive member */
 char	  magic[SARMAG];
 LstNode	  ln;	  /* Lst member containing archive descriptor */
 Arch	  *ar;	  /* Archive descriptor */
@@ -634,7 +634,7 @@ ArchStatMember(const char *archive, cons
 	 * 'size' field of the header and round it up during the seek.
 	 */
 	arh.ar_size[sizeof(arh.ar_size)-1] = '\0';
-	size = (int)strtol(arh.ar_size, NULL, 10);
+	size = (size_t)strtol(arh.ar_size, NULL, 10);
 
 	memcpy(memName, arh.ar_name, sizeof(arh.ar_name));
 	nameend = memName + AR_MAX_NAME_LEN;
@@ -674,11 +674,11 @@ ArchStatMember(const char *archive, cons
 	if (strncmp(memName, AR_EFMT1, sizeof(AR_EFMT1) - 1) == 0 &&
 		isdigit((unsigned char)memName[sizeof(AR_EFMT1) - 1])) {
 
-		unsigned int elen = atoi([sizeof(AR_EFMT1)-1]);
+		int elen = atoi([sizeof(AR_EFMT1)-1]);
 
-		if (elen > MAXPATHLEN)
+		if ((unsigned int)elen > MAXPATHLEN)
 			goto badarch;
-		if (fread(memName, elen, 1, arch) != 1)
+		if (fread(memName, (size_t)elen, 1, arch) != 1)
 			goto badarch;
 		memName[elen] = '\0';
 		if (fseek(arch, -elen, SEEK_CUR) != 0)
@@ -693,7 +693,7 @@ ArchStatMember(const char *archive, cons
 	Hash_SetValue(he, bmake_malloc(sizeof(struct ar_hdr)));
 	memcpy(Hash_GetValue(he), , sizeof(struct ar_hdr));
 	}
-	if (fseek(arch, (size + 1) & ~1, SEEK_CUR) != 0)
+	if (fseek(arch, ((long)size + 1) & ~1, SEEK_CUR) != 0)
 	goto badarch;
 }
 



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 18:59:01 UTC 2020

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

Log Message:
make(1): make ArchFindMember ready for WARNS=6


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 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.95 src/usr.bin/make/arch.c:1.96
--- src/usr.bin/make/arch.c:1.95	Sun Aug 23 18:57:32 2020
+++ src/usr.bin/make/arch.c	Sun Aug 23 18:59:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.95 2020/08/23 18:57:32 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.96 2020/08/23 18:59:01 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.95 2020/08/23 18:57:32 rillig Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.96 2020/08/23 18:59:01 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.95 2020/08/23 18:57:32 rillig Exp $");
+__RCSID("$NetBSD: arch.c,v 1.96 2020/08/23 18:59:01 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -912,7 +912,7 @@ ArchFindMember(const char *archive, cons
 		 * the file at the actual member, rather than its header, but
 		 * not here...
 		 */
-		if (fseek(arch, -sizeof(struct ar_hdr), SEEK_CUR) != 0) {
+		if (fseek(arch, -(long)sizeof(struct ar_hdr), SEEK_CUR) != 0) {
 		fclose(arch);
 		return NULL;
 		}
@@ -928,14 +928,14 @@ ArchFindMember(const char *archive, cons
 	sizeof(AR_EFMT1) - 1) == 0 &&
 		isdigit((unsigned char)arhPtr->ar_name[sizeof(AR_EFMT1) - 1])) {
 
-		unsigned int elen = atoi(>ar_name[sizeof(AR_EFMT1)-1]);
+		int elen = atoi(>ar_name[sizeof(AR_EFMT1)-1]);
 		char ename[MAXPATHLEN + 1];
 
-		if (elen > MAXPATHLEN) {
+		if ((unsigned int)elen > MAXPATHLEN) {
 			fclose(arch);
 			return NULL;
 		}
-		if (fread(ename, elen, 1, arch) != 1) {
+		if (fread(ename, (size_t)elen, 1, arch) != 1) {
 			fclose(arch);
 			return NULL;
 		}
@@ -945,7 +945,7 @@ ArchFindMember(const char *archive, cons
 		}
 		if (strncmp(ename, member, len) == 0) {
 			/* Found as extended name */
-			if (fseek(arch, -sizeof(struct ar_hdr) - elen,
+			if (fseek(arch, -(long)sizeof(struct ar_hdr) - elen,
 SEEK_CUR) != 0) {
 			fclose(arch);
 			return NULL;



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 18:59:01 UTC 2020

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

Log Message:
make(1): make ArchFindMember ready for WARNS=6


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 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.



CVS commit: src

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 13:50:17 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: cond-cmp-numeric-eq.exp
cond-cmp-numeric-eq.mk cond-cmp-numeric-ge.exp
cond-cmp-numeric-ge.mk cond-cmp-numeric-gt.exp
cond-cmp-numeric-gt.mk cond-cmp-numeric-le.exp
cond-cmp-numeric-le.mk cond-cmp-numeric-lt.exp
cond-cmp-numeric-lt.mk cond-cmp-numeric-ne.exp
cond-cmp-numeric-ne.mk

Log Message:
make(1): add tests for numeric comparisons in .if directives


To generate a diff of this commit:
cvs rdiff -u -r1.902 -r1.903 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.116 -r1.117 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp \
src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk \
src/usr.bin/make/unit-tests/cond-cmp-numeric-ge.exp \
src/usr.bin/make/unit-tests/cond-cmp-numeric-ge.mk \
src/usr.bin/make/unit-tests/cond-cmp-numeric-gt.exp \
src/usr.bin/make/unit-tests/cond-cmp-numeric-gt.mk \
src/usr.bin/make/unit-tests/cond-cmp-numeric-le.exp \
src/usr.bin/make/unit-tests/cond-cmp-numeric-le.mk \
src/usr.bin/make/unit-tests/cond-cmp-numeric-lt.exp \
src/usr.bin/make/unit-tests/cond-cmp-numeric-lt.mk \
src/usr.bin/make/unit-tests/cond-cmp-numeric-ne.exp \
src/usr.bin/make/unit-tests/cond-cmp-numeric-ne.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.902 src/distrib/sets/lists/tests/mi:1.903
--- src/distrib/sets/lists/tests/mi:1.902	Sun Aug 23 09:18:25 2020
+++ src/distrib/sets/lists/tests/mi	Sun Aug 23 13:50:17 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.902 2020/08/23 09:18:25 rillig Exp $
+# $NetBSD: mi,v 1.903 2020/08/23 13:50:17 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4541,6 +4541,18 @@
 ./usr/tests/usr.bin/make/unit-tests/cmdline.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/comment.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/comment.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-ge.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-ge.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-gt.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-gt.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-le.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-le.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-lt.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-lt.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-ne.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric-ne.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-cmp-numeric.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-cmp-string.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.116 src/usr.bin/make/unit-tests/Makefile:1.117
--- src/usr.bin/make/unit-tests/Makefile:1.116	Sun Aug 23 09:28:52 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sun Aug 23 13:50:17 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.116 2020/08/23 09:28:52 rillig Exp $
+# $NetBSD: Makefile,v 1.117 2020/08/23 13:50:17 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -39,6 +39,12 @@ TESTS+=		# archive	# broken on FreeBSD, 
 TESTS+=		cmdline
 TESTS+=		comment
 TESTS+=		cond-cmp-numeric
+TESTS+=		cond-cmp-numeric-eq
+TESTS+=		cond-cmp-numeric-ge
+TESTS+=		cond-cmp-numeric-gt
+TESTS+=		cond-cmp-numeric-le
+TESTS+=		cond-cmp-numeric-lt
+TESTS+=		cond-cmp-numeric-ne
 TESTS+=		cond-cmp-string
 TESTS+=		cond-func
 TESTS+=		cond-func-commands

Added files:

Index: src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp
diff -u /dev/null src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp:1.1
--- /dev/null	Sun Aug 23 13:50:17 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp	Sun Aug 23 13:50:17 2020
@@ 

CVS commit: src

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 13:50:17 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: cond-cmp-numeric-eq.exp
cond-cmp-numeric-eq.mk cond-cmp-numeric-ge.exp
cond-cmp-numeric-ge.mk cond-cmp-numeric-gt.exp
cond-cmp-numeric-gt.mk cond-cmp-numeric-le.exp
cond-cmp-numeric-le.mk cond-cmp-numeric-lt.exp
cond-cmp-numeric-lt.mk cond-cmp-numeric-ne.exp
cond-cmp-numeric-ne.mk

Log Message:
make(1): add tests for numeric comparisons in .if directives


To generate a diff of this commit:
cvs rdiff -u -r1.902 -r1.903 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.116 -r1.117 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp \
src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk \
src/usr.bin/make/unit-tests/cond-cmp-numeric-ge.exp \
src/usr.bin/make/unit-tests/cond-cmp-numeric-ge.mk \
src/usr.bin/make/unit-tests/cond-cmp-numeric-gt.exp \
src/usr.bin/make/unit-tests/cond-cmp-numeric-gt.mk \
src/usr.bin/make/unit-tests/cond-cmp-numeric-le.exp \
src/usr.bin/make/unit-tests/cond-cmp-numeric-le.mk \
src/usr.bin/make/unit-tests/cond-cmp-numeric-lt.exp \
src/usr.bin/make/unit-tests/cond-cmp-numeric-lt.mk \
src/usr.bin/make/unit-tests/cond-cmp-numeric-ne.exp \
src/usr.bin/make/unit-tests/cond-cmp-numeric-ne.mk

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



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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 14:28:04 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: Makefile opt-ignore.exp opt-ignore.mk
opt-keep-going.exp opt-keep-going.mk opt-var-expanded.exp
opt-var-expanded.mk opt-var-literal.exp opt-var-literal.mk
opt-warnings-as-errors.exp opt-warnings-as-errors.mk

Log Message:
make(1): add tests for the -i -k -v -V -W options


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/opt-ignore.exp \
src/usr.bin/make/unit-tests/opt-keep-going.exp \
src/usr.bin/make/unit-tests/opt-var-expanded.exp \
src/usr.bin/make/unit-tests/opt-var-literal.exp \
src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-ignore.mk \
src/usr.bin/make/unit-tests/opt-keep-going.mk \
src/usr.bin/make/unit-tests/opt-var-expanded.mk \
src/usr.bin/make/unit-tests/opt-var-literal.mk \
src/usr.bin/make/unit-tests/opt-warnings-as-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/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.117 src/usr.bin/make/unit-tests/Makefile:1.118
--- src/usr.bin/make/unit-tests/Makefile:1.117	Sun Aug 23 13:50:17 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sun Aug 23 14:28:04 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.117 2020/08/23 13:50:17 rillig Exp $
+# $NetBSD: Makefile,v 1.118 2020/08/23 14:28:04 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -325,8 +325,13 @@ FLAGS.doterror=		# none
 FLAGS.envfirst=		-e
 FLAGS.export=		# none
 FLAGS.lint=		-dL -k
+FLAGS.opt-ignore=	-i
+FLAGS.opt-keep-going=	-k
 FLAGS.opt-no-action=	-n
 FLAGS.opt-query=	-q
+FLAGS.opt-var-expanded=	-v VAR -v VALUE
+FLAGS.opt-var-literal=	-V VAR -V VALUE
+FLAGS.opt-warnings-as-errors= -W
 FLAGS.order=		-j1
 FLAGS.recursive=	-dL
 FLAGS.vardebug=		-k -dv FROM_CMDLINE=

Index: src/usr.bin/make/unit-tests/opt-ignore.exp
diff -u src/usr.bin/make/unit-tests/opt-ignore.exp:1.1 src/usr.bin/make/unit-tests/opt-ignore.exp:1.2
--- src/usr.bin/make/unit-tests/opt-ignore.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-ignore.exp	Sun Aug 23 14:28:04 2020
@@ -1 +1,12 @@
+dependency 1
+dependency 2
+dependency 3
+other 1
+other 2
+main 1
+main 2
+*** Error code 1 (ignored)
+*** Error code 7 (ignored)
+*** Error code 1 (ignored)
+*** Error code 1 (ignored)
 exit status 0
Index: src/usr.bin/make/unit-tests/opt-keep-going.exp
diff -u src/usr.bin/make/unit-tests/opt-keep-going.exp:1.1 src/usr.bin/make/unit-tests/opt-keep-going.exp:1.2
--- src/usr.bin/make/unit-tests/opt-keep-going.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-keep-going.exp	Sun Aug 23 14:28:04 2020
@@ -1 +1,6 @@
+dependency 1
+other 1
+*** Error code 1 (continuing)
+*** Error code 1 (continuing)
+`all' not remade because of errors.
 exit status 0
Index: src/usr.bin/make/unit-tests/opt-var-expanded.exp
diff -u src/usr.bin/make/unit-tests/opt-var-expanded.exp:1.1 src/usr.bin/make/unit-tests/opt-var-expanded.exp:1.2
--- src/usr.bin/make/unit-tests/opt-var-expanded.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-var-expanded.exp	Sun Aug 23 14:28:04 2020
@@ -1 +1,3 @@
+other value $$
+value
 exit status 0
Index: src/usr.bin/make/unit-tests/opt-var-literal.exp
diff -u src/usr.bin/make/unit-tests/opt-var-literal.exp:1.1 src/usr.bin/make/unit-tests/opt-var-literal.exp:1.2
--- src/usr.bin/make/unit-tests/opt-var-literal.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-var-literal.exp	Sun Aug 23 14:28:04 2020
@@ -1 +1,3 @@
+other ${VALUE} 
+value
 exit status 0
Index: src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp
diff -u src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp:1.1 src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp:1.2
--- src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp	Sun Aug 23 14:28:04 2020
@@ -1 +1,7 @@
-exit status 0
+make: "opt-warnings-as-errors.mk" line 5: warning: message 1
+make: parsing warnings being treated as errors
+make: "opt-warnings-as-errors.mk" line 6: warning: message 2
+parsing continues
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1

Index: src/usr.bin/make/unit-tests/opt-ignore.mk
diff -u src/usr.bin/make/unit-tests/opt-ignore.mk:1.2 src/usr.bin/make/unit-tests/opt-ignore.mk:1.3
--- src/usr.bin/make/unit-tests/opt-ignore.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/opt-ignore.mk	Sun Aug 23 14:28:04 2020
@@ -1,8 +1,30 @@
-# $NetBSD: opt-ignore.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt-ignore.mk,v 1.3 2020/08/23 14:28:04 rillig Exp $
 #
-# Tests for the 

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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 14:28:04 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: Makefile opt-ignore.exp opt-ignore.mk
opt-keep-going.exp opt-keep-going.mk opt-var-expanded.exp
opt-var-expanded.mk opt-var-literal.exp opt-var-literal.mk
opt-warnings-as-errors.exp opt-warnings-as-errors.mk

Log Message:
make(1): add tests for the -i -k -v -V -W options


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/opt-ignore.exp \
src/usr.bin/make/unit-tests/opt-keep-going.exp \
src/usr.bin/make/unit-tests/opt-var-expanded.exp \
src/usr.bin/make/unit-tests/opt-var-literal.exp \
src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-ignore.mk \
src/usr.bin/make/unit-tests/opt-keep-going.mk \
src/usr.bin/make/unit-tests/opt-var-expanded.mk \
src/usr.bin/make/unit-tests/opt-var-literal.mk \
src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk

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



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 17:04:21 UTC 2020

Modified Files:
src/usr.bin/make: lst.h make.h metachar.h

Log Message:
make(1): remove unused declarations from header files


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/make/lst.h
cvs rdiff -u -r1.124 -r1.125 src/usr.bin/make/make.h
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/metachar.h

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

Modified files:

Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.42 src/usr.bin/make/lst.h:1.43
--- src/usr.bin/make/lst.h:1.42	Sun Aug 23 16:59:44 2020
+++ src/usr.bin/make/lst.h	Sun Aug 23 17:04:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lst.h,v 1.42 2020/08/23 16:59:44 rillig Exp $	*/
+/*	$NetBSD: lst.h,v 1.43 2020/08/23 17:04:21 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -115,7 +115,6 @@ Boolean		Lst_IsEmpty(Lst);
 /* Insert an element before another */
 void		Lst_InsertBeforeS(Lst, LstNode, void *);
 /* Place an element at the front of a lst. */
-ReturnStatus	Lst_AtFront(Lst, void *);
 void		Lst_PrependS(Lst, void *);
 /* Place an element at the end of a lst. */
 void		Lst_AppendS(Lst, void *);

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.124 src/usr.bin/make/make.h:1.125
--- src/usr.bin/make/make.h:1.124	Sun Aug 23 08:26:03 2020
+++ src/usr.bin/make/make.h	Sun Aug 23 17:04:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.124 2020/08/23 08:26:03 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.125 2020/08/23 17:04:21 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -420,7 +420,6 @@ extern GNode	*VAR_INTERNAL;	/* Variables
 extern GNode*VAR_GLOBAL;   	/* Variables defined in a global context, e.g
  * in the Makefile itself */
 extern GNode*VAR_CMD;	/* Variables defined on the command line */
-extern GNode	*VAR_FOR;	/* Iteration variables */
 extern char	var_Error[];   	/* Value returned by Var_Parse when an error
  * is encountered. It actually points to
  * an empty string, so naive callers needn't

Index: src/usr.bin/make/metachar.h
diff -u src/usr.bin/make/metachar.h:1.5 src/usr.bin/make/metachar.h:1.6
--- src/usr.bin/make/metachar.h:1.5	Thu Aug 13 03:54:57 2020
+++ src/usr.bin/make/metachar.h	Sun Aug 23 17:04:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: metachar.h,v 1.5 2020/08/13 03:54:57 rillig Exp $	*/
+/*	$NetBSD: metachar.h,v 1.6 2020/08/23 17:04:21 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -38,15 +38,6 @@ extern unsigned char _metachar[];
 #define ismeta(c)	_metachar[(c) & 0x7f]
 
 static inline int
-hasmeta(const char *cmd)
-{
-	while (!ismeta(*cmd))
-		cmd++;
-
-	return *cmd != '\0';
-}
-
-static inline int
 needshell(const char *cmd, int white)
 {
 	while (!ismeta(*cmd) && *cmd != ':' && *cmd != '=') {



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 17:04:21 UTC 2020

Modified Files:
src/usr.bin/make: lst.h make.h metachar.h

Log Message:
make(1): remove unused declarations from header files


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/make/lst.h
cvs rdiff -u -r1.124 -r1.125 src/usr.bin/make/make.h
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/metachar.h

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



CVS commit: src/tests/fs/lfs

2020-08-23 Thread Konrad Schroder
Module Name:src
Committed By:   perseant
Date:   Sun Aug 23 16:03:54 UTC 2020

Modified Files:
src/tests/fs/lfs: t_rfw.c

Log Message:
Expand test to cover more failure cases.  Change from skipped to expect fail
in anticipation of working roll-forward code.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/lfs/t_rfw.c

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



CVS commit: src/tests/fs/lfs

2020-08-23 Thread Konrad Schroder
Module Name:src
Committed By:   perseant
Date:   Sun Aug 23 16:03:54 UTC 2020

Modified Files:
src/tests/fs/lfs: t_rfw.c

Log Message:
Expand test to cover more failure cases.  Change from skipped to expect fail
in anticipation of working roll-forward code.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/lfs/t_rfw.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/fs/lfs/t_rfw.c
diff -u src/tests/fs/lfs/t_rfw.c:1.1 src/tests/fs/lfs/t_rfw.c:1.2
--- src/tests/fs/lfs/t_rfw.c:1.1	Tue Aug 18 03:02:50 2020
+++ src/tests/fs/lfs/t_rfw.c	Sun Aug 23 16:03:54 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: t_rfw.c,v 1.1 2020/08/18 03:02:50 perseant Exp $	*/
+/*	$NetBSD: t_rfw.c,v 1.2 2020/08/23 16:03:54 perseant Exp $	*/
 
 #include 
 #include 
-#include 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -25,7 +25,6 @@
 
 /* Debugging conditions */
 /* #define FORCE_SUCCESS */ /* Don't actually revert, everything worked */
-/* #define FORCE_SYSCTL */ /* Don't check - necessary for FORCE_SUCCESS */
 
 /* Write a well-known byte pattern into a file, appending if it exists */
 int write_file(const char *, int);
@@ -33,6 +32,12 @@ int write_file(const char *, int);
 /* Check the byte pattern and size of the file */
 int check_file(const char *, int);
 
+/* Check the file system for consistency */
+int fsck(void);
+
+/* Actually run the test, differentiating the orphaned delete problem */
+void test(int);
+
 ATF_TC(rfw);
 ATF_TC_HEAD(rfw, tc)
 {
@@ -41,42 +46,39 @@ ATF_TC_HEAD(rfw, tc)
 	atf_tc_set_md_var(tc, "timeout", "20");
 }
 
+#define MAXLINE 132
+#define CHUNKSIZE 300
+
 #define IMGNAME "disk.img"
 #define FAKEBLK "/dev/blk"
 #define LOGFILE "newfs.log"
 #define SBLOCK0_COPY "sb0.dd"
 #define SBLOCK1_COPY "sb1.dd"
-#define MAXLINE 132
-#define CHUNKSIZE 300
+
+#define MP "/mp"
+#define UNCHANGED_CONTROL MP "/3-unchanged-control"
+#define TO_BE_DELETED MP "/4-to-be-deleted"
+#define TO_BE_APPENDEDMP "/5-to-be-appended"
+#define NEWLY_CREATED MP "/6-newly-created"
+
+long long sbaddr[2] = { -1, -1 };
+const char *sblock[2] = { SBLOCK0_COPY, SBLOCK1_COPY };
+
 ATF_TC_BODY(rfw, tc)
 {
 	struct ufs_args args;
 	FILE *pipe;
-#if (!defined FORCE_SUCCESS && !defined FORCE_SYSCTL)
-	int o_sysctl_rfw;
-	int n_sysctl_rfw;
-	int mib[3];
-	size_t len;
-#endif
 	char buf[MAXLINE];
-	long long sb0addr = -1, sb1addr = -1;
+	int i;
+
+	setvbuf(stdout, NULL, _IONBF, 0);
 
 	/*
 	 * Initialize.
 	 */
-#if (!defined FORCE_SUCCESS && !defined FORCE_SYSCTL)
-	/* Set sysctl to allow roll-forward */
-	fprintf(stderr, "* Set sysctl\n");
-	mib[0] = CTL_VFS;
-	mib[1] = 5; /* LFS */
-	mib[2] = LFS_DO_RFW;
-	len = sizeof(o_sysctl_rfw);
-	if (sysctl(mib, 3, _sysctl_rfw, ,
-		_sysctl_rfw, sizeof(n_sysctl_rfw)) < 0)
-		atf_tc_skip("roll-forward not enabled in kernel");
-#endif /* !FORCE_SUCCESS && !FORCE_SYSCTL */
+	atf_tc_expect_fail("roll-forward not yet implemented");
 
-	/* Create filesystem */
+	/* Create filesystem, note superblock locations */
 	fprintf(stderr, "* Create file system\n");
 	if (system("newfs_lfs -D -F -s 1 ./" IMGNAME " > " LOGFILE) == -1)
 		atf_tc_fail_errno("newfs failed");
@@ -84,20 +86,20 @@ ATF_TC_BODY(rfw, tc)
 	if (pipe == NULL)
 		atf_tc_fail_errno("newfs failed to execute");
 	while (fgets(buf, MAXLINE, pipe) != NULL) {
-		if (sscanf(buf, "%lld,%lld", , ) == 2)
+		if (sscanf(buf, "%lld,%lld", sbaddr, sbaddr + 1) == 2)
 			break;
 	}
 	while (fgets(buf, MAXLINE, pipe) != NULL)
 		;
 	fclose(pipe);
-	if (sb0addr < 0 || sb1addr < 0)
+	if (sbaddr[0] < 0 || sbaddr[1] < 0)
 		atf_tc_fail("superblock not found");
 	fprintf(stderr, "* Superblocks at %lld and %lld\n",
-		sb0addr, sb1addr);
+		sbaddr[0], sbaddr[1]);
 
 	/* Set up rump */
 	rump_init();
-	if (rump_sys_mkdir("/mp", 0777) == -1)
+	if (rump_sys_mkdir(MP, 0777) == -1)
 		atf_tc_fail_errno("cannot create mountpoint");
 	rump_pub_etfs_register(FAKEBLK, IMGNAME, RUMP_ETFS_BLK);
 
@@ -107,61 +109,63 @@ ATF_TC_BODY(rfw, tc)
 	 */
 
 	/* Mount filesystem */
-	fprintf(stderr, "* Mount fs [1]\n");
+	fprintf(stderr, "* Mount fs [1, initial]\n");
 	memset(, 0, sizeof(args));
 	args.fspec = __UNCONST(FAKEBLK);
-	if (rump_sys_mount(MOUNT_LFS, "/mp", 0, , sizeof(args)) == -1)
+	if (rump_sys_mount(MOUNT_LFS, MP, 0, , sizeof(args)) == -1)
 		atf_tc_fail_errno("rump_sys_mount failed");
 
 	/* Payload */
 	fprintf(stderr, "* Initial payload\n");
-	write_file("/mp/to_be_deleted", CHUNKSIZE);
-	write_file("/mp/to_be_appended", CHUNKSIZE);
-
-	/* Unmount */
-	rump_sys_unmount("/mp", 0);
+	write_file(UNCHANGED_CONTROL, CHUNKSIZE);
+	write_file(TO_BE_DELETED, CHUNKSIZE);
+	write_file(TO_BE_APPENDED, CHUNKSIZE);
+	rump_sys_sync();
+	rump_sys_sync();
+	sleep(1); /* XXX yuck - but we need the superblocks dirty */
 
 	/* Make copies of superblocks */
-	sprintf(buf, "dd if=%s of=%s bs=512 iseek=%lld count=16 conv=sync",

CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 16:59:44 UTC 2020

Modified Files:
src/usr.bin/make: lst.h

Log Message:
make(1): remove parameter names from function prototypes

Thanks kre for noticing.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/make/lst.h

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

Modified files:

Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.41 src/usr.bin/make/lst.h:1.42
--- src/usr.bin/make/lst.h:1.41	Sun Aug 23 16:58:02 2020
+++ src/usr.bin/make/lst.h	Sun Aug 23 16:59:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lst.h,v 1.41 2020/08/23 16:58:02 rillig Exp $	*/
+/*	$NetBSD: lst.h,v 1.42 2020/08/23 16:59:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -122,8 +122,8 @@ void		Lst_AppendS(Lst, void *);
 /* Remove an element */
 void		Lst_RemoveS(Lst, LstNode);
 /* Replace a node with a new value */
-void		LstNode_SetS(LstNode node, void *datum);
-void		LstNode_SetNullS(LstNode node);
+void		LstNode_SetS(LstNode, void *);
+void		LstNode_SetNullS(LstNode);
 void		Lst_PrependAllS(Lst, Lst);
 void		Lst_AppendAllS(Lst, Lst);
 void		Lst_MoveAllS(Lst, Lst);



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 16:59:44 UTC 2020

Modified Files:
src/usr.bin/make: lst.h

Log Message:
make(1): remove parameter names from function prototypes

Thanks kre for noticing.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/make/lst.h

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



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 16:58:03 UTC 2020

Modified Files:
src/usr.bin/make: arch.c cond.c dir.c lst.c lst.h main.c meta.c suff.c

Log Message:
make(1): reverse order of the Lst_Find parameters

The other callbacks all have (function, param), only the Lst_Find had
(param, function), which was inconsistent.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/usr.bin/make/arch.c
cvs rdiff -u -r1.99 -r1.100 src/usr.bin/make/cond.c
cvs rdiff -u -r1.109 -r1.110 src/usr.bin/make/dir.c
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/make/lst.c src/usr.bin/make/lst.h
cvs rdiff -u -r1.310 -r1.311 src/usr.bin/make/main.c
cvs rdiff -u -r1.98 -r1.99 src/usr.bin/make/meta.c
cvs rdiff -u -r1.113 -r1.114 src/usr.bin/make/suff.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/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 16:58:03 UTC 2020

Modified Files:
src/usr.bin/make: arch.c cond.c dir.c lst.c lst.h main.c meta.c suff.c

Log Message:
make(1): reverse order of the Lst_Find parameters

The other callbacks all have (function, param), only the Lst_Find had
(param, function), which was inconsistent.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/usr.bin/make/arch.c
cvs rdiff -u -r1.99 -r1.100 src/usr.bin/make/cond.c
cvs rdiff -u -r1.109 -r1.110 src/usr.bin/make/dir.c
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/make/lst.c src/usr.bin/make/lst.h
cvs rdiff -u -r1.310 -r1.311 src/usr.bin/make/main.c
cvs rdiff -u -r1.98 -r1.99 src/usr.bin/make/meta.c
cvs rdiff -u -r1.113 -r1.114 src/usr.bin/make/suff.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.91 src/usr.bin/make/arch.c:1.92
--- src/usr.bin/make/arch.c:1.91	Sat Aug 22 21:58:27 2020
+++ src/usr.bin/make/arch.c	Sun Aug 23 16:58:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.91 2020/08/22 21:58:27 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.92 2020/08/23 16:58:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.91 2020/08/22 21:58:27 rillig Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.92 2020/08/23 16:58:02 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.91 2020/08/22 21:58:27 rillig Exp $");
+__RCSID("$NetBSD: arch.c,v 1.92 2020/08/23 16:58:02 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -542,7 +542,7 @@ ArchStatMember(const char *archive, cons
 	member = base + 1;
 }
 
-ln = Lst_Find(archives, archive, ArchFindArchive);
+ln = Lst_Find(archives, ArchFindArchive, archive);
 if (ln != NULL) {
 	ar = Lst_DatumS(ln);
 

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.99 src/usr.bin/make/cond.c:1.100
--- src/usr.bin/make/cond.c:1.99	Sat Aug 22 21:42:38 2020
+++ src/usr.bin/make/cond.c	Sun Aug 23 16:58:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.99 2020/08/22 21:42:38 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.100 2020/08/23 16:58:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.99 2020/08/22 21:42:38 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.100 2020/08/23 16:58:02 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.99 2020/08/22 21:42:38 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.100 2020/08/23 16:58:02 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -284,7 +284,7 @@ CondFindStrMatch(const void *string, con
 static Boolean
 CondDoMake(int argLen MAKE_ATTR_UNUSED, const char *arg)
 {
-return Lst_Find(create, arg, CondFindStrMatch) != NULL;
+return Lst_Find(create, CondFindStrMatch, arg) != NULL;
 }
 
 /* See if the given file exists. */

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.109 src/usr.bin/make/dir.c:1.110
--- src/usr.bin/make/dir.c:1.109	Sat Aug 22 23:06:51 2020
+++ src/usr.bin/make/dir.c	Sun Aug 23 16:58:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.109 2020/08/22 23:06:51 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.110 2020/08/23 16:58:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.109 2020/08/22 23:06:51 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.110 2020/08/23 16:58:02 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.109 2020/08/22 23:06:51 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.110 2020/08/23 16:58:02 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1560,7 +1560,7 @@ Dir_AddDir(Lst path, const char *name)
 struct dirent *dp;		/* entry in directory */
 
 if (strcmp(name, ".DOTLAST") == 0) {
-	ln = Lst_Find(path, name, DirFindName);
+	ln = Lst_Find(path, DirFindName, name);
 	if (ln != NULL)
 	return Lst_DatumS(ln);
 	else {
@@ -1573,7 +1573,7 @@ Dir_AddDir(Lst path, const char *name)
 }
 
 if (path)
-	ln = Lst_Find(openDirectories, name, DirFindName);
+	ln = Lst_Find(openDirectories, DirFindName, name);
 if (ln != NULL) {
 	p = Lst_DatumS(ln);
 	if (path && Lst_MemberS(path, p) == NULL) {

Index: src/usr.bin/make/lst.c
diff -u src/usr.bin/make/lst.c:1.40 src/usr.bin/make/lst.c:1.41
--- src/usr.bin/make/lst.c:1.40	Sun Aug 23 16:43:34 2020
+++ src/usr.bin/make/lst.c	Sun Aug 23 

CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 18:26:35 UTC 2020

Modified Files:
src/usr.bin/make: compat.c for.c job.c main.c nonints.h str.c var.c

Log Message:
make(1): make brk_string return size_t for the number of words


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/usr.bin/make/compat.c
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/make/for.c
cvs rdiff -u -r1.214 -r1.215 src/usr.bin/make/job.c
cvs rdiff -u -r1.311 -r1.312 src/usr.bin/make/main.c
cvs rdiff -u -r1.97 -r1.98 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/make/str.c
cvs rdiff -u -r1.464 -r1.465 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/compat.c
diff -u src/usr.bin/make/compat.c:1.127 src/usr.bin/make/compat.c:1.128
--- src/usr.bin/make/compat.c:1.127	Sun Aug 23 10:53:27 2020
+++ src/usr.bin/make/compat.c	Sun Aug 23 18:26:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.127 2020/08/23 10:53:27 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.128 2020/08/23 18:26:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.127 2020/08/23 10:53:27 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.128 2020/08/23 18:26:35 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.127 2020/08/23 10:53:27 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.128 2020/08/23 18:26:35 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -221,8 +221,6 @@ CompatRunCommand(void *cmdp, void *gnp)
 LstNode 	  cmdNode;  	/* Node where current command is located */
 const char  ** volatile av;	/* Argument vector for thing to exec */
 char	** volatile mav;/* Copy of the argument vector for freeing */
-int		  argc;		/* Number of arguments in av or 0 if not
- * dynamically allocated */
 Boolean 	  useShell;	/* TRUE if command should be executed
  * using a shell */
 char	  * volatile cmd = (char *)cmdp;
@@ -350,15 +348,15 @@ again:
 	shargv[shargc++] = cmd;
 	shargv[shargc++] = NULL;
 	av = shargv;
-	argc = 0;
 	bp = NULL;
 	mav = NULL;
 } else {
+size_t argc;
 	/*
 	 * No meta-characters, so no need to exec a shell. Break the command
 	 * into words to form an argument vector we can execute.
 	 */
-	mav = brk_string(cmd, , TRUE, );
+	mav = brk_string(cmd, TRUE, , );
 	if (mav == NULL) {
 		useShell = 1;
 		goto again;

Index: src/usr.bin/make/for.c
diff -u src/usr.bin/make/for.c:1.64 src/usr.bin/make/for.c:1.65
--- src/usr.bin/make/for.c:1.64	Sat Aug 22 21:42:38 2020
+++ src/usr.bin/make/for.c	Sun Aug 23 18:26:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.64 2020/08/22 21:42:38 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.65 2020/08/23 18:26:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -30,14 +30,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: for.c,v 1.64 2020/08/22 21:42:38 rillig Exp $";
+static char rcsid[] = "$NetBSD: for.c,v 1.65 2020/08/23 18:26:35 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)for.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: for.c,v 1.64 2020/08/22 21:42:38 rillig Exp $");
+__RCSID("$NetBSD: for.c,v 1.65 2020/08/23 18:26:35 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -141,11 +141,11 @@ For_Eval(char *line)
 {
 For *new_for;
 char *ptr = line, *sub;
-int len;
+size_t len;
 int escapes;
 unsigned char ch;
 char **words, *word_buf;
-int n, nwords;
+size_t nwords;
 
 /* Skip the '.' and any following whitespace */
 for (ptr++; *ptr && isspace((unsigned char)*ptr); ptr++)
@@ -214,11 +214,13 @@ For_Eval(char *line)
 /*
  * Split into words allowing for quoted strings.
  */
-words = brk_string(sub, , FALSE, _buf);
+words = brk_string(sub, FALSE, , _buf);
 
 free(sub);
 
 if (words != NULL) {
+size_t n;
+
 	for (n = 0; n < nwords; n++) {
 	ptr = words[n];
 	if (!*ptr)
@@ -252,8 +254,8 @@ For_Eval(char *line)
 	if ((len = strlist_num(_for->items)) > 0 &&
 	len % (n = strlist_num(_for->vars))) {
 	Parse_Error(PARSE_FATAL,
-			"Wrong number of words (%d) in .for substitution list"
-			" with %d vars", len, n);
+			"Wrong number of words (%zu) in .for substitution list"
+			" with %zu vars", len, n);
 	/*
 	 * Return 'success' so that the body of the .for loop is
 	 * accumulated.

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.214 src/usr.bin/make/job.c:1.215
--- src/usr.bin/make/job.c:1.214	Sat Aug 22 21:42:38 2020
+++ src/usr.bin/make/job.c	Sun Aug 23 18:26:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.214 

CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 18:26:35 UTC 2020

Modified Files:
src/usr.bin/make: compat.c for.c job.c main.c nonints.h str.c var.c

Log Message:
make(1): make brk_string return size_t for the number of words


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/usr.bin/make/compat.c
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/make/for.c
cvs rdiff -u -r1.214 -r1.215 src/usr.bin/make/job.c
cvs rdiff -u -r1.311 -r1.312 src/usr.bin/make/main.c
cvs rdiff -u -r1.97 -r1.98 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/make/str.c
cvs rdiff -u -r1.464 -r1.465 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.



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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 14:46:33 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: Makefile sh-leading-plus.exp
sh-leading-plus.mk

Log Message:
make(1): add test for + commands with the -n command line option


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/sh-leading-plus.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/sh-leading-plus.mk

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



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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 14:46:33 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: Makefile sh-leading-plus.exp
sh-leading-plus.mk

Log Message:
make(1): add test for + commands with the -n command line option


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/sh-leading-plus.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/sh-leading-plus.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/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.118 src/usr.bin/make/unit-tests/Makefile:1.119
--- src/usr.bin/make/unit-tests/Makefile:1.118	Sun Aug 23 14:28:04 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sun Aug 23 14:46:33 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.118 2020/08/23 14:28:04 rillig Exp $
+# $NetBSD: Makefile,v 1.119 2020/08/23 14:46:33 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -334,6 +334,7 @@ FLAGS.opt-var-literal=	-V VAR -V VALUE
 FLAGS.opt-warnings-as-errors= -W
 FLAGS.order=		-j1
 FLAGS.recursive=	-dL
+FLAGS.sh-leading-plus=	-n
 FLAGS.vardebug=		-k -dv FROM_CMDLINE=
 FLAGS.varmod-match-escape= -dv
 FLAGS.varname-dot-shell= -dpv

Index: src/usr.bin/make/unit-tests/sh-leading-plus.exp
diff -u src/usr.bin/make/unit-tests/sh-leading-plus.exp:1.1 src/usr.bin/make/unit-tests/sh-leading-plus.exp:1.2
--- src/usr.bin/make/unit-tests/sh-leading-plus.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/sh-leading-plus.exp	Sun Aug 23 14:46:33 2020
@@ -1 +1,4 @@
+echo 'this command is not run'
+echo 'this command is run'
+this command is run
 exit status 0

Index: src/usr.bin/make/unit-tests/sh-leading-plus.mk
diff -u src/usr.bin/make/unit-tests/sh-leading-plus.mk:1.2 src/usr.bin/make/unit-tests/sh-leading-plus.mk:1.3
--- src/usr.bin/make/unit-tests/sh-leading-plus.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/sh-leading-plus.mk	Sun Aug 23 14:46:33 2020
@@ -1,9 +1,8 @@
-# $NetBSD: sh-leading-plus.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: sh-leading-plus.mk,v 1.3 2020/08/23 14:46:33 rillig Exp $
 #
 # Tests for shell commands preceded by a '+', to run them even if
 # the command line option -n is given.
 
-# TODO: Implementation
-
 all:
-	@:;
+	@echo 'this command is not run'
+	@+echo 'this command is run'



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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 15:13:22 UTC 2020

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

Log Message:
make(1): move tests for :hash :range :localtime into separate files


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/make/unit-tests/modmisc.exp \
src/usr.bin/make/unit-tests/modmisc.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-hash.exp \
src/usr.bin/make/unit-tests/varmod-localtime.exp \
src/usr.bin/make/unit-tests/varmod-range.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-hash.mk \
src/usr.bin/make/unit-tests/varmod-localtime.mk \
src/usr.bin/make/unit-tests/varmod-range.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/modmisc.exp
diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.44 src/usr.bin/make/unit-tests/modmisc.exp:1.45
--- src/usr.bin/make/unit-tests/modmisc.exp:1.44	Sun Aug 23 15:09:15 2020
+++ src/usr.bin/make/unit-tests/modmisc.exp	Sun Aug 23 15:13:21 2020
@@ -21,25 +21,4 @@ line
 mod-break-many-words: 500
 mod-remember: 1 2 3 1 2 3 1 2 3
 mod-remember: 1 2 3, SAVED=3
-mod-localtime:
-%Y
-2020
-%Y
-mod-hash:
-make: Unknown modifier 'h'
-
-26bb0f5f
-12345
-make: Unknown modifier 'h'
-
-make: Unknown modifier 'h'
-
-mod-range:
-make: Unknown modifier 'r'
-
-1 2 3
-make: Unknown modifier 'r'
-
-make: Unknown modifier 'r'
-
 exit status 0
Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.44 src/usr.bin/make/unit-tests/modmisc.mk:1.45
--- src/usr.bin/make/unit-tests/modmisc.mk:1.44	Sun Aug 23 15:09:15 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Sun Aug 23 15:13:21 2020
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.44 2020/08/23 15:09:15 rillig Exp $
+# $Id: modmisc.mk,v 1.45 2020/08/23 15:13:21 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -20,9 +20,6 @@ all:	mod-tu-space
 all:	mod-quote
 all:	mod-break-many-words
 all:	mod-remember
-all:	mod-localtime
-all:	mod-hash
-all:	mod-range
 
 # See also sysv.mk.
 modsysv:
@@ -82,27 +79,6 @@ mod-remember:
 	@echo $@: ${1 2 3:L:_:@var@${_}@}
 	@echo $@: ${1 2 3:L:@var@${var:_=SAVED:}@}, SAVED=${SAVED}
 
-mod-localtime:
-	@echo $@:
-	@echo ${%Y:L:localtim=1593536400}	# modifier name too short
-	@echo ${%Y:L:localtime=1593536400}	# 2020-07-01T00:00:00Z
-	@echo ${%Y:L:localtimer=1593536400}	# modifier name too long
-
-mod-hash:
-	@echo $@:
-	@echo ${12345:L:has}			# modifier name too short
-	@echo ${12345:L:hash}			# ok
-	@echo ${12345:L:hash=SHA-256}		# :hash does not accept '='
-	@echo ${12345:L:hasX}			# misspelled
-	@echo ${12345:L:hashed}			# modifier name too long
-
-mod-range:
-	@echo $@:
-	@echo ${a b c:L:rang}			# modifier name too short
-	@echo ${a b c:L:range}			# ok
-	@echo ${a b c:L:rango}			# misspelled
-	@echo ${a b c:L:ranger}			# modifier name too long
-
 # To apply a modifier indirectly via another variable, the whole
 # modifier must be put into a single variable.
 .if ${value:L:${:US}${:U,value,replacement,}} != "S,value,replacement,}"

Index: src/usr.bin/make/unit-tests/varmod-hash.exp
diff -u src/usr.bin/make/unit-tests/varmod-hash.exp:1.1 src/usr.bin/make/unit-tests/varmod-hash.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-hash.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-hash.exp	Sun Aug 23 15:13:21 2020
@@ -1 +1,9 @@
+make: Unknown modifier 'h'
+
+26bb0f5f
+12345
+make: Unknown modifier 'h'
+
+make: Unknown modifier 'h'
+
 exit status 0
Index: src/usr.bin/make/unit-tests/varmod-localtime.exp
diff -u src/usr.bin/make/unit-tests/varmod-localtime.exp:1.1 src/usr.bin/make/unit-tests/varmod-localtime.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-localtime.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-localtime.exp	Sun Aug 23 15:13:21 2020
@@ -1 +1,4 @@
+%Y
+2020
+%Y
 exit status 0
Index: src/usr.bin/make/unit-tests/varmod-range.exp
diff -u src/usr.bin/make/unit-tests/varmod-range.exp:1.1 src/usr.bin/make/unit-tests/varmod-range.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-range.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-range.exp	Sun Aug 23 15:13:21 2020
@@ -1 +1,8 @@
+make: Unknown modifier 'r'
+
+1 2 3
+make: Unknown modifier 'r'
+
+make: Unknown modifier 'r'
+
 exit status 0

Index: src/usr.bin/make/unit-tests/varmod-hash.mk
diff -u src/usr.bin/make/unit-tests/varmod-hash.mk:1.2 src/usr.bin/make/unit-tests/varmod-hash.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-hash.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varmod-hash.mk	Sun Aug 23 15:13:21 2020
@@ -1,8 +1,10 @@
-# $NetBSD: varmod-hash.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-hash.mk,v 1.3 2020/08/23 15:13:21 

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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 15:13:22 UTC 2020

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

Log Message:
make(1): move tests for :hash :range :localtime into separate files


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/make/unit-tests/modmisc.exp \
src/usr.bin/make/unit-tests/modmisc.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-hash.exp \
src/usr.bin/make/unit-tests/varmod-localtime.exp \
src/usr.bin/make/unit-tests/varmod-range.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-hash.mk \
src/usr.bin/make/unit-tests/varmod-localtime.mk \
src/usr.bin/make/unit-tests/varmod-range.mk

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



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 17:22:52 UTC 2020

Modified Files:
src/usr.bin/make: Makefile

Log Message:
make(1): allow to run only selected tests via the command line


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/usr.bin/make/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/Makefile
diff -u src/usr.bin/make/Makefile:1.91 src/usr.bin/make/Makefile:1.92
--- src/usr.bin/make/Makefile:1.91	Sat Aug 22 20:50:43 2020
+++ src/usr.bin/make/Makefile	Sun Aug 23 17:22:52 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.91 2020/08/22 20:50:43 sjg Exp $
+#	$NetBSD: Makefile,v 1.92 2020/08/23 17:22:52 rillig Exp $
 #	@(#)Makefile	5.2 (Berkeley) 12/28/90
 
 PROG=	make
@@ -168,7 +168,7 @@ COPTS+=		-Wdeclaration-after-statement
 TEST_MAKE ?= ${.OBJDIR}/${PROG:T}
 test: .MAKE
 	cd ${.CURDIR}/unit-tests \
-	&& MAKEFLAGS= ${TEST_MAKE} -r -m / TEST_MAKE=${TEST_MAKE} ${.TARGET}
+	&& MAKEFLAGS= ${TEST_MAKE} -r -m / TEST_MAKE=${TEST_MAKE} ${TESTS:DTESTS=${TESTS:Q}} ${.TARGET}
 .if ${USE_COVERAGE} == yes
 	${GCOV} ${GCOV_OPTS} ${SRCS}
 	sed -i 's,^\([^:]*\): *[0-9]*:,\1: ,' *.gcov



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 17:22:52 UTC 2020

Modified Files:
src/usr.bin/make: Makefile

Log Message:
make(1): allow to run only selected tests via the command line


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/usr.bin/make/Makefile

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



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

2020-08-23 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sun Aug 23 11:04:58 UTC 2020

Modified Files:
src/tests/lib/libc/gen: t_fpsetmask.c

Log Message:
Expect failure only when running under qemu's TCG CPU emulation, not
when running under hardware virtualization such as qemu -accel nvmm.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/tests/lib/libc/gen/t_fpsetmask.c

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

Modified files:

Index: src/tests/lib/libc/gen/t_fpsetmask.c
diff -u src/tests/lib/libc/gen/t_fpsetmask.c:1.20 src/tests/lib/libc/gen/t_fpsetmask.c:1.21
--- src/tests/lib/libc/gen/t_fpsetmask.c:1.20	Thu Apr 25 20:48:54 2019
+++ src/tests/lib/libc/gen/t_fpsetmask.c	Sun Aug 23 11:04:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fpsetmask.c,v 1.20 2019/04/25 20:48:54 kamil Exp $ */
+/*	$NetBSD: t_fpsetmask.c,v 1.21 2020/08/23 11:04:58 gson Exp $ */
 
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -311,7 +311,7 @@ sigfpe(int s, siginfo_t *si, void *c)
 	\
 		FPU_PREREQ();		\
 	\
-		if (isQEMU())		\
+		if (isQEMU_TCG())	\
 			atf_tc_expect_fail("PR misc/44767");		\
 	\
 		m(t##_ops);		\



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

2020-08-23 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sun Aug 23 11:04:58 UTC 2020

Modified Files:
src/tests/lib/libc/gen: t_fpsetmask.c

Log Message:
Expect failure only when running under qemu's TCG CPU emulation, not
when running under hardware virtualization such as qemu -accel nvmm.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/tests/lib/libc/gen/t_fpsetmask.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/make/unit-tests

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 15:09:15 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk
varmod-extension.exp varmod-extension.mk varmod-head.exp
varmod-head.mk varmod-root.exp varmod-root.mk varmod-tail.exp
varmod-tail.mk

Log Message:
make(1): move tests for :H :E :R :T into separate files


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/make/unit-tests/modmisc.exp \
src/usr.bin/make/unit-tests/modmisc.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-extension.exp \
src/usr.bin/make/unit-tests/varmod-head.exp \
src/usr.bin/make/unit-tests/varmod-root.exp \
src/usr.bin/make/unit-tests/varmod-tail.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-extension.mk \
src/usr.bin/make/unit-tests/varmod-head.mk \
src/usr.bin/make/unit-tests/varmod-root.mk \
src/usr.bin/make/unit-tests/varmod-tail.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/modmisc.exp
diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.43 src/usr.bin/make/unit-tests/modmisc.exp:1.44
--- src/usr.bin/make/unit-tests/modmisc.exp:1.43	Sun Aug 16 12:48:55 2020
+++ src/usr.bin/make/unit-tests/modmisc.exp	Sun Aug 23 15:09:15 2020
@@ -8,10 +8,6 @@ path_/usr/xbin=/opt/xbin/
 paths=/bin /tmp / /no/such/dir /opt/xbin
 PATHS=/BIN /TMP / /NO/SUCH/DIR /OPT/XBIN
 The answer is 42
-dirname of 'a/b/c def a.b.c a.b/c a a.a .gitignore a a.a' is 'a/b . . a.b . . . . .'
-basename of 'a/b/c def a.b.c a.b/c a a.a .gitignore a a.a' is 'c def a.b.c c a a.a .gitignore a a.a'
-suffix of 'a/b/c def a.b.c a.b/c a a.a .gitignore a a.a' is 'c b/c a gitignore a'
-root of 'a/b/c def a.b.c a.b/c a a.a .gitignore a a.a' is 'a/b/c def a.b a a a a a'
 S:
 C:
 @:
Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.43 src/usr.bin/make/unit-tests/modmisc.mk:1.44
--- src/usr.bin/make/unit-tests/modmisc.mk:1.43	Sun Aug 16 12:48:55 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Sun Aug 23 15:09:15 2020
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.43 2020/08/16 12:48:55 rillig Exp $
+# $Id: modmisc.mk,v 1.44 2020/08/23 15:09:15 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -15,7 +15,7 @@ MOD_HOMES=S,/home/,/homes/,
 MOD_OPT=@d@$${exists($$d):?$$d:$${d:S,/usr,/opt,}}@
 MOD_SEP=S,:, ,g
 
-all:	modvar modvarloop modsysv mod-HTE emptyvar undefvar
+all:	modvar modvarloop modsysv emptyvar undefvar
 all:	mod-tu-space
 all:	mod-quote
 all:	mod-break-many-words
@@ -46,13 +46,6 @@ modvarloop:
 	@echo "paths=${paths}"
 	@echo "PATHS=${paths:tu}"
 
-PATHNAMES=	a/b/c def a.b.c a.b/c a a.a .gitignore a a.a
-mod-HTE:
-	@echo "dirname of '"${PATHNAMES:Q}"' is '"${PATHNAMES:H:Q}"'"
-	@echo "basename of '"${PATHNAMES:Q}"' is '"${PATHNAMES:T:Q}"'"
-	@echo "suffix of '"${PATHNAMES:Q}"' is '"${PATHNAMES:E:Q}"'"
-	@echo "root of '"${PATHNAMES:Q}"' is '"${PATHNAMES:R:Q}"'"
-
 # When a modifier is applied to the "" variable, the result is discarded.
 emptyvar:
 	@echo S:${:S,^$,empty,}

Index: src/usr.bin/make/unit-tests/varmod-extension.exp
diff -u src/usr.bin/make/unit-tests/varmod-extension.exp:1.1 src/usr.bin/make/unit-tests/varmod-extension.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-extension.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-extension.exp	Sun Aug 23 15:09:15 2020
@@ -1 +1,10 @@
+extension of 'a/b/c' is ''
+extension of 'def' is ''
+extension of 'a.b.c' is 'c'
+extension of 'a.b/c' is 'b/c'
+extension of 'a' is ''
+extension of 'a.a' is 'a'
+extension of '.gitignore' is 'gitignore'
+extension of 'a' is ''
+extension of 'a.a' is 'a'
 exit status 0
Index: src/usr.bin/make/unit-tests/varmod-head.exp
diff -u src/usr.bin/make/unit-tests/varmod-head.exp:1.1 src/usr.bin/make/unit-tests/varmod-head.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-head.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-head.exp	Sun Aug 23 15:09:15 2020
@@ -1 +1,10 @@
+head (dirname) of 'a/b/c' is 'a/b'
+head (dirname) of 'def' is '.'
+head (dirname) of 'a.b.c' is '.'
+head (dirname) of 'a.b/c' is 'a.b'
+head (dirname) of 'a' is '.'
+head (dirname) of 'a.a' is '.'
+head (dirname) of '.gitignore' is '.'
+head (dirname) of 'a' is '.'
+head (dirname) of 'a.a' is '.'
 exit status 0
Index: src/usr.bin/make/unit-tests/varmod-root.exp
diff -u src/usr.bin/make/unit-tests/varmod-root.exp:1.1 src/usr.bin/make/unit-tests/varmod-root.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-root.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-root.exp	Sun Aug 23 15:09:15 2020
@@ -1 +1,10 @@
+root of 'a/b/c' is 'a/b/c'
+root of 'def' is 'def'
+root of 'a.b.c' is 'a.b'
+root of 'a.b/c' is 'a'
+root of 'a' is 'a'
+root of 'a.a' is 'a'
+root of '.gitignore' is ''
+root of 'a' is 'a'
+root of 'a.a' is 'a'
 exit status 0

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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 15:09:15 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk
varmod-extension.exp varmod-extension.mk varmod-head.exp
varmod-head.mk varmod-root.exp varmod-root.mk varmod-tail.exp
varmod-tail.mk

Log Message:
make(1): move tests for :H :E :R :T into separate files


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/make/unit-tests/modmisc.exp \
src/usr.bin/make/unit-tests/modmisc.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-extension.exp \
src/usr.bin/make/unit-tests/varmod-head.exp \
src/usr.bin/make/unit-tests/varmod-root.exp \
src/usr.bin/make/unit-tests/varmod-tail.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-extension.mk \
src/usr.bin/make/unit-tests/varmod-head.mk \
src/usr.bin/make/unit-tests/varmod-root.mk \
src/usr.bin/make/unit-tests/varmod-tail.mk

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



CVS commit: src/tests/bin/df

2020-08-23 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sun Aug 23 15:51:30 UTC 2020

Modified Files:
src/tests/bin/df: t_df.sh

Log Message:
adjust the number of spaces to match the current df(1) output.
fix NetBSD PR/55600

TODO: it should not be dependent on the number of spaces.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/bin/df/t_df.sh

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

Modified files:

Index: src/tests/bin/df/t_df.sh
diff -u src/tests/bin/df/t_df.sh:1.1 src/tests/bin/df/t_df.sh:1.2
--- src/tests/bin/df/t_df.sh:1.1	Sat Mar 17 16:33:11 2012
+++ src/tests/bin/df/t_df.sh	Sun Aug 23 15:51:30 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_df.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $
+# $NetBSD: t_df.sh,v 1.2 2020/08/23 15:51:30 ryo Exp $
 #
 # Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -33,51 +33,51 @@ normal_head() {
 }
 normal_body() {
 	cat >expout 

CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 17:49:37 UTC 2020

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

Log Message:
make(1): replace tricky malloc+realloc+strlen+snprintf with Buffer

The code for handling archives is not widely used.  Therefore it does
not need to be fast.  Clarity of the code is more important.  Therefore
replace the malloc + strlen + realloc + snprintf string processing with
the Buffer type, which removes a lot of redundancy.

In the wildcard loop, the "if (sz > nsz)" looked like a mistake.  Why
should it be useful to first allocate a large buffer and then resize it
to a smaller buffer, but still twice as large as necessary?


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 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.



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 17:49:37 UTC 2020

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

Log Message:
make(1): replace tricky malloc+realloc+strlen+snprintf with Buffer

The code for handling archives is not widely used.  Therefore it does
not need to be fast.  Clarity of the code is more important.  Therefore
replace the malloc + strlen + realloc + snprintf string processing with
the Buffer type, which removes a lot of redundancy.

In the wildcard loop, the "if (sz > nsz)" looked like a mistake.  Why
should it be useful to first allocate a large buffer and then resize it
to a smaller buffer, but still twice as large as necessary?


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 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.92 src/usr.bin/make/arch.c:1.93
--- src/usr.bin/make/arch.c:1.92	Sun Aug 23 16:58:02 2020
+++ src/usr.bin/make/arch.c	Sun Aug 23 17:49:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.92 2020/08/23 16:58:02 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.93 2020/08/23 17:49:37 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.92 2020/08/23 16:58:02 rillig Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.93 2020/08/23 17:49:37 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.92 2020/08/23 16:58:02 rillig Exp $");
+__RCSID("$NetBSD: arch.c,v 1.93 2020/08/23 17:49:37 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -241,7 +241,6 @@ Arch_ParseArchive(char **linePtr, Lst no
 GNode	*gn; 	/* New node */
 char	*libName;  	/* Library-part of specification */
 char	*memName;  	/* Member-part of specification */
-char	*nameBuf;	/* temporary place for node name */
 char	saveChar;  	/* Ending delimiter of member-name */
 Boolean 	subLibName;	/* TRUE if libName should have/had
  * variable substitution performed on it */
@@ -393,21 +392,23 @@ Arch_ParseArchive(char **linePtr, Lst no
 	free(buf);
 	} else if (Dir_HasWildcards(memName)) {
 	Lst	  members = Lst_Init();
-	size_t sz = MAXPATHLEN, nsz;
-	nameBuf = bmake_malloc(sz);
+	Buffer nameBuf;
 
+	Buf_Init(, 0);
 	Dir_Expand(memName, dirSearchPath, members);
 	while (!Lst_IsEmpty(members)) {
 		char *member = Lst_DequeueS(members);
-		nsz = strlen(libName) + strlen(member) + 3;
-		if (sz > nsz)
-		nameBuf = bmake_realloc(nameBuf, sz = nsz * 2);
 
-		snprintf(nameBuf, sz, "%s(%s)", libName, member);
+		Buf_Empty();
+		Buf_AddStr(, libName);
+		Buf_AddStr(, "(");
+		Buf_AddStr(, member);
+		Buf_AddStr(, ")");
 		free(member);
-		gn = Targ_FindNode(nameBuf, TARG_CREATE);
+
+		gn = Targ_FindNode(Buf_GetAll(, NULL), TARG_CREATE);
 		if (gn == NULL) {
-		free(nameBuf);
+		Buf_Destroy(, TRUE);
 		return FAILURE;
 		} else {
 		/*
@@ -422,13 +423,18 @@ Arch_ParseArchive(char **linePtr, Lst no
 		}
 	}
 	Lst_Destroy(members, NULL);
-	free(nameBuf);
+	Buf_Destroy(, TRUE);
 	} else {
-	size_t	sz = strlen(libName) + strlen(memName) + 3;
-	nameBuf = bmake_malloc(sz);
-	snprintf(nameBuf, sz, "%s(%s)", libName, memName);
-	gn = Targ_FindNode(nameBuf, TARG_CREATE);
-	free(nameBuf);
+	Buffer nameBuf;
+
+	Buf_Init(, 0);
+	Buf_AddStr(, libName);
+	Buf_AddStr(, "(");
+	Buf_AddStr(, memName);
+	Buf_AddStr(, ")");
+
+	gn = Targ_FindNode(Buf_GetAll(, NULL), TARG_CREATE);
+	Buf_Destroy(, TRUE);
 	if (gn == NULL) {
 		return FAILURE;
 	} else {



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

2020-08-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 23 17:50:19 UTC 2020

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

Log Message:
Split getrandom tests into several cases to find out which ones hang.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_getrandom.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_getrandom.c
diff -u src/tests/lib/libc/sys/t_getrandom.c:1.1 src/tests/lib/libc/sys/t_getrandom.c:1.2
--- src/tests/lib/libc/sys/t_getrandom.c:1.1	Fri Aug 14 00:53:16 2020
+++ src/tests/lib/libc/sys/t_getrandom.c	Sun Aug 23 17:50:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_getrandom.c,v 1.1 2020/08/14 00:53:16 riastradh Exp $	*/
+/*	$NetBSD: t_getrandom.c,v 1.2 2020/08/23 17:50:19 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_getrandom.c,v 1.1 2020/08/14 00:53:16 riastradh Exp $");
+__RCSID("$NetBSD: t_getrandom.c,v 1.2 2020/08/23 17:50:19 riastradh Exp $");
 
 #include 
 
@@ -47,13 +47,6 @@ alarm_handler(int signo)
 {
 }
 
-ATF_TC(getrandom);
-ATF_TC_HEAD(getrandom, tc)
-{
-
-	atf_tc_set_md_var(tc, "descr", "getrandom(2)");
-}
-
 /*
  * Probability of spurious failure is 1/2^192 for each of the memcmps.
  * As long as there are fewer than 2^64 of them, the probability of
@@ -61,7 +54,12 @@ ATF_TC_HEAD(getrandom, tc)
  * don't care about it.
  */
 
-ATF_TC_BODY(getrandom, tc)
+ATF_TC(getrandom_default);
+ATF_TC_HEAD(getrandom_default, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "getrandom(..., 0)");
+}
+ATF_TC_BODY(getrandom_default, tc)
 {
 	ssize_t n;
 
@@ -79,6 +77,16 @@ ATF_TC_BODY(getrandom, tc)
 		ATF_CHECK(memcmp(buf + sizeof buf - 24, zero24, 24) != 0);
 	}
 	alarm(0);
+}
+
+ATF_TC(getrandom_nonblock);
+ATF_TC_HEAD(getrandom_nonblock, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "getrandom(..., GRND_NONBLOCK)");
+}
+ATF_TC_BODY(getrandom_nonblock, tc)
+{
+	ssize_t n;
 
 	/* default, nonblocking */
 	memset(buf, 0, sizeof buf);
@@ -90,6 +98,16 @@ ATF_TC_BODY(getrandom, tc)
 		ATF_CHECK(memcmp(buf, zero24, 24) != 0);
 		ATF_CHECK(memcmp(buf + sizeof buf - 24, zero24, 24) != 0);
 	}
+}
+
+ATF_TC(getrandom_insecure);
+ATF_TC_HEAD(getrandom_insecure, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "getrandom(..., GRND_INSECURE)");
+}
+ATF_TC_BODY(getrandom_insecure, tc)
+{
+	ssize_t n;
 
 	/* insecure */
 	memset(buf, 0, sizeof buf);
@@ -98,6 +116,17 @@ ATF_TC_BODY(getrandom, tc)
 	ATF_CHECK_EQ((size_t)n, sizeof buf);
 	ATF_CHECK(memcmp(buf, zero24, 24) != 0);
 	ATF_CHECK(memcmp(buf + sizeof buf - 24, zero24, 24) != 0);
+}
+
+ATF_TC(getrandom_insecure_nonblock);
+ATF_TC_HEAD(getrandom_insecure_nonblock, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"getrandom(..., GRND_INSECURE|GRND_NONBLOCK)");
+}
+ATF_TC_BODY(getrandom_insecure_nonblock, tc)
+{
+	ssize_t n;
 
 	/* insecure, nonblocking -- same as mere insecure */
 	memset(buf, 0, sizeof buf);
@@ -106,6 +135,18 @@ ATF_TC_BODY(getrandom, tc)
 	ATF_CHECK_EQ((size_t)n, sizeof buf);
 	ATF_CHECK(memcmp(buf, zero24, 24) != 0);
 	ATF_CHECK(memcmp(buf + sizeof buf - 24, zero24, 24) != 0);
+}
+
+ATF_TC(getrandom_random);
+ATF_TC_HEAD(getrandom_random, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "getrandom(..., GRND_RANDOM)");
+}
+ATF_TC_BODY(getrandom_random, tc)
+{
+	ssize_t n;
+
+	ATF_REQUIRE(signal(SIGALRM, _handler) != SIG_ERR);
 
 	/* `random' (hokey) */
 	alarm(1);
@@ -122,6 +163,17 @@ ATF_TC_BODY(getrandom, tc)
 		}
 	}
 	alarm(0);
+}
+
+ATF_TC(getrandom_random_nonblock);
+ATF_TC_HEAD(getrandom_random_nonblock, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"getrandom(..., GRND_RANDOM|GRND_NONBLOCK)");
+}
+ATF_TC_BODY(getrandom_random_nonblock, tc)
+{
+	ssize_t n;
 
 	/* `random' (hokey), nonblocking */
 	memset(buf, 0, sizeof buf);
@@ -136,17 +188,49 @@ ATF_TC_BODY(getrandom, tc)
 			ATF_CHECK(memcmp(buf + n - 24, zero24, 24) != 0);
 		}
 	}
+}
+
+ATF_TC(getrandom_random_insecure);
+ATF_TC_HEAD(getrandom_random_insecure, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"getrandom(..., GRND_RANDOM|GRND_INSECURE)");
+}
+ATF_TC_BODY(getrandom_random_insecure, tc)
+{
+	ssize_t n;
 
 	/* random and insecure -- nonsensical */
 	n = getrandom(buf, sizeof buf, GRND_RANDOM|GRND_INSECURE);
 	ATF_CHECK_EQ(n, -1);
 	ATF_CHECK_EQ(errno, EINVAL);
+}
+
+ATF_TC(getrandom_random_insecure_nonblock);
+ATF_TC_HEAD(getrandom_random_insecure_nonblock, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"getrandom(..., GRND_RANDOM|GRND_INSECURE|GRND_NONBLOCK)");
+}
+ATF_TC_BODY(getrandom_random_insecure_nonblock, tc)
+{
+	ssize_t n;
 
 	/* random and insecure, nonblocking -- nonsensical */
 	n = getrandom(buf, sizeof buf,
 	GRND_RANDOM|GRND_INSECURE|GRND_NONBLOCK);
 	ATF_CHECK_EQ(n, -1);
 	ATF_CHECK_EQ(errno, EINVAL);
+}
+
+ATF_TC(getrandom_invalid);
+ATF_TC_HEAD(getrandom_invalid, tc)
+{
+	atf_tc_set_md_var(tc, "descr", 

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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 17:51:24 UTC 2020

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

Log Message:
make(1): in archive test, use wildcard that matches more than 1 file

This is to make sure that the buffer used for "archive(member)" is
properly reset after each member.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/archive.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/archive.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/archive.exp
diff -u src/usr.bin/make/unit-tests/archive.exp:1.3 src/usr.bin/make/unit-tests/archive.exp:1.4
--- src/usr.bin/make/unit-tests/archive.exp:1.3	Sun Aug 23 17:34:46 2020
+++ src/usr.bin/make/unit-tests/archive.exp	Sun Aug 23 17:51:24 2020
@@ -6,6 +6,7 @@ archive.mk
 modmisc.mk
 varmisc.mk
 list-archive-wildcard: archive.mk
+list-archive-wildcard: ternary.mk
 depend-on-existing-member
 `depend-on-nonexistent-member' is up to date.
 rm -f libprog.a

Index: src/usr.bin/make/unit-tests/archive.mk
diff -u src/usr.bin/make/unit-tests/archive.mk:1.4 src/usr.bin/make/unit-tests/archive.mk:1.5
--- src/usr.bin/make/unit-tests/archive.mk:1.4	Sun Aug 23 17:34:46 2020
+++ src/usr.bin/make/unit-tests/archive.mk	Sun Aug 23 17:51:24 2020
@@ -1,4 +1,4 @@
-# $NetBSD: archive.mk,v 1.4 2020/08/23 17:34:46 rillig Exp $
+# $NetBSD: archive.mk,v 1.5 2020/08/23 17:51:24 rillig Exp $
 #
 # Very basic demonstration of handling archives, based on the description
 # in PSD.doc/tutorial.ms.
@@ -31,8 +31,8 @@ list-archive: ${ARCHIVE}
 
 # XXX: I had expected that this dependency would select all *.mk files from
 # the archive.  Instead, the globbing is done in the current directory.
-# To prevent an overly long file list, the pattern is restricted to ar*.mk.
-list-archive-wildcard: ${ARCHIVE}(ar*.mk)
+# To prevent an overly long file list, the pattern is restricted to [at]*.mk.
+list-archive-wildcard: ${ARCHIVE}([at]*.mk)
 	${RUN} printf '%s\n' ${.ALLSRC:O:@member@${.TARGET:Q}': '${member:Q}@}
 
 depend-on-existing-member: ${ARCHIVE}(archive.mk)



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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 17:51:24 UTC 2020

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

Log Message:
make(1): in archive test, use wildcard that matches more than 1 file

This is to make sure that the buffer used for "archive(member)" is
properly reset after each member.


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

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



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

2020-08-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 23 17:50:19 UTC 2020

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

Log Message:
Split getrandom tests into several cases to find out which ones hang.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_getrandom.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/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 19:00:19 UTC 2020

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

Log Message:
make(1): make compat.c ready for WARNS=6


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 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.128 src/usr.bin/make/compat.c:1.129
--- src/usr.bin/make/compat.c:1.128	Sun Aug 23 18:26:35 2020
+++ src/usr.bin/make/compat.c	Sun Aug 23 19:00:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.128 2020/08/23 18:26:35 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.129 2020/08/23 19:00:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.128 2020/08/23 18:26:35 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.129 2020/08/23 19:00:19 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.128 2020/08/23 18:26:35 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.129 2020/08/23 19:00:19 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -535,7 +535,7 @@ Compat_Make(void *gnp, void *pgnp)
 	Lst_ForEach(gn->children, Compat_Make, gn);
 	if ((gn->flags & REMAKE) == 0) {
 	gn->made = ABORTED;
-	pgn->flags &= ~REMAKE;
+	pgn->flags &= ~(unsigned)REMAKE;
 	goto cohorts;
 	}
 
@@ -631,7 +631,7 @@ Compat_Make(void *gnp, void *pgnp)
 		Make_TimeStamp(pgn, gn);
 	}
 	} else if (keepgoing) {
-	pgn->flags &= ~REMAKE;
+	pgn->flags &= ~(unsigned)REMAKE;
 	} else {
 	PrintOnError(gn, "\nStop.");
 	exit(1);
@@ -641,7 +641,7 @@ Compat_Make(void *gnp, void *pgnp)
 	 * Already had an error when making this beastie. Tell the parent
 	 * to abort.
 	 */
-	pgn->flags &= ~REMAKE;
+	pgn->flags &= ~(unsigned)REMAKE;
 } else {
 	if (Lst_MemberS(gn->iParents, pgn) != NULL) {
 	char *p1;
@@ -652,7 +652,7 @@ Compat_Make(void *gnp, void *pgnp)
 	case BEINGMADE:
 		Error("Graph cycles through %s", gn->name);
 		gn->made = ERROR;
-		pgn->flags &= ~REMAKE;
+		pgn->flags &= ~(unsigned)REMAKE;
 		break;
 	case MADE:
 		if ((gn->type & OP_EXEC) == 0) {



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 19:00:19 UTC 2020

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

Log Message:
make(1): make compat.c ready for WARNS=6


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 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.



CVS commit: src/share/man/man4

2020-08-23 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Aug 23 09:55:58 UTC 2020

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

Log Message:
Fix editor mistake in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/share/man/man4/ddb.4

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

Modified files:

Index: src/share/man/man4/ddb.4
diff -u src/share/man/man4/ddb.4:1.194 src/share/man/man4/ddb.4:1.195
--- src/share/man/man4/ddb.4:1.194	Sun Aug 23 03:23:53 2020
+++ src/share/man/man4/ddb.4	Sun Aug 23 09:55:58 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ddb.4,v 1.194 2020/08/23 03:23:53 simonb Exp $
+.\"	$NetBSD: ddb.4,v 1.195 2020/08/23 09:55:58 wiz Exp $
 .\"
 .\" Copyright (c) 1997 - 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -208,7 +208,7 @@ is entered by using
 or by setting
 .Ar ddb.commandonenter
 with
-2Xr sysctl 8 .
+.Xr sysctl 8 .
 Multiple commands can be separated by a semi-colon.
 .Sh COMMAND SYNTAX
 The general command syntax is:



CVS commit: src/share/man/man4

2020-08-23 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Aug 23 09:55:58 UTC 2020

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

Log Message:
Fix editor mistake in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/share/man/man4/ddb.4

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



CVS commit: src/sys/arch/mips

2020-08-23 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Aug 23 10:23:38 UTC 2020

Modified Files:
src/sys/arch/mips/include: mips_param.h proc.h
src/sys/arch/mips/mips: mipsX_subr.S vm_machdep.c

Log Message:
Use a 16kB USPACE (and larger kernel stack) for LP64 kernels.  Invert
the logic for setting the USPACE size.  Define a desired USPACE size
(16kB for LP64, 8kB otherwise) then divide by PAGE_SIZE to get UPAGES.

Fixes random segmap lossage, since the uarea usually sits immediately
above the segmap for a process.  Thanks to mrg@, skrll@ and dholland@
for testing, debugging and general help tracking down this problem.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/mips/include/mips_param.h
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/mips/include/proc.h
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/mips/mips/mipsX_subr.S
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/mips/mips/vm_machdep.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/mips

2020-08-23 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Aug 23 10:23:38 UTC 2020

Modified Files:
src/sys/arch/mips/include: mips_param.h proc.h
src/sys/arch/mips/mips: mipsX_subr.S vm_machdep.c

Log Message:
Use a 16kB USPACE (and larger kernel stack) for LP64 kernels.  Invert
the logic for setting the USPACE size.  Define a desired USPACE size
(16kB for LP64, 8kB otherwise) then divide by PAGE_SIZE to get UPAGES.

Fixes random segmap lossage, since the uarea usually sits immediately
above the segmap for a process.  Thanks to mrg@, skrll@ and dholland@
for testing, debugging and general help tracking down this problem.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/mips/include/mips_param.h
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/mips/include/proc.h
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/mips/mips/mipsX_subr.S
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/mips/mips/vm_machdep.c

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

Modified files:

Index: src/sys/arch/mips/include/mips_param.h
diff -u src/sys/arch/mips/include/mips_param.h:1.45 src/sys/arch/mips/include/mips_param.h:1.46
--- src/sys/arch/mips/include/mips_param.h:1.45	Sun Jul 26 08:08:41 2020
+++ src/sys/arch/mips/include/mips_param.h	Sun Aug 23 10:23:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_param.h,v 1.45 2020/07/26 08:08:41 simonb Exp $	*/
+/*	$NetBSD: mips_param.h,v 1.46 2020/08/23 10:23:38 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -117,12 +117,18 @@
 #endif
 #define	NSEGPG		(1 << SEGLENGTH)
 
-#if PGSHIFT >= 13
-#define	UPAGES		1		/* pages of u-area */
+#ifdef _LP64
+#define	__MIN_USPACE	16384		/* LP64 needs a 16kB stack */
 #else
-#define	UPAGES		2		/* pages of u-area */
+/*
+ * Note for the non-LP64 case, cpu_switch_resume has the assumption
+ * that UPAGES == 2.  For MIPS-I we wire USPACE in TLB #0 and #1.
+ * For MIPS3+ we wire USPACE in the the TLB #0 pair.
+ */
+#define	__MIN_USPACE	8192		/* otherwise use an 8kB stack */
 #endif
-#define	USPACE		(UPAGES*NBPG)	/* size of u-area in bytes */
+#define	USPACE		MAX(__MIN_USPACE, PAGE_SIZE)
+#define	UPAGES		(USPACE / PAGE_SIZE) /* number of pages for u-area */
 #define	USPACE_ALIGN	USPACE		/* make sure it starts on a even VA */
 
 /*

Index: src/sys/arch/mips/include/proc.h
diff -u src/sys/arch/mips/include/proc.h:1.29 src/sys/arch/mips/include/proc.h:1.30
--- src/sys/arch/mips/include/proc.h:1.29	Sun Jul 26 08:08:41 2020
+++ src/sys/arch/mips/include/proc.h	Sun Aug 23 10:23:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.29 2020/07/26 08:08:41 simonb Exp $	*/
+/*	$NetBSD: proc.h,v 1.30 2020/08/23 10:23:38 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -52,7 +52,7 @@ struct mdlwp {
 	vaddr_t	md_ss_addr;		/* single step address for ptrace */
 	int	md_ss_instr;		/* single step instruction for ptrace */
 	volatile int md_astpending;	/* AST pending on return to userland */
-	int	md_upte[2];		/* ptes for mapping u page */
+	int	md_upte[UPAGES];	/* ptes for mapping u page */
 };
 
 struct mdproc {

Index: src/sys/arch/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.108 src/sys/arch/mips/mips/mipsX_subr.S:1.109
--- src/sys/arch/mips/mips/mipsX_subr.S:1.108	Sat Jun 13 12:53:42 2020
+++ src/sys/arch/mips/mips/mipsX_subr.S	Sun Aug 23 10:23:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.108 2020/06/13 12:53:42 simonb Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.109 2020/08/23 10:23:38 simonb Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -2707,12 +2707,14 @@ END(MIPSX(lwp_trampoline))
  * Disable the optimisation for PGSHIFT == 14 (aka ENABLE_MIPS_16KB_PAGE)
  * as the code needs fixing for this case
  *
- * _LP64 with UPAGES == 1 is always direct mappable; everything else can have
- * non-direct mappable USPACE.
+ * A TLB entry isn't used for the following cases:
+ *  - 16kB USPACE
+ *  - LP64 - USPACE is always accessed directly via XKPHYS
  */
 
 LEAF_NOPROFILE(MIPSX(cpu_switch_resume))
-#if (PGSHIFT < 14)
+#if !defined(_LP64)
+#if (PAGE_SIZE < 16384)
 #if (USPACE > PAGE_SIZE) || !defined(_LP64)
 	INT_L	a1, L_MD_UPTE_0(a0)		# a1 = upte[0]
 #if (PGSHIFT & 1)
@@ -2789,7 +2791,8 @@ MIPSX(entry0set):
 	COP0_SYNC
 MIPSX(resume):
 #endif /* (USPACE > PAGE_SIZE) || !defined(_LP64) */
-#endif /* PGSHIFT < 14 */
+#endif /* PAGE_SIZE < 16384 */
+#endif /* ! LP64 */
 #ifdef MIPSNNR2
 	PTR_L	v0, L_PRIVATE(a0)		# get lwp private
 	_MTC0	v0, MIPS_COP_0_USERLOCAL	# make available for rdhwr

Index: src/sys/arch/mips/mips/vm_machdep.c
diff -u src/sys/arch/mips/mips/vm_machdep.c:1.161 src/sys/arch/mips/mips/vm_machdep.c:1.162
--- src/sys/arch/mips/mips/vm_machdep.c:1.161	Sun Aug  9 07:09:35 2020
+++ src/sys/arch/mips/mips/vm_machdep.c	Sun Aug 23 10:23:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.161 2020/08/09 07:09:35 skrll Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.162 2020/08/23 10:23:38 simonb Exp $	*/
 
 /*
  * 

CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 10:27:22 UTC 2020

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

Log Message:
make(1): save a variable lookup when adding a read-only variable


To generate a diff of this commit:
cvs rdiff -u -r1.463 -r1.464 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.



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 10:53:27 UTC 2020

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

Log Message:
make(1): handle special case of a list containing null pointers

GNode.commands is the only place in make where a list can contain null
pointers.  That's unexpected, and memory management in CompatRunCommand
looks suspicous enough to warrant extensive documentation.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/usr.bin/make/compat.c
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/make/lst.c
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/make/lst.h

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



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 10:53:27 UTC 2020

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

Log Message:
make(1): handle special case of a list containing null pointers

GNode.commands is the only place in make where a list can contain null
pointers.  That's unexpected, and memory management in CompatRunCommand
looks suspicous enough to warrant extensive documentation.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/usr.bin/make/compat.c
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/make/lst.c
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/make/lst.h

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

Modified files:

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.126 src/usr.bin/make/compat.c:1.127
--- src/usr.bin/make/compat.c:1.126	Sat Aug 22 21:42:38 2020
+++ src/usr.bin/make/compat.c	Sun Aug 23 10:53:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.126 2020/08/22 21:42:38 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.127 2020/08/23 10:53:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.126 2020/08/22 21:42:38 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.127 2020/08/23 10:53:27 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.126 2020/08/22 21:42:38 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.127 2020/08/23 10:53:27 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -247,7 +247,7 @@ CompatRunCommand(void *cmdp, void *gnp)
 	return 0;
 }
 cmd = cmdStart;
-Lst_ReplaceS(cmdNode, cmdStart);
+LstNode_SetS(cmdNode, cmdStart);
 
 if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) {
 assert(ENDNode != NULL);
@@ -394,7 +394,9 @@ again:
 free(mav);
 free(bp);
 
-Lst_ReplaceS(cmdNode, NULL);
+/* XXX: Memory management looks suspicious here. */
+/* XXX: Setting a list item to NULL is unexpected. */
+LstNode_SetNullS(cmdNode);
 
 #ifdef USE_META
 if (useMeta) {

Index: src/usr.bin/make/lst.c
diff -u src/usr.bin/make/lst.c:1.36 src/usr.bin/make/lst.c:1.37
--- src/usr.bin/make/lst.c:1.36	Sat Aug 22 23:06:51 2020
+++ src/usr.bin/make/lst.c	Sun Aug 23 10:53:27 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.36 2020/08/22 23:06:51 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.37 2020/08/23 10:53:27 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -37,11 +37,11 @@
 #include "make.h"
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lst.c,v 1.36 2020/08/22 23:06:51 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.37 2020/08/23 10:53:27 rillig Exp $";
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.36 2020/08/22 23:06:51 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.37 2020/08/23 10:53:27 rillig Exp $");
 #endif /* not lint */
 #endif
 
@@ -302,11 +302,23 @@ Lst_RemoveS(Lst list, LstNode node)
 
 /* Replace the datum in the given node with the new datum. */
 void
-Lst_ReplaceS(LstNode node, void *datum)
+LstNode_SetS(LstNode node, void *datum)
 {
+assert(LstNodeIsValid(node));
+assert(datum != NULL);
+
 node->datum = datum;
 }
 
+/* Replace the datum in the given node to NULL. */
+void
+LstNode_SetNullS(LstNode node)
+{
+assert(LstNodeIsValid(node));
+
+node->datum = NULL;
+}
+
 
 /*
  * Node-specific functions

Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.38 src/usr.bin/make/lst.h:1.39
--- src/usr.bin/make/lst.h:1.38	Sat Aug 22 22:57:53 2020
+++ src/usr.bin/make/lst.h	Sun Aug 23 10:53:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lst.h,v 1.38 2020/08/22 22:57:53 rillig Exp $	*/
+/*	$NetBSD: lst.h,v 1.39 2020/08/23 10:53:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -120,7 +120,8 @@ void		Lst_AppendS(Lst, void *);
 /* Remove an element */
 void		Lst_RemoveS(Lst, LstNode);
 /* Replace a node with a new value */
-void		Lst_ReplaceS(LstNode, void *);
+void		LstNode_SetS(LstNode node, void *datum);
+void		LstNode_SetNullS(LstNode node);
 void		Lst_PrependAllS(Lst, Lst);
 void		Lst_AppendAllS(Lst, Lst);
 void		Lst_MoveAllS(Lst, Lst);



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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 14:07:20 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: cond-func-commands.mk cond-func-exists.mk
cond-func-target.mk

Log Message:
make(1): add tests for functions in .if conditions


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cond-func-commands.mk \
src/usr.bin/make/unit-tests/cond-func-exists.mk \
src/usr.bin/make/unit-tests/cond-func-target.mk

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



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 16:18:12 UTC 2020

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

Log Message:
make(1): make navigating lists in debugging mode easier

Lst is an untyped list of pointers.  During debugging, it is often
necessary to inspect the content of the list.  To do this without manual
typecasting, add a few aliases for the LstNode.datum pointer, for
inspecting GNodes and strings.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/make/lst.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/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 18:03:35 UTC 2020

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

Log Message:
make(1): prepare str.c for WARNS=6

The next step is to make brk_string return size_t instead of int.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/usr.bin/make/str.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/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 11:13:08 UTC 2020

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

Log Message:
make(1): remove another piece of code for circular lists


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/make/lst.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/lst.c
diff -u src/usr.bin/make/lst.c:1.37 src/usr.bin/make/lst.c:1.38
--- src/usr.bin/make/lst.c:1.37	Sun Aug 23 10:53:27 2020
+++ src/usr.bin/make/lst.c	Sun Aug 23 11:13:08 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.37 2020/08/23 10:53:27 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.38 2020/08/23 11:13:08 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -37,11 +37,11 @@
 #include "make.h"
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lst.c,v 1.37 2020/08/23 10:53:27 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.38 2020/08/23 11:13:08 rillig Exp $";
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.37 2020/08/23 10:53:27 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.38 2020/08/23 11:13:08 rillig Exp $");
 #endif /* not lint */
 #endif
 
@@ -472,12 +472,11 @@ Lst_ForEachFrom(Lst list, LstNode node,
 
 	/*
 	 * We're done with the traversal if
-	 *  - the next node to examine is the first in the queue or
-	 *doesn't exist and
+	 *  - the next node to examine doesn't exist and
 	 *  - nothing's been added after the current node (check this
 	 *after proc() has been called).
 	 */
-	done = (next == NULL || next == list->first);
+	done = next == NULL;
 
 	tln->useCount++;
 	result = (*proc)(tln->datum, procData);



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 11:13:08 UTC 2020

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

Log Message:
make(1): remove another piece of code for circular lists


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/make/lst.c

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



CVS commit: src/share/man/man4

2020-08-23 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Sun Aug 23 13:35:46 UTC 2020

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

Log Message:
Link to i386/pnpbios(4) instead of pnpbios(4)

And bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/share/man/man4/ym.4

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

Modified files:

Index: src/share/man/man4/ym.4
diff -u src/share/man/man4/ym.4:1.19 src/share/man/man4/ym.4:1.20
--- src/share/man/man4/ym.4:1.19	Mon Jul  3 21:30:58 2017
+++ src/share/man/man4/ym.4	Sun Aug 23 13:35:46 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: ym.4,v 1.19 2017/07/03 21:30:58 wiz Exp $
+.\" $NetBSD: ym.4,v 1.20 2020/08/23 13:35:46 ryoon Exp $
 .\"
 .\" Copyright (c) 1999 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 14, 2006
+.Dd August 23, 2020
 .Dt YM 4
 .Os
 .Sh NAME
@@ -182,7 +182,7 @@ On suspending, the device is put into po
 .Xr midi 4 ,
 .Xr mpu 4 ,
 .Xr opl 4 ,
-.Xr pnpbios 4
+.Xr i386/pnpbios 4
 .Sh HISTORY
 The
 .Nm



CVS commit: src/share/man/man4

2020-08-23 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Sun Aug 23 13:35:46 UTC 2020

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

Log Message:
Link to i386/pnpbios(4) instead of pnpbios(4)

And bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/share/man/man4/ym.4

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



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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 14:07:20 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: cond-func-commands.mk cond-func-exists.mk
cond-func-target.mk

Log Message:
make(1): add tests for functions in .if conditions


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cond-func-commands.mk \
src/usr.bin/make/unit-tests/cond-func-exists.mk \
src/usr.bin/make/unit-tests/cond-func-target.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/cond-func-commands.mk
diff -u src/usr.bin/make/unit-tests/cond-func-commands.mk:1.2 src/usr.bin/make/unit-tests/cond-func-commands.mk:1.3
--- src/usr.bin/make/unit-tests/cond-func-commands.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/cond-func-commands.mk	Sun Aug 23 14:07:20 2020
@@ -1,8 +1,36 @@
-# $NetBSD: cond-func-commands.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: cond-func-commands.mk,v 1.3 2020/08/23 14:07:20 rillig Exp $
 #
 # Tests for the commands() function in .if conditions.
 
-# TODO: Implementation
+.MAIN: all
+
+# The target "target" does not exist yet, therefore it cannot have commands.
+.if commands(target)
+.error
+.endif
+
+target:
+
+# Now the target exists, but it still has no commands.
+.if commands(target)
+.error
+.endif
+
+target:
+	# not a command
+
+# Even after the comment, the target still has no commands.
+.if commands(target)
+.error
+.endif
+
+target:
+	@:;
+
+# Finally the target has commands.
+.if !commands(target)
+.error
+.endif
 
 all:
 	@:;
Index: src/usr.bin/make/unit-tests/cond-func-exists.mk
diff -u src/usr.bin/make/unit-tests/cond-func-exists.mk:1.2 src/usr.bin/make/unit-tests/cond-func-exists.mk:1.3
--- src/usr.bin/make/unit-tests/cond-func-exists.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/cond-func-exists.mk	Sun Aug 23 14:07:20 2020
@@ -1,8 +1,40 @@
-# $NetBSD: cond-func-exists.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: cond-func-exists.mk,v 1.3 2020/08/23 14:07:20 rillig Exp $
 #
 # Tests for the exists() function in .if conditions.
 
-# TODO: Implementation
+.if exists(.)
+.else
+.error
+.endif
+
+# The argument to the function must not be enclosed in quotes.
+# Neither double quotes nor single quotes are allowed.
+.if exists(".")
+.error
+.endif
+
+.if exists('.')
+.error
+.endif
+
+# The only way to escape characters that would otherwise influence the parser
+# is to enclose them in a variable expression.  For function arguments,
+# neither the backslash nor the dollar sign act as escape character.
+.if exists(\.)
+.error
+.endif
+
+.if exists(${:U.})
+.else
+.error
+.endif
+
+# The argument to the function can have several variable expressions.
+# See cond-func.mk for the characters that cannot be used directly.
+.if exists(${.PARSEDIR}/${.PARSEFILE})
+.else
+.error
+.endif
 
 all:
 	@:;
Index: src/usr.bin/make/unit-tests/cond-func-target.mk
diff -u src/usr.bin/make/unit-tests/cond-func-target.mk:1.2 src/usr.bin/make/unit-tests/cond-func-target.mk:1.3
--- src/usr.bin/make/unit-tests/cond-func-target.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/cond-func-target.mk	Sun Aug 23 14:07:20 2020
@@ -1,8 +1,38 @@
-# $NetBSD: cond-func-target.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: cond-func-target.mk,v 1.3 2020/08/23 14:07:20 rillig Exp $
 #
 # Tests for the target() function in .if conditions.
 
-# TODO: Implementation
+.MAIN: all
+
+# The target "target" does not exist yet.
+.if target(target)
+.error
+.endif
+
+target:
+
+# The target exists, even though it does not have any commands.
+.if !target(target)
+.error
+.endif
+
+target:
+	# not a command
+
+# Adding a comment to an existing target does not change whether the target
+# is defined or not.
+.if !target(target)
+.error
+.endif
+
+target:
+	@:;
+
+# Adding a command to an existing target does not change whether the target
+# is defined or not.
+.if !target(target)
+.error
+.endif
 
 all:
 	@:;



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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 15:18:43 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk varmod-remember.exp
varmod-remember.mk varmod-to-upper.exp varmod-to-upper.mk

Log Message:
make(1): move tests for the :tu and :_ modifiers into separate files


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/make/unit-tests/modmisc.exp \
src/usr.bin/make/unit-tests/modmisc.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-remember.exp \
src/usr.bin/make/unit-tests/varmod-to-upper.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-remember.mk \
src/usr.bin/make/unit-tests/varmod-to-upper.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/modmisc.exp
diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.45 src/usr.bin/make/unit-tests/modmisc.exp:1.46
--- src/usr.bin/make/unit-tests/modmisc.exp:1.45	Sun Aug 23 15:13:21 2020
+++ src/usr.bin/make/unit-tests/modmisc.exp	Sun Aug 23 15:18:43 2020
@@ -14,11 +14,8 @@ C:
 S:empty
 C:empty
 @:
-mod-tu-space: A   B
 mod-quote: new
 
 line
 mod-break-many-words: 500
-mod-remember: 1 2 3 1 2 3 1 2 3
-mod-remember: 1 2 3, SAVED=3
 exit status 0
Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.45 src/usr.bin/make/unit-tests/modmisc.mk:1.46
--- src/usr.bin/make/unit-tests/modmisc.mk:1.45	Sun Aug 23 15:13:21 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Sun Aug 23 15:18:43 2020
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.45 2020/08/23 15:13:21 rillig Exp $
+# $Id: modmisc.mk,v 1.46 2020/08/23 15:18:43 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -16,10 +16,8 @@ MOD_OPT=@d@$${exists($$d):?$$d:$${d:S,/u
 MOD_SEP=S,:, ,g
 
 all:	modvar modvarloop modsysv emptyvar undefvar
-all:	mod-tu-space
 all:	mod-quote
 all:	mod-break-many-words
-all:	mod-remember
 
 # See also sysv.mk.
 modsysv:
@@ -58,11 +56,6 @@ undefvar:
 	@echo C:${:U:C,^$,empty,}
 	@echo @:${:U:@var@empty@}
 
-mod-tu-space:
-	# The :tu and :tl modifiers operate on the variable value
-	# as a single string, not as a list of words. Therefore,
-	# the adjacent spaces are preserved.
-	@echo $@: ${a   b:L:tu:Q}
 
 mod-quote:
 	@echo $@: new${.newline:Q}${.newline:Q}line
@@ -71,14 +64,6 @@ mod-quote:
 mod-break-many-words:
 	@echo $@: ${UNDEF:U:range=500:[#]}
 
-# Demonstrate the :_ modifier.
-# In the parameterized form, having the variable name on the right side
-# of the = assignment operator is confusing. Luckily this modifier is
-# only rarely needed.
-mod-remember:
-	@echo $@: ${1 2 3:L:_:@var@${_}@}
-	@echo $@: ${1 2 3:L:@var@${var:_=SAVED:}@}, SAVED=${SAVED}
-
 # To apply a modifier indirectly via another variable, the whole
 # modifier must be put into a single variable.
 .if ${value:L:${:US}${:U,value,replacement,}} != "S,value,replacement,}"

Index: src/usr.bin/make/unit-tests/varmod-remember.exp
diff -u src/usr.bin/make/unit-tests/varmod-remember.exp:1.1 src/usr.bin/make/unit-tests/varmod-remember.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-remember.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-remember.exp	Sun Aug 23 15:18:43 2020
@@ -1 +1,3 @@
+1 2 3 1 2 3 1 2 3
+1 2 3, SAVED=3
 exit status 0
Index: src/usr.bin/make/unit-tests/varmod-to-upper.exp
diff -u src/usr.bin/make/unit-tests/varmod-to-upper.exp:1.1 src/usr.bin/make/unit-tests/varmod-to-upper.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-to-upper.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-to-upper.exp	Sun Aug 23 15:18:43 2020
@@ -1 +1,2 @@
+mod-tu-space: A   B
 exit status 0

Index: src/usr.bin/make/unit-tests/varmod-remember.mk
diff -u src/usr.bin/make/unit-tests/varmod-remember.mk:1.2 src/usr.bin/make/unit-tests/varmod-remember.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-remember.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varmod-remember.mk	Sun Aug 23 15:18:43 2020
@@ -1,9 +1,12 @@
-# $NetBSD: varmod-remember.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-remember.mk,v 1.3 2020/08/23 15:18:43 rillig Exp $
 #
 # Tests for the :_ modifier, which saves the current variable value
 # in the _ variable or another, to be used later again.
 
-# TODO: Implementation
-
+# In the parameterized form, having the variable name on the right side of
+# the = assignment operator is confusing.  In almost all other situations
+# the variable name is on the left-hand side of the = operator.  Luckily
+# this modifier is only rarely needed.
 all:
-	@:;
+	@echo ${1 2 3:L:_:@var@${_}@}
+	@echo ${1 2 3:L:@var@${var:_=SAVED:}@}, SAVED=${SAVED}
Index: src/usr.bin/make/unit-tests/varmod-to-upper.mk
diff -u src/usr.bin/make/unit-tests/varmod-to-upper.mk:1.2 src/usr.bin/make/unit-tests/varmod-to-upper.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-to-upper.mk:1.2	Sun Aug 16 14:25:16 2020

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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 15:18:43 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk varmod-remember.exp
varmod-remember.mk varmod-to-upper.exp varmod-to-upper.mk

Log Message:
make(1): move tests for the :tu and :_ modifiers into separate files


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/make/unit-tests/modmisc.exp \
src/usr.bin/make/unit-tests/modmisc.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-remember.exp \
src/usr.bin/make/unit-tests/varmod-to-upper.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-remember.mk \
src/usr.bin/make/unit-tests/varmod-to-upper.mk

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



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 16:18:12 UTC 2020

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

Log Message:
make(1): make navigating lists in debugging mode easier

Lst is an untyped list of pointers.  During debugging, it is often
necessary to inspect the content of the list.  To do this without manual
typecasting, add a few aliases for the LstNode.datum pointer, for
inspecting GNodes and strings.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/make/lst.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/lst.c
diff -u src/usr.bin/make/lst.c:1.38 src/usr.bin/make/lst.c:1.39
--- src/usr.bin/make/lst.c:1.38	Sun Aug 23 11:13:08 2020
+++ src/usr.bin/make/lst.c	Sun Aug 23 16:18:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.38 2020/08/23 11:13:08 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.39 2020/08/23 16:18:12 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -37,11 +37,11 @@
 #include "make.h"
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lst.c,v 1.38 2020/08/23 11:13:08 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.39 2020/08/23 16:18:12 rillig Exp $";
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.38 2020/08/23 11:13:08 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.39 2020/08/23 16:18:12 rillig Exp $");
 #endif /* not lint */
 #endif
 
@@ -52,7 +52,11 @@ struct ListNode {
  * node may not be deleted until count
  * goes to 0 */
 Boolean deleted;		/* List node should be removed when done */
-void *datum;		/* datum associated with this element */
+union {
+	void *datum;		/* datum associated with this element */
+	const GNode *gnode;	/* alias, just for debugging */
+	const char *str;	/* alias, just for debugging */
+};
 };
 
 typedef enum {



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 16:43:35 UTC 2020

Modified Files:
src/usr.bin/make: lst.c lst.h meta.c

Log Message:
make(1): define aliases for function types in list processing

This makes the prototypes of the functions clearer.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/make/lst.c src/usr.bin/make/lst.h
cvs rdiff -u -r1.97 -r1.98 src/usr.bin/make/meta.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/lst.c
diff -u src/usr.bin/make/lst.c:1.39 src/usr.bin/make/lst.c:1.40
--- src/usr.bin/make/lst.c:1.39	Sun Aug 23 16:18:12 2020
+++ src/usr.bin/make/lst.c	Sun Aug 23 16:43:34 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.39 2020/08/23 16:18:12 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.40 2020/08/23 16:43:34 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -37,11 +37,11 @@
 #include "make.h"
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lst.c,v 1.39 2020/08/23 16:18:12 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.40 2020/08/23 16:43:34 rillig Exp $";
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.39 2020/08/23 16:18:12 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.40 2020/08/23 16:43:34 rillig Exp $");
 #endif /* not lint */
 #endif
 
@@ -125,7 +125,7 @@ Lst_Init(void)
  * If copyProc is given, that function is used to create the new datum from the
  * old datum, usually by creating a copy of it. */
 Lst
-Lst_CopyS(Lst list, DuplicateProc *copyProc)
+Lst_CopyS(Lst list, LstCopyProc copyProc)
 {
 Lst newList;
 LstNode node;
@@ -145,7 +145,7 @@ Lst_CopyS(Lst list, DuplicateProc *copyP
 /* Destroy a list and free all its resources. If the freeProc is given, it is
  * called with the datum from each node in turn before the node is freed. */
 void
-Lst_Destroy(Lst list, FreeProc *freeProc)
+Lst_Destroy(Lst list, LstFreeProc freeProc)
 {
 LstNode node;
 LstNode next = NULL;
Index: src/usr.bin/make/lst.h
diff -u src/usr.bin/make/lst.h:1.39 src/usr.bin/make/lst.h:1.40
--- src/usr.bin/make/lst.h:1.39	Sun Aug 23 10:53:27 2020
+++ src/usr.bin/make/lst.h	Sun Aug 23 16:43:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lst.h,v 1.39 2020/08/23 10:53:27 rillig Exp $	*/
+/*	$NetBSD: lst.h,v 1.40 2020/08/23 16:43:34 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -92,8 +92,10 @@
 typedef	struct List	*Lst;
 typedef	struct ListNode	*LstNode;
 
-typedef void		*DuplicateProc(void *);
-typedef void		FreeProc(void *);
+typedef void *LstCopyProc(void *);
+typedef void LstFreeProc(void *);
+typedef int LstFindProc(const void *, const void *);
+typedef int LstActionProc(void *, void *);
 
 /*
  * Creation/destruction functions
@@ -101,9 +103,9 @@ typedef void		FreeProc(void *);
 /* Create a new list */
 Lst		Lst_Init(void);
 /* Duplicate an existing list */
-Lst		Lst_CopyS(Lst, DuplicateProc *);
+Lst		Lst_CopyS(Lst, LstCopyProc);
 /* Destroy an old one */
-void		Lst_Destroy(Lst, FreeProc *);
+void		Lst_Destroy(Lst, LstFreeProc);
 /* True if list is empty */
 Boolean		Lst_IsEmpty(Lst);
 
@@ -144,20 +146,18 @@ void		*Lst_DatumS(LstNode);
  * Functions for entire lists
  */
 /* Find an element in a list */
-LstNode		Lst_Find(Lst, const void *, int (*)(const void *, const void *));
+LstNode		Lst_Find(Lst, const void *, LstFindProc);
 /* Find an element starting from somewhere */
-LstNode		Lst_FindFrom(Lst, LstNode, const void *,
-			 int (*cmp)(const void *, const void *));
+LstNode		Lst_FindFrom(Lst, LstNode, const void *, LstFindProc);
 /*
  * See if the given datum is on the list. Returns the LstNode containing
  * the datum
  */
 LstNode		Lst_MemberS(Lst, void *);
 /* Apply a function to all elements of a lst */
-int		Lst_ForEach(Lst, int (*)(void *, void *), void *);
+int		Lst_ForEach(Lst, LstActionProc, void *);
 /* Apply a function to all elements of a lst starting from a certain point. */
-int		Lst_ForEachFrom(Lst, LstNode, int (*)(void *, void *),
-void *);
+int		Lst_ForEachFrom(Lst, LstNode, LstActionProc, void *);
 /*
  * these functions are for dealing with a list as a table, of sorts.
  * An idea of the "current element" is kept and used by all the functions

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.97 src/usr.bin/make/meta.c:1.98
--- src/usr.bin/make/meta.c:1.97	Sat Aug 22 17:34:25 2020
+++ src/usr.bin/make/meta.c	Sun Aug 23 16:43:34 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: meta.c,v 1.97 2020/08/22 17:34:25 rillig Exp $ */
+/*  $NetBSD: meta.c,v 1.98 2020/08/23 16:43:34 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -1623,7 +1623,7 @@ meta_oodate(GNode *gn, Boolean oodate)
 	}
 }
 
-Lst_Destroy(missingFiles, (FreeProc *)free);
+Lst_Destroy(missingFiles, free);
 
 if (oodate && needOODATE) {
 	/*



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 16:43:35 UTC 2020

Modified Files:
src/usr.bin/make: lst.c lst.h meta.c

Log Message:
make(1): define aliases for function types in list processing

This makes the prototypes of the functions clearer.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/make/lst.c src/usr.bin/make/lst.h
cvs rdiff -u -r1.97 -r1.98 src/usr.bin/make/meta.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/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 18:03:35 UTC 2020

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

Log Message:
make(1): prepare str.c for WARNS=6

The next step is to make brk_string return size_t instead of int.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/usr.bin/make/str.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/str.c
diff -u src/usr.bin/make/str.c:1.60 src/usr.bin/make/str.c:1.61
--- src/usr.bin/make/str.c:1.60	Tue Aug 11 18:41:46 2020
+++ src/usr.bin/make/str.c	Sun Aug 23 18:03:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.60 2020/08/11 18:41:46 rillig Exp $	*/
+/*	$NetBSD: str.c,v 1.61 2020/08/23 18:03:35 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: str.c,v 1.60 2020/08/11 18:41:46 rillig Exp $";
+static char rcsid[] = "$NetBSD: str.c,v 1.61 2020/08/23 18:03:35 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)str.c	5.8 (Berkeley) 6/1/90";
 #else
-__RCSID("$NetBSD: str.c,v 1.60 2020/08/11 18:41:46 rillig Exp $");
+__RCSID("$NetBSD: str.c,v 1.61 2020/08/23 18:03:35 rillig Exp $");
 #endif
 #endif/* not lint */
 #endif
@@ -147,9 +147,9 @@ brk_string(const char *str, int *out_wor
 {
 	size_t str_len;
 	char *words_buf;
-	int words_cap;
+	size_t words_cap;
 	char **words;
-	int words_len;
+	size_t words_len;
 	char inquote;
 	char *word_start;
 	char *word_end;
@@ -282,7 +282,7 @@ brk_string(const char *str, int *out_wor
 	}
 done:
 	words[words_len] = NULL;
-	*out_words_len = words_len;
+	*out_words_len = (int)words_len;
 	*out_words_buf = words_buf;
 	return words;
 }



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 18:53:13 UTC 2020

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

Log Message:
make(1): make Arch_MemMTime ready for WARNS=6


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 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.93 src/usr.bin/make/arch.c:1.94
--- src/usr.bin/make/arch.c:1.93	Sun Aug 23 17:49:37 2020
+++ src/usr.bin/make/arch.c	Sun Aug 23 18:53:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.93 2020/08/23 17:49:37 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.94 2020/08/23 18:53:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.93 2020/08/23 17:49:37 rillig Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.94 2020/08/23 18:53:13 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.93 2020/08/23 17:49:37 rillig Exp $");
+__RCSID("$NetBSD: arch.c,v 1.94 2020/08/23 18:53:13 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1126,8 +1126,6 @@ Arch_MemMTime(GNode *gn)
 {
 LstNode 	  ln;
 GNode   	  *pgn;
-char	  *nameStart,
-		  *nameEnd;
 
 Lst_OpenS(gn->parents);
 while ((ln = Lst_NextS(gn->parents)) != NULL) {
@@ -1141,12 +1139,13 @@ Arch_MemMTime(GNode *gn)
 	 * child. We keep searching its parents in case some other
 	 * parent requires this child to exist...
 	 */
-	nameStart = strchr(pgn->name, '(') + 1;
-	nameEnd = strchr(nameStart, ')');
+	const char *nameStart = strchr(pgn->name, '(') + 1;
+	const char *nameEnd = strchr(nameStart, ')');
+	size_t nameLen = (size_t)(nameEnd - nameStart);
 
 	if ((pgn->flags & REMAKE) &&
-		strncmp(nameStart, gn->name, nameEnd - nameStart) == 0) {
- gn->mtime = Arch_MTime(pgn);
+		strncmp(nameStart, gn->name, nameLen) == 0) {
+		gn->mtime = Arch_MTime(pgn);
 	}
 	} else if (pgn->flags & REMAKE) {
 	/*



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 18:53:13 UTC 2020

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

Log Message:
make(1): make Arch_MemMTime ready for WARNS=6


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 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.



CVS commit: src/sys/net

2020-08-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 23 18:52:53 UTC 2020

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

Log Message:
Initialize peers early on for error branch.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/net/if_wg.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_wg.c
diff -u src/sys/net/if_wg.c:1.22 src/sys/net/if_wg.c:1.23
--- src/sys/net/if_wg.c:1.22	Fri Aug 21 20:21:36 2020
+++ src/sys/net/if_wg.c	Sun Aug 23 18:52:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wg.c,v 1.22 2020/08/21 20:21:36 riastradh Exp $	*/
+/*	$NetBSD: if_wg.c,v 1.23 2020/08/23 18:52:53 riastradh Exp $	*/
 
 /*
  * Copyright (C) Ryota Ozaki 
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.22 2020/08/21 20:21:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.23 2020/08/23 18:52:53 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -4083,7 +4083,7 @@ wg_ioctl_get(struct wg_softc *wg, struct
 {
 	int error = ENOMEM;
 	prop_dictionary_t prop_dict;
-	prop_array_t peers;
+	prop_array_t peers = NULL;
 	char *buf;
 	struct wg_peer *wgp;
 	int s, i;



CVS commit: src/sys/net

2020-08-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 23 18:52:53 UTC 2020

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

Log Message:
Initialize peers early on for error branch.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/net/if_wg.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/make/unit-tests

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 14:52:07 UTC 2020

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

Log Message:
make(1): move some of the SysV modifier tests into another file


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/sysv.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/sysv.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-sysv.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-sysv.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/sysv.exp
diff -u src/usr.bin/make/unit-tests/sysv.exp:1.9 src/usr.bin/make/unit-tests/sysv.exp:1.10
--- src/usr.bin/make/unit-tests/sysv.exp:1.9	Sun Jul 26 11:19:04 2020
+++ src/usr.bin/make/unit-tests/sysv.exp	Sun Aug 23 14:52:06 2020
@@ -12,11 +12,4 @@ asam.c.c
 asam.c
 a.c.c
 
-ax:Q b c d eb
-bcd.e
-&
-anchor-dollar: value
-anchor-dollar: valux
-mismatch: file.cpp file.h
-mismatch: renamed.c other.c
 exit status 0

Index: src/usr.bin/make/unit-tests/sysv.mk
diff -u src/usr.bin/make/unit-tests/sysv.mk:1.12 src/usr.bin/make/unit-tests/sysv.mk:1.13
--- src/usr.bin/make/unit-tests/sysv.mk:1.12	Sat Aug  1 13:35:13 2020
+++ src/usr.bin/make/unit-tests/sysv.mk	Sun Aug 23 14:52:06 2020
@@ -1,7 +1,6 @@
-# $Id: sysv.mk,v 1.12 2020/08/01 13:35:13 rillig Exp $
+# $Id: sysv.mk,v 1.13 2020/08/23 14:52:06 rillig Exp $
 
-all: foo fun sam bla words ampersand anchor-dollar
-all: mismatch
+all: foo fun sam bla
 
 FOO ?=
 FOOBAR = ${FOO:=bar}
@@ -42,56 +41,3 @@ BLA=
 
 bla:
 	@echo $(BLA:%=foo/%x)
-
-# The :Q looks like a modifier but isn't.
-# It is part of the replacement string.
-words:
-	@echo a${a b c d e:L:%a=x:Q}b
-
-# Before 2020-07-19, an ampersand could be used in the replacement part
-# of a SysV substitution modifier.  This was probably a copy-and-paste
-# mistake since the SysV modifier code looked a lot like the code for the
-# :S and :C modifiers.  The ampersand is not mentioned in the manual page.
-ampersand:
-	@echo ${:U${a.bcd.e:L:a.%=%}:Q}
-	@echo ${:U${a.bcd.e:L:a.%=&}:Q}
-
-# Before 2020-07-20, when a SysV modifier was parsed, a single dollar
-# before the '=' was interpreted as an anchor, which doesn't make sense
-# since the anchor was discarded immediately.
-anchor-dollar:
-	@echo $@: ${:U${value:L:e$=x}:Q}
-	@echo $@: ${:U${value:L:e=x}:Q}
-
-# Words that don't match are copied unmodified.
-# The % placeholder can be anywhere in the string.
-mismatch:
-	@echo $@: ${:Ufile.c file.h:%.c=%.cpp}
-	@echo $@: ${:Ufile.c other.c:file.%=renamed.%}
-
-# Trying to cover all possible variants of the SysV modifier.
-LIST=	one two
-EXPR.1=	${LIST:o=X}
-EXP.1=	one twX
-EXPR.2=	${LIST:o=}
-EXP.2=	one tw
-EXPR.3=	${LIST:o=%}
-EXP.3=	one tw%
-EXPR.4=	${LIST:%o=X}
-EXP.4=	one X
-EXPR.5=	${LIST:o%=X}
-EXP.5=	X two
-EXPR.6=	${LIST:o%e=X}
-EXP.6=	X two
-EXPR.7=	${LIST:o%%e=X}		# Only the first '%' is the wildcard.
-EXP.7=	one two			# None of the words contains a literal '%'.
-EXPR.8=	${LIST:%=%%}
-EXP.8=	one% two%
-EXPR.9=	${LIST:%nes=%xxx}	# lhs is longer than the word "one"
-EXP.9=	one two
-
-.for i in ${:U:range=9}
-.if ${EXPR.$i} != ${EXP.$i}
-.warning test case $i expected "${EXP.$i}", got "${EXPR.$i}
-.endif
-.endfor

Index: src/usr.bin/make/unit-tests/varmod-sysv.exp
diff -u src/usr.bin/make/unit-tests/varmod-sysv.exp:1.1 src/usr.bin/make/unit-tests/varmod-sysv.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-sysv.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-sysv.exp	Sun Aug 23 14:52:06 2020
@@ -1 +1,8 @@
+ax:Q b c d eb
+bcd.e
+&
+anchor-dollar: value
+anchor-dollar: valux
+mismatch: file.cpp file.h
+mismatch: renamed.c other.c
 exit status 0

Index: src/usr.bin/make/unit-tests/varmod-sysv.mk
diff -u src/usr.bin/make/unit-tests/varmod-sysv.mk:1.2 src/usr.bin/make/unit-tests/varmod-sysv.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-sysv.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varmod-sysv.mk	Sun Aug 23 14:52:06 2020
@@ -1,11 +1,61 @@
-# $NetBSD: varmod-sysv.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-sysv.mk,v 1.3 2020/08/23 14:52:06 rillig Exp $
 #
 # Tests for the ${VAR:from=to} variable modifier, which replaces the suffix
 # "from" with "to".  It can also use '%' as a wildcard.
 #
 # This modifier is applied when the other modifiers don't match exactly.
 
-# TODO: Implementation
+all: words ampersand anchor-dollar mismatch
 
-all:
-	@:;
+# The :Q looks like a modifier but isn't.
+# It is part of the replacement string.
+words:
+	@echo a${a b c d e:L:%a=x:Q}b
+
+# Before 2020-07-19, an ampersand could be used in the replacement part
+# of a SysV substitution modifier.  This was probably a copy-and-paste
+# mistake since the SysV modifier code looked a lot like the code for the
+# :S and :C modifiers.  The ampersand 

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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 14:52:07 UTC 2020

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

Log Message:
make(1): move some of the SysV modifier tests into another file


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/sysv.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/sysv.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-sysv.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-sysv.mk

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



CVS commit: src/tests/bin/df

2020-08-23 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sun Aug 23 15:51:30 UTC 2020

Modified Files:
src/tests/bin/df: t_df.sh

Log Message:
adjust the number of spaces to match the current df(1) output.
fix NetBSD PR/55600

TODO: it should not be dependent on the number of spaces.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/bin/df/t_df.sh

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



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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 17:34:46 UTC 2020

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

Log Message:
make(1): add test for wildcards in archive dependency


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/archive.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/archive.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/archive.exp
diff -u src/usr.bin/make/unit-tests/archive.exp:1.2 src/usr.bin/make/unit-tests/archive.exp:1.3
--- src/usr.bin/make/unit-tests/archive.exp:1.2	Sun Aug 16 14:39:50 2020
+++ src/usr.bin/make/unit-tests/archive.exp	Sun Aug 23 17:34:46 2020
@@ -5,6 +5,7 @@ ar t libprog.a
 archive.mk
 modmisc.mk
 varmisc.mk
+list-archive-wildcard: archive.mk
 depend-on-existing-member
 `depend-on-nonexistent-member' is up to date.
 rm -f libprog.a

Index: src/usr.bin/make/unit-tests/archive.mk
diff -u src/usr.bin/make/unit-tests/archive.mk:1.3 src/usr.bin/make/unit-tests/archive.mk:1.4
--- src/usr.bin/make/unit-tests/archive.mk:1.3	Sun Aug 16 14:39:50 2020
+++ src/usr.bin/make/unit-tests/archive.mk	Sun Aug 23 17:34:46 2020
@@ -1,4 +1,4 @@
-# $NetBSD: archive.mk,v 1.3 2020/08/16 14:39:50 rillig Exp $
+# $NetBSD: archive.mk,v 1.4 2020/08/23 17:34:46 rillig Exp $
 #
 # Very basic demonstration of handling archives, based on the description
 # in PSD.doc/tutorial.ms.
@@ -16,6 +16,7 @@ all:
 	${RUN} ${MAKE_CMD} remove-archive
 	${RUN} ${MAKE_CMD} create-archive
 	${RUN} ${MAKE_CMD} list-archive
+	${RUN} ${MAKE_CMD} list-archive-wildcard
 	${RUN} ${MAKE_CMD} depend-on-existing-member
 	${RUN} ${MAKE_CMD} depend-on-nonexistent-member
 	${RUN} ${MAKE_CMD} remove-archive
@@ -28,6 +29,12 @@ ${ARCHIVE}: ${ARCHIVE}(${FILES})
 list-archive: ${ARCHIVE}
 	ar t ${.ALLSRC}
 
+# XXX: I had expected that this dependency would select all *.mk files from
+# the archive.  Instead, the globbing is done in the current directory.
+# To prevent an overly long file list, the pattern is restricted to ar*.mk.
+list-archive-wildcard: ${ARCHIVE}(ar*.mk)
+	${RUN} printf '%s\n' ${.ALLSRC:O:@member@${.TARGET:Q}': '${member:Q}@}
+
 depend-on-existing-member: ${ARCHIVE}(archive.mk)
 	${RUN} echo $@
 



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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 17:34:46 UTC 2020

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

Log Message:
make(1): add test for wildcards in archive dependency


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

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



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

2020-08-23 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sun Aug 23 11:00:18 UTC 2020

Modified Files:
src/tests/lib/libc/gen: isqemu.h

Log Message:
Provide separate functions to check for running under qemu in general
and for running under qemu's built-in TCG CPU emulation (as opposed to
hardware virtualization via NVMM or KVM).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/gen/isqemu.h

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

Modified files:

Index: src/tests/lib/libc/gen/isqemu.h
diff -u src/tests/lib/libc/gen/isqemu.h:1.4 src/tests/lib/libc/gen/isqemu.h:1.5
--- src/tests/lib/libc/gen/isqemu.h:1.4	Sat Jan  3 14:21:05 2015
+++ src/tests/lib/libc/gen/isqemu.h	Sun Aug 23 11:00:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: isqemu.h,v 1.4 2015/01/03 14:21:05 gson Exp $	*/
+/*	$NetBSD: isqemu.h,v 1.5 2020/08/23 11:00:18 gson Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -33,14 +33,36 @@
  */
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 static __inline bool
 isQEMU(void) {
+   struct devlistargs dla = {
+	   .l_devname = "qemufwcfg0",
+	   .l_childname = NULL,
+	   .l_children = 0,
+   };
+   int fd = open(DRVCTLDEV, O_RDONLY, 0);
+   if (fd == -1)
+	   return false;
+   if (ioctl(fd, DRVLISTDEV, ) == -1) {
+	   close(fd);
+	   return false;
+   }
+   close(fd);
+   return true;
+}
+
+static __inline bool
+isQEMU_TCG(void) {
 #if defined(__i386__) || defined(__x86_64__)
 	char name[1024];
 	size_t len = sizeof(name);



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

2020-08-23 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sun Aug 23 11:00:18 UTC 2020

Modified Files:
src/tests/lib/libc/gen: isqemu.h

Log Message:
Provide separate functions to check for running under qemu in general
and for running under qemu's built-in TCG CPU emulation (as opposed to
hardware virtualization via NVMM or KVM).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/gen/isqemu.h

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



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 06:12:52 UTC 2020

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

Log Message:
make(1): use common MAX macro instead of self-defined


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/buf.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/buf.c
diff -u src/usr.bin/make/buf.c:1.35 src/usr.bin/make/buf.c:1.36
--- src/usr.bin/make/buf.c:1.35	Thu Aug 13 04:12:13 2020
+++ src/usr.bin/make/buf.c	Sun Aug 23 06:12:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.c,v 1.35 2020/08/13 04:12:13 rillig Exp $	*/
+/*	$NetBSD: buf.c,v 1.36 2020/08/23 06:12:52 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: buf.c,v 1.35 2020/08/13 04:12:13 rillig Exp $";
+static char rcsid[] = "$NetBSD: buf.c,v 1.36 2020/08/23 06:12:52 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)buf.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: buf.c,v 1.35 2020/08/13 04:12:13 rillig Exp $");
+__RCSID("$NetBSD: buf.c,v 1.36 2020/08/23 06:12:52 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -86,19 +86,12 @@ __RCSID("$NetBSD: buf.c,v 1.35 2020/08/1
 
 #include 
 #include "make.h"
-#include "buf.h"
-
-#ifndef max
-#define max(a, b)  ((a) > (b) ? (a) : (b))
-#endif
-
-#define BUF_DEF_SIZE	256 	/* Default buffer size */
 
 /* Extend the buffer for adding a single byte. */
 void
 Buf_Expand_1(Buffer *bp)
 {
-bp->size += max(bp->size, 16);
+bp->size += MAX(bp->size, 16);
 bp->buffer = bmake_realloc(bp->buffer, bp->size);
 }
 
@@ -110,7 +103,7 @@ Buf_AddBytes(Buffer *bp, const char *byt
 char *ptr;
 
 if (__predict_false(count + numBytes >= bp->size)) {
-	bp->size += max(bp->size, numBytes + 16);
+	bp->size += MAX(bp->size, numBytes + 16);
 	bp->buffer = bmake_realloc(bp->buffer, bp->size);
 }
 
@@ -181,7 +174,7 @@ void
 Buf_Init(Buffer *bp, size_t size)
 {
 if (size <= 0) {
-	size = BUF_DEF_SIZE;
+	size = 256;
 }
 bp->size = size;
 bp->count = 0;



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 06:12:52 UTC 2020

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

Log Message:
make(1): use common MAX macro instead of self-defined


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/make/buf.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/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 06:54:01 UTC 2020

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

Log Message:
make(1): unroll loop in SuffFindArchiveDeps

The compiler had unrolled this loop anyway, and for humans it is more
readable as well.

The comments "must be first" and "must be second" came from a time when
the variables were stored in a linked list instead of a hash table.
Maybe this "must" was about performance back then.  Anyway, the tests
run fine with either order, and there is absolutely no evidence that the
order of these variables could have any effect.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/usr.bin/make/suff.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/suff.c
diff -u src/usr.bin/make/suff.c:1.112 src/usr.bin/make/suff.c:1.113
--- src/usr.bin/make/suff.c:1.112	Sat Aug 22 22:57:53 2020
+++ src/usr.bin/make/suff.c	Sun Aug 23 06:54:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.112 2020/08/22 22:57:53 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.113 2020/08/23 06:54:01 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.112 2020/08/22 22:57:53 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.113 2020/08/23 06:54:01 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c	8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.112 2020/08/22 22:57:53 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.113 2020/08/23 06:54:01 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1886,13 +1886,7 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
 char	*eoarch;/* End of archive portion */
 char	*eoname;/* End of member portion */
 GNode   	*mem;	/* Node for member */
-static const char	*copy[] = {
-	/* Variables to be copied from the member node */
-	TARGET,		/* Must be first */
-	PREFIX,		/* Must be second */
-};
 LstNode 	ln, nln;/* Next suffix node to check */
-int		i;  	/* Index into copy and vals */
 Suff	*ms;	/* Suffix descriptor for member */
 char	*name;	/* Start of member's name */
 
@@ -1935,11 +1929,12 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
 /*
  * Copy in the variables from the member node to this one.
  */
-for (i = (sizeof(copy)/sizeof(copy[0]))-1; i >= 0; i--) {
-	char *p1;
-	Var_Set(copy[i], Var_Value(copy[i], mem, ), gn);
-	bmake_free(p1);
-
+{
+	char *freeIt;
+	Var_Set(PREFIX, Var_Value(PREFIX, mem, ), gn);
+	bmake_free(freeIt);
+	Var_Set(TARGET, Var_Value(TARGET, mem, ), gn);
+	bmake_free(freeIt);
 }
 
 ms = mem->suffix;



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 06:54:01 UTC 2020

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

Log Message:
make(1): unroll loop in SuffFindArchiveDeps

The compiler had unrolled this loop anyway, and for humans it is more
readable as well.

The comments "must be first" and "must be second" came from a time when
the variables were stored in a linked list instead of a hash table.
Maybe this "must" was about performance back then.  Anyway, the tests
run fine with either order, and there is absolutely no evidence that the
order of these variables could have any effect.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/usr.bin/make/suff.c

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



CVS commit: src/share/man/man5

2020-08-23 Thread Travis Paul
Module Name:src
Committed By:   tpaul
Date:   Sun Aug 23 20:23:56 UTC 2020

Modified Files:
src/share/man/man5: capfile.5

Log Message:
Man page typo fix.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man5/capfile.5

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

Modified files:

Index: src/share/man/man5/capfile.5
diff -u src/share/man/man5/capfile.5:1.4 src/share/man/man5/capfile.5:1.5
--- src/share/man/man5/capfile.5:1.4	Mon Jul  3 21:30:59 2017
+++ src/share/man/man5/capfile.5	Sun Aug 23 20:23:56 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: capfile.5,v 1.4 2017/07/03 21:30:59 wiz Exp $
+.\"	$NetBSD: capfile.5,v 1.5 2020/08/23 20:23:56 tpaul Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -35,7 +35,7 @@
 .Nd capability database files
 .Sh DESCRIPTION
 .Nm
-descibes the format of capability database files,
+describes the format of capability database files,
 made popular by
 .Nm termcap .
 .Nm termcap



CVS commit: src/share/man/man5

2020-08-23 Thread Travis Paul
Module Name:src
Committed By:   tpaul
Date:   Sun Aug 23 20:23:56 UTC 2020

Modified Files:
src/share/man/man5: capfile.5

Log Message:
Man page typo fix.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man5/capfile.5

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



CVS commit: src/sys/dev/mii

2020-08-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug 24 04:23:41 UTC 2020

Modified Files:
src/sys/dev/mii: ciphy.c mii_physubr.c miivar.h urlphy.c

Log Message:
 Don't do full initialization for autonego when just restarting autonego
because it's not required.

 This change reduce extra initialization which include PHY_RESET() which
caused long delay(max 500ms).


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/mii/miivar.h
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/mii/urlphy.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/pci

2020-08-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug 24 05:34:00 UTC 2020

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

Log Message:
s/ressource/resource/. Found by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.685 -r1.686 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.685 src/sys/dev/pci/if_wm.c:1.686
--- src/sys/dev/pci/if_wm.c:1.685	Wed Aug  5 03:17:18 2020
+++ src/sys/dev/pci/if_wm.c	Mon Aug 24 05:34:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.685 2020/08/05 03:17:18 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.686 2020/08/24 05:34:00 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.685 2020/08/05 03:17:18 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.686 2020/08/24 05:34:00 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -10958,7 +10958,7 @@ wm_gmii_i82544_writereg_locked(device_t 
  *
  *	Read a PHY register on the kumeran
  * This could be handled by the PHY layer if we didn't have to lock the
- * ressource ...
+ * resource ...
  */
 static int
 wm_gmii_i80003_readreg(device_t dev, int phy, int reg, uint16_t *val)
@@ -11017,7 +11017,7 @@ out:
  *
  *	Write a PHY register on the kumeran.
  * This could be handled by the PHY layer if we didn't have to lock the
- * ressource ...
+ * resource ...
  */
 static int
 wm_gmii_i80003_writereg(device_t dev, int phy, int reg, uint16_t val)
@@ -11075,7 +11075,7 @@ out:
  *
  *	Read a PHY register on the kumeran
  * This could be handled by the PHY layer if we didn't have to lock the
- * ressource ...
+ * resource ...
  */
 static int
 wm_gmii_bm_readreg(device_t dev, int phy, int reg, uint16_t *val)
@@ -11122,7 +11122,7 @@ release:
  *
  *	Write a PHY register on the kumeran.
  * This could be handled by the PHY layer if we didn't have to lock the
- * ressource ...
+ * resource ...
  */
 static int
 wm_gmii_bm_writereg(device_t dev, int phy, int reg, uint16_t val)
@@ -11333,7 +11333,7 @@ wm_access_phy_wakeup_reg_bm(device_t dev
  *
  *	Read a PHY register on the kumeran
  * This could be handled by the PHY layer if we didn't have to lock the
- * ressource ...
+ * resource ...
  */
 static int
 wm_gmii_hv_readreg(device_t dev, int phy, int reg, uint16_t *val)
@@ -11397,7 +11397,7 @@ wm_gmii_hv_readreg_locked(device_t dev, 
  *
  *	Write a PHY register on the kumeran.
  * This could be handled by the PHY layer if we didn't have to lock the
- * ressource ...
+ * resource ...
  */
 static int
 wm_gmii_hv_writereg(device_t dev, int phy, int reg, uint16_t val)
@@ -11483,7 +11483,7 @@ wm_gmii_hv_writereg_locked(device_t dev,
  *
  *	Read a PHY register on the 82580 and I350.
  * This could be handled by the PHY layer if we didn't have to lock the
- * ressource ...
+ * resource ...
  */
 static int
 wm_gmii_82580_readreg(device_t dev, int phy, int reg, uint16_t *val)
@@ -11514,7 +11514,7 @@ wm_gmii_82580_readreg(device_t dev, int 
  *
  *	Write a PHY register on the 82580 and I350.
  * This could be handled by the PHY layer if we didn't have to lock the
- * ressource ...
+ * resource ...
  */
 static int
 wm_gmii_82580_writereg(device_t dev, int phy, int reg, uint16_t val)
@@ -11545,7 +11545,7 @@ wm_gmii_82580_writereg(device_t dev, int
  *
  *	Read a PHY register on the I2100 and I211.
  * This could be handled by the PHY layer if we didn't have to lock the
- * ressource ...
+ * resource ...
  */
 static int
 wm_gmii_gs40g_readreg(device_t dev, int phy, int reg, uint16_t *val)
@@ -11580,7 +11580,7 @@ release:
  *
  *	Write a PHY register on the I210 and I211.
  * This could be handled by the PHY layer if we didn't have to lock the
- * ressource ...
+ * resource ...
  */
 static int
 wm_gmii_gs40g_writereg(device_t dev, int phy, int reg, uint16_t val)
@@ -11867,7 +11867,7 @@ wm_sgmii_sfp_preconfig(struct wm_softc *
  *
  *	Read a PHY register on the SGMII
  * This could be handled by the PHY layer if we didn't have to lock the
- * ressource ...
+ * resource ...
  */
 static int
 wm_sgmii_readreg(device_t dev, int phy, int reg, uint16_t *val)
@@ -11924,7 +11924,7 @@ wm_sgmii_readreg_locked(device_t dev, in
  *
  *	Write a PHY register on the SGMII.
  * This could be handled by the PHY layer if we didn't have to lock the
- * ressource ...
+ * resource ...
  */
 static int
 wm_sgmii_writereg(device_t dev, int phy, int reg, uint16_t val)



CVS commit: src/sys/dev/pci

2020-08-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug 24 05:34:00 UTC 2020

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

Log Message:
s/ressource/resource/. Found by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.685 -r1.686 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.



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 21:40:30 UTC 2020

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

Log Message:
make(1): extend the documentation on the ApplyModifier functions


To generate a diff of this commit:
cvs rdiff -u -r1.466 -r1.467 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.466 src/usr.bin/make/var.c:1.467
--- src/usr.bin/make/var.c:1.466	Sun Aug 23 20:57:02 2020
+++ src/usr.bin/make/var.c	Sun Aug 23 21:40:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.466 2020/08/23 20:57:02 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.467 2020/08/23 21:40:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.466 2020/08/23 20:57:02 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.467 2020/08/23 21:40:30 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.466 2020/08/23 20:57:02 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.467 2020/08/23 21:40:30 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -162,8 +162,10 @@ char var_Error[] = "";
 
 /*
  * Similar to var_Error, but returned when the 'VARE_UNDEFERR' flag for
- * Var_Parse is not set. Why not just use a constant? Well, GCC likes
- * to condense identical string instances...
+ * Var_Parse is not set.
+ *
+ * Why not just use a constant? Well, GCC likes to condense identical string
+ * instances...
  */
 static char varNoError[] = "";
 
@@ -1897,32 +1899,62 @@ VarStrftime(const char *fmt, Boolean zul
 
 /* The ApplyModifier functions all work in the same way.  They get the
  * current parsing position (pp) and parse the modifier from there.  The
- * modifier typically lasts until the next ':', or a closing '}', ')'
+ * modifier typically lasts until the next ':', or a closing '}' or ')'
  * (taken from st->endc), or the end of the string (parse error).
  *
- * After parsing, no matter whether successful or not, they set the parsing
- * position to the character after the modifier, or in case of parse errors,
- * just increment the parsing position.  (That's how it is right now, it
- * shouldn't hurt to keep the parsing position as-is in case of parse errors.)
- *
- * On success, an ApplyModifier function:
- *	* sets the parsing position *pp to the first character following the
- *	  current modifier
- *	* processes the current variable value from st->val to produce the
- *	  modified variable value and stores it in st->newVal
- *	* returns AMR_OK
- *
- * On parse errors, an ApplyModifier function:
- *	* either issues a custom error message and then returns AMR_CLEANUP
- *	* or returns AMR_BAD to issue the standard "Bad modifier" error message
- *	In both of these cases, it updates the parsing position.
- *	Modifiers that use ParseModifierPart typically set st->missing_delim
- *	and then return AMR_CLEANUP to issue the standard error message.
- *
- * If the expected modifier was not found, several modifiers return AMR_UNKNOWN
- * to fall back to the SysV modifier ${VAR:from=to}.  This is especially
- * useful for newly added long-name modifiers, to avoid breaking any existing
- * code.  In such a case the parsing position must not be changed.
+ * The high-level behavior of these functions is:
+ *
+ * 1. parse the modifier
+ * 2. evaluate the modifier
+ * 3. housekeeping
+ *
+ * Parsing the modifier
+ *
+ * If parsing succeeds, the parsing position *pp is updated to point to the
+ * first character following the modifier, which typically is either ':' or
+ * st->endc.
+ *
+ * If parsing fails because of a missing delimiter (as in the :S, :C or :@
+ * modifiers), set st->missing_delim and return AMR_CLEANUP.
+ *
+ * If parsing fails because the modifier is unknown, return AMR_UNKNOWN to
+ * try the SysV modifier ${VAR:from=to} as fallback.  This should only be
+ * done as long as there have been no side effects from evaluating nested
+ * variables, to avoid evaluating them more than once.  In this case, the
+ * parsing position must not be updated.  (XXX: Why not? The original parsing
+ * position is well-known in ApplyModifiers.)
+ *
+ * If parsing fails and the SysV modifier ${VAR:from=to} should not be used
+ * as a fallback, either issue an error message using Error or Parse_Error
+ * and then return AMR_CLEANUP, or return AMR_BAD for the default error
+ * message.  Both of these return values will stop processing the variable
+ * expression.  (XXX: As of 2020-08-23, evaluation of the whole string
+ * continues nevertheless after skipping a few bytes, which essentially is
+ * undefined behavior.  Not in the sense of C, but still it's impossible to
+ * predict what happens in the parser.)
+ *
+ * Evaluating the modifier
+ *
+ * After parsing, 

CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 21:40:30 UTC 2020

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

Log Message:
make(1): extend the documentation on the ApplyModifier functions


To generate a diff of this commit:
cvs rdiff -u -r1.466 -r1.467 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.



CVS commit: src/sys/dev/mii

2020-08-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug 24 04:23:41 UTC 2020

Modified Files:
src/sys/dev/mii: ciphy.c mii_physubr.c miivar.h urlphy.c

Log Message:
 Don't do full initialization for autonego when just restarting autonego
because it's not required.

 This change reduce extra initialization which include PHY_RESET() which
caused long delay(max 500ms).


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/mii/miivar.h
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/mii/urlphy.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/mii/ciphy.c
diff -u src/sys/dev/mii/ciphy.c:1.40 src/sys/dev/mii/ciphy.c:1.41
--- src/sys/dev/mii/ciphy.c:1.40	Tue Jul  7 08:44:12 2020
+++ src/sys/dev/mii/ciphy.c	Mon Aug 24 04:23:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ciphy.c,v 1.40 2020/07/07 08:44:12 msaitoh Exp $ */
+/* $NetBSD: ciphy.c,v 1.41 2020/08/24 04:23:41 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.40 2020/07/07 08:44:12 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.41 2020/08/24 04:23:41 msaitoh Exp $");
 
 /*
  * Driver for the Cicada CS8201 10/100/1000 copper PHY.
@@ -273,7 +273,7 @@ setit:
 		if (sc->mii_ticks <= sc->mii_anegticks)
 			break;
 
-		mii_phy_auto(sc);
+		mii_phy_auto_restart(sc);
 		return 0;
 	}
 

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.91 src/sys/dev/mii/mii_physubr.c:1.92
--- src/sys/dev/mii/mii_physubr.c:1.91	Tue Jul  7 08:44:12 2020
+++ src/sys/dev/mii/mii_physubr.c	Mon Aug 24 04:23:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.91 2020/07/07 08:44:12 msaitoh Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.92 2020/08/24 04:23:41 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.91 2020/07/07 08:44:12 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.92 2020/08/24 04:23:41 msaitoh Exp $");
 
 #include 
 #include 
@@ -198,6 +198,7 @@ mii_phy_setmedia(struct mii_softc *sc)
 		PHY_WRITE(sc, MII_BMCR, bmcr);
 }
 
+/* Setup autonegotiation and start it. */
 int
 mii_phy_auto(struct mii_softc *sc)
 {
@@ -283,6 +284,20 @@ mii_phy_auto(struct mii_softc *sc)
 	return EJUSTRETURN;
 }
 
+/* Just restart autonegotiation without changing any setting */
+int
+mii_phy_auto_restart(struct mii_softc *sc)
+{
+	uint16_t reg;
+
+	PHY_READ(sc, MII_BMCR, );
+	reg |= BMCR_STARTNEG;
+	PHY_WRITE(sc, MII_BMCR, reg);
+	sc->mii_ticks = 0;
+
+	return EJUSTRETURN;
+}
+
 static void
 mii_phy_auto_timeout_locked(struct mii_softc *sc)
 {
@@ -365,9 +380,7 @@ mii_phy_tick(struct mii_softc *sc)
 	if (sc->mii_ticks <= sc->mii_anegticks)
 		return EJUSTRETURN;
 
-	PHY_RESET(sc);
-
-	if (mii_phy_auto(sc) == EJUSTRETURN)
+	if (mii_phy_auto_restart(sc) == EJUSTRETURN)
 		return EJUSTRETURN;
 
 	/*

Index: src/sys/dev/mii/miivar.h
diff -u src/sys/dev/mii/miivar.h:1.72 src/sys/dev/mii/miivar.h:1.73
--- src/sys/dev/mii/miivar.h:1.72	Tue Jul  7 08:44:12 2020
+++ src/sys/dev/mii/miivar.h	Mon Aug 24 04:23:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: miivar.h,v 1.72 2020/07/07 08:44:12 msaitoh Exp $	*/
+/*	$NetBSD: miivar.h,v 1.73 2020/08/24 04:23:41 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc.
@@ -332,6 +332,7 @@ void	mii_phy_delete_media(struct mii_sof
 /* MII must be LOCKED */
 void	mii_phy_setmedia(struct mii_softc *);
 int	mii_phy_auto(struct mii_softc *);
+int	mii_phy_auto_restart(struct mii_softc *);
 void	mii_phy_reset(struct mii_softc *);
 void	mii_phy_down(struct mii_softc *);
 int	mii_phy_tick(struct mii_softc *);

Index: src/sys/dev/mii/urlphy.c
diff -u src/sys/dev/mii/urlphy.c:1.36 src/sys/dev/mii/urlphy.c:1.37
--- src/sys/dev/mii/urlphy.c:1.36	Tue Jul  7 08:44:12 2020
+++ src/sys/dev/mii/urlphy.c	Mon Aug 24 04:23:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: urlphy.c,v 1.36 2020/07/07 08:44:12 msaitoh Exp $	*/
+/*	$NetBSD: urlphy.c,v 1.37 2020/08/24 04:23:41 msaitoh Exp $	*/
 /*
  * Copyright (c) 2001, 2002
  * Shingo WATANABE .  All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.36 2020/07/07 08:44:12 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.37 2020/08/24 04:23:41 msaitoh Exp $");
 
 #include 
 #include 
@@ -199,7 +199,7 @@ urlphy_service(struct mii_softc *sc, str
 
 		PHY_RESET(sc);
 
-		if (mii_phy_auto(sc) == EJUSTRETURN)
+		if (mii_phy_auto_restart(sc) == EJUSTRETURN)
 			return 0;
 
 		break;



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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 19:30:13 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: directive-undef.mk varmisc.mk

Log Message:
make(1): move test for .undef into separate file


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-undef.mk
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmisc.mk

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



CVS commit: src/sys/dev/mii

2020-08-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug 24 04:49:05 UTC 2020

Modified Files:
src/sys/dev/mii: urlphy.c

Log Message:
 Remove extra PHY_RESET(sc) in the MII_TICK path because it's not requierd
to just restart autonego.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/mii/urlphy.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/mii/urlphy.c
diff -u src/sys/dev/mii/urlphy.c:1.37 src/sys/dev/mii/urlphy.c:1.38
--- src/sys/dev/mii/urlphy.c:1.37	Mon Aug 24 04:23:41 2020
+++ src/sys/dev/mii/urlphy.c	Mon Aug 24 04:49:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: urlphy.c,v 1.37 2020/08/24 04:23:41 msaitoh Exp $	*/
+/*	$NetBSD: urlphy.c,v 1.38 2020/08/24 04:49:05 msaitoh Exp $	*/
 /*
  * Copyright (c) 2001, 2002
  * Shingo WATANABE .  All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.37 2020/08/24 04:23:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.38 2020/08/24 04:49:05 msaitoh Exp $");
 
 #include 
 #include 
@@ -197,8 +197,6 @@ urlphy_service(struct mii_softc *sc, str
 		if (sc->mii_ticks <= sc->mii_anegticks)
 			return 0;
 
-		PHY_RESET(sc);
-
 		if (mii_phy_auto_restart(sc) == EJUSTRETURN)
 			return 0;
 



CVS commit: src/sys/dev/mii

2020-08-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug 24 04:49:05 UTC 2020

Modified Files:
src/sys/dev/mii: urlphy.c

Log Message:
 Remove extra PHY_RESET(sc) in the MII_TICK path because it's not requierd
to just restart autonego.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/mii/urlphy.c

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



CVS commit: src/sys

2020-08-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug 24 05:37:41 UTC 2020

Modified Files:
src/sys/arch/i386/pnpbios: pciide_pnpbios.c pnpbios.c
src/sys/arch/i386/stand/lib/netif: am7990.c
src/sys/dev/acpi: acpi_i2c.c
src/sys/dev/pci: btvmei.c pciide_common.c
src/sys/dev/vme: vme.c

Log Message:
s/ressource/resource/. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/i386/pnpbios/pciide_pnpbios.c
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/i386/pnpbios/pnpbios.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/lib/netif/am7990.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/acpi/acpi_i2c.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/btvmei.c
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/pci/pciide_common.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/vme/vme.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/i386/pnpbios/pciide_pnpbios.c
diff -u src/sys/arch/i386/pnpbios/pciide_pnpbios.c:1.33 src/sys/arch/i386/pnpbios/pciide_pnpbios.c:1.34
--- src/sys/arch/i386/pnpbios/pciide_pnpbios.c:1.33	Fri Oct 20 07:06:06 2017
+++ src/sys/arch/i386/pnpbios/pciide_pnpbios.c	Mon Aug 24 05:37:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pciide_pnpbios.c,v 1.33 2017/10/20 07:06:06 jdolecek Exp $	*/
+/*	$NetBSD: pciide_pnpbios.c,v 1.34 2020/08/24 05:37:40 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1999 Soren S. Jorvang.  All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pciide_pnpbios.c,v 1.33 2017/10/20 07:06:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciide_pnpbios.c,v 1.34 2020/08/24 05:37:40 msaitoh Exp $");
 
 #include 
 #include 
@@ -178,7 +178,7 @@ pciide_pnpbios_attach(device_t parent, d
 	for (drive = 0; drive < cp->ata_channel.ch_ndrives; drive++) {
 		/*
 		 * we have not probed the drives yet,
-		 * allocate ressources for all of them.
+		 * allocate resources for all of them.
 		 */
 		if (pciide_dma_table_setup(sc, 0, drive) != 0) {
 			/* Abort DMA setup */

Index: src/sys/arch/i386/pnpbios/pnpbios.c
diff -u src/sys/arch/i386/pnpbios/pnpbios.c:1.74 src/sys/arch/i386/pnpbios/pnpbios.c:1.75
--- src/sys/arch/i386/pnpbios/pnpbios.c:1.74	Sun Nov 10 21:16:28 2019
+++ src/sys/arch/i386/pnpbios/pnpbios.c	Mon Aug 24 05:37:40 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pnpbios.c,v 1.74 2019/11/10 21:16:28 chs Exp $ */
+/* $NetBSD: pnpbios.c,v 1.75 2020/08/24 05:37:40 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2000 Jason R. Thorpe.  All rights reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pnpbios.c,v 1.74 2019/11/10 21:16:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pnpbios.c,v 1.75 2020/08/24 05:37:40 msaitoh Exp $");
 
 #include 
 #include 
@@ -155,7 +155,7 @@ static int pnp_debugdump(struct pnpresou
 #endif
 
 /*
- * small ressource types (beginning with 1)
+ * small resource types (beginning with 1)
  */
 static const struct{
 	int (*handler)(struct pnpresources *, const void *, size_t);

Index: src/sys/arch/i386/stand/lib/netif/am7990.c
diff -u src/sys/arch/i386/stand/lib/netif/am7990.c:1.7 src/sys/arch/i386/stand/lib/netif/am7990.c:1.8
--- src/sys/arch/i386/stand/lib/netif/am7990.c:1.7	Sun Dec 14 18:46:33 2008
+++ src/sys/arch/i386/stand/lib/netif/am7990.c	Mon Aug 24 05:37:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: am7990.c,v 1.7 2008/12/14 18:46:33 christos Exp $	*/
+/*	$NetBSD: am7990.c,v 1.8 2020/08/24 05:37:40 msaitoh Exp $	*/
 
 /* mostly from netbsd:sys/arch/i386/netboot/ne2100.c
  memory allocation now 1 chunk, added deallocation
@@ -157,7 +157,7 @@ am7990_init(void)
 }
 
 /*
- * Stop ethernet board and free ressources
+ * Stop ethernet board and free resources
  */
 void
 EtherStop(void)

Index: src/sys/dev/acpi/acpi_i2c.c
diff -u src/sys/dev/acpi/acpi_i2c.c:1.7 src/sys/dev/acpi/acpi_i2c.c:1.8
--- src/sys/dev/acpi/acpi_i2c.c:1.7	Thu Jun 11 02:39:30 2020
+++ src/sys/dev/acpi/acpi_i2c.c	Mon Aug 24 05:37:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_i2c.c,v 1.7 2020/06/11 02:39:30 thorpej Exp $ */
+/* $NetBSD: acpi_i2c.c,v 1.8 2020/08/24 05:37:41 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_i2c.c,v 1.7 2020/06/11 02:39:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_i2c.c,v 1.8 2020/08/24 05:37:41 msaitoh Exp $");
 
 #include 
 #include 
@@ -152,7 +152,7 @@ acpi_i2c_resource_parse_callback(ACPI_RE
 	case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
 		break;
 	default:
-		printf("ressource type 0x%x ignored\n", res->Type);
+		printf("resource type 0x%x ignored\n", res->Type);
 	}
 	return_ACPI_STATUS(AE_OK);
 }

Index: src/sys/dev/pci/btvmei.c
diff -u src/sys/dev/pci/btvmei.c:1.32 src/sys/dev/pci/btvmei.c:1.33
--- src/sys/dev/pci/btvmei.c:1.32	Sun Nov 10 21:16:36 2019
+++ src/sys/dev/pci/btvmei.c	Mon Aug 24 05:37:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: btvmei.c,v 1.32 2019/11/10 21:16:36 chs Exp $ */
+/* 

CVS commit: src/sys

2020-08-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug 24 05:37:41 UTC 2020

Modified Files:
src/sys/arch/i386/pnpbios: pciide_pnpbios.c pnpbios.c
src/sys/arch/i386/stand/lib/netif: am7990.c
src/sys/dev/acpi: acpi_i2c.c
src/sys/dev/pci: btvmei.c pciide_common.c
src/sys/dev/vme: vme.c

Log Message:
s/ressource/resource/. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/i386/pnpbios/pciide_pnpbios.c
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/i386/pnpbios/pnpbios.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/lib/netif/am7990.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/acpi/acpi_i2c.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/btvmei.c
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/pci/pciide_common.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/vme/vme.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/make/unit-tests

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 19:30:13 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: directive-undef.mk varmisc.mk

Log Message:
make(1): move test for .undef into separate file


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-undef.mk
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmisc.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/directive-undef.mk
diff -u src/usr.bin/make/unit-tests/directive-undef.mk:1.2 src/usr.bin/make/unit-tests/directive-undef.mk:1.3
--- src/usr.bin/make/unit-tests/directive-undef.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/directive-undef.mk	Sun Aug 23 19:30:13 2020
@@ -1,8 +1,17 @@
-# $NetBSD: directive-undef.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive-undef.mk,v 1.3 2020/08/23 19:30:13 rillig Exp $
 #
 # Tests for the .undef directive.
 
-# TODO: Implementation
+# As of 2020-07-28, .undef only undefines the first variable.
+# All further variable names are silently ignored.
+# See parse.c, string literal "undef".
+1=		1
+2=		2
+3=		3
+.undef 1 2 3
+.if ${1:U_}${2:U_}${3:U_} != _23
+.warning $1$2$3
+.endif
 
 all:
 	@:;

Index: src/usr.bin/make/unit-tests/varmisc.mk
diff -u src/usr.bin/make/unit-tests/varmisc.mk:1.21 src/usr.bin/make/unit-tests/varmisc.mk:1.22
--- src/usr.bin/make/unit-tests/varmisc.mk:1.21	Sat Aug  8 14:59:59 2020
+++ src/usr.bin/make/unit-tests/varmisc.mk	Sun Aug 23 19:30:13 2020
@@ -1,4 +1,4 @@
-# $Id: varmisc.mk,v 1.21 2020/08/08 14:59:59 rillig Exp $
+# $Id: varmisc.mk,v 1.22 2020/08/23 19:30:13 rillig Exp $
 #
 # Miscellaneous variable tests.
 
@@ -211,14 +211,3 @@ varerror-unclosed:
 .endfor
 	@echo ${UNCLOSED_INDIR_2}
 	@echo $@:end
-
-# As of 2020-07-28, .undef only undefines the first variable.
-# All further variable names are silently ignored.
-# See parse.c, string literal "undef".
-1=		1
-2=		2
-3=		3
-.undef 1 2 3
-.if ${1:U_}${2:U_}${3:U_} != _23
-.warning $1$2$3
-.endif



re: CVS commit: src/sys/uvm/pmap

2020-08-23 Thread matthew green
> Modified Files:
>   src/sys/uvm/pmap: pmap_segtab.c
> 
> Log Message:
> Remove the #if defined(__mips_n64) && PAGE_SIZE == 8192 and make the
> check MI - all PTs are PAGE_SIZE aligned

thanks!  that is a much better way of doing it.


.mrg.


CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 20:57:02 UTC 2020

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

Log Message:
make(1): split code for parsing the :U modifier into digestible parts

The comment about "unescaped $'s that aren't before the delimiter" was
wrong, as the code didn't contain the "aren't before the delimiter"
part.  By splitting the code into paragraphs, the larger structure
becomes easily visible.  Having a few short comments in the right place
is more helpful than a big block of text.


To generate a diff of this commit:
cvs rdiff -u -r1.465 -r1.466 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.465 src/usr.bin/make/var.c:1.466
--- src/usr.bin/make/var.c:1.465	Sun Aug 23 18:26:35 2020
+++ src/usr.bin/make/var.c	Sun Aug 23 20:57:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.465 2020/08/23 18:26:35 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.466 2020/08/23 20:57:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.465 2020/08/23 18:26:35 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.466 2020/08/23 20:57:02 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.465 2020/08/23 18:26:35 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.466 2020/08/23 20:57:02 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2031,25 +2031,22 @@ ApplyModifier_Defined(const char **pp, A
 	eflags |= VARE_WANTRES;
 }
 
-/*
- * Pass through mod looking for 1) escaped delimiters,
- * '$'s and backslashes (place the escaped character in
- * uninterpreted) and 2) unescaped $'s that aren't before
- * the delimiter (expand the variable substitution).
- * The result is left in the Buffer buf.
- */
 Buf_Init(, 0);
 p = *pp + 1;
 while (*p != st->endc && *p != ':' && *p != '\0') {
-	if (*p == '\\' &&
-	(p[1] == ':' || p[1] == '$' || p[1] == st->endc || p[1] == '\\')) {
-	Buf_AddByte(, p[1]);
-	p += 2;
-	} else if (*p == '$') {
-	/*
-	 * If unescaped dollar sign, assume it's a
-	 * variable substitution and recurse.
-	 */
+
+/* Escaped delimiter or other special character */
+	if (*p == '\\') {
+	char c = p[1];
+	if (c == st->endc || c == ':' || c == '$' || c == '\\') {
+		Buf_AddByte(, c);
+		p += 2;
+		continue;
+	}
+	}
+
+	/* Nested variable expressions */
+	if (*p == '$') {
 	const char *cp2;
 	int len;
 	void *freeIt;
@@ -2058,10 +2055,12 @@ ApplyModifier_Defined(const char **pp, A
 	Buf_AddStr(, cp2);
 	free(freeIt);
 	p += len;
-	} else {
-	Buf_AddByte(, *p);
-	p++;
+	continue;
 	}
+
+	/* Ordinary text */
+	Buf_AddByte(, *p);
+	p++;
 }
 *pp = p;
 



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 20:57:02 UTC 2020

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

Log Message:
make(1): split code for parsing the :U modifier into digestible parts

The comment about "unescaped $'s that aren't before the delimiter" was
wrong, as the code didn't contain the "aren't before the delimiter"
part.  By splitting the code into paragraphs, the larger structure
becomes easily visible.  Having a few short comments in the right place
is more helpful than a big block of text.


To generate a diff of this commit:
cvs rdiff -u -r1.465 -r1.466 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.



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 22:49:45 UTC 2020

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

Log Message:
make(1): remove redundant range restriction

re.re_nsub is at least 0, and (at least 0) + 1 cannot be 0.


To generate a diff of this commit:
cvs rdiff -u -r1.468 -r1.469 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.468 src/usr.bin/make/var.c:1.469
--- src/usr.bin/make/var.c:1.468	Sun Aug 23 22:13:38 2020
+++ src/usr.bin/make/var.c	Sun Aug 23 22:49:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.468 2020/08/23 22:13:38 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.469 2020/08/23 22:49:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.468 2020/08/23 22:13:38 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.469 2020/08/23 22:49:45 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.468 2020/08/23 22:13:38 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.469 2020/08/23 22:49:45 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2473,8 +2473,6 @@ ApplyModifier_Regex(const char **pp, App
 }
 
 args.nsub = args.re.re_nsub + 1;
-if (args.nsub < 1)
-	args.nsub = 1;
 if (args.nsub > 10)
 	args.nsub = 10;
 st->newVal = ModifyWords(st->ctxt, st->sep, oneBigWord, st->val,



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 22:49:45 UTC 2020

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

Log Message:
make(1): remove redundant range restriction

re.re_nsub is at least 0, and (at least 0) + 1 cannot be 0.


To generate a diff of this commit:
cvs rdiff -u -r1.468 -r1.469 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.



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 22:13:38 UTC 2020

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

Log Message:
make(1): restructure code of the :ts modifier

Now there is one paragraph per case, as opposed to the highly condensed
code from before.

In the cases of :ts\n and :ts\t, the variables for number parsing are no
longer in the code path, which makes the code easier to understand for
humans.  Not sure what the compilers made out of it.

The assignment "base = 0" has gone since it was redundant.  An integer
that starts with 0 is always interpreted as octal by strtol, no matter
if the base is 8 or 0.


To generate a diff of this commit:
cvs rdiff -u -r1.467 -r1.468 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.467 src/usr.bin/make/var.c:1.468
--- src/usr.bin/make/var.c:1.467	Sun Aug 23 21:40:30 2020
+++ src/usr.bin/make/var.c	Sun Aug 23 22:13:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.467 2020/08/23 21:40:30 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.468 2020/08/23 22:13:38 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.467 2020/08/23 21:40:30 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.468 2020/08/23 22:13:38 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.467 2020/08/23 21:40:30 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.468 2020/08/23 22:13:38 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2498,52 +2498,58 @@ ApplyModifier_ToSep(const char **pp, App
 /* XXX: pp points to the 's', for historic reasons only.
  * Changing this will influence the error messages. */
 const char *sep = *pp + 1;
+
+/* ":ts" or ":ts:" */
 if (sep[0] != st->endc && (sep[1] == st->endc || sep[1] == ':')) {
-	/* ":ts" or ":ts:" */
 	st->sep = sep[0];
 	*pp = sep + 1;
-} else if (sep[0] == st->endc || sep[0] == ':') {
-	/* ":ts" or ":ts:" */
+	goto ok;
+}
+
+/* ":ts" or ":ts:" */
+if (sep[0] == st->endc || sep[0] == ':') {
 	st->sep = '\0';		/* no separator */
 	*pp = sep;
-} else if (sep[0] == '\\') {
-	const char *xp = sep + 1;
+	goto ok;
+}
+
+/* ":ts". */
+if (sep[0] != '\\')
+	return AMR_BAD;
+
+/* ":ts\n" */
+if (sep[1] == 'n') {
+	st->sep = '\n';
+	*pp = sep + 2;
+	goto ok;
+}
+
+/* ":ts\t" */
+if (sep[1] == 't') {
+	st->sep = '\t';
+	*pp = sep + 2;
+	goto ok;
+}
+
+/* ":ts\x40" or ":ts\100" */
+{
+	const char *numStart = sep + 1;
 	int base = 8;		/* assume octal */
+	char *end;
 
-	switch (sep[1]) {
-	case 'n':
-	st->sep = '\n';
-	*pp = sep + 2;
-	break;
-	case 't':
-	st->sep = '\t';
-	*pp = sep + 2;
-	break;
-	case 'x':
+	if (sep[1] == 'x') {
 	base = 16;
-	xp++;
-	goto get_numeric;
-	case '0':
-	base = 0;
-	goto get_numeric;
-	default:
-	if (!isdigit((unsigned char)sep[1]))
-		return AMR_BAD;	/* ":ts". */
-
-	get_numeric:
-	{
-		char *end;
-		st->sep = (char)strtoul(xp, , base);
-		if (*end != ':' && *end != st->endc)
-		return AMR_BAD;
-		*pp = end;
-	}
-	break;
-	}
-} else {
-	return AMR_BAD;		/* Found ":ts". */
+	numStart++;
+	} else if (!isdigit((unsigned char)sep[1]))
+	return AMR_BAD;	/* ":ts". */
+
+	st->sep = (char)strtoul(numStart, , base);
+	if (*end != ':' && *end != st->endc)
+	return AMR_BAD;
+	*pp = end;
 }
 
+ok:
 st->newVal = ModifyWords(st->ctxt, st->sep, st->oneBigWord, st->val,
 			 ModifyWord_Copy, NULL);
 return AMR_OK;



CVS commit: src/usr.bin/make

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 22:13:38 UTC 2020

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

Log Message:
make(1): restructure code of the :ts modifier

Now there is one paragraph per case, as opposed to the highly condensed
code from before.

In the cases of :ts\n and :ts\t, the variables for number parsing are no
longer in the code path, which makes the code easier to understand for
humans.  Not sure what the compilers made out of it.

The assignment "base = 0" has gone since it was redundant.  An integer
that starts with 0 is always interpreted as octal by strtol, no matter
if the base is 8 or 0.


To generate a diff of this commit:
cvs rdiff -u -r1.467 -r1.468 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.



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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 20:49:33 UTC 2020

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

Log Message:
make(1): add test for :U modifier


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-undefined.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-undefined.mk
diff -u src/usr.bin/make/unit-tests/varmod-undefined.mk:1.2 src/usr.bin/make/unit-tests/varmod-undefined.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-undefined.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varmod-undefined.mk	Sun Aug 23 20:49:33 2020
@@ -1,11 +1,55 @@
-# $NetBSD: varmod-undefined.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-undefined.mk,v 1.3 2020/08/23 20:49:33 rillig Exp $
 #
 # Tests for the :U variable modifier, which returns the given string
 # if the variable is undefined.
 #
-# This modifier is heavily used when expanding .for loops.
+# The pattern ${:Uword} is heavily used when expanding .for loops.
 
-# TODO: Implementation
+# This is how an expanded .for loop looks like.
+# .for word in one
+# .  if ${word} != one
+# .error ${word}
+# .  endif
+# .endfor
+
+.if ${:Uone} != one
+.  error ${:Uone}
+.endif
+
+# The variable expressions in the text of the :U modifier may be arbitrarily
+# nested.
+
+.if ${:U${:Unested}${${${:Udeeply != nested
+.error
+.endif
+
+# The nested variable expressions may contain braces, and these braces don't
+# need to match pairwise.  In the following example, the :S modifier uses '{'
+# as delimiter, which confuses both editors and humans because the opening
+# and # closing braces don't match anymore.  It's syntactically valid though.
+# For more similar examples, see varmod-subst.mk, mod-subst-delimiter.
+
+.if ${:U${:Uvalue:S{a{X{}} != vXlue
+.error
+.endif
+
+# The escaping rules for the :U modifier (left-hand side) and condition
+# string literals (right-hand side) are completely different.
+#
+# In the :U modifier, the backslash only escapes very few characters, all
+# other backslashes are retained.
+#
+# In condition string literals, the backslash always escapes the following
+# character, no matter whether it would be necessary or not.
+#
+# In both contexts, \n is an escaped letter n, not a newline; that's what
+# the .newline variable is for.
+#
+# Whitespace at the edges is preserved, on both sides of the comparison.
+
+.if ${:U \: \} \$ \\ \a \b \n } != " : } \$ \\ \\a \\b \\n "
+.error
+.endif
 
 all:
 	@:;



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

2020-08-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 23 20:49:33 UTC 2020

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

Log Message:
make(1): add test for :U modifier


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

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



CVS commit: src/tests/fs/lfs

2020-08-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 23 22:34:29 UTC 2020

Modified Files:
src/tests/fs/lfs: t_rfw.c

Log Message:
Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/fs/lfs/t_rfw.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/fs/lfs/t_rfw.c
diff -u src/tests/fs/lfs/t_rfw.c:1.2 src/tests/fs/lfs/t_rfw.c:1.3
--- src/tests/fs/lfs/t_rfw.c:1.2	Sun Aug 23 16:03:54 2020
+++ src/tests/fs/lfs/t_rfw.c	Sun Aug 23 22:34:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_rfw.c,v 1.2 2020/08/23 16:03:54 perseant Exp $	*/
+/*	$NetBSD: t_rfw.c,v 1.3 2020/08/23 22:34:29 riastradh Exp $	*/
 
 #include 
 #include 
@@ -264,7 +264,7 @@ int check_file(const char *filename, int
 	int fd, i;
 	struct stat statbuf;
 	unsigned char b;
-	
+
 	if (rump_sys_stat(filename, ) < 0) {
 		fprintf(stderr, "%s: stat failed\n", filename);
 		return 1;



  1   2   >