CVS commit: src/games/fortune/datfiles

2020-11-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Nov  9 03:23:15 UTC 2020

Modified Files:
src/games/fortune/datfiles: fortunes

Log Message:
Restore the catman joke.

It needs the (8), or it fails to work for people who don't know or had
forgotten catman(8) was ever a thing.

as the de facto fortunes editor and also I think the person who added
that fortune in the first place, and given the discussion in
tech-userlevel, I think I get to do this.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/games/fortune/datfiles/fortunes

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

Modified files:

Index: src/games/fortune/datfiles/fortunes
diff -u src/games/fortune/datfiles/fortunes:1.95 src/games/fortune/datfiles/fortunes:1.96
--- src/games/fortune/datfiles/fortunes:1.95	Mon Nov  9 00:46:00 2020
+++ src/games/fortune/datfiles/fortunes	Mon Nov  9 03:23:14 2020
@@ -16177,7 +16177,7 @@ be named Eustace Clarence Scrubb.
 %
 Never leave a macassar and an antimacassar in the same room together.
 %
-Why did the furry install Unix? Because it supports catman.
+Why did the furry install Unix? Because it supports catman(8).
 %
 Many people don't realize that trailhead doggerel is illegal -- but
 surely you've heard of "hike rhymes and misdemeanors"...



CVS commit: src/etc/mtree

2020-11-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Nov  9 01:07:04 UTC 2020

Modified Files:
src/etc/mtree: NetBSD.dist.Xorg NetBSD.dist.base

Log Message:
Remove the catman directories

No longer relevant after the MKCATPAGES removal.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/etc/mtree/NetBSD.dist.Xorg
cvs rdiff -u -r1.225 -r1.226 src/etc/mtree/NetBSD.dist.base

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

Modified files:

Index: src/etc/mtree/NetBSD.dist.Xorg
diff -u src/etc/mtree/NetBSD.dist.Xorg:1.26 src/etc/mtree/NetBSD.dist.Xorg:1.27
--- src/etc/mtree/NetBSD.dist.Xorg:1.26	Sun Jan 19 00:58:14 2020
+++ src/etc/mtree/NetBSD.dist.Xorg	Mon Nov  9 01:07:04 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.Xorg,v 1.26 2020/01/19 00:58:14 jmcneill Exp $
+#	$NetBSD: NetBSD.dist.Xorg,v 1.27 2020/11/09 01:07:04 kamil Exp $
 ./usr/X11R7
 ./usr/X11R7/bin
 ./usr/X11R7/include
@@ -155,13 +155,6 @@
 ./usr/X11R7/lib/xorg
 ./usr/X11R7/libexec
 ./usr/X11R7/man
-./usr/X11R7/man/cat1
-./usr/X11R7/man/cat3
-./usr/X11R7/man/cat4
-./usr/X11R7/man/cat4/evbarm
-./usr/X11R7/man/cat4/x86
-./usr/X11R7/man/cat5
-./usr/X11R7/man/cat7
 ./usr/X11R7/man/html1
 ./usr/X11R7/man/html3
 ./usr/X11R7/man/html4

Index: src/etc/mtree/NetBSD.dist.base
diff -u src/etc/mtree/NetBSD.dist.base:1.225 src/etc/mtree/NetBSD.dist.base:1.226
--- src/etc/mtree/NetBSD.dist.base:1.225	Sat Oct 24 07:03:00 2020
+++ src/etc/mtree/NetBSD.dist.base	Mon Nov  9 01:07:04 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.base,v 1.225 2020/10/24 07:03:00 kamil Exp $
+#	$NetBSD: NetBSD.dist.base,v 1.226 2020/11/09 01:07:04 kamil Exp $
 #	@(#)4.4BSD.dist	8.1 (Berkeley) 6/13/93
 
 # Do not customize this file as it may be overwritten on upgrades.
@@ -883,114 +883,6 @@
 ./usr/share/lua
 ./usr/share/lua/5.3
 ./usr/share/man
-./usr/share/man/cat1
-./usr/share/man/cat1/atari
-./usr/share/man/cat1/hp300
-./usr/share/man/cat1/x68k
-./usr/share/man/cat2
-./usr/share/man/cat3
-./usr/share/man/cat3lua
-./usr/share/man/cat4
-./usr/share/man/cat4/acorn32
-./usr/share/man/cat4/alpha
-./usr/share/man/cat4/amiga
-./usr/share/man/cat4/arc
-./usr/share/man/cat4/atari
-./usr/share/man/cat4/cobalt
-./usr/share/man/cat4/dreamcast
-./usr/share/man/cat4/emips
-./usr/share/man/cat4/evbarm
-./usr/share/man/cat4/evbmips
-./usr/share/man/cat4/evbppc
-./usr/share/man/cat4/hp300
-./usr/share/man/cat4/hpcarm
-./usr/share/man/cat4/hpcmips
-./usr/share/man/cat4/hpcsh
-./usr/share/man/cat4/hppa
-./usr/share/man/cat4/i386
-./usr/share/man/cat4/mac68k
-./usr/share/man/cat4/macppc
-./usr/share/man/cat4/mvme68k
-./usr/share/man/cat4/pmax
-./usr/share/man/cat4/prep
-./usr/share/man/cat4/sandpoint
-./usr/share/man/cat4/sgimips
-./usr/share/man/cat4/sparc
-./usr/share/man/cat4/sparc64
-./usr/share/man/cat4/sun2
-./usr/share/man/cat4/sun3
-./usr/share/man/cat4/vax
-./usr/share/man/cat4/x68k
-./usr/share/man/cat4/x86
-./usr/share/man/cat5
-./usr/share/man/cat6
-./usr/share/man/cat7
-./usr/share/man/cat8
-./usr/share/man/cat8/acorn32
-./usr/share/man/cat8/algor
-./usr/share/man/cat8/alpha
-./usr/share/man/cat8/amd64
-./usr/share/man/cat8/amiga
-./usr/share/man/cat8/arc
-./usr/share/man/cat8/atari
-./usr/share/man/cat8/bebox
-./usr/share/man/cat8/cats
-./usr/share/man/cat8/cesfic
-./usr/share/man/cat8/cobalt
-./usr/share/man/cat8/dreamcast
-./usr/share/man/cat8/emips
-./usr/share/man/cat8/evbarm
-./usr/share/man/cat8/evbmips
-./usr/share/man/cat8/evbppc
-./usr/share/man/cat8/evbsh3
-./usr/share/man/cat8/hp300
-./usr/share/man/cat8/hpcarm
-./usr/share/man/cat8/hpcmips
-./usr/share/man/cat8/hpcsh
-./usr/share/man/cat8/hppa
-./usr/share/man/cat8/i386
-./usr/share/man/cat8/ibmnws
-./usr/share/man/cat8/luna68k
-./usr/share/man/cat8/mac68k
-./usr/share/man/cat8/macppc
-./usr/share/man/cat8/mipsco
-./usr/share/man/cat8/mmeye
-./usr/share/man/cat8/mvme68k
-./usr/share/man/cat8/mvmeppc
-./usr/share/man/cat8/netwinder
-./usr/share/man/cat8/news68k
-./usr/share/man/cat8/newsmips
-./usr/share/man/cat8/next68k
-./usr/share/man/cat8/ofppc
-./usr/share/man/cat8/playstation2
-./usr/share/man/cat8/pmax
-./usr/share/man/cat8/prep
-./usr/share/man/cat8/sandpoint
-./usr/share/man/cat8/sbmips
-./usr/share/man/cat8/sgimips
-./usr/share/man/cat8/shark
-./usr/share/man/cat8/sparc
-./usr/share/man/cat8/sparc64
-./usr/share/man/cat8/sun2
-./usr/share/man/cat8/sun3
-./usr/share/man/cat8/vax
-./usr/share/man/cat8/x68k
-./usr/share/man/cat8/x86
-./usr/share/man/cat9
-./usr/share/man/cat9lua
-./usr/share/man/cat9/alpha
-./usr/share/man/cat9/amiga
-./usr/share/man/cat9/atari
-./usr/share/man/cat9/emips
-./usr/share/man/cat9/hp300
-./usr/share/man/cat9/i386
-./usr/share/man/cat9/mac68k
-./usr/share/man/cat9/pmax
-./usr/share/man/cat9/sparc
-./usr/share/man/cat9/sun3
-./usr/share/man/cat9/vax
-./usr/share/man/cat9/x68k
-./usr/share/man/cat9/x86
 ./usr/share/man/html1
 ./usr/share/man/html1/atari
 ./usr/share/man/html1/hp300



CVS commit: src/distrib/sets

2020-11-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Nov  9 01:05:52 UTC 2020

Modified Files:
src/distrib/sets: comments deps descrs
src/distrib/sets/lists/base: mi
src/distrib/sets/lists/comp: mi
src/distrib/sets/lists/games: mi
src/distrib/sets/lists/man: mi
src/distrib/sets/lists/text: mi
src/distrib/sets/lists/xbase: mi
src/distrib/sets/lists/xcomp: mi
src/distrib/sets/lists/xserver: md.alpha md.amd64 md.amiga md.bebox
md.cats md.dreamcast md.evbarm md.evbmips md.ews4800mips md.hp300
md.hpcarm md.hpcmips md.hpcsh md.hppa md.i386 md.ibmnws md.luna68k
md.mac68k md.macppc md.netwinder md.newsmips md.ofppc md.prep
md.sgimips md.shark md.sparc md.sparc64 md.sun3 md.vax md.x68k
md.zaurus mi

Log Message:
Remove catman pages support

No longer relevant after the MKCATPAGES removal.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/distrib/sets/comments
cvs rdiff -u -r1.20 -r1.21 src/distrib/sets/deps
cvs rdiff -u -r1.26 -r1.27 src/distrib/sets/descrs
cvs rdiff -u -r1.1267 -r1.1268 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.2364 -r1.2365 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.56 -r1.57 src/distrib/sets/lists/games/mi
cvs rdiff -u -r1.1709 -r1.1710 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.48 -r1.49 src/distrib/sets/lists/text/mi
cvs rdiff -u -r1.161 -r1.162 src/distrib/sets/lists/xbase/mi
cvs rdiff -u -r1.221 -r1.222 src/distrib/sets/lists/xcomp/mi
cvs rdiff -u -r1.51 -r1.52 src/distrib/sets/lists/xserver/md.alpha
cvs rdiff -u -r1.113 -r1.114 src/distrib/sets/lists/xserver/md.amd64
cvs rdiff -u -r1.29 -r1.30 src/distrib/sets/lists/xserver/md.amiga
cvs rdiff -u -r1.20 -r1.21 src/distrib/sets/lists/xserver/md.bebox \
src/distrib/sets/lists/xserver/md.luna68k \
src/distrib/sets/lists/xserver/md.vax
cvs rdiff -u -r1.61 -r1.62 src/distrib/sets/lists/xserver/md.cats \
src/distrib/sets/lists/xserver/md.sgimips
cvs rdiff -u -r1.28 -r1.29 src/distrib/sets/lists/xserver/md.dreamcast
cvs rdiff -u -r1.21 -r1.22 src/distrib/sets/lists/xserver/md.evbarm \
src/distrib/sets/lists/xserver/md.x68k
cvs rdiff -u -r1.14 -r1.15 src/distrib/sets/lists/xserver/md.evbmips
cvs rdiff -u -r1.23 -r1.24 src/distrib/sets/lists/xserver/md.ews4800mips \
src/distrib/sets/lists/xserver/md.hp300 \
src/distrib/sets/lists/xserver/md.prep \
src/distrib/sets/lists/xserver/md.zaurus
cvs rdiff -u -r1.27 -r1.28 src/distrib/sets/lists/xserver/md.hpcarm
cvs rdiff -u -r1.33 -r1.34 src/distrib/sets/lists/xserver/md.hpcmips
cvs rdiff -u -r1.26 -r1.27 src/distrib/sets/lists/xserver/md.hpcsh
cvs rdiff -u -r1.1 -r1.2 src/distrib/sets/lists/xserver/md.hppa
cvs rdiff -u -r1.129 -r1.130 src/distrib/sets/lists/xserver/md.i386
cvs rdiff -u -r1.8 -r1.9 src/distrib/sets/lists/xserver/md.ibmnws
cvs rdiff -u -r1.22 -r1.23 src/distrib/sets/lists/xserver/md.mac68k \
src/distrib/sets/lists/xserver/md.newsmips
cvs rdiff -u -r1.81 -r1.82 src/distrib/sets/lists/xserver/md.macppc
cvs rdiff -u -r1.40 -r1.41 src/distrib/sets/lists/xserver/md.netwinder
cvs rdiff -u -r1.31 -r1.32 src/distrib/sets/lists/xserver/md.ofppc
cvs rdiff -u -r1.55 -r1.56 src/distrib/sets/lists/xserver/md.shark
cvs rdiff -u -r1.72 -r1.73 src/distrib/sets/lists/xserver/md.sparc
cvs rdiff -u -r1.69 -r1.70 src/distrib/sets/lists/xserver/md.sparc64
cvs rdiff -u -r1.17 -r1.18 src/distrib/sets/lists/xserver/md.sun3
cvs rdiff -u -r1.44 -r1.45 src/distrib/sets/lists/xserver/mi

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

diffs are larger than 1MB and have been omitted


CVS commit: src/games/fortune/datfiles

2020-11-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Nov  9 00:46:00 UTC 2020

Modified Files:
src/games/fortune/datfiles: fortunes

Log Message:
Revert to the original phrasing, but remove the man 8 section reference.

catman is a historical Unix tool.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/games/fortune/datfiles/fortunes

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

Modified files:

Index: src/games/fortune/datfiles/fortunes
diff -u src/games/fortune/datfiles/fortunes:1.94 src/games/fortune/datfiles/fortunes:1.95
--- src/games/fortune/datfiles/fortunes:1.94	Sun Nov  8 17:37:29 2020
+++ src/games/fortune/datfiles/fortunes	Mon Nov  9 00:46:00 2020
@@ -16177,7 +16177,7 @@ be named Eustace Clarence Scrubb.
 %
 Never leave a macassar and an antimacassar in the same room together.
 %
-Why did the furry install Unix? Because it supported catman(8).
+Why did the furry install Unix? Because it supports catman.
 %
 Many people don't realize that trailhead doggerel is illegal -- but
 surely you've heard of "hike rhymes and misdemeanors"...



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Nov  9 00:07:06 UTC 2020

Modified Files:
src/usr.bin/make: cond.c
src/usr.bin/make/unit-tests: cond-token-plain.mk

Log Message:
make(1): document handling of '#' and '\n' in conditionals


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/usr.bin/make/cond.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-token-plain.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/cond.c
diff -u src/usr.bin/make/cond.c:1.197 src/usr.bin/make/cond.c:1.198
--- src/usr.bin/make/cond.c:1.197	Sun Nov  8 23:54:28 2020
+++ src/usr.bin/make/cond.c	Mon Nov  9 00:07:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.197 2020/11/08 23:54:28 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.198 2020/11/09 00:07:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.197 2020/11/08 23:54:28 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.198 2020/11/09 00:07:06 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -860,8 +860,9 @@ CondParser_Token(CondParser *par, Boolea
 	par->p++;
 	return TOK_NOT;
 
-case '#':
-case '\n':
+case '#':			/* XXX: see unit-tests/cond-token-plain.mk */
+case '\n':			/* XXX: why should this end the condition? */
+/* Probably obsolete now, from 1993-03-21. */
 case '\0':
 	return TOK_EOF;
 

Index: src/usr.bin/make/unit-tests/cond-token-plain.mk
diff -u src/usr.bin/make/unit-tests/cond-token-plain.mk:1.4 src/usr.bin/make/unit-tests/cond-token-plain.mk:1.5
--- src/usr.bin/make/unit-tests/cond-token-plain.mk:1.4	Sat Sep 12 17:47:24 2020
+++ src/usr.bin/make/unit-tests/cond-token-plain.mk	Mon Nov  9 00:07:06 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-token-plain.mk,v 1.4 2020/09/12 17:47:24 rillig Exp $
+# $NetBSD: cond-token-plain.mk,v 1.5 2020/11/09 00:07:06 rillig Exp $
 #
 # Tests for plain tokens (that is, string literals without quotes)
 # in .if conditions.
@@ -31,6 +31,9 @@
 # comment handling anymore.  The comments are supposed to be stripped off
 # in a very early parsing phase.
 #
+# See https://gnats.netbsd.org/19596 for example makefiles demonstrating the
+# original problems.  This workaround is probably not needed anymore.
+#
 # XXX: Missing error message for the malformed condition. The right-hand
 # side is double-quotes, backslash, backslash.
 # XXX: It is unexpected that the right-hand side evaluates to a single



CVS commit: src

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 23:54:28 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make: cond.c
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: cond-op-and-lint.exp cond-op-and-lint.mk
cond-op-or-lint.exp cond-op-or-lint.mk

Log Message:
make(1): in lint mode, only allow '&&' and '||', not '&' and '|'

These variants of the condition operators are neither documented in the
manual page nor are they used in practice.


To generate a diff of this commit:
cvs rdiff -u -r1.964 -r1.965 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.196 -r1.197 src/usr.bin/make/cond.c
cvs rdiff -u -r1.191 -r1.192 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/cond-op-and-lint.exp \
src/usr.bin/make/unit-tests/cond-op-and-lint.mk \
src/usr.bin/make/unit-tests/cond-op-or-lint.exp \
src/usr.bin/make/unit-tests/cond-op-or-lint.mk

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.964 src/distrib/sets/lists/tests/mi:1.965
--- src/distrib/sets/lists/tests/mi:1.964	Sun Nov  8 16:44:47 2020
+++ src/distrib/sets/lists/tests/mi	Sun Nov  8 23:54:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.964 2020/11/08 16:44:47 rillig Exp $
+# $NetBSD: mi,v 1.965 2020/11/08 23:54:28 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4859,10 +4859,14 @@
 ./usr/tests/usr.bin/make/unit-tests/cond-func.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-late.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-late.mktests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-op-and-lint.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-op-and-lint.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-op-and.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-op-and.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-op-not.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-op-not.mktests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-op-or-lint.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-op-or-lint.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-op-or.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-op-or.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond-op-parentheses.exp			tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.196 src/usr.bin/make/cond.c:1.197
--- src/usr.bin/make/cond.c:1.196	Sun Nov  8 23:20:19 2020
+++ src/usr.bin/make/cond.c	Sun Nov  8 23:54:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.196 2020/11/08 23:20:19 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.197 2020/11/08 23:54:28 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.196 2020/11/08 23:20:19 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.197 2020/11/08 23:54:28 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -836,15 +836,23 @@ CondParser_Token(CondParser *par, Boolea
 
 case '|':
 	par->p++;
-	if (par->p[0] == '|') {
+	if (par->p[0] == '|')
 	par->p++;
+	else if (opts.lint) {
+	Parse_Error(PARSE_FATAL, "Unknown operator '|'");
+	par->printedError = TRUE;
+	return TOK_ERROR;
 	}
 	return TOK_OR;
 
 case '&':
 	par->p++;
-	if (par->p[0] == '&') {
+	if (par->p[0] == '&')
 	par->p++;
+	else if (opts.lint) {
+	Parse_Error(PARSE_FATAL, "Unknown operator '&'");
+	par->printedError = TRUE;
+	return TOK_ERROR;
 	}
 	return TOK_AND;
 

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.191 src/usr.bin/make/unit-tests/Makefile:1.192
--- src/usr.bin/make/unit-tests/Makefile:1.191	Sun Nov  8 16:44:47 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sun Nov  8 23:54:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.191 2020/11/08 16:44:47 rillig Exp $
+# $NetBSD: Makefile,v 1.192 2020/11/08 23:54:28 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -62,8 +62,10 @@ TESTS+=		cond-func-target
 TESTS+=		cond-late
 TESTS+=		cond-op
 TESTS+=		cond-op-and
+TESTS+=		cond-op-and-lint
 TESTS+=		cond-op-not
 TESTS+=		cond-op-or
+TESTS+=		cond-op-or-lint
 TESTS+=		cond-op-parentheses
 TESTS+=		cond-short
 TESTS+=		

CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 23:38:02 UTC 2020

Modified Files:
src/usr.bin/make: main.c make.h parse.c var.c

Log Message:
make(1): move lint option away from the debug flags

The lint option affects much more than a typical debug flag.  Not only
does it produce additional diagnostics, it also changes the control flow
and fixes the traditional error handling in a few places.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.454 -r1.455 src/usr.bin/make/main.c
cvs rdiff -u -r1.203 -r1.204 src/usr.bin/make/make.h
cvs rdiff -u -r1.436 -r1.437 src/usr.bin/make/parse.c
cvs rdiff -u -r1.682 -r1.683 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/main.c
diff -u src/usr.bin/make/main.c:1.454 src/usr.bin/make/main.c:1.455
--- src/usr.bin/make/main.c:1.454	Sun Nov  8 15:07:37 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 23:38:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.454 2020/11/08 15:07:37 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.455 2020/11/08 23:38:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.454 2020/11/08 15:07:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.455 2020/11/08 23:38:02 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -250,10 +250,10 @@ parse_debug_options(const char *argvalue
 	for (modules = argvalue; *modules; ++modules) {
 		switch (*modules) {
 		case '0':	/* undocumented, only intended for tests */
-			opts.debug &= DEBUG_LINT;
+			opts.debug = DEBUG_NONE;
 			break;
 		case 'A':
-			opts.debug = ~(0 | DEBUG_LINT);
+			opts.debug = DEBUG_ALL;
 			break;
 		case 'a':
 			opts.debug |= DEBUG_ARCH;
@@ -292,7 +292,7 @@ parse_debug_options(const char *argvalue
 			opts.debug |= DEBUG_JOB;
 			break;
 		case 'L':
-			opts.debug |= DEBUG_LINT;
+			opts.lint = TRUE;
 			break;
 		case 'l':
 			opts.debug |= DEBUG_LOUD;
@@ -1124,6 +1124,7 @@ CmdOpts_Init(void)
 	opts.compatMake = FALSE;	/* No compat mode */
 	opts.debug = 0;			/* No debug verbosity, please. */
 	/* opts.debug_file has been initialized earlier */
+	opts.lint = FALSE;
 	opts.debugVflag = FALSE;
 	opts.checkEnvFirst = FALSE;
 	opts.makefiles = Lst_New();
@@ -1649,7 +1650,7 @@ main_CleanUp(void)
 static int
 main_Exit(Boolean outOfDate)
 {
-	if (DEBUG(LINT) && (errors > 0 || Parse_GetFatals() > 0))
+	if (opts.lint && (errors > 0 || Parse_GetFatals() > 0))
 		return 2;	/* Not 1 so -q can distinguish error */
 	return outOfDate ? 1 : 0;
 }

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.203 src/usr.bin/make/make.h:1.204
--- src/usr.bin/make/make.h:1.203	Sun Nov  8 23:30:59 2020
+++ src/usr.bin/make/make.h	Sun Nov  8 23:38:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.203 2020/11/08 23:30:59 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.204 2020/11/08 23:38:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -496,6 +496,7 @@ extern pid_t myPid;
 #endif
 
 typedef enum DebugFlags {
+DEBUG_NONE		= 0,
 DEBUG_ARCH		= 1 << 0,
 DEBUG_COND		= 1 << 1,
 DEBUG_CWD		= 1 << 2,
@@ -516,12 +517,7 @@ typedef enum DebugFlags {
 DEBUG_SUFF		= 1 << 17,
 DEBUG_TARG		= 1 << 18,
 DEBUG_VAR		= 1 << 19,
-
-/* Runs make in strict mode, with additional checks and better error
- * handling.  This is not the default mode to preserve compatibility.
- *
- * XXX: This is not really a debug flag, it doesn't belong here. */
-DEBUG_LINT		= 1 << 20
+DEBUG_ALL		= (1 << 20) - 1
 } DebugFlags;
 
 #define CONCAT(a,b)	a##b
@@ -572,6 +568,12 @@ typedef struct CmdOpts {
 /* -df: debug output is written here - default stderr */
 FILE *debug_file;
 
+/* -dL: lint mode
+ *
+ * Runs make in strict mode, with additional checks and better error
+ * handling. */
+Boolean lint;
+
 /* -dV: for the -V option, print unexpanded variable values */
 Boolean debugVflag;
 

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.436 src/usr.bin/make/parse.c:1.437
--- src/usr.bin/make/parse.c:1.436	Sun Nov  8 19:53:11 2020
+++ src/usr.bin/make/parse.c	Sun Nov  8 23:38:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.436 2020/11/08 19:53:11 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.437 2020/11/08 23:38:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.436 2020/11/08 19:53:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.437 2020/11/08 23:38:02 rillig Exp $");
 
 /* types and constants */
 
@@ -1884,7 +1884,7 @@ Parse_IsVar(const char *p, VarAssign *ou
 static 

CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 23:30:59 UTC 2020

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

Log Message:
make(1): sort debug flags alphabetically

DEBUG_FOR had been accidentally left at the end of the list.


To generate a diff of this commit:
cvs rdiff -u -r1.202 -r1.203 src/usr.bin/make/make.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/make.h
diff -u src/usr.bin/make/make.h:1.202 src/usr.bin/make/make.h:1.203
--- src/usr.bin/make/make.h:1.202	Sun Nov  8 15:18:09 2020
+++ src/usr.bin/make/make.h	Sun Nov  8 23:30:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.202 2020/11/08 15:18:09 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.203 2020/11/08 23:30:59 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -501,21 +501,21 @@ typedef enum DebugFlags {
 DEBUG_CWD		= 1 << 2,
 DEBUG_DIR		= 1 << 3,
 DEBUG_ERROR		= 1 << 4,
-DEBUG_GRAPH1	= 1 << 5,
-DEBUG_GRAPH2	= 1 << 6,
-DEBUG_GRAPH3	= 1 << 7,
-DEBUG_HASH		= 1 << 8,
-DEBUG_JOB		= 1 << 9,
-DEBUG_LOUD		= 1 << 10,
-DEBUG_MAKE		= 1 << 11,
-DEBUG_META		= 1 << 12,
-DEBUG_PARSE		= 1 << 13,
-DEBUG_SCRIPT	= 1 << 14,
-DEBUG_SHELL		= 1 << 15,
-DEBUG_SUFF		= 1 << 16,
-DEBUG_TARG		= 1 << 17,
-DEBUG_VAR		= 1 << 18,
-DEBUG_FOR		= 1 << 19,
+DEBUG_FOR		= 1 << 5,
+DEBUG_GRAPH1	= 1 << 6,
+DEBUG_GRAPH2	= 1 << 7,
+DEBUG_GRAPH3	= 1 << 8,
+DEBUG_HASH		= 1 << 9,
+DEBUG_JOB		= 1 << 10,
+DEBUG_LOUD		= 1 << 11,
+DEBUG_MAKE		= 1 << 12,
+DEBUG_META		= 1 << 13,
+DEBUG_PARSE		= 1 << 14,
+DEBUG_SCRIPT	= 1 << 15,
+DEBUG_SHELL		= 1 << 16,
+DEBUG_SUFF		= 1 << 17,
+DEBUG_TARG		= 1 << 18,
+DEBUG_VAR		= 1 << 19,
 
 /* Runs make in strict mode, with additional checks and better error
  * handling.  This is not the default mode to preserve compatibility.



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 23:20:19 UTC 2020

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

Log Message:
make(1): extract CondParser_Func from CondParser_LeafToken


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/usr.bin/make/cond.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/cond.c
diff -u src/usr.bin/make/cond.c:1.195 src/usr.bin/make/cond.c:1.196
--- src/usr.bin/make/cond.c:1.195	Sun Nov  8 23:10:22 2020
+++ src/usr.bin/make/cond.c	Sun Nov  8 23:20:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.195 2020/11/08 23:10:22 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.196 2020/11/08 23:20:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.195 2020/11/08 23:10:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.196 2020/11/08 23:20:19 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -718,10 +718,8 @@ FuncEmpty(size_t arglen, const char *arg
 return arglen == 1;
 }
 
-/* Parse a function call, a number, a variable expression or a string
- * literal. */
-static Token
-CondParser_LeafToken(CondParser *par, Boolean doEval)
+static Boolean
+CondParser_Func(CondParser *par, Boolean doEval, Token *out_token)
 {
 static const struct fn_def {
 	const char *fn_name;
@@ -738,17 +736,15 @@ CondParser_LeafToken(CondParser *par, Bo
 	{ NULL,   0, NULL, NULL },
 };
 const struct fn_def *fn_def;
-Token t;
 char *arg = NULL;
 size_t arglen;
 const char *cp = par->p;
-const char *cp1;
 
 for (fn_def = fn_defs; fn_def->fn_name != NULL; fn_def++) {
 	if (!is_token(cp, fn_def->fn_name, fn_def->fn_name_len))
 	continue;
+
 	cp += fn_def->fn_name_len;
-	/* There can only be whitespace before the '(' */
 	cpp_skip_whitespace();
 	if (*cp != '(')
 	break;
@@ -756,15 +752,33 @@ CondParser_LeafToken(CondParser *par, Bo
 	arglen = fn_def->fn_parse(, doEval, fn_def->fn_name, );
 	if (arglen == 0 || arglen == (size_t)-1) {
 	par->p = cp;
-	return arglen == 0 ? TOK_FALSE : TOK_ERROR;
+	*out_token = arglen == 0 ? TOK_FALSE : TOK_ERROR;
+	return TRUE;
 	}
 	/* Evaluate the argument using the required function. */
-	t = ToToken(!doEval || fn_def->fn_eval(arglen, arg));
+	*out_token = ToToken(!doEval || fn_def->fn_eval(arglen, arg));
 	free(arg);
 	par->p = cp;
-	return t;
+	return TRUE;
 }
 
+return FALSE;
+}
+
+/* Parse a function call, a number, a variable expression or a string
+ * literal. */
+static Token
+CondParser_LeafToken(CondParser *par, Boolean doEval)
+{
+Token t;
+char *arg = NULL;
+size_t arglen;
+const char *cp = par->p;
+const char *cp1;
+
+if (CondParser_Func(par, doEval, ))
+	return t;
+
 /* Push anything numeric through the compare expression */
 cp = par->p;
 if (ch_isdigit(cp[0]) || cp[0] == '-' || cp[0] == '+')



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 23:10:22 UTC 2020

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

Log Message:
make(1): inline strchr call in CondParser_LeafToken


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/usr.bin/make/cond.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/cond.c
diff -u src/usr.bin/make/cond.c:1.194 src/usr.bin/make/cond.c:1.195
--- src/usr.bin/make/cond.c:1.194	Sun Nov  8 23:08:49 2020
+++ src/usr.bin/make/cond.c	Sun Nov  8 23:10:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.194 2020/11/08 23:08:49 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.195 2020/11/08 23:10:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.194 2020/11/08 23:08:49 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.195 2020/11/08 23:10:22 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -767,7 +767,7 @@ CondParser_LeafToken(CondParser *par, Bo
 
 /* Push anything numeric through the compare expression */
 cp = par->p;
-if (ch_isdigit(cp[0]) || strchr("+-", cp[0]) != NULL)
+if (ch_isdigit(cp[0]) || cp[0] == '-' || cp[0] == '+')
 	return CondParser_Comparison(par, doEval);
 
 /*



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 23:08:49 UTC 2020

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

Log Message:
make(1): rename CondParser_Func to CondParser_LeafToken

The previous name was misleading since the function did not only parse
function call expressions.


To generate a diff of this commit:
cvs rdiff -u -r1.193 -r1.194 src/usr.bin/make/cond.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/cond.c
diff -u src/usr.bin/make/cond.c:1.193 src/usr.bin/make/cond.c:1.194
--- src/usr.bin/make/cond.c:1.193	Sun Nov  8 23:05:47 2020
+++ src/usr.bin/make/cond.c	Sun Nov  8 23:08:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.193 2020/11/08 23:05:47 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.194 2020/11/08 23:08:49 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.193 2020/11/08 23:05:47 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.194 2020/11/08 23:08:49 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -718,8 +718,10 @@ FuncEmpty(size_t arglen, const char *arg
 return arglen == 1;
 }
 
+/* Parse a function call, a number, a variable expression or a string
+ * literal. */
 static Token
-CondParser_Func(CondParser *par, Boolean doEval)
+CondParser_LeafToken(CondParser *par, Boolean doEval)
 {
 static const struct fn_def {
 	const char *fn_name;
@@ -846,7 +848,7 @@ CondParser_Token(CondParser *par, Boolea
 	return CondParser_Comparison(par, doEval);
 
 default:
-	return CondParser_Func(par, doEval);
+	return CondParser_LeafToken(par, doEval);
 }
 }
 



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 23:05:47 UTC 2020

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

Log Message:
make(1): fix type mismatch between int and Token


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 src/usr.bin/make/cond.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/cond.c
diff -u src/usr.bin/make/cond.c:1.192 src/usr.bin/make/cond.c:1.193
--- src/usr.bin/make/cond.c:1.192	Sun Nov  8 22:44:05 2020
+++ src/usr.bin/make/cond.c	Sun Nov  8 23:05:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.192 2020/11/08 22:44:05 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.193 2020/11/08 23:05:47 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.192 2020/11/08 22:44:05 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.193 2020/11/08 23:05:47 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -757,7 +757,7 @@ CondParser_Func(CondParser *par, Boolean
 	return arglen == 0 ? TOK_FALSE : TOK_ERROR;
 	}
 	/* Evaluate the argument using the required function. */
-	t = !doEval || fn_def->fn_eval(arglen, arg);
+	t = ToToken(!doEval || fn_def->fn_eval(arglen, arg));
 	free(arg);
 	par->p = cp;
 	return t;
@@ -789,7 +789,7 @@ CondParser_Func(CondParser *par, Boolean
  * after .if must have been taken literally, so the argument cannot
  * be empty - even if it contained a variable expansion.
  */
-t = !doEval || If_Eval(par->if_info, arg, arglen);
+t = ToToken(!doEval || If_Eval(par->if_info, arg, arglen));
 free(arg);
 return t;
 }



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

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 23:00:10 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: cond-cmp-string.mk

Log Message:
make(1): add test for comparing numbers with strings


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-cmp-string.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-cmp-string.mk
diff -u src/usr.bin/make/unit-tests/cond-cmp-string.mk:1.11 src/usr.bin/make/unit-tests/cond-cmp-string.mk:1.12
--- src/usr.bin/make/unit-tests/cond-cmp-string.mk:1.11	Fri Oct 30 14:53:31 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-string.mk	Sun Nov  8 23:00:09 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-cmp-string.mk,v 1.11 2020/10/30 14:53:31 rillig Exp $
+# $NetBSD: cond-cmp-string.mk,v 1.12 2020/11/08 23:00:09 rillig Exp $
 #
 # Tests for string comparisons in .if conditions.
 
@@ -88,3 +88,16 @@
 .if ${:U word } != " ${:Uword} "
 .  error
 .endif
+
+# If at least one side of the comparison is a string literal, the string
+# comparison is performed.
+.if 12345 != "12345"
+.  error
+.endif
+
+# If at least one side of the comparison is a string literal, the string
+# comparison is performed.  The ".0" in the left-hand side makes the two
+# sides of the equation unequal.
+.if 12345.0 == "12345"
+.  error
+.endif



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

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 22:56:16 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: cond-cmp-numeric.exp cond-cmp-numeric.mk

Log Message:
make(1): add test for wrong comparison operator in conditional


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cond-cmp-numeric.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-cmp-numeric.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-cmp-numeric.exp
diff -u src/usr.bin/make/unit-tests/cond-cmp-numeric.exp:1.2 src/usr.bin/make/unit-tests/cond-cmp-numeric.exp:1.3
--- src/usr.bin/make/unit-tests/cond-cmp-numeric.exp:1.2	Sat Sep 12 18:01:51 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-numeric.exp	Sun Nov  8 22:56:16 2020
@@ -6,6 +6,10 @@ make: "cond-cmp-numeric.mk" line 16: war
 make: "cond-cmp-numeric.mk" line 16: Malformed conditional (${:UNaN} > NaN)
 CondParser_Eval: !(${:UNaN} == NaN)
 lhs = "NaN", rhs = "NaN", op = ==
+CondParser_Eval: 123 ! 123
+lhs = 123.00, rhs = 123.00, op = ! 
+make: "cond-cmp-numeric.mk" line 34: warning: Unknown operator
+make: "cond-cmp-numeric.mk" line 34: Malformed conditional (123 ! 123)
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/cond-cmp-numeric.mk
diff -u src/usr.bin/make/unit-tests/cond-cmp-numeric.mk:1.3 src/usr.bin/make/unit-tests/cond-cmp-numeric.mk:1.4
--- src/usr.bin/make/unit-tests/cond-cmp-numeric.mk:1.3	Sat Sep 12 18:01:51 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-numeric.mk	Sun Nov  8 22:56:16 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-cmp-numeric.mk,v 1.3 2020/09/12 18:01:51 rillig Exp $
+# $NetBSD: cond-cmp-numeric.mk,v 1.4 2020/11/08 22:56:16 rillig Exp $
 #
 # Tests for numeric comparisons in .if conditions.
 
@@ -25,5 +25,17 @@
 .  error
 .endif
 
+# The parsing code in CondParser_Comparison only performs a light check on
+# whether the operator is valid, leaving the rest of the work to the
+# evaluation functions EvalCompareNum and EvalCompareStr.  Ensure that this
+# parse error is properly reported.
+#
+# XXX: The warning message does not mention the actual operator.
+.if 123 ! 123
+.  error
+.else
+.  error
+.endif
+
 all:
 	@:;



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

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 22:45:51 UTC 2020

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

Log Message:
make(1): add test for .ifmake 0 and .ifmake 1


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/directive-ifmake.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-ifmake.mk
diff -u src/usr.bin/make/unit-tests/directive-ifmake.mk:1.5 src/usr.bin/make/unit-tests/directive-ifmake.mk:1.6
--- src/usr.bin/make/unit-tests/directive-ifmake.mk:1.5	Fri Nov  6 20:29:35 2020
+++ src/usr.bin/make/unit-tests/directive-ifmake.mk	Sun Nov  8 22:45:51 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-ifmake.mk,v 1.5 2020/11/06 20:29:35 rillig Exp $
+# $NetBSD: directive-ifmake.mk,v 1.6 2020/11/08 22:45:51 rillig Exp $
 #
 # Tests for the .ifmake directive, which provides a shortcut for asking
 # whether a certain target is requested to be made from the command line.
@@ -51,5 +51,15 @@
 .  info No, targets cannot be added at parse time anymore.
 .endif
 
+# Numbers are interpreted as numbers, no matter whether the directive is
+# a plain .if or an .ifmake.
+.ifmake 0
+.  error
+.endif
+.ifmake 1
+.else
+.  error
+.endif
+
 first second unmentioned late-target:
 	: $@



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 22:44:05 UTC 2020

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 src/usr.bin/make/cond.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/cond.c
diff -u src/usr.bin/make/cond.c:1.191 src/usr.bin/make/cond.c:1.192
--- src/usr.bin/make/cond.c:1.191	Sun Nov  8 22:41:40 2020
+++ src/usr.bin/make/cond.c	Sun Nov  8 22:44:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.191 2020/11/08 22:41:40 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.192 2020/11/08 22:44:05 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.191 2020/11/08 22:41:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.192 2020/11/08 22:44:05 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -534,15 +534,15 @@ If_Eval(const struct If *if_info, const 
 static Boolean
 EvalNotEmpty(CondParser *par, const char *value, Boolean quoted)
 {
-double left;
+double num;
 
 /* For .ifxxx "...", check for non-empty string. */
 if (quoted)
 	return value[0] != '\0';
 
 /* For .ifxxx , compare against zero */
-if (TryParseNumber(value, ))
-	return left != 0.0;
+if (TryParseNumber(value, ))
+	return num != 0.0;
 
 /* For .if ${...}, check for non-empty string (defProc is ifdef). */
 if (par->if_info->form[0] == '\0')



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 22:41:40 UTC 2020

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

Log Message:
make(1): improve variable names in EvalNotEmpty

In a unary expression, there is no left-hand side.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/usr.bin/make/cond.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/cond.c
diff -u src/usr.bin/make/cond.c:1.190 src/usr.bin/make/cond.c:1.191
--- src/usr.bin/make/cond.c:1.190	Sun Nov  8 22:37:52 2020
+++ src/usr.bin/make/cond.c	Sun Nov  8 22:41:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.190 2020/11/08 22:37:52 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.191 2020/11/08 22:41:40 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.190 2020/11/08 22:37:52 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.191 2020/11/08 22:41:40 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -532,24 +532,24 @@ If_Eval(const struct If *if_info, const 
 /* Evaluate a "comparison without operator", such as in ".if ${VAR}" or
  * ".if 0". */
 static Boolean
-EvalNotEmpty(CondParser *par, const char *lhs, Boolean lhsQuoted)
+EvalNotEmpty(CondParser *par, const char *value, Boolean quoted)
 {
 double left;
 
-/* For .ifxxx "..." check for non-empty string. */
-if (lhsQuoted)
-	return lhs[0] != '\0';
+/* For .ifxxx "...", check for non-empty string. */
+if (quoted)
+	return value[0] != '\0';
 
-/* For .ifxxx  compare against zero */
-if (TryParseNumber(lhs, ))
+/* For .ifxxx , compare against zero */
+if (TryParseNumber(value, ))
 	return left != 0.0;
 
-/* For .if ${...} check for non-empty string (defProc is ifdef). */
+/* For .if ${...}, check for non-empty string (defProc is ifdef). */
 if (par->if_info->form[0] == '\0')
-	return lhs[0] != '\0';
+	return value[0] != '\0';
 
 /* Otherwise action default test ... */
-return If_Eval(par->if_info, lhs, strlen(lhs));
+return If_Eval(par->if_info, value, strlen(value));
 }
 
 /* Evaluate a numerical comparison, such as in ".if ${VAR} >= 9". */



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

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 22:38:28 UTC 2020

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

Log Message:
make(1): add test for function call in .ifdef directive


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/directive-ifdef.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-ifdef.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-ifdef.exp
diff -u src/usr.bin/make/unit-tests/directive-ifdef.exp:1.1 src/usr.bin/make/unit-tests/directive-ifdef.exp:1.2
--- src/usr.bin/make/unit-tests/directive-ifdef.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/directive-ifdef.exp	Sun Nov  8 22:38:28 2020
@@ -1 +1,2 @@
+make: "directive-ifdef.mk" line 12: Function calls in .ifdef are possible.
 exit status 0

Index: src/usr.bin/make/unit-tests/directive-ifdef.mk
diff -u src/usr.bin/make/unit-tests/directive-ifdef.mk:1.2 src/usr.bin/make/unit-tests/directive-ifdef.mk:1.3
--- src/usr.bin/make/unit-tests/directive-ifdef.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/directive-ifdef.mk	Sun Nov  8 22:38:28 2020
@@ -1,8 +1,18 @@
-# $NetBSD: directive-ifdef.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive-ifdef.mk,v 1.3 2020/11/08 22:38:28 rillig Exp $
 #
 # Tests for the .ifdef directive.
 
 # TODO: Implementation
 
+DEFINED=	defined
+
+# It looks redundant to have a call to defined() in an .ifdef, but it's
+# possible.  The .ifdef only affects plain symbols, not function calls.
+.ifdef defined(DEFINED)
+.  info Function calls in .ifdef are possible.
+.else
+.  error
+.endif
+
 all:
 	@:;



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 22:37:52 UTC 2020

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

Log Message:
make(1): rename local variable in CondParser_String


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/make/cond.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/cond.c
diff -u src/usr.bin/make/cond.c:1.189 src/usr.bin/make/cond.c:1.190
--- src/usr.bin/make/cond.c:1.189	Sun Nov  8 22:22:03 2020
+++ src/usr.bin/make/cond.c	Sun Nov  8 22:37:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.189 2020/11/08 22:22:03 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.190 2020/11/08 22:37:52 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.189 2020/11/08 22:22:03 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.190 2020/11/08 22:37:52 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -398,7 +398,7 @@ CondParser_String(CondParser *par, Boole
 const char *str;
 Boolean atStart;
 const char *nested_p;
-Boolean qt;
+Boolean quoted;
 const char *start;
 VarEvalFlags eflags;
 VarParseResult parseResult;
@@ -406,9 +406,9 @@ CondParser_String(CondParser *par, Boole
 Buf_Init();
 str = NULL;
 *out_freeIt = NULL;
-*out_quoted = qt = par->p[0] == '"';
+*out_quoted = quoted = par->p[0] == '"';
 start = par->p;
-if (qt)
+if (quoted)
 	par->p++;
 while (par->p[0] != '\0' && str == NULL) {
 	switch (par->p[0]) {
@@ -420,28 +420,28 @@ CondParser_String(CondParser *par, Boole
 	}
 	continue;
 	case '"':
-	if (qt) {
-		par->p++;	/* we don't want the quotes */
+	if (quoted) {
+		par->p++;	/* skip the closing quote */
 		goto got_str;
 	}
 	Buf_AddByte(, par->p[0]); /* likely? */
 	par->p++;
 	continue;
-	case ')':
+	case ')':		/* see is_separator */
 	case '!':
 	case '=':
 	case '>':
 	case '<':
 	case ' ':
 	case '\t':
-	if (!qt)
+	if (!quoted)
 		goto got_str;
 	Buf_AddByte(, par->p[0]);
 	par->p++;
 	continue;
 	case '$':
 	/* if we are in quotes, an undefined variable is ok */
-	eflags = doEval && !qt ? VARE_WANTRES | VARE_UNDEFERR :
+	eflags = doEval && !quoted ? VARE_WANTRES | VARE_UNDEFERR :
 		 doEval ? VARE_WANTRES :
 		 VARE_NONE;
 
@@ -453,7 +453,7 @@ CondParser_String(CondParser *par, Boole
 	if (str == var_Error) {
 		if (parseResult & VPR_ANY_MSG)
 		par->printedError = TRUE;
-		if (*out_freeIt) {
+		if (*out_freeIt != NULL) {
 		free(*out_freeIt);
 		*out_freeIt = NULL;
 		}
@@ -483,7 +483,7 @@ CondParser_String(CondParser *par, Boole
 	str = NULL;		/* not finished yet */
 	continue;
 	default:
-	if (strictLHS && !qt && *start != '$' && !ch_isdigit(*start)) {
+	if (strictLHS && !quoted && *start != '$' && !ch_isdigit(*start)) {
 		/* lhs must be quoted, a variable reference or number */
 		if (*out_freeIt) {
 		free(*out_freeIt);



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

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 22:28:05 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: cond-token-number.exp cond-token-number.mk

Log Message:
make(1): add test for hexadecimal numbers in conditionals


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cond-token-number.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-token-number.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-token-number.exp
diff -u src/usr.bin/make/unit-tests/cond-token-number.exp:1.2 src/usr.bin/make/unit-tests/cond-token-number.exp:1.3
--- src/usr.bin/make/unit-tests/cond-token-number.exp:1.2	Mon Sep 14 06:22:59 2020
+++ src/usr.bin/make/unit-tests/cond-token-number.exp	Sun Nov  8 22:28:05 2020
@@ -2,7 +2,7 @@ make: "cond-token-number.mk" line 13: Ma
 make: "cond-token-number.mk" line 21: Malformed conditional (+0)
 make: "cond-token-number.mk" line 29: Malformed conditional (!-1)
 make: "cond-token-number.mk" line 37: Malformed conditional (!+1)
-make: "cond-token-number.mk" line 54: End of the tests.
+make: "cond-token-number.mk" line 70: End of the tests.
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/cond-token-number.mk
diff -u src/usr.bin/make/unit-tests/cond-token-number.mk:1.3 src/usr.bin/make/unit-tests/cond-token-number.mk:1.4
--- src/usr.bin/make/unit-tests/cond-token-number.mk:1.3	Mon Sep 14 06:22:59 2020
+++ src/usr.bin/make/unit-tests/cond-token-number.mk	Sun Nov  8 22:28:05 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-token-number.mk,v 1.3 2020/09/14 06:22:59 rillig Exp $
+# $NetBSD: cond-token-number.mk,v 1.4 2020/11/08 22:28:05 rillig Exp $
 #
 # Tests for number tokens in .if conditions.
 
@@ -50,6 +50,22 @@
 .  error
 .endif
 
+# Hexadecimal numbers are accepted.
+.if 0x0
+.  error
+.endif
+.if 0x1
+.else
+.  error
+.endif
+
+# This is not a hexadecimal number, even though it has an x.
+# It is interpreted as a string instead, effectively meaning defined(3x4).
+.if 3x4
+.else
+.  error
+.endif
+
 # Ensure that parsing continues until here.
 .info End of the tests.
 



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 22:22:04 UTC 2020

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

Log Message:
make(1): clean up TryParseNumber in conditions

More descriptive variable names, more appropriate literals for
comparisons, one task per paragraph of code.


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/usr.bin/make/cond.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/cond.c
diff -u src/usr.bin/make/cond.c:1.188 src/usr.bin/make/cond.c:1.189
--- src/usr.bin/make/cond.c:1.188	Sun Nov  8 21:10:18 2020
+++ src/usr.bin/make/cond.c	Sun Nov  8 22:22:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.188 2020/11/08 21:10:18 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.189 2020/11/08 22:22:03 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.188 2020/11/08 21:10:18 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.189 2020/11/08 22:22:03 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -336,40 +336,41 @@ FuncCommands(size_t argLen MAKE_ATTR_UNU
 return gn != NULL && GNode_IsTarget(gn) && !Lst_IsEmpty(gn->commands);
 }
 
-/*-
+/*
  * Convert the given number into a double.
  * We try a base 10 or 16 integer conversion first, if that fails
  * then we try a floating point conversion instead.
  *
  * Results:
- *	Sets 'value' to double value of string.
  *	Returns TRUE if the conversion succeeded.
+ *	Sets 'out_value' to the converted number.
  */
 static Boolean
-TryParseNumber(const char *str, double *value)
+TryParseNumber(const char *str, double *out_value)
 {
-char *eptr, ech;
-unsigned long l_val;
-double d_val;
+char *end;
+unsigned long ul_val;
+double dbl_val;
 
 errno = 0;
-if (!*str) {
-	*value = 0.0;
+if (str[0] == '\0') {	/* XXX: why is an empty string a number? */
+	*out_value = 0.0;
 	return TRUE;
 }
-l_val = strtoul(str, , str[1] == 'x' ? 16 : 10);
-ech = *eptr;
-if (ech == '\0' && errno != ERANGE) {
-	d_val = str[0] == '-' ? -(double)-l_val : (double)l_val;
-} else {
-	if (ech != '\0' && ech != '.' && ech != 'e' && ech != 'E')
-	return FALSE;
-	d_val = strtod(str, );
-	if (*eptr)
-	return FALSE;
+
+ul_val = strtoul(str, , str[1] == 'x' ? 16 : 10);
+if (*end == '\0' && errno != ERANGE) {
+	*out_value = str[0] == '-' ? -(double)-ul_val : (double)ul_val;
+	return TRUE;
 }
 
-*value = d_val;
+if (*end != '\0' && *end != '.' && *end != 'e' && *end != 'E')
+	return FALSE;		/* skip the expensive strtod call */
+dbl_val = strtod(str, );
+if (*end != '\0')
+	return FALSE;
+
+*out_value = dbl_val;
 return TRUE;
 }
 



CVS commit: src

2020-11-08 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sun Nov  8 21:56:48 UTC 2020

Modified Files:
src/external/bsd/kyua-cli: Makefile.inc
src/external/ibm-public/postfix: Makefile.inc
src/external/public-domain/sqlite: Makefile.inc
src/external/public-domain/sqlite/bin: Makefile
src/external/public-domain/sqlite/lib: Makefile sqlite3.pc.in
src/usr.sbin/makemandb: Makefile

Log Message:
sqlite: do not build without multithreading support

at least a few pkgsrc packages avoid base sqlite because it fails
this check, and it's probably a surprising performance penalty for
unsuspecting users


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/kyua-cli/Makefile.inc
cvs rdiff -u -r1.24 -r1.25 src/external/ibm-public/postfix/Makefile.inc
cvs rdiff -u -r1.8 -r1.9 src/external/public-domain/sqlite/Makefile.inc
cvs rdiff -u -r1.6 -r1.7 src/external/public-domain/sqlite/bin/Makefile
cvs rdiff -u -r1.11 -r1.12 src/external/public-domain/sqlite/lib/Makefile
cvs rdiff -u -r1.2 -r1.3 src/external/public-domain/sqlite/lib/sqlite3.pc.in
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/makemandb/Makefile

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

Modified files:

Index: src/external/bsd/kyua-cli/Makefile.inc
diff -u src/external/bsd/kyua-cli/Makefile.inc:1.7 src/external/bsd/kyua-cli/Makefile.inc:1.8
--- src/external/bsd/kyua-cli/Makefile.inc:1.7	Fri Oct 30 08:41:58 2020
+++ src/external/bsd/kyua-cli/Makefile.inc	Sun Nov  8 21:56:47 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.7 2020/10/30 08:41:58 martin Exp $
+# $NetBSD: Makefile.inc,v 1.8 2020/11/08 21:56:47 nia Exp $
 
 .include 
 
@@ -58,8 +58,8 @@ DPADD+=			${LIBOBJDIR_${lib}}/lib${lib}.
 .endfor
 
 .if !empty(KYUA_LIBS:Mutils)
-LDADD+=		-llutok -lsqlite3 -lm
-DPADD+=		${LIBLUTOK} ${LIBSQLITE} ${LIBM}
+LDADD+=		-llutok -lsqlite3 -lm -lpthread
+DPADD+=		${LIBLUTOK} ${LIBSQLITE} ${LIBM} ${LIBPTHREAD}
 .endif
 
 MANPAGE_DEPS = cookie-tarname cookie-version

Index: src/external/ibm-public/postfix/Makefile.inc
diff -u src/external/ibm-public/postfix/Makefile.inc:1.24 src/external/ibm-public/postfix/Makefile.inc:1.25
--- src/external/ibm-public/postfix/Makefile.inc:1.24	Fri Oct 30 08:41:58 2020
+++ src/external/ibm-public/postfix/Makefile.inc	Sun Nov  8 21:56:47 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.24 2020/10/30 08:41:58 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.25 2020/11/08 21:56:47 nia Exp $
 
 .include 
 
@@ -45,8 +45,8 @@ CPPFLAGS+=	-DNO_IPV6
 # SQLite support.
 CPPFLAGS+=	-DHAS_SQLITE
 . if defined(PROG)
-DPADD+=		${LIBSQLITE3} ${LIBM}
-LDADD+=		-lsqlite3 -lm
+DPADD+=		${LIBSQLITE3} ${LIBM} ${LIBPTHREAD}
+LDADD+=		-lsqlite3 -lm -lpthread
 .endif
 
 # LDAP support.

Index: src/external/public-domain/sqlite/Makefile.inc
diff -u src/external/public-domain/sqlite/Makefile.inc:1.8 src/external/public-domain/sqlite/Makefile.inc:1.9
--- src/external/public-domain/sqlite/Makefile.inc:1.8	Thu Oct 29 12:38:06 2020
+++ src/external/public-domain/sqlite/Makefile.inc	Sun Nov  8 21:56:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.8 2020/10/29 12:38:06 nia Exp $
+# $NetBSD: Makefile.inc,v 1.9 2020/11/08 21:56:48 nia Exp $
 
 WARNS=		2
 
@@ -15,6 +15,7 @@ CPPFLAGS+=	\
 		-DHAVE_STRERROR_R=1 \
 		-DHAVE_USLEEP=1 \
 		-DHAVE_SYS_ENDIAN_H=1 \
+		-DSQLITE_THREADSAFE \
 		-DSQLITE_ENABLE_COLUMN_METADATA \
 		-DSQLITE_ENABLE_FTS3_PARENTHESIS \
 		-DSQLITE_ENABLE_FTS4 \
@@ -24,7 +25,6 @@ CPPFLAGS+=	\
 		-DSQLITE_ENABLE_GEOPOLY \
 		-DSQLITE_ENABLE_LOAD_EXTENSION \
 		-DSQLITE_ENABLE_UNLOCK_NOTIFY \
-		-DSQLITE_HAVE_ISNAN \
--DSQLITE_MAX_WORKER_THREADS=0
+		-DSQLITE_HAVE_ISNAN
 
 CWARNFLAGS+=	-Wno-shadow -Wno-unused

Index: src/external/public-domain/sqlite/bin/Makefile
diff -u src/external/public-domain/sqlite/bin/Makefile:1.6 src/external/public-domain/sqlite/bin/Makefile:1.7
--- src/external/public-domain/sqlite/bin/Makefile:1.6	Fri Oct 30 08:41:58 2020
+++ src/external/public-domain/sqlite/bin/Makefile	Sun Nov  8 21:56:48 2020
@@ -1,11 +1,11 @@
-# $NetBSD: Makefile,v 1.6 2020/10/30 08:41:58 martin Exp $
+# $NetBSD: Makefile,v 1.7 2020/11/08 21:56:48 nia Exp $
 
 PROG=		sqlite3
 
 SRCS=		shell.c
 
-DPADD+=		${LIBSQLITE3} ${LIBEDIT} ${LIBTERIMINFO} ${LIBM}
-LDADD+=		-lsqlite3 -ledit -lterminfo -lm
+DPADD+=		${LIBSQLITE3} ${LIBEDIT} ${LIBTERIMINFO} ${LIBM} ${LIBPTHREAD}
+LDADD+=		-lsqlite3 -ledit -lterminfo -lpthread -lm
 
 BINDIR=		/usr/bin
 

Index: src/external/public-domain/sqlite/lib/Makefile
diff -u src/external/public-domain/sqlite/lib/Makefile:1.11 src/external/public-domain/sqlite/lib/Makefile:1.12
--- src/external/public-domain/sqlite/lib/Makefile:1.11	Thu Oct 29 16:35:33 2020
+++ src/external/public-domain/sqlite/lib/Makefile	Sun Nov  8 21:56:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.11 2020/10/29 16:35:33 nia Exp $
+# $NetBSD: Makefile,v 1.12 2020/11/08 21:56:48 nia Exp $
 
 LIB=		sqlite3
 INCS=		

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

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 21:47:59 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: cond-cmp-numeric-eq.exp
cond-cmp-numeric-eq.mk

Log Message:
make(1): add test for comparison of large integers


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.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-cmp-numeric-eq.exp
diff -u src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp:1.2 src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp:1.3
--- src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp:1.2	Fri Sep 11 15:33:28 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.exp	Sun Nov  8 21:47:59 2020
@@ -1,6 +1,6 @@
-make: "cond-cmp-numeric-eq.mk" line 54: warning: Unknown operator
-make: "cond-cmp-numeric-eq.mk" line 54: Malformed conditional (!(12345 = 12345))
-make: "cond-cmp-numeric-eq.mk" line 61: Malformed conditional (!(12345 === 12345))
+make: "cond-cmp-numeric-eq.mk" line 67: warning: Unknown operator
+make: "cond-cmp-numeric-eq.mk" line 67: Malformed conditional (!(12345 = 12345))
+make: "cond-cmp-numeric-eq.mk" line 74: Malformed conditional (!(12345 === 12345))
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk
diff -u src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk:1.4 src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk:1.5
--- src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk:1.4	Sat Oct 24 08:46:08 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-numeric-eq.mk	Sun Nov  8 21:47:59 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-cmp-numeric-eq.mk,v 1.4 2020/10/24 08:46:08 rillig Exp $
+# $NetBSD: cond-cmp-numeric-eq.mk,v 1.5 2020/11/08 21:47:59 rillig Exp $
 #
 # Tests for numeric comparisons with the == operator in .if conditions.
 
@@ -49,6 +49,19 @@
 .  error
 .endif
 
+# Because an IEEE 754 double can only hold integers with a mantissa of 53
+# bits, these two numbers are considered the same.  The 993 is rounded down
+# to the 992.
+.if 9007199254740993 == 9007199254740992
+.else
+. error
+.endif
+# The 995 is rounded up, the 997 is rounded down.
+.if 9007199254740995 == 9007199254740997
+.else
+. error Probably a misconfiguration in the floating point environment, \
+	or maybe a machine without IEEE 754 floating point support.
+.endif
 
 # There is no = operator for numbers.
 .if !(12345 = 12345)



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

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 21:40:13 UTC 2020

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

Log Message:
make(1): add test for function argument with unbalanced braces


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond-func.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-func.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.exp
diff -u src/usr.bin/make/unit-tests/cond-func.exp:1.1 src/usr.bin/make/unit-tests/cond-func.exp:1.2
--- src/usr.bin/make/unit-tests/cond-func.exp:1.1	Thu Aug 20 17:45:47 2020
+++ src/usr.bin/make/unit-tests/cond-func.exp	Sun Nov  8 21:40:13 2020
@@ -1,9 +1,9 @@
-make: "cond-func.mk" line 29: warning: Missing closing parenthesis for defined()
-make: "cond-func.mk" line 29: Malformed conditional (!defined(A B))
-make: "cond-func.mk" line 44: warning: Missing closing parenthesis for defined()
-make: "cond-func.mk" line 44: Malformed conditional (!defined(A))
-make: "cond-func.mk" line 47: warning: Missing closing parenthesis for defined()
-make: "cond-func.mk" line 47: Malformed conditional (!defined(A|B))
+make: "cond-func.mk" line 34: warning: Missing closing parenthesis for defined()
+make: "cond-func.mk" line 34: Malformed conditional (!defined(A B))
+make: "cond-func.mk" line 49: warning: Missing closing parenthesis for defined()
+make: "cond-func.mk" line 49: Malformed conditional (!defined(A))
+make: "cond-func.mk" line 52: warning: Missing closing parenthesis for defined()
+make: "cond-func.mk" line 52: Malformed conditional (!defined(A|B))
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/cond-func.mk
diff -u src/usr.bin/make/unit-tests/cond-func.mk:1.5 src/usr.bin/make/unit-tests/cond-func.mk:1.6
--- src/usr.bin/make/unit-tests/cond-func.mk:1.5	Sun Nov  8 21:33:05 2020
+++ src/usr.bin/make/unit-tests/cond-func.mk	Sun Nov  8 21:40:13 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func.mk,v 1.5 2020/11/08 21:33:05 rillig Exp $
+# $NetBSD: cond-func.mk,v 1.6 2020/11/08 21:40:13 rillig Exp $
 #
 # Tests for those parts of the functions in .if conditions that are common
 # among several functions.
@@ -9,7 +9,12 @@
 DEF=			defined
 ${:UA B}=		variable name with spaces
 ${:UVAR(value)}=	variable name with parentheses
-${:UVAR{value}}=	variable name with braces
+${:UVAR{value}}=	variable name with balanced braces
+
+# Really strange variable names must be given indirectly via another variable,
+# so that no unbalanced braces appear in the top-level expression.
+VARNAME_UNBALANCED_BRACES=	VAR{{{value
+${VARNAME_UNBALANCED_BRACES}=	variable name with unbalanced braces
 
 .if !defined(DEF)
 .  error
@@ -59,6 +64,12 @@ ${:UVAR{value}}=	variable name with brac
 .  error
 .endif
 
+# Braces do not have any special meaning when parsing arguments.
+# They don't need to be balanced.
+.if !defined(VAR{{{value)
+.  error
+.endif
+
 # There may be spaces around the operators and parentheses, and even
 # inside the parentheses.  The spaces inside the parentheses are not
 # allowed for the empty() function (see cond-func-empty.mk), therefore



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

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 21:33:05 UTC 2020

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

Log Message:
make(1): document what the directive ".if A" means


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-func.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.mk
diff -u src/usr.bin/make/unit-tests/cond-func.mk:1.4 src/usr.bin/make/unit-tests/cond-func.mk:1.5
--- src/usr.bin/make/unit-tests/cond-func.mk:1.4	Sat Oct 24 08:46:08 2020
+++ src/usr.bin/make/unit-tests/cond-func.mk	Sun Nov  8 21:33:05 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func.mk,v 1.4 2020/10/24 08:46:08 rillig Exp $
+# $NetBSD: cond-func.mk,v 1.5 2020/11/08 21:33:05 rillig Exp $
 #
 # Tests for those parts of the functions in .if conditions that are common
 # among several functions.
@@ -67,5 +67,13 @@ ${:UVAR{value}}=	variable name with brac
 .  error
 .endif
 
+# The following condition is interpreted as defined(A) && defined(B).
+# In lack of a function call expression, each kind of .if directive has a
+# default function that is called when a bare word is parsed.  For the plain
+# .if directive, this function is defined(); see "struct If ifs" in cond.c.
+.if A
+.  error
+.endif
+
 all:
 	@:;



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 21:10:18 UTC 2020

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

Log Message:
make(1): clean up FuncExists


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/usr.bin/make/cond.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/cond.c
diff -u src/usr.bin/make/cond.c:1.187 src/usr.bin/make/cond.c:1.188
--- src/usr.bin/make/cond.c:1.187	Sun Nov  8 19:53:11 2020
+++ src/usr.bin/make/cond.c	Sun Nov  8 21:10:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.187 2020/11/08 19:53:11 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.188 2020/11/08 21:10:18 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.187 2020/11/08 19:53:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.188 2020/11/08 21:10:18 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -312,13 +312,10 @@ FuncExists(size_t argLen MAKE_ATTR_UNUSE
 char *path;
 
 path = Dir_FindFile(arg, dirSearchPath);
-DEBUG2(COND, "exists(%s) result is \"%s\"\n", arg, path ? path : "");
-if (path != NULL) {
-	result = TRUE;
-	free(path);
-} else {
-	result = FALSE;
-}
+DEBUG2(COND, "exists(%s) result is \"%s\"\n",
+	   arg, path != NULL ? path : "");
+result = path != NULL;
+free(path);
 return result;
 }
 



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

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 20:29:13 UTC 2020

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

Log Message:
make(1): add test demonstrating the :D modifier with := assignments


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-defined.exp
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-defined.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-defined.exp
diff -u src/usr.bin/make/unit-tests/varmod-defined.exp:1.1 src/usr.bin/make/unit-tests/varmod-defined.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-defined.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-defined.exp	Sun Nov  8 20:29:13 2020
@@ -1 +1,23 @@
+Global:8_DOLLARS = 
+Global:VAR = 
+Var_Parse: ${8_DOLLARS} with VARE_WANTRES|VARE_KEEP_DOLLAR
+Global:VAR = 
+Var_Parse: ${VAR:D${8_DOLLARS}} with VARE_WANTRES|VARE_KEEP_DOLLAR
+Applying ${VAR:D...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, none)
+Var_Parse: ${8_DOLLARS}} with VARE_WANTRES|VARE_KEEP_DOLLAR
+Result of ${VAR:D${8_DOLLARS}} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, none)
+Global:VAR = 
+Var_Parse: ${VAR:@var@${8_DOLLARS}@} with VARE_WANTRES|VARE_KEEP_DOLLAR
+Applying ${VAR:@...} to "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, none)
+Modifier part: "var"
+Modifier part: "${8_DOLLARS}"
+ModifyWords: split "" into 1 words
+Global:var = 
+Var_Parse: ${8_DOLLARS} with VARE_WANTRES
+ModifyWord_Loop: in "", replace "var" with "${8_DOLLARS}" to ""
+Global:delete var
+Result of ${VAR:@var@${8_DOLLARS}@} is "" (VARE_WANTRES|VARE_KEEP_DOLLAR, none, none)
+Global:VAR = 
+Global:.MAKEFLAGS =  -r -k -d v -d
+Global:.MAKEFLAGS =  -r -k -d v -d 0
 exit status 0

Index: src/usr.bin/make/unit-tests/varmod-defined.mk
diff -u src/usr.bin/make/unit-tests/varmod-defined.mk:1.7 src/usr.bin/make/unit-tests/varmod-defined.mk:1.8
--- src/usr.bin/make/unit-tests/varmod-defined.mk:1.7	Sat Oct 24 08:46:08 2020
+++ src/usr.bin/make/unit-tests/varmod-defined.mk	Sun Nov  8 20:29:13 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-defined.mk,v 1.7 2020/10/24 08:46:08 rillig Exp $
+# $NetBSD: varmod-defined.mk,v 1.8 2020/11/08 20:29:13 rillig Exp $
 #
 # Tests for the :D variable modifier, which returns the given string
 # if the variable is defined.  It is closely related to the :U modifier.
@@ -85,5 +85,19 @@ DEF=	defined
 # TODO: Add more tests for parsing the plain text part, to cover each branch
 # of ApplyModifier_Defined.
 
+# The :D and :U modifiers behave differently from the :@var@ modifier in
+# that they preserve dollars in a ':=' assignment.  This is because
+# ApplyModifier_Defined passes the eflags unmodified to Var_Parse, unlike
+# ApplyModifier_Loop, which uses ParseModifierPart, which in turn removes
+# VARE_KEEP_DOLLAR from eflags.
+#
+# XXX: This inconsistency is documented nowhere.
+.MAKEFLAGS: -dv
+8_DOLLARS=	
+VAR:=		${8_DOLLARS}
+VAR:=		${VAR:D${8_DOLLARS}}
+VAR:=		${VAR:@var@${8_DOLLARS}@}
+.MAKEFLAGS: -d0
+
 all:
 	@:;



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 19:53:11 UTC 2020

Modified Files:
src/usr.bin/make: arch.c cond.c parse.c suff.c var.c

Log Message:
make(1): clean up code related to VarEvalFlags

Mention VARE_WANTRES before VARE_UNDEFERR since the latter depends on
the former.

In ApplyModifier_Assign, VARE_KEEP_DOLLAR doesn't have to be removed
from eflags since ParseModifierPart does this already.

In EvalUndefined, testing for VARE_WANTRES is redundant if VARE_UNDEFERR
is already set.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/usr.bin/make/arch.c
cvs rdiff -u -r1.186 -r1.187 src/usr.bin/make/cond.c
cvs rdiff -u -r1.435 -r1.436 src/usr.bin/make/parse.c
cvs rdiff -u -r1.234 -r1.235 src/usr.bin/make/suff.c
cvs rdiff -u -r1.681 -r1.682 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/arch.c
diff -u src/usr.bin/make/arch.c:1.174 src/usr.bin/make/arch.c:1.175
--- src/usr.bin/make/arch.c:1.174	Sun Nov  8 09:15:19 2020
+++ src/usr.bin/make/arch.c	Sun Nov  8 19:53:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.174 2020/11/08 09:15:19 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.175 2020/11/08 19:53:11 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -125,7 +125,7 @@
 #include "config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.174 2020/11/08 09:15:19 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.175 2020/11/08 19:53:11 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -210,7 +210,7 @@ Arch_ParseArchive(char **pp, GNodeList *
 	Boolean isError;
 
 	/* XXX: is expanded twice: once here and once below */
-	(void)Var_Parse(_p, ctxt, VARE_UNDEFERR|VARE_WANTRES,
+	(void)Var_Parse(_p, ctxt, VARE_WANTRES | VARE_UNDEFERR,
 			, _freeIt);
 	/* TODO: handle errors */
 	isError = result == var_Error;
@@ -226,7 +226,7 @@ Arch_ParseArchive(char **pp, GNodeList *
 
 *cp++ = '\0';
 if (expandLibName) {
-	(void)Var_Subst(libName, ctxt, VARE_UNDEFERR|VARE_WANTRES, );
+	(void)Var_Subst(libName, ctxt, VARE_WANTRES | VARE_UNDEFERR, );
 	/* TODO: handle errors */
 	libName_freeIt = libName;
 }
@@ -254,7 +254,7 @@ Arch_ParseArchive(char **pp, GNodeList *
 		Boolean isError;
 		const char *nested_p = cp;
 
-		(void)Var_Parse(_p, ctxt, VARE_UNDEFERR|VARE_WANTRES,
+		(void)Var_Parse(_p, ctxt, VARE_WANTRES | VARE_UNDEFERR,
 , );
 		/* TODO: handle errors */
 		isError = result == var_Error;
@@ -307,7 +307,7 @@ Arch_ParseArchive(char **pp, GNodeList *
 	char *sacrifice;
 	char *oldMemName = memName;
 
-	(void)Var_Subst(memName, ctxt, VARE_UNDEFERR|VARE_WANTRES,
+	(void)Var_Subst(memName, ctxt, VARE_WANTRES | VARE_UNDEFERR,
 			);
 	/* TODO: handle errors */
 

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.186 src/usr.bin/make/cond.c:1.187
--- src/usr.bin/make/cond.c:1.186	Sun Nov  8 19:24:19 2020
+++ src/usr.bin/make/cond.c	Sun Nov  8 19:53:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.186 2020/11/08 19:24:19 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.187 2020/11/08 19:53:11 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.186 2020/11/08 19:24:19 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.187 2020/11/08 19:53:11 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -443,7 +443,7 @@ CondParser_String(CondParser *par, Boole
 	continue;
 	case '$':
 	/* if we are in quotes, an undefined variable is ok */
-	eflags = doEval && !qt ? VARE_UNDEFERR | VARE_WANTRES :
+	eflags = doEval && !qt ? VARE_WANTRES | VARE_UNDEFERR :
 		 doEval ? VARE_WANTRES :
 		 VARE_NONE;
 

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.435 src/usr.bin/make/parse.c:1.436
--- src/usr.bin/make/parse.c:1.435	Sun Nov  8 16:58:33 2020
+++ src/usr.bin/make/parse.c	Sun Nov  8 19:53:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.435 2020/11/08 16:58:33 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.436 2020/11/08 19:53:11 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.435 2020/11/08 16:58:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.436 2020/11/08 19:53:11 rillig Exp $");
 
 /* types and constants */
 
@@ -1063,8 +1063,8 @@ ParseDependencyTargetWord(/*const*/ char
 	const char *nested_val;
 	void *freeIt;
 
-	(void)Var_Parse(_p, VAR_CMDLINE, VARE_UNDEFERR|VARE_WANTRES,
-			_val, );
+	(void)Var_Parse(_p, VAR_CMDLINE,
+			VARE_WANTRES | VARE_UNDEFERR, _val, );
 	/* TODO: handle errors */
 	

CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 19:24:19 UTC 2020

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

Log Message:
make(1): clean up VarEvalFlags in the calls to Var_Parse and Var_Subst

There are only 3 flags, and some combinations don't even make sense.

VARE_UNDEFERR only makes sense if combined with VARE_WANTRES.  If the
latter is not set, the variable expressions are only parsed, without
asking whether they are defined or not.  Therefore, VARE_UNDEFERR cannot
have any effect in that case.

VARE_KEEP_DOLLAR is actively ignored by ParseModifierPart.  In cases
where VARE_WANTRES is not set, this means that VARE_NONE can be passed,
which is easier to grasp than any bitset operations.  This also gets rid
of a few type casts from enum to unsigned int that were necessary to
pass WARNS=6.


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 src/usr.bin/make/cond.c
cvs rdiff -u -r1.680 -r1.681 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/cond.c
diff -u src/usr.bin/make/cond.c:1.185 src/usr.bin/make/cond.c:1.186
--- src/usr.bin/make/cond.c:1.185	Sat Nov  7 20:39:56 2020
+++ src/usr.bin/make/cond.c	Sun Nov  8 19:24:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.185 2020/11/07 20:39:56 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.186 2020/11/08 19:24:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.185 2020/11/07 20:39:56 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.186 2020/11/08 19:24:19 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -248,7 +248,8 @@ ParseFuncArg(const char **pp, Boolean do
 	 * though perhaps we should...
 	 */
 	void *nestedVal_freeIt;
-	VarEvalFlags eflags = VARE_UNDEFERR | (doEval ? VARE_WANTRES : 0);
+	VarEvalFlags eflags = doEval ? VARE_WANTRES | VARE_UNDEFERR
+	 : VARE_NONE;
 	const char *nestedVal;
 	(void)Var_Parse(, VAR_CMDLINE, eflags, ,
 			_freeIt);

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.680 src/usr.bin/make/var.c:1.681
--- src/usr.bin/make/var.c:1.680	Sun Nov  8 18:27:14 2020
+++ src/usr.bin/make/var.c	Sun Nov  8 19:24:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.680 2020/11/08 18:27:14 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.681 2020/11/08 19:24:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.680 2020/11/08 18:27:14 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.681 2020/11/08 19:24:19 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -2068,13 +2068,12 @@ ApplyModifier_Loop(const char **pp, Appl
 {
 struct ModifyWord_LoopArgs args;
 char prev_sep;
-VarEvalFlags eflags = st->eflags & ~(unsigned)VARE_WANTRES;
 VarParseResult res;
 
 args.ctx = st->ctxt;
 
 (*pp)++;			/* Skip the first '@' */
-res = ParseModifierPart(pp, '@', eflags, st,
+res = ParseModifierPart(pp, '@', VARE_NONE, st,
 			, NULL, NULL, NULL);
 if (res != VPR_OK)
 	return AMR_CLEANUP;
@@ -2086,12 +2085,12 @@ ApplyModifier_Loop(const char **pp, Appl
 	return AMR_CLEANUP;
 }
 
-res = ParseModifierPart(pp, '@', eflags, st,
+res = ParseModifierPart(pp, '@', VARE_NONE, st,
 			, NULL, NULL, NULL);
 if (res != VPR_OK)
 	return AMR_CLEANUP;
 
-args.eflags = st->eflags & (VARE_UNDEFERR | VARE_WANTRES);
+args.eflags = st->eflags & ~(unsigned)VARE_KEEP_DOLLAR;
 prev_sep = st->sep;
 st->sep = ' ';		/* XXX: should be st->sep for consistency */
 st->newVal = ModifyWords(st->val, ModifyWord_Loop, ,
@@ -2110,11 +2109,10 @@ ApplyModifier_Defined(const char **pp, A
 Buffer buf;
 const char *p;
 
-VarEvalFlags eflags = st->eflags & ~(unsigned)VARE_WANTRES;
-if (st->eflags & VARE_WANTRES) {
+VarEvalFlags eflags = VARE_NONE;
+if (st->eflags & VARE_WANTRES)
 	if ((**pp == 'D') == !(st->exprFlags & VEF_UNDEF))
-	eflags |= VARE_WANTRES;
-}
+	eflags = st->eflags;
 
 Buf_Init();
 p = *pp + 1;
@@ -2873,16 +2871,16 @@ ApplyModifier_IfElse(const char **pp, Ap
 VarParseResult res;
 
 Boolean value = FALSE;
-VarEvalFlags then_eflags = st->eflags & ~(unsigned)VARE_WANTRES;
-VarEvalFlags else_eflags = st->eflags & ~(unsigned)VARE_WANTRES;
+VarEvalFlags then_eflags = VARE_NONE;
+VarEvalFlags else_eflags = VARE_NONE;
 
 int cond_rc = COND_PARSE;	/* anything other than COND_INVALID */
 if (st->eflags & VARE_WANTRES) {
 	cond_rc = Cond_EvalCondition(st->v->name, );
 	if (cond_rc != COND_INVALID && value)
-	

CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 18:27:14 UTC 2020

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

Log Message:
make(1): rename local variable in VarSubstNested


To generate a diff of this commit:
cvs rdiff -u -r1.679 -r1.680 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.679 src/usr.bin/make/var.c:1.680
--- src/usr.bin/make/var.c:1.679	Sun Nov  8 18:16:55 2020
+++ src/usr.bin/make/var.c	Sun Nov  8 18:27:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.679 2020/11/08 18:16:55 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.680 2020/11/08 18:27:14 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.679 2020/11/08 18:16:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.680 2020/11/08 18:27:14 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3945,10 +3945,10 @@ VarSubstNested(const char **const pp, Bu
 {
 const char *p = *pp;
 const char *nested_p = p;
-void *freeIt;
 const char *val;
+void *val_freeIt;
 
-(void)Var_Parse(_p, ctxt, eflags, , );
+(void)Var_Parse(_p, ctxt, eflags, , _freeIt);
 /* TODO: handle errors */
 
 if (val == var_Error || val == varUndefined) {
@@ -3984,7 +3984,7 @@ VarSubstNested(const char **const pp, Bu
 	Buf_AddStr(buf, val);
 }
 
-free(freeIt);
+free(val_freeIt);
 
 *pp = p;
 }



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 18:16:55 UTC 2020

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

Log Message:
make(1): reorder branches in Var_Subst

This way, '$$' is handled first, followed by '$', followed by everything
else.  This is easier to follow than first '$$' then not '$' and finally
'$'.


To generate a diff of this commit:
cvs rdiff -u -r1.678 -r1.679 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.678 src/usr.bin/make/var.c:1.679
--- src/usr.bin/make/var.c:1.678	Sun Nov  8 18:13:01 2020
+++ src/usr.bin/make/var.c	Sun Nov  8 18:16:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.678 2020/11/08 18:13:01 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.679 2020/11/08 18:16:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.678 2020/11/08 18:13:01 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.679 2020/11/08 18:16:55 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -4019,7 +4019,11 @@ Var_Subst(const char *str, GNode *ctxt, 
 		Buf_AddByte(, '$');
 	Buf_AddByte(, '$');
 	p += 2;
-	} else if (*p != '$') {
+
+	} else if (p[0] == '$') {
+	VarSubstNested(, , ctxt, eflags, );
+
+	} else {
 	/*
 	 * Skip as many characters as possible -- either to the end of
 	 * the string or to the next dollar sign (variable expression).
@@ -4029,8 +4033,6 @@ Var_Subst(const char *str, GNode *ctxt, 
 	for (p++; *p != '$' && *p != '\0'; p++)
 		continue;
 	Buf_AddBytesBetween(, plainStart, p);
-	} else {
-	VarSubstNested(, , ctxt, eflags, );
 	}
 }
 



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 18:13:01 UTC 2020

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

Log Message:
make(1): extract VarSubstNested from Var_Subst

Each of these functions now fits on a moderately large screen.


To generate a diff of this commit:
cvs rdiff -u -r1.677 -r1.678 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.677 src/usr.bin/make/var.c:1.678
--- src/usr.bin/make/var.c:1.677	Sun Nov  8 16:58:33 2020
+++ src/usr.bin/make/var.c	Sun Nov  8 18:13:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.677 2020/11/08 16:58:33 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.678 2020/11/08 18:13:01 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.677 2020/11/08 16:58:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.678 2020/11/08 18:13:01 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3939,6 +3939,56 @@ Var_Parse(const char **pp, GNode *ctxt, 
 return VPR_UNKNOWN;
 }
 
+static void
+VarSubstNested(const char **const pp, Buffer *const buf, GNode *const ctxt,
+	   VarEvalFlags const eflags, Boolean *inout_errorReported)
+{
+const char *p = *pp;
+const char *nested_p = p;
+void *freeIt;
+const char *val;
+
+(void)Var_Parse(_p, ctxt, eflags, , );
+/* TODO: handle errors */
+
+if (val == var_Error || val == varUndefined) {
+	if (!preserveUndefined) {
+	p = nested_p;
+	} else if ((eflags & VARE_UNDEFERR) || val == var_Error) {
+	/* XXX: This condition is wrong.  If val == var_Error,
+	 * this doesn't necessarily mean there was an undefined
+	 * variable.  It could equally well be a parse error; see
+	 * unit-tests/varmod-order.exp. */
+
+	/*
+	 * If variable is undefined, complain and skip the
+	 * variable. The complaint will stop us from doing anything
+	 * when the file is parsed.
+	 */
+	if (!*inout_errorReported) {
+		Parse_Error(PARSE_FATAL, "Undefined variable \"%.*s\"",
+			(int)(size_t)(nested_p - p), p);
+	}
+	p = nested_p;
+	*inout_errorReported = TRUE;
+	} else {
+	/* Copy the initial '$' of the undefined expression,
+	 * thereby deferring expansion of the expression, but
+	 * expand nested expressions if already possible.
+	 * See unit-tests/varparse-undef-partial.mk. */
+	Buf_AddByte(buf, *p);
+	p++;
+	}
+} else {
+	p = nested_p;
+	Buf_AddStr(buf, val);
+}
+
+free(freeIt);
+
+*pp = p;
+}
+
 /* Expand all variable expressions like $V, ${VAR}, $(VAR:Modifiers) in the
  * given string.
  *
@@ -3980,46 +4030,7 @@ Var_Subst(const char *str, GNode *ctxt, 
 		continue;
 	Buf_AddBytesBetween(, plainStart, p);
 	} else {
-	const char *nested_p = p;
-	void *freeIt;
-	const char *val;
-	(void)Var_Parse(_p, ctxt, eflags, , );
-	/* TODO: handle errors */
-
-	if (val == var_Error || val == varUndefined) {
-		if (!preserveUndefined) {
-		p = nested_p;
-		} else if ((eflags & VARE_UNDEFERR) || val == var_Error) {
-		/* XXX: This condition is wrong.  If val == var_Error,
-		 * this doesn't necessarily mean there was an undefined
-		 * variable.  It could equally well be a parse error; see
-		 * unit-tests/varmod-order.exp. */
-
-		/*
-		 * If variable is undefined, complain and skip the
-		 * variable. The complaint will stop us from doing anything
-		 * when the file is parsed.
-		 */
-		if (!errorReported) {
-			Parse_Error(PARSE_FATAL, "Undefined variable \"%.*s\"",
-(int)(size_t)(nested_p - p), p);
-		}
-		p = nested_p;
-		errorReported = TRUE;
-		} else {
-		/* Copy the initial '$' of the undefined expression,
-		 * thereby deferring expansion of the expression, but
-		 * expand nested expressions if already possible.
-		 * See unit-tests/varparse-undef-partial.mk. */
-		Buf_AddByte(, *p);
-		p++;
-		}
-	} else {
-		p = nested_p;
-		Buf_AddStr(, val);
-	}
-	free(freeIt);
-	freeIt = NULL;
+	VarSubstNested(, , ctxt, eflags, );
 	}
 }
 



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

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 18:05:32 UTC 2020

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

Log Message:
make(1): add test demonstrating how ':=' and ':@var@' interact


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-loop.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-loop.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-loop.exp
diff -u src/usr.bin/make/unit-tests/varmod-loop.exp:1.3 src/usr.bin/make/unit-tests/varmod-loop.exp:1.4
--- src/usr.bin/make/unit-tests/varmod-loop.exp:1.3	Sun Sep 13 07:32:32 2020
+++ src/usr.bin/make/unit-tests/varmod-loop.exp	Sun Nov  8 18:05:32 2020
@@ -1,3 +1,11 @@
+ParseReadLine (115): 'USE_8_DOLLARS=	${:U1:@var@${8_DOLLARS}@} ${8_DOLLARS} '
+CondParser_Eval: ${USE_8_DOLLARS} != "\$\$\$\$ \$\$\$\$ \$\$\$\$"
+lhs = "  ", rhs = "  ", op = !=
+ParseReadLine (120): 'SUBST_CONTAINING_LOOP:= ${USE_8_DOLLARS}'
+CondParser_Eval: ${SUBST_CONTAINING_LOOP} != "\$\$ \$\$\$\$ \$\$\$\$"
+lhs = "$$  ", rhs = "$$  ", op = !=
+ParseReadLine (145): '.MAKEFLAGS: -d0'
+ParseDoDependency(.MAKEFLAGS: -d0)
 :+one+ +two+ +three+:
 :x1y x2y x3y:
 :x1y x2y x3y:

Index: src/usr.bin/make/unit-tests/varmod-loop.mk
diff -u src/usr.bin/make/unit-tests/varmod-loop.mk:1.6 src/usr.bin/make/unit-tests/varmod-loop.mk:1.7
--- src/usr.bin/make/unit-tests/varmod-loop.mk:1.6	Tue Nov  3 18:21:36 2020
+++ src/usr.bin/make/unit-tests/varmod-loop.mk	Sun Nov  8 18:05:32 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-loop.mk,v 1.6 2020/11/03 18:21:36 rillig Exp $
+# $NetBSD: varmod-loop.mk,v 1.7 2020/11/08 18:05:32 rillig Exp $
 #
 # Tests for the :@var@...${var}...@ variable modifier.
 
@@ -100,3 +100,46 @@ mod-loop-dollar:
 .if defined(var)
 .  error
 .endif
+
+# Assignment using the ':=' operator, combined with the :@var@ modifier
+#
+8_DOLLARS=	
+# This string literal is written with 8 dollars, and this is saved as the
+# variable value.  But as soon as this value is evaluated, it goes through
+# Var_Subst, which replaces each '$$' with a single '$'.  This could be
+# prevented by VARE_KEEP_DOLLAR, but that flag is usually removed before
+# expanding subexpressions.  See ApplyModifier_Loop and ParseModifierPart
+# for examples.
+#
+.MAKEFLAGS: -dcp
+USE_8_DOLLARS=	${:U1:@var@${8_DOLLARS}@} ${8_DOLLARS} 
+.if ${USE_8_DOLLARS} != "\$\$\$\$ \$\$\$\$ \$\$\$\$"
+.  error
+.endif
+#
+SUBST_CONTAINING_LOOP:= ${USE_8_DOLLARS}
+# The ':=' assignment operator evaluates the variable value using the flag
+# VARE_KEEP_DOLLAR, which means that some dollar signs are preserved, but not
+# all.  The dollar signs in the top-level expression and in the indirect
+# ${8_DOLLARS} are preserved.
+#
+# The variable modifier :@var@ does not preserve the dollar signs though, no
+# matter in which context it is evaluated.  What happens in detail is:
+# First, the modifier part "${8_DOLLARS}" is parsed without expanding it.
+# Next, each word of the value is expanded on its own, and at this moment
+# in ApplyModifier_Loop, the VARE_KEEP_DOLLAR flag is not passed down to
+# ModifyWords, resulting in "" for the first word of USE_8_DOLLARS.
+#
+# The remaining words of USE_8_DOLLARS are not affected by any variable
+# modifier and are thus expanded with the flag VARE_KEEP_DOLLAR in action.
+# The variable SUBST_CONTAINING_LOOP therefore gets assigned the raw value
+# "  ".
+#
+# The variable expression in the condition then expands this raw stored value
+# once, resulting in "$$  ".  The effects from VARE_KEEP_DOLLAR no
+# longer take place since they had only been active during the evaluation of
+# the variable assignment.
+.if ${SUBST_CONTAINING_LOOP} != "\$\$ \$\$\$\$ \$\$\$\$"
+.  error
+.endif
+.MAKEFLAGS: -d0



CVS commit: src/games/fortune/datfiles

2020-11-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Nov  8 17:37:30 UTC 2020

Modified Files:
src/games/fortune/datfiles: fortunes

Log Message:
catman(8) is a past thing


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/games/fortune/datfiles/fortunes

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

Modified files:

Index: src/games/fortune/datfiles/fortunes
diff -u src/games/fortune/datfiles/fortunes:1.93 src/games/fortune/datfiles/fortunes:1.94
--- src/games/fortune/datfiles/fortunes:1.93	Fri Oct 30 04:56:32 2020
+++ src/games/fortune/datfiles/fortunes	Sun Nov  8 17:37:29 2020
@@ -16177,7 +16177,7 @@ be named Eustace Clarence Scrubb.
 %
 Never leave a macassar and an antimacassar in the same room together.
 %
-Why did the furry install Unix? Because it supports catman(8).
+Why did the furry install Unix? Because it supported catman(8).
 %
 Many people don't realize that trailhead doggerel is illegal -- but
 surely you've heard of "hike rhymes and misdemeanors"...



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 16:58:34 UTC 2020

Modified Files:
src/usr.bin/make: nonints.h parse.c var.c
src/usr.bin/make/unit-tests: varname-dot-shell.exp

Log Message:
make(1): rename VARE_ASSIGN to VARE_KEEP_DOLLAR

The other flags in VarEvalFlags already describe their effects, not the
place where they are used.  It's more important to know the effect.

Only a single unit test had to be adjusted.  This probably means that
there are too few tests where the special effects of VARE_KEEP_DOLLAR
come into play.  It could also mean that the effects are so simple and
obvious that they don't need any debug log, but that's not the case.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.434 -r1.435 src/usr.bin/make/parse.c
cvs rdiff -u -r1.676 -r1.677 src/usr.bin/make/var.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varname-dot-shell.exp

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

Modified files:

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.158 src/usr.bin/make/nonints.h:1.159
--- src/usr.bin/make/nonints.h:1.158	Sun Nov  8 09:15:19 2020
+++ src/usr.bin/make/nonints.h	Sun Nov  8 16:58:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.158 2020/11/08 09:15:19 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.159 2020/11/08 16:58:33 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -215,16 +215,28 @@ void Var_End(void);
 
 typedef enum VarEvalFlags {
 VARE_NONE		= 0,
-/* Treat undefined variables as errors. */
-VARE_UNDEFERR	= 1 << 0,
-/* Expand and evaluate variables during parsing. */
-VARE_WANTRES	= 1 << 1,
-/* In an assignment using the ':=' operator, keep '$$' as '$$' instead
- * of reducing it to a single '$'.
+
+/* Expand and evaluate variables during parsing.
+ *
+ * TODO: Document what Var_Parse and Var_Subst return when this flag
+ * is not set. */
+VARE_WANTRES	= 1 << 0,
+
+/* Treat undefined variables as errors.
+ * Must only be used in combination with VARE_WANTRES. */
+VARE_UNDEFERR	= 1 << 1,
+
+/* Keep '$$' as '$$' instead of reducing it to a single '$'.
+ *
+ * Used in variable assignments using the ':=' operator.  It allows
+ * multiple such assignments to be chained without accidentally expanding
+ * '$$file' to '$file' in the first assignment and interpreting it as
+ * '${f}' followed by 'ile' in the next assignment.
  *
- * See also preserveUndefined, which preserves subexpressions based on
- * undefined variables; maybe that can be converted to a flag as well. */
-VARE_ASSIGN		= 1 << 2
+ * See also preserveUndefined, which preserves subexpressions that are
+ * based on undefined variables; maybe that can be converted to a flag
+ * as well. */
+VARE_KEEP_DOLLAR	= 1 << 2
 } VarEvalFlags;
 
 typedef enum VarSetFlags {

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.434 src/usr.bin/make/parse.c:1.435
--- src/usr.bin/make/parse.c:1.434	Sun Nov  8 15:07:37 2020
+++ src/usr.bin/make/parse.c	Sun Nov  8 16:58:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.434 2020/11/08 15:07:37 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.435 2020/11/08 16:58:33 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.434 2020/11/08 15:07:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.435 2020/11/08 16:58:33 rillig Exp $");
 
 /* types and constants */
 
@@ -1923,7 +1923,7 @@ VarAssign_EvalSubst(const char *name, co
 if (!Var_Exists(name, ctxt))
 	Var_Set(name, "", ctxt);
 
-(void)Var_Subst(uvalue, ctxt, VARE_WANTRES|VARE_ASSIGN, );
+(void)Var_Subst(uvalue, ctxt, VARE_WANTRES|VARE_KEEP_DOLLAR, );
 /* TODO: handle errors */
 preserveUndefined = savedPreserveUndefined;
 avalue = evalue;

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.676 src/usr.bin/make/var.c:1.677
--- src/usr.bin/make/var.c:1.676	Sun Nov  8 15:07:37 2020
+++ src/usr.bin/make/var.c	Sun Nov  8 16:58:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.676 2020/11/08 15:07:37 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.677 2020/11/08 16:58:33 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.676 2020/11/08 15:07:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.677 2020/11/08 16:58:33 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -138,7 +138,7 @@ MAKE_RCSID("$NetBSD: var.c,v 1.676 2020/
 #define VAR_DEBUG4(fmt, arg1, arg2, arg3, arg4) DEBUG4(VAR, fmt, arg1, arg2, arg3, arg4)
 
 

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

2020-11-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Nov  8 16:47:59 UTC 2020

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

Log Message:
Move the html9/psref* files from comp-sys-catman to comp-sys-htmlman


To generate a diff of this commit:
cvs rdiff -u -r1.2363 -r1.2364 src/distrib/sets/lists/comp/mi

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2363 src/distrib/sets/lists/comp/mi:1.2364
--- src/distrib/sets/lists/comp/mi:1.2363	Sat Oct 31 22:43:01 2020
+++ src/distrib/sets/lists/comp/mi	Sun Nov  8 16:47:59 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2363 2020/10/31 22:43:01 uwe Exp $
+#	$NetBSD: mi,v 1.2364 2020/11/08 16:47:59 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -20199,15 +20199,15 @@
 ./usr/share/man/html9/pserialize_read_exit.html comp-sys-htmlman	html
 ./usr/share/man/html9/psignal.html		comp-sys-htmlman	html
 ./usr/share/man/html9/pslist.html		comp-sys-htmlman	html
-./usr/share/man/html9/psref.html		comp-sys-catman		html
-./usr/share/man/html9/psref_acquire.html	comp-sys-catman		html
-./usr/share/man/html9/psref_class_create.html	comp-sys-catman		html
-./usr/share/man/html9/psref_class_destroy.html	comp-sys-catman		html
-./usr/share/man/html9/psref_copy.html		comp-sys-catman		html
-./usr/share/man/html9/psref_held.html		comp-sys-catman		html
-./usr/share/man/html9/psref_release.html	comp-sys-catman		html
-./usr/share/man/html9/psref_target_destroy.html	comp-sys-catman		html
-./usr/share/man/html9/psref_target_init.html	comp-sys-catman		html
+./usr/share/man/html9/psref.html		comp-sys-htmlman	html
+./usr/share/man/html9/psref_acquire.html	comp-sys-htmlman	html
+./usr/share/man/html9/psref_class_create.html	comp-sys-htmlman	html
+./usr/share/man/html9/psref_class_destroy.html	comp-sys-htmlman	html
+./usr/share/man/html9/psref_copy.html		comp-sys-htmlman	html
+./usr/share/man/html9/psref_held.html		comp-sys-htmlman	html
+./usr/share/man/html9/psref_release.html	comp-sys-htmlman	html
+./usr/share/man/html9/psref_target_destroy.html	comp-sys-htmlman	html
+./usr/share/man/html9/psref_target_init.html	comp-sys-htmlman	html
 ./usr/share/man/html9/ptoa.html			comp-sys-htmlman	html
 ./usr/share/man/html9/putiobuf.html		comp-sys-htmlman	html
 ./usr/share/man/html9/putter.html		comp-sys-htmlman	html



CVS commit: src

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 16:44:47 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: varparse-errors.exp varparse-errors.mk

Log Message:
make(1): add test for expanding variable expressions


To generate a diff of this commit:
cvs rdiff -u -r1.963 -r1.964 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.190 -r1.191 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/varparse-errors.exp \
src/usr.bin/make/unit-tests/varparse-errors.mk

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.963 src/distrib/sets/lists/tests/mi:1.964
--- src/distrib/sets/lists/tests/mi:1.963	Sun Nov  8 02:33:18 2020
+++ src/distrib/sets/lists/tests/mi	Sun Nov  8 16:44:47 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.963 2020/11/08 02:33:18 rillig Exp $
+# $NetBSD: mi,v 1.964 2020/11/08 16:44:47 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5499,6 +5499,8 @@
 ./usr/tests/usr.bin/make/unit-tests/varname.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varparse-dynamic.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varparse-dynamic.mktests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varparse-errors.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varparse-errors.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varparse-mod.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varparse-mod.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varparse-undef-partial.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.190 src/usr.bin/make/unit-tests/Makefile:1.191
--- src/usr.bin/make/unit-tests/Makefile:1.190	Sat Nov  7 23:25:06 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sun Nov  8 16:44:47 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.190 2020/11/07 23:25:06 rillig Exp $
+# $NetBSD: Makefile,v 1.191 2020/11/08 16:44:47 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -371,6 +371,7 @@ TESTS+=		varname-makeflags
 TESTS+=		varname-pwd
 TESTS+=		varname-vpath
 TESTS+=		varparse-dynamic
+TESTS+=		varparse-errors
 TESTS+=		varparse-mod
 TESTS+=		varparse-undef-partial
 TESTS+=		varquote

Added files:

Index: src/usr.bin/make/unit-tests/varparse-errors.exp
diff -u /dev/null src/usr.bin/make/unit-tests/varparse-errors.exp:1.1
--- /dev/null	Sun Nov  8 16:44:47 2020
+++ src/usr.bin/make/unit-tests/varparse-errors.exp	Sun Nov  8 16:44:47 2020
@@ -0,0 +1 @@
+exit status 0
Index: src/usr.bin/make/unit-tests/varparse-errors.mk
diff -u /dev/null src/usr.bin/make/unit-tests/varparse-errors.mk:1.1
--- /dev/null	Sun Nov  8 16:44:47 2020
+++ src/usr.bin/make/unit-tests/varparse-errors.mk	Sun Nov  8 16:44:47 2020
@@ -0,0 +1,35 @@
+# $NetBSD: varparse-errors.mk,v 1.1 2020/11/08 16:44:47 rillig Exp $
+
+# Tests for parsing and evaluating all kinds of variable expressions.
+#
+# This is the basis for redesigning the error handling in Var_Parse and
+# Var_Subst, collecting typical and not so typical use cases.
+#
+# See also:
+#	VarParseResult
+#	Var_Parse
+#	Var_Subst
+
+PLAIN=		plain value
+
+LITERAL_DOLLAR=	To get a dollar, double $$ it.
+
+INDIRECT=	An ${:Uindirect} value.
+
+REF_UNDEF=	A reference to an ${UNDEF}undefined variable.
+
+ERR_UNCLOSED=	An ${UNCLOSED variable expression.
+
+ERR_BAD_MOD=	An ${:Uindirect:Z} expression with an unknown modifier.
+
+ERR_EVAL=	An evaluation error ${:Uvalue:C,.,\3,}.
+
+# In a conditional, a variable expression that is not enclosed in quotes is
+# expanded using the flags VARE_UNDEFERR and VARE_WANTRES.
+# The variable itself must be defined.
+# It may refer to undefined variables though.
+.if ${REF_UNDEF} != "A reference to an undefined variable."
+.  error
+.endif
+
+all:



CVS commit: src/doc

2020-11-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Nov  8 15:57:01 UTC 2020

Modified Files:
src/doc: 3RDPARTY

Log Message:
grep 3.5 is out for a while.


To generate a diff of this commit:
cvs rdiff -u -r1.1759 -r1.1760 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1759 src/doc/3RDPARTY:1.1760
--- src/doc/3RDPARTY:1.1759	Sun Nov  1 17:54:46 2020
+++ src/doc/3RDPARTY	Sun Nov  8 15:57:01 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1759 2020/11/01 17:54:46 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1760 2020/11/08 15:57:01 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -2080,7 +2080,7 @@ we use BSD-licensed implementation from 
 
 Package:	grep
 Version:	2.5.1a (last GPLv2+ version)
-Current Vers:	3.1
+Current Vers:	3.5
 Maintainer:	FSF
 Archive Site:	ftp://ftp.gnu.org/gnu/grep/
 Home Page:	http://www.gnu.org/software/grep/



CVS commit: src/share/mk

2020-11-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Nov  8 15:19:18 UTC 2020

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

Log Message:
Stop mentioning the support for cat pages


To generate a diff of this commit:
cvs rdiff -u -r1.413 -r1.414 src/share/mk/bsd.README

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

Modified files:

Index: src/share/mk/bsd.README
diff -u src/share/mk/bsd.README:1.413 src/share/mk/bsd.README:1.414
--- src/share/mk/bsd.README:1.413	Sun Nov  8 14:52:35 2020
+++ src/share/mk/bsd.README	Sun Nov  8 15:19:18 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.README,v 1.413 2020/11/08 14:52:35 kamil Exp $
+#	$NetBSD: bsd.README,v 1.414 2020/11/08 15:19:18 kamil Exp $
 #	@(#)bsd.README	8.2 (Berkeley) 4/2/94
 
 This is the README file for the make "include" files for the NetBSD
@@ -350,9 +350,9 @@ MKMAN		If "no", don't build or install t
 		Default: yes
 
 MKMANDOC	If "yes", mandoc is built as tool and used to compile
-		catman or html pages.  A directory can be exempted by
-		defining NOMANDOC.  Individual man pages are exempted
-		if NOMANDOC.${target} is set to "yes".
+		html pages.  A directory can be exempted by defining NOMANDOC.
+		Individual man pages are exempted if NOMANDOC.${target} is set
+		to "yes".
 		Default: yes
 
 MKMANZ		If not "no", compress manual pages at installation time.
@@ -459,8 +459,8 @@ MKSANITIZER	if "yes", use the selected s
 
 MKSHARE		If "no", act as "MKDOC=no MKHTML=no MKINFO=no
 		MKMAN=no MKNLS=no".
-		I.e, don't build catman pages, documentation, Info
-		documentation, man pages, NLS files, ...
+		I.e, don't build documentation, Info documentation, man pages,
+		NLS files, ...
 		Default: yes
 
 MKSKEY		If "no", disables building of S/key authentication
@@ -717,7 +717,7 @@ BINMODE		Binary mode.  [555]
 
 NONBINMODE	Mode for non-executable files.  [444]
 
-MANDIR		Base path for manual installation.  [/usr/share/man/cat]
+MANDIR		Base path for manual installation.  [/usr/share/man]
 
 MANGRP		Manual group.  [wheel]
 



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 15:18:09 UTC 2020

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

Log Message:
make(1): fix documentation of preserveUndefined

Since it is a global variable and not a VarEvalFlags, it affects nested
subexpressions as well, and there is no way to escape it.


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/usr.bin/make/make.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/make.h
diff -u src/usr.bin/make/make.h:1.201 src/usr.bin/make/make.h:1.202
--- src/usr.bin/make/make.h:1.201	Sun Nov  8 10:33:47 2020
+++ src/usr.bin/make/make.h	Sun Nov  8 15:18:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.201 2020/11/08 10:33:47 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.202 2020/11/08 15:18:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -441,7 +441,7 @@ extern time_t now;
 /*
  * If FALSE (the default behavior), undefined subexpressions in a variable
  * expression are discarded.  If TRUE (only during variable assignments using
- * the ':=' assignment operator, in the top-level expansion), they are
+ * the ':=' assignment operator, no matter how deeply nested), they are
  * preserved and possibly expanded later when the variable from the
  * subexpression has been defined.
  *



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 15:07:37 UTC 2020

Modified Files:
src/usr.bin/make: job.c main.c meta.c parse.c var.c

Log Message:
make(1): use strict typing in conditions of the form !var


To generate a diff of this commit:
cvs rdiff -u -r1.315 -r1.316 src/usr.bin/make/job.c
cvs rdiff -u -r1.453 -r1.454 src/usr.bin/make/main.c
cvs rdiff -u -r1.140 -r1.141 src/usr.bin/make/meta.c
cvs rdiff -u -r1.433 -r1.434 src/usr.bin/make/parse.c
cvs rdiff -u -r1.675 -r1.676 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/job.c
diff -u src/usr.bin/make/job.c:1.315 src/usr.bin/make/job.c:1.316
--- src/usr.bin/make/job.c:1.315	Sun Nov  8 09:34:55 2020
+++ src/usr.bin/make/job.c	Sun Nov  8 15:07:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.315 2020/11/08 09:34:55 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.316 2020/11/08 15:07:37 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.315 2020/11/08 09:34:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.316 2020/11/08 15:07:37 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -375,8 +375,8 @@ static char *shellArgv = NULL;	/* Custom
 static Job *job_table;		/* The structures that describe them */
 static Job *job_table_end;	/* job_table + maxJobs */
 static unsigned int wantToken;	/* we want a token */
-static int lurking_children = 0;
-static int make_suspended = 0;	/* non-zero if we've seen a SIGTSTP (etc) */
+static Boolean lurking_children = FALSE;
+static Boolean make_suspended = FALSE;	/* Whether we've seen a SIGTSTP (etc) */
 
 /*
  * Set of descriptors of pipes connected to
@@ -583,7 +583,7 @@ JobPassSig_suspend(int signo)
 struct sigaction act;
 
 /* Suppress job started/continued messages */
-make_suspended = 1;
+make_suspended = TRUE;
 
 /* Pass the signal onto every job */
 JobCondPassSig(signo);
@@ -2139,7 +2139,7 @@ Job_Init(void)
 	if (rval > 0)
 	continue;
 	if (rval == 0)
-	lurking_children = 1;
+	lurking_children = TRUE;
 	break;
 }
 
@@ -2579,7 +2579,7 @@ JobRestartJobs(void)
 	/* Job exit deferred after calling waitpid() in a signal handler */
 	JobFinish(job, job->exit_status);
 }
-make_suspended = 0;
+make_suspended = FALSE;
 }
 
 static void

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.453 src/usr.bin/make/main.c:1.454
--- src/usr.bin/make/main.c:1.453	Sun Nov  8 14:50:24 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 15:07:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.453 2020/11/08 14:50:24 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.454 2020/11/08 15:07:37 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.453 2020/11/08 14:50:24 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.454 2020/11/08 15:07:37 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -785,7 +785,7 @@ str2Lst_Append(StringList *lp, char *str
 	char *cp;
 	int n;
 
-	if (!sep)
+	if (sep == NULL)
 		sep = " \t";
 
 	for (n = 0, cp = strtok(str, sep); cp; cp = strtok(NULL, sep)) {
@@ -1678,12 +1678,12 @@ ReadMakefile(const char *fname)
 	int fd;
 	char *name, *path = NULL;
 
-	if (!strcmp(fname, "-")) {
+	if (strcmp(fname, "-") == 0) {
 		Parse_File(NULL /*stdin*/, -1);
 		Var_Set("MAKEFILE", "", VAR_INTERNAL);
 	} else {
 		/* if we've chdir'd, rebuild the path name */
-		if (strcmp(curdir, objdir) && *fname != '/') {
+		if (strcmp(curdir, objdir) != 0 && *fname != '/') {
 			path = str_concat3(curdir, "/", fname);
 			fd = open(path, O_RDONLY);
 			if (fd != -1) {
@@ -1706,12 +1706,12 @@ ReadMakefile(const char *fname)
 		}
 		/* look in -I and system include directories. */
 		name = Dir_FindFile(fname, parseIncPath);
-		if (!name) {
+		if (name == NULL) {
 			SearchPath *sysInc = Lst_IsEmpty(sysIncPath)
 	 ? defSysIncPath : sysIncPath;
 			name = Dir_FindFile(fname, sysInc);
 		}
-		if (!name || (fd = open(name, O_RDONLY)) == -1) {
+		if (name == NULL || (fd = open(name, O_RDONLY)) == -1) {
 			free(name);
 			free(path);
 			return -1;
@@ -2017,7 +2017,7 @@ static GNode *
 get_cached_realpaths(void)
 {
 
-	if (!cached_realpaths) {
+	if (cached_realpaths == NULL) {
 		cached_realpaths = Targ_NewGN("Realpath");
 #ifndef DEBUG_REALPATH_CACHE
 		cached_realpaths->flags = INTERNAL;
@@ -2183,7 +2183,7 @@ getTmpdir(void)
 {
 	static char *tmpdir = NULL;
 
-	if (!tmpdir) {
+	if (tmpdir == NULL) {
 		

CVS commit: src/share/mk

2020-11-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Nov  8 14:55:26 UTC 2020

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

Log Message:
Remove the MKCATPAGES remnants


To generate a diff of this commit:
cvs rdiff -u -r1.1231 -r1.1232 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1231 src/share/mk/bsd.own.mk:1.1232
--- src/share/mk/bsd.own.mk:1.1231	Sun Nov  8 14:52:35 2020
+++ src/share/mk/bsd.own.mk	Sun Nov  8 14:55:25 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1231 2020/11/08 14:52:35 kamil Exp $
+#	$NetBSD: bsd.own.mk,v 1.1232 2020/11/08 14:55:25 kamil Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1273,7 +1273,7 @@ _MKVARS.no= \
 	MKARGON2 \
 	MKARZERO \
 	MKBSDGREP \
-	MKCATPAGES MKCOMPATTESTS MKCOMPATX11 MKCTF \
+	MKCOMPATTESTS MKCOMPATX11 MKCTF \
 	MKDEBUG MKDEBUGLIB MKDTB MKDTRACE \
 	MKEXTSRC \
 	MKFIRMWARE \
@@ -1350,7 +1350,6 @@ MKKYUA:=	no
 .endif
 
 .if ${MKMAN} == "no"
-MKCATPAGES:=	no
 MKHTML:=	no
 .endif
 
@@ -1374,7 +1373,6 @@ MKOBJDIRS:=	no
 .endif
 
 .if ${MKSHARE} == "no"
-MKCATPAGES:=	no
 MKDOC:=		no
 MKINFO:=	no
 MKHTML:=	no



CVS commit: src

2020-11-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Nov  8 14:52:36 UTC 2020

Modified Files:
src: BUILDING
src/distrib/sets: sets.subr
src/doc: BUILDING.mdoc
src/share/man/man5: mk.conf.5
src/share/mk: bsd.README bsd.man.mk bsd.own.mk

Log Message:
Remove the support for MKCATPAGES

It was optional since 1999 and disabled by default since 2012.

Proposed on tech-userlevel@.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/BUILDING
cvs rdiff -u -r1.193 -r1.194 src/distrib/sets/sets.subr
cvs rdiff -u -r1.131 -r1.132 src/doc/BUILDING.mdoc
cvs rdiff -u -r1.81 -r1.82 src/share/man/man5/mk.conf.5
cvs rdiff -u -r1.412 -r1.413 src/share/mk/bsd.README
cvs rdiff -u -r1.120 -r1.121 src/share/mk/bsd.man.mk
cvs rdiff -u -r1.1230 -r1.1231 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/BUILDING
diff -u src/BUILDING:1.138 src/BUILDING:1.139
--- src/BUILDING:1.138	Tue Oct 13 01:59:32 2020
+++ src/BUILDING	Sun Nov  8 14:52:35 2020
@@ -247,11 +247,6 @@ CONFIGURATION
 
  Default: 2
 
- MKCATPAGES  Can be set to "yes" or "no".  Indicates whether preformatted
- plaintext manual pages will be created during a build.
-
- Default: "no"
-
  MKCROSSGDB  Can be set to "yes" or "no".  Create a cross-gdb as a host
  tool.
 
@@ -385,9 +380,8 @@ CONFIGURATION
 
  MKSHARE Can be set to "yes" or "no".  Indicates whether files
  destined to reside in DESTDIR/usr/share will be built and
- installed during a build.  If set to "no", then all of
- MKCATPAGES, MKDOC, MKINFO, MKMAN, and MKNLS will be set to
- "no" unconditionally.
+ installed during a build.  If set to "no", then all of MKDOC,
+ MKINFO, MKMAN, and MKNLS will be set to "no" unconditionally.
 
  Default: "yes"
 

Index: src/distrib/sets/sets.subr
diff -u src/distrib/sets/sets.subr:1.193 src/distrib/sets/sets.subr:1.194
--- src/distrib/sets/sets.subr:1.193	Sat Sep 26 17:49:49 2020
+++ src/distrib/sets/sets.subr	Sun Nov  8 14:52:35 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: sets.subr,v 1.193 2020/09/26 17:49:49 jmcneill Exp $
+#	$NetBSD: sets.subr,v 1.194 2020/11/08 14:52:35 kamil Exp $
 #
 
 #
@@ -192,7 +192,7 @@ SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g
 # In each file, a record consists of a path and a System Package name,
 # separated by whitespace. E.g.,
 #
-# 	# $NetBSD: sets.subr,v 1.193 2020/09/26 17:49:49 jmcneill Exp $
+# 	# $NetBSD: sets.subr,v 1.194 2020/11/08 14:52:35 kamil Exp $
 # 	.			base-sys-root	[keyword[,...]]
 # 	./altroot		base-sys-root
 # 	./bin			base-sys-root
@@ -250,9 +250,6 @@ SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g
 #	endian=		 = value of ${TARGET_ENDIANNESS}
 #
 #
-#	.cat			if ${MKMANZ} != "no" && ${MKCATPAGES} != "no"
-#  automatically append ".gz" to the filename
-#
 #	.man			if ${MKMANZ} != "no" && ${MKMAN} != "no"
 #  automatically append ".gz" to the filename
 #
@@ -354,8 +351,6 @@ list_set_files()
 			if ("uefi" in wanted) {
 wanted["uefi=" "'"${HAVE_UEFI}"'"] = 1
 			}
-			if (("man" in wanted) && ("catpages" in wanted))
-wanted[".cat"] = 1
 			if (("man" in wanted) && ("manpages" in wanted))
 wanted[".man"] = 1
 			if ("endian" in wanted)

Index: src/doc/BUILDING.mdoc
diff -u src/doc/BUILDING.mdoc:1.131 src/doc/BUILDING.mdoc:1.132
--- src/doc/BUILDING.mdoc:1.131	Tue Oct 13 01:59:32 2020
+++ src/doc/BUILDING.mdoc	Sun Nov  8 14:52:35 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: BUILDING.mdoc,v 1.131 2020/10/13 01:59:32 thorpej Exp $
+.\"	$NetBSD: BUILDING.mdoc,v 1.132 2020/11/08 14:52:35 kamil Exp $
 .\"
 .\" Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -360,7 +360,7 @@ either the process environment or the
 configuration file specified by
 .Sy MAKECONF .
 .
-.Bl -tag -width "MKCATPAGES"
+.Bl -tag -width "MK"
 .
 .It Sy BUILDID
 Identifier for the build.
@@ -500,12 +500,6 @@ flag.
 .DFLT
 2
 .
-.It Sy MKCATPAGES
-.YorN
-Indicates whether preformatted plaintext manual pages will be created
-during a build.
-.DFLTn
-.
 .It Sy MKCROSSGDB
 .YorN
 Create a cross-gdb as a host tool.
@@ -698,7 +692,7 @@ will be built and installed during a bui
 If set to
 .Dq no ,
 then all of
-.Sy MKCATPAGES , MKDOC , MKINFO , MKMAN ,
+.Sy MKDOC , MKINFO , MKMAN ,
 and
 .Sy MKNLS
 will be set to

Index: src/share/man/man5/mk.conf.5
diff -u src/share/man/man5/mk.conf.5:1.81 src/share/man/man5/mk.conf.5:1.82
--- src/share/man/man5/mk.conf.5:1.81	Tue Oct 27 06:33:38 2020
+++ src/share/man/man5/mk.conf.5	Sun Nov  8 14:52:35 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mk.conf.5,v 1.81 2020/10/27 06:33:38 rin Exp $
+.\"	$NetBSD: mk.conf.5,v 1.82 2020/11/08 14:52:35 kamil Exp $
 .\"
 .\"  Copyright (c) 1999-2003 The NetBSD Foundation, Inc.
 .\"  All rights reserved.
@@ 

CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 14:50:24 UTC 2020

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

Log Message:
make(1): reformat main.c more closely to share/misc/style


To generate a diff of this commit:
cvs rdiff -u -r1.452 -r1.453 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.452 src/usr.bin/make/main.c:1.453
--- src/usr.bin/make/main.c:1.452	Sun Nov  8 14:19:15 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 14:50:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.452 2020/11/08 14:19:15 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.453 2020/11/08 14:50:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,38 +109,38 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.452 2020/11/08 14:19:15 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.453 2020/11/08 14:50:24 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
 	"All rights reserved.");
 #endif
 
-#ifndef	DEFMAXLOCAL
-#define	DEFMAXLOCAL DEFMAXJOBS
+#ifndef DEFMAXLOCAL
+#define DEFMAXLOCAL DEFMAXJOBS
 #endif
 
 CmdOpts opts;
-time_t			now;		/* Time at start of make */
-GNode			*DEFAULT;	/* .DEFAULT node */
-Boolean			allPrecious;	/* .PRECIOUS given on line by itself */
-Boolean			deleteOnError;	/* .DELETE_ON_ERROR: set */
+time_t now;			/* Time at start of make */
+GNode *DEFAULT;			/* .DEFAULT node */
+Boolean allPrecious;		/* .PRECIOUS given on line by itself */
+Boolean deleteOnError;		/* .DELETE_ON_ERROR: set */
 
-static int		maxJobTokens;	/* -j argument */
-Boolean			enterFlagObj;	/* -w and objdir != srcdir */
+static int maxJobTokens;	/* -j argument */
+Boolean enterFlagObj;		/* -w and objdir != srcdir */
 
 Boolean preserveUndefined;
-static int jp_0 = -1, jp_1 = -1;	/* ends of parent job pipe */
-Boolean			doing_depend;	/* Set while reading .depend */
-static Boolean		jobsRunning;	/* TRUE if the jobs might be running */
-static const char *	tracefile;
-static int		ReadMakefile(const char *);
-static void		purge_cached_realpaths(void);
-
-static Boolean		ignorePWD;	/* if we use -C, PWD is meaningless */
-static char objdir[MAXPATHLEN + 1];	/* where we chdir'ed to */
-char curdir[MAXPATHLEN + 1];		/* Startup directory */
-char *progname;/* the program name */
+static int jp_0 = -1, jp_1 = -1; /* ends of parent job pipe */
+Boolean doing_depend;		/* Set while reading .depend */
+static Boolean jobsRunning;	/* TRUE if the jobs might be running */
+static const char *tracefile;
+static int ReadMakefile(const char *);
+static void purge_cached_realpaths(void);
+
+static Boolean ignorePWD;	/* if we use -C, PWD is meaningless */
+static char objdir[MAXPATHLEN + 1]; /* where we chdir'ed to */
+char curdir[MAXPATHLEN + 1];	/* Startup directory */
+char *progname;			/* the program name */
 char *makeDependfile;
 pid_t myPid;
 int makelevel;
@@ -155,29 +155,29 @@ static int errors = 0;
 static char *
 explode(const char *flags)
 {
-size_t len;
-char *nf, *st;
-const char *f;
-
-if (flags == NULL)
-	return NULL;
-
-for (f = flags; *f; f++)
-	if (!ch_isalpha(*f))
-	break;
-
-if (*f)
-	return bmake_strdup(flags);
-
-len = strlen(flags);
-st = nf = bmake_malloc(len * 3 + 1);
-while (*flags) {
-	*nf++ = '-';
-	*nf++ = *flags++;
-	*nf++ = ' ';
-}
-*nf = '\0';
-return st;
+	size_t len;
+	char *nf, *st;
+	const char *f;
+
+	if (flags == NULL)
+		return NULL;
+
+	for (f = flags; *f; f++)
+		if (!ch_isalpha(*f))
+			break;
+
+	if (*f)
+		return bmake_strdup(flags);
+
+	len = strlen(flags);
+	st = nf = bmake_malloc(len * 3 + 1);
+	while (*flags) {
+		*nf++ = '-';
+		*nf++ = *flags++;
+		*nf++ = ' ';
+	}
+	*nf = '\0';
+	return st;
 }
 
 /*
@@ -196,50 +196,50 @@ usage(void)
 "[-C directory] [-D variable] [-d flags] [-f makefile]\n"
 "[-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]\n"
 "[-V variable] [-v variable] [variable=value] [target ...]\n",
-		  progname);
+	progname);
 	exit(2);
 }
 
 static void
 parse_debug_option_F(const char *modules)
 {
-const char *mode;
-size_t len;
-char *fname;
-
-if (opts.debug_file != stdout && opts.debug_file != stderr)
-	fclose(opts.debug_file);
-
-if (*modules == '+') {
-	modules++;
-	mode = "a";
-} else
-	mode = "w";
+	const char *mode;
+	size_t len;
+	char *fname;
+
+	if (opts.debug_file != stdout && opts.debug_file != stderr)
+		fclose(opts.debug_file);
+
+	if (*modules == '+') {
+		modules++;
+		mode = "a";
+	} else
+		mode = "w";
 
-if (strcmp(modules, "stdout") == 0) {
-	opts.debug_file = stdout;
-	return;
-}
-if (strcmp(modules, "stderr") == 0) {
-	opts.debug_file = stderr;
-	

CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 14:19:15 UTC 2020

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

Log Message:
make(1): remove redundant comment from main_ReadFiles

The code has become so simple that it made the comment redundant.


To generate a diff of this commit:
cvs rdiff -u -r1.451 -r1.452 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.451 src/usr.bin/make/main.c:1.452
--- src/usr.bin/make/main.c:1.451	Sun Nov  8 13:10:30 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 14:19:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.451 2020/11/08 13:10:30 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.452 2020/11/08 14:19:15 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.451 2020/11/08 13:10:30 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.452 2020/11/08 14:19:15 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1521,13 +1521,10 @@ main_Init(int argc, char **argv)
 static void
 main_ReadFiles(void)
 {
-	/*
-	 * Read in the built-in rules first, followed by the specified
-	 * makefiles, or the default makefile and Makefile, in that order,
-	 * if no makefiles were given on the command line.
-	 */
+
 	if (!opts.noBuiltins)
 		ReadBuiltinRules();
+
 	if (!Lst_IsEmpty(opts.makefiles))
 		ReadAllMakefiles(opts.makefiles);
 	else



CVS commit: src/sys/dev/acpi

2020-11-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov  8 14:16:59 UTC 2020

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

Log Message:
Ignore PNP0001 (EISA interrupt controller) and PNP0C02 (motherboard
resources) when enumerating devices.


To generate a diff of this commit:
cvs rdiff -u -r1.285 -r1.286 src/sys/dev/acpi/acpi.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/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.285 src/sys/dev/acpi/acpi.c:1.286
--- src/sys/dev/acpi/acpi.c:1.285	Mon Jun 22 16:14:18 2020
+++ src/sys/dev/acpi/acpi.c	Sun Nov  8 14:16:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.285 2020/06/22 16:14:18 maxv Exp $	*/
+/*	$NetBSD: acpi.c,v 1.286 2020/11/08 14:16:59 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.285 2020/06/22 16:14:18 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.286 2020/11/08 14:16:59 jmcneill Exp $");
 
 #include "pci.h"
 #include "opt_acpi.h"
@@ -166,9 +166,11 @@ static const char * const acpi_ignored_i
 #if defined(i386) || defined(x86_64)
 	"ACPI0007",	/* ACPI CPUs do not attach to acpi(4) */
 	"PNP",	/* AT interrupt controller is handled internally */
+	"PNP0001",	/* EISA interrupt controller is handled internally */
 	"PNP0200",	/* AT DMA controller is handled internally */
 	"PNP0A??",	/* PCI Busses are handled internally */
 	"PNP0B00",	/* AT RTC is handled internally */
+	"PNP0C02",	/* PnP motherboard resources */
 	"PNP0C0F",	/* ACPI PCI link devices are handled internally */
 #endif
 #if defined(x86_64)



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

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 14:00:52 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: var-op-expand.mk

Log Message:
make(1): fix bug description of using := with undefined variable

In 1993, the variable names could not refer to other variables yet.
This has been made possible on 2000-05-11, when the "cool magic" was
added that allows assigning to VAR.${param}.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/var-op-expand.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/var-op-expand.mk
diff -u src/usr.bin/make/unit-tests/var-op-expand.mk:1.3 src/usr.bin/make/unit-tests/var-op-expand.mk:1.4
--- src/usr.bin/make/unit-tests/var-op-expand.mk:1.3	Sun Nov  8 13:46:15 2020
+++ src/usr.bin/make/unit-tests/var-op-expand.mk	Sun Nov  8 14:00:52 2020
@@ -1,4 +1,4 @@
-# $NetBSD: var-op-expand.mk,v 1.3 2020/11/08 13:46:15 rillig Exp $
+# $NetBSD: var-op-expand.mk,v 1.4 2020/11/08 14:00:52 rillig Exp $
 #
 # Tests for the := variable assignment operator, which expands its
 # right-hand side.
@@ -7,7 +7,7 @@
 
 # XXX: edge case: When a variable name refers to an undefined variable, the
 # behavior differs between the '=' and the ':=' assignment operators.
-# This bug exists since at least 1993-03-21.
+# This bug exists since var.c 1.42 from 2000-05-11.
 #
 # The '=' operator expands the undefined variable to an empty string, thus
 # assigning to VAR_ASSIGN_.  In the name of variables to be set, it should



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

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 13:46:16 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: var-op-expand.exp var-op-expand.mk

Log Message:
make(1): add test for edge case in resolving undefined variables


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/var-op-expand.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/var-op-expand.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/var-op-expand.exp
diff -u src/usr.bin/make/unit-tests/var-op-expand.exp:1.1 src/usr.bin/make/unit-tests/var-op-expand.exp:1.2
--- src/usr.bin/make/unit-tests/var-op-expand.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/var-op-expand.exp	Sun Nov  8 13:46:15 2020
@@ -1 +1,10 @@
+Var_Parse: ${UNDEF} with VARE_WANTRES
+Global:VAR_ASSIGN_ = undef value
+Var_Parse: ${UNDEF} with VARE_WANTRES
+Var_Parse: ${UNDEF} with VARE_WANTRES
+Global:VAR_SUBST_${UNDEF} = 
+Var_Parse: ${UNDEF} with VARE_WANTRES
+Global:VAR_SUBST_ = undef value
+Global:.MAKEFLAGS =  -r -k -d v -d
+Global:.MAKEFLAGS =  -r -k -d v -d 0
 exit status 0

Index: src/usr.bin/make/unit-tests/var-op-expand.mk
diff -u src/usr.bin/make/unit-tests/var-op-expand.mk:1.2 src/usr.bin/make/unit-tests/var-op-expand.mk:1.3
--- src/usr.bin/make/unit-tests/var-op-expand.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/var-op-expand.mk	Sun Nov  8 13:46:15 2020
@@ -1,9 +1,27 @@
-# $NetBSD: var-op-expand.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: var-op-expand.mk,v 1.3 2020/11/08 13:46:15 rillig Exp $
 #
 # Tests for the := variable assignment operator, which expands its
 # right-hand side.
 
 # TODO: Implementation
 
+# XXX: edge case: When a variable name refers to an undefined variable, the
+# behavior differs between the '=' and the ':=' assignment operators.
+# This bug exists since at least 1993-03-21.
+#
+# The '=' operator expands the undefined variable to an empty string, thus
+# assigning to VAR_ASSIGN_.  In the name of variables to be set, it should
+# really be forbidden to refer to undefined variables.
+#
+# The ':=' operator expands the variable name twice.  In one of these
+# expansions, the undefined variable expression is preserved (controlled by
+# preserveUndefined in VarAssign_EvalSubst), in the other expansion it expands
+# to an empty string.  This way, 2 variables are created using a single
+# variable assignment.  It's magic. :-/
+.MAKEFLAGS: -dv
+VAR_ASSIGN_${UNDEF}=	undef value
+VAR_SUBST_${UNDEF}:=	undef value
+.MAKEFLAGS: -d0
+
 all:
 	@:;



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 13:10:30 UTC 2020

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

Log Message:
make(1): rename init_machine to InitVarMachine

For consistency with the other Init functions.


To generate a diff of this commit:
cvs rdiff -u -r1.450 -r1.451 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.450 src/usr.bin/make/main.c:1.451
--- src/usr.bin/make/main.c:1.450	Sun Nov  8 13:05:03 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 13:10:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.450 2020/11/08 13:05:03 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.451 2020/11/08 13:10:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.450 2020/11/08 13:05:03 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.451 2020/11/08 13:10:30 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -982,7 +982,7 @@ InitRandom(void)
 }
 
 static const char *
-init_machine(const struct utsname *utsname)
+InitVarMachine(const struct utsname *utsname)
 {
 	const char *machine = getenv("MACHINE");
 	if (machine != NULL)
@@ -1000,7 +1000,7 @@ init_machine(const struct utsname *utsna
 }
 
 static const char *
-init_machine_arch(void)
+InitVarMachineArch(void)
 {
 	const char *env = getenv("MACHINE_ARCH");
 	if (env != NULL)
@@ -1370,8 +1370,8 @@ main_Init(int argc, char **argv)
 	 * Note that both MACHINE and MACHINE_ARCH are decided at
 	 * run-time.
 	 */
-	machine = init_machine();
-	machine_arch = init_machine_arch();
+	machine = InitVarMachine();
+	machine_arch = InitVarMachineArch();
 
 	myPid = getpid();	/* remember this for vFork() */
 



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 13:05:03 UTC 2020

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

Log Message:
make(1): move usage further to the top

This avoids a forward declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.449 -r1.450 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.449 src/usr.bin/make/main.c:1.450
--- src/usr.bin/make/main.c:1.449	Sun Nov  8 12:50:57 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 13:05:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.449 2020/11/08 12:50:57 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.450 2020/11/08 13:05:03 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.449 2020/11/08 12:50:57 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.450 2020/11/08 13:05:03 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -135,7 +135,6 @@ Boolean			doing_depend;	/* Set while rea
 static Boolean		jobsRunning;	/* TRUE if the jobs might be running */
 static const char *	tracefile;
 static int		ReadMakefile(const char *);
-static void		usage(void) MAKE_ATTR_DEAD;
 static void		purge_cached_realpaths(void);
 
 static Boolean		ignorePWD;	/* if we use -C, PWD is meaningless */
@@ -181,6 +180,26 @@ explode(const char *flags)
 return st;
 }
 
+/*
+ * usage --
+ *	exit with usage message
+ */
+MAKE_ATTR_DEAD static void
+usage(void)
+{
+	char *p;
+	if ((p = strchr(progname, '[')) != NULL)
+		*p = '\0';
+
+	(void)fprintf(stderr,
+"usage: %s [-BeikNnqrstWwX] \n"
+"[-C directory] [-D variable] [-d flags] [-f makefile]\n"
+"[-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]\n"
+"[-V variable] [-v variable] [variable=value] [target ...]\n",
+		  progname);
+	exit(2);
+}
+
 static void
 parse_debug_option_F(const char *modules)
 {
@@ -1993,26 +2012,6 @@ execDie(const char *af, const char *av)
 }
 
 /*
- * usage --
- *	exit with usage message
- */
-static void
-usage(void)
-{
-	char *p;
-	if ((p = strchr(progname, '[')) != NULL)
-		*p = '\0';
-
-	(void)fprintf(stderr,
-"usage: %s [-BeikNnqrstWwX] \n"
-"[-C directory] [-D variable] [-d flags] [-f makefile]\n"
-"[-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]\n"
-"[-V variable] [-v variable] [variable=value] [target ...]\n",
-	progname);
-	exit(2);
-}
-
-/*
  * realpath(3) can get expensive, cache results...
  */
 static GNode *cached_realpaths = NULL;



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 12:50:58 UTC 2020

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

Log Message:
make(1): move documentation from main to the phase functions


To generate a diff of this commit:
cvs rdiff -u -r1.448 -r1.449 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.448 src/usr.bin/make/main.c:1.449
--- src/usr.bin/make/main.c:1.448	Sun Nov  8 12:40:04 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 12:50:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.448 2020/11/08 12:40:04 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.449 2020/11/08 12:50:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.448 2020/11/08 12:40:04 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.449 2020/11/08 12:50:57 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1309,6 +1309,9 @@ ReadFirstDefaultMakefile(void)
 	free(prefs);
 }
 
+/* Initialize variables such as MAKE, MACHINE, .MAKEFLAGS.
+ * Initialize a few modules.
+ * Parse the arguments from MAKEFLAGS and the command line. */
 static void
 main_Init(int argc, char **argv)
 {
@@ -1494,6 +1497,8 @@ main_Init(int argc, char **argv)
 	InitDefSysIncPath(syspath);
 }
 
+/* Read the system makefile followed by either makefile, Makefile or the
+ * files given by the -f option. Exit on parse errors. */
 static void
 main_ReadFiles(void)
 {
@@ -1510,6 +1515,7 @@ main_ReadFiles(void)
 		ReadFirstDefaultMakefile();
 }
 
+/* Compute the dependency graph. */
 static void
 main_PrepareMaking(void)
 {
@@ -1574,6 +1580,9 @@ main_PrepareMaking(void)
 		Targ_PrintGraph(1);
 }
 
+/* Make the targets.
+ * If the -v or -V options are given, print variables instead.
+ * Return whether the targets are out-of-date. */
 static Boolean
 main_Run(void)
 {
@@ -1586,6 +1595,7 @@ main_Run(void)
 	}
 }
 
+/* Clean up after making the targets. */
 static void
 main_CleanUp(void)
 {
@@ -1619,6 +1629,7 @@ main_CleanUp(void)
 	Trace_End();
 }
 
+/* Determine the exit code. */
 static int
 main_Exit(Boolean outOfDate)
 {
@@ -1627,23 +1638,6 @@ main_Exit(Boolean outOfDate)
 	return outOfDate ? 1 : 0;
 }
 
-/*-
- * main --
- *	The main function, for obvious reasons. Initializes variables
- *	and a few modules, then parses the arguments give it in the
- *	environment and on the command line. Reads the system makefile
- *	followed by either Makefile, makefile or the file given by the
- *	-f argument. Sets the .MAKEFLAGS PMake variable based on all the
- *	flags it has received by then uses either the Make or the Compat
- *	module to create the initial list of targets.
- *
- * Results:
- *	If -q was given, exits -1 if anything was out-of-date. Else it exits
- *	0.
- *
- * Side Effects:
- *	The program exits when done. Targets are created. etc. etc. etc.
- */
 int
 main(int argc, char **argv)
 {



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 12:40:04 UTC 2020

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

Log Message:
make(1): split main into manageable pieces

The purpose of a main function is to give a high-level overview about the
whole program.  270 lines of code with lots of tricky details did not serve this
purpose.  Split the code into functions corresponding to the phases.


To generate a diff of this commit:
cvs rdiff -u -r1.447 -r1.448 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.447 src/usr.bin/make/main.c:1.448
--- src/usr.bin/make/main.c:1.447	Sun Nov  8 12:21:27 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 12:40:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.447 2020/11/08 12:21:27 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.448 2020/11/08 12:40:04 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.447 2020/11/08 12:21:27 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.448 2020/11/08 12:40:04 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1310,59 +1310,8 @@ ReadFirstDefaultMakefile(void)
 }
 
 static void
-CleanUp(void)
+main_Init(int argc, char **argv)
 {
-#ifdef CLEANUP
-	Lst_Destroy(opts.variables, free);
-	Lst_Free(opts.makefiles);	/* don't free, may be used in GNodes */
-	Lst_Destroy(opts.create, free);
-#endif
-
-	/* print the graph now it's been processed if the user requested it */
-	if (DEBUG(GRAPH2))
-		Targ_PrintGraph(2);
-
-	Trace_Log(MAKEEND, NULL);
-
-	if (enterFlagObj)
-		printf("%s: Leaving directory `%s'\n", progname, objdir);
-	if (opts.enterFlag)
-		printf("%s: Leaving directory `%s'\n", progname, curdir);
-
-#ifdef USE_META
-	meta_finish();
-#endif
-	Suff_End();
-	Targ_End();
-	Arch_End();
-	Var_End();
-	Parse_End();
-	Dir_End();
-	Job_End();
-	Trace_End();
-}
-
-/*-
- * main --
- *	The main function, for obvious reasons. Initializes variables
- *	and a few modules, then parses the arguments give it in the
- *	environment and on the command line. Reads the system makefile
- *	followed by either Makefile, makefile or the file given by the
- *	-f argument. Sets the .MAKEFLAGS PMake variable based on all the
- *	flags it has received by then uses either the Make or the Compat
- *	module to create the initial list of targets.
- *
- * Results:
- *	If -q was given, exits -1 if anything was out-of-date. Else it exits
- *	0.
- *
- * Side Effects:
- *	The program exits when done. Targets are created. etc. etc. etc.
- */
-int
-main(int argc, char **argv)
-{
-	Boolean outOfDate;	/* FALSE if all targets up to date */
 	struct stat sa;
 	const char *machine;
 	const char *machine_arch;
@@ -1543,7 +1492,11 @@ main(int argc, char **argv)
 	InitVarTargets();
 
 	InitDefSysIncPath(syspath);
+}
 
+static void
+main_ReadFiles(void)
+{
 	/*
 	 * Read in the built-in rules first, followed by the specified
 	 * makefiles, or the default makefile and Makefile, in that order,
@@ -1555,7 +1508,11 @@ main(int argc, char **argv)
 		ReadAllMakefiles(opts.makefiles);
 	else
 		ReadFirstDefaultMakefile();
+}
 
+static void
+main_PrepareMaking(void)
+{
 	/* In particular suppress .depend for '-r -V .OBJDIR -f /dev/null' */
 	if (!opts.noBuiltins || opts.printVars == PVM_NONE) {
 		/* ignore /dev/null and anything starting with "no" */
@@ -1615,22 +1572,91 @@ main(int argc, char **argv)
 	/* print the initial graph, if the user requested it */
 	if (DEBUG(GRAPH1))
 		Targ_PrintGraph(1);
+}
 
+static Boolean
+main_Run(void)
+{
 	/* print the values of any variables requested by the user */
 	if (opts.printVars != PVM_NONE) {
 		doPrintVars();
-		outOfDate = FALSE;
+		return FALSE;
 	} else {
-		outOfDate = runTargets();
+		return runTargets();
 	}
+}
+
+static void
+main_CleanUp(void)
+{
+#ifdef CLEANUP
+	Lst_Destroy(opts.variables, free);
+	Lst_Free(opts.makefiles);	/* don't free, may be used in GNodes */
+	Lst_Destroy(opts.create, free);
+#endif
+
+	/* print the graph now it's been processed if the user requested it */
+	if (DEBUG(GRAPH2))
+		Targ_PrintGraph(2);
 
-	CleanUp();
+	Trace_Log(MAKEEND, NULL);
+
+	if (enterFlagObj)
+		printf("%s: Leaving directory `%s'\n", progname, objdir);
+	if (opts.enterFlag)
+		printf("%s: Leaving directory `%s'\n", progname, curdir);
 
+#ifdef USE_META
+	meta_finish();
+#endif
+	Suff_End();
+	Targ_End();
+	Arch_End();
+	Var_End();
+	Parse_End();
+	Dir_End();
+	Job_End();
+	Trace_End();
+}
+
+static int
+main_Exit(Boolean outOfDate)
+{
 	if (DEBUG(LINT) && (errors > 0 || Parse_GetFatals() > 0))
 		return 2;	/* Not 1 so -q can distinguish error */
 	return outOfDate ? 1 : 0;
 }
 
+/*-
+ * main --
+ *	The main 

CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 12:21:28 UTC 2020

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

Log Message:
make(1): indent main consistently


To generate a diff of this commit:
cvs rdiff -u -r1.446 -r1.447 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.446 src/usr.bin/make/main.c:1.447
--- src/usr.bin/make/main.c:1.446	Sun Nov  8 12:14:14 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 12:21:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.446 2020/11/08 12:14:14 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.447 2020/11/08 12:21:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.446 2020/11/08 12:14:14 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.447 2020/11/08 12:21:27 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1386,9 +1386,9 @@ main(int argc, char **argv)
 	UnlimitFiles();
 
 	if (uname() == -1) {
-	(void)fprintf(stderr, "%s: uname failed (%s).\n", progname,
-		strerror(errno));
-	exit(2);
+		(void)fprintf(stderr, "%s: uname failed (%s).\n", progname,
+			  strerror(errno));
+		exit(2);
 	}
 
 	/*
@@ -1402,7 +1402,7 @@ main(int argc, char **argv)
 	machine = init_machine();
 	machine_arch = init_machine_arch();
 
-	myPid = getpid();		/* remember this for vFork() */
+	myPid = getpid();	/* remember this for vFork() */
 
 	/*
 	 * Just in case MAKEOBJDIR wants us to do something tricky.
@@ -1427,8 +1427,8 @@ main(int argc, char **argv)
 	Var_Set(MAKE_DEPENDFILE, ".depend", VAR_GLOBAL);
 
 	CmdOpts_Init();
-	allPrecious = FALSE;		/* Remove targets when interrupted */
-	deleteOnError = FALSE;		/* Historical default behavior */
+	allPrecious = FALSE;	/* Remove targets when interrupted */
+	deleteOnError = FALSE;	/* Historical default behavior */
 	jobsRunning = FALSE;
 
 	maxJobTokens = opts.maxJobs;
@@ -1455,21 +1455,19 @@ main(int argc, char **argv)
 	/* some makefiles need to know this */
 	Var_Set(MAKE_LEVEL ".ENV", MAKE_LEVEL_ENV, VAR_CMDLINE);
 
-	/*
-	 * Set some other useful macros
-	 */
+	/* Set some other useful variables. */
 	{
-	char tmp[64], *ep = getenv(MAKE_LEVEL_ENV);
+		char tmp[64], *ep = getenv(MAKE_LEVEL_ENV);
 
-	makelevel = ep != NULL && ep[0] != '\0' ? atoi(ep) : 0;
-	if (makelevel < 0)
-		makelevel = 0;
-	snprintf(tmp, sizeof tmp, "%d", makelevel);
-	Var_Set(MAKE_LEVEL, tmp, VAR_GLOBAL);
-	snprintf(tmp, sizeof tmp, "%u", myPid);
-	Var_Set(".MAKE.PID", tmp, VAR_GLOBAL);
-	snprintf(tmp, sizeof tmp, "%u", getppid());
-	Var_Set(".MAKE.PPID", tmp, VAR_GLOBAL);
+		makelevel = ep != NULL && ep[0] != '\0' ? atoi(ep) : 0;
+		if (makelevel < 0)
+			makelevel = 0;
+		snprintf(tmp, sizeof tmp, "%d", makelevel);
+		Var_Set(MAKE_LEVEL, tmp, VAR_GLOBAL);
+		snprintf(tmp, sizeof tmp, "%u", myPid);
+		Var_Set(".MAKE.PID", tmp, VAR_GLOBAL);
+		snprintf(tmp, sizeof tmp, "%u", getppid());
+		Var_Set(".MAKE.PPID", tmp, VAR_GLOBAL);
 	}
 	if (makelevel > 0) {
 		char pn[1024];
@@ -1489,9 +1487,9 @@ main(int argc, char **argv)
 	 */
 #ifdef POSIX
 	{
-	char *p1 = explode(getenv("MAKEFLAGS"));
-	Main_ParseArgLine(p1);
-	free(p1);
+		char *p1 = explode(getenv("MAKEFLAGS"));
+		Main_ParseArgLine(p1);
+		free(p1);
 	}
 #else
 	Main_ParseArgLine(getenv("MAKE"));
@@ -1503,7 +1501,7 @@ main(int argc, char **argv)
 	 */
 	if (getcwd(curdir, MAXPATHLEN) == NULL) {
 		(void)fprintf(stderr, "%s: getcwd: %s.\n",
-		progname, strerror(errno));
+			  progname, strerror(errno));
 		exit(2);
 	}
 
@@ -1516,9 +1514,9 @@ main(int argc, char **argv)
 	 * Verify that cwd is sane.
 	 */
 	if (stat(curdir, ) == -1) {
-	(void)fprintf(stderr, "%s: %s: %s.\n",
-		 progname, curdir, strerror(errno));
-	exit(2);
+		(void)fprintf(stderr, "%s: %s: %s.\n",
+			  progname, curdir, strerror(errno));
+		exit(2);
 	}
 
 #ifndef NO_PWD_OVERRIDE
@@ -1560,15 +1558,15 @@ main(int argc, char **argv)
 
 	/* In particular suppress .depend for '-r -V .OBJDIR -f /dev/null' */
 	if (!opts.noBuiltins || opts.printVars == PVM_NONE) {
-	/* ignore /dev/null and anything starting with "no" */
-	(void)Var_Subst("${.MAKE.DEPENDFILE:N/dev/null:Nno*:T}",
-			VAR_CMDLINE, VARE_WANTRES, );
-	if (makeDependfile[0] != '\0') {
-		/* TODO: handle errors */
-		doing_depend = TRUE;
-		(void)ReadMakefile(makeDependfile);
-		doing_depend = FALSE;
-	}
+		/* ignore /dev/null and anything starting with "no" */
+		(void)Var_Subst("${.MAKE.DEPENDFILE:N/dev/null:Nno*:T}",
+VAR_CMDLINE, VARE_WANTRES, );
+		if (makeDependfile[0] != '\0') {
+			/* TODO: handle errors */
+			doing_depend = TRUE;
+			

CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 12:14:14 UTC 2020

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

Log Message:
make(1): inline ReadMakefileSucceeded into ReadFirstDefaultMakefile

This gets rid of a few void pointers and an unused function parameter.


To generate a diff of this commit:
cvs rdiff -u -r1.445 -r1.446 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.445 src/usr.bin/make/main.c:1.446
--- src/usr.bin/make/main.c:1.445	Sun Nov  8 12:02:16 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 12:14:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.445 2020/11/08 12:02:16 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.446 2020/11/08 12:14:14 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.445 2020/11/08 12:02:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.446 2020/11/08 12:14:14 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -759,14 +759,6 @@ Main_SetVarObjdir(const char *var, const
 	return TRUE;
 }
 
-/* Read and parse the makefile.
- * Return TRUE if reading the makefile succeeded. */
-static int
-ReadMakefileSucceeded(void *fname, void *unused)
-{
-	return ReadMakefile(fname) == 0;
-}
-
 int
 str2Lst_Append(StringList *lp, char *str, const char *sep)
 {
@@ -1297,7 +1289,9 @@ ReadAllMakefiles(StringList *makefiles)
 static void
 ReadFirstDefaultMakefile(void)
 {
+	StringListNode *ln;
 	char *prefs;
+
 	(void)Var_Subst("${" MAKE_MAKEFILE_PREFERENCE "}",
 			VAR_CMDLINE, VARE_WANTRES, );
 	/* TODO: handle errors */
@@ -1307,7 +1301,11 @@ ReadFirstDefaultMakefile(void)
 	 * also have different semantics in that only the first file that
 	 * is found is processed.  See ReadAllMakefiles. */
 	(void)str2Lst_Append(opts.makefiles, prefs, NULL);
-	(void)Lst_ForEachUntil(opts.makefiles, ReadMakefileSucceeded, NULL);
+
+	for (ln = opts.makefiles->first; ln != NULL; ln = ln->next)
+		if (ReadMakefile(ln->datum) == 0)
+			break;
+
 	free(prefs);
 }
 



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 12:02:16 UTC 2020

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

Log Message:
make(1): inline Lst_ForEachUntil in ReadBuiltinRules

The list of expanded filenames for sys.mk is freed in the end, but not
the filenames themselves, as these are still needed.


To generate a diff of this commit:
cvs rdiff -u -r1.444 -r1.445 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.444 src/usr.bin/make/main.c:1.445
--- src/usr.bin/make/main.c:1.444	Sun Nov  8 08:53:22 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 12:02:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.444 2020/11/08 08:53:22 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.445 2020/11/08 12:02:16 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.444 2020/11/08 08:53:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.445 2020/11/08 12:02:16 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1196,16 +1196,26 @@ InitDefSysIncPath(char *syspath)
 static void
 ReadBuiltinRules(void)
 {
+	StringListNode *ln;
 	StringList *sysMkPath = Lst_New();
+
 	Dir_Expand(_PATH_DEFSYSMK,
 		   Lst_IsEmpty(sysIncPath) ? defSysIncPath : sysIncPath,
 		   sysMkPath);
 	if (Lst_IsEmpty(sysMkPath))
 		Fatal("%s: no system rules (%s).", progname, _PATH_DEFSYSMK);
-	if (!Lst_ForEachUntil(sysMkPath, ReadMakefileSucceeded, NULL))
-		Fatal("%s: cannot open %s.", progname,
-		  (char *)sysMkPath->first->datum);
-	/* XXX: sysMkPath is not freed */
+
+	for (ln = sysMkPath->first; ln != NULL; ln = ln->next)
+		if (ReadMakefile(ln->datum) == 0)
+			break;
+
+	if (ln == NULL)
+		Fatal("%s: cannot open %s.",
+		  progname, (const char *)sysMkPath->first->datum);
+
+	/* Free the list but not the actual filenames since these may still
+	 * be used in GNodes. */
+	Lst_Free(sysMkPath);
 }
 
 static void



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 11:57:49 UTC 2020

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

Log Message:
make(1): document inefficient cache lookup in DirMatchFiles


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/usr.bin/make/dir.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/dir.c
diff -u src/usr.bin/make/dir.c:1.201 src/usr.bin/make/dir.c:1.202
--- src/usr.bin/make/dir.c:1.201	Sun Nov  8 09:34:55 2020
+++ src/usr.bin/make/dir.c	Sun Nov  8 11:57:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.201 2020/11/08 09:34:55 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.202 2020/11/08 11:57:49 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -134,7 +134,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.201 2020/11/08 09:34:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.202 2020/11/08 11:57:49 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -589,6 +589,9 @@ DirMatchFiles(const char *pattern, Cache
 Boolean isDot = dirName[0] == '.' && dirName[1] == '\0';
 HashIter hi;
 
+/* XXX: Iterating over all hash entries is inefficient.  If the pattern
+ * is a plain string without any wildcards, a direct lookup is faster. */
+
 HashIter_Init(, >files);
 while (HashIter_Next() != NULL) {
 	const char *base = hi.entry->key;



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 11:37:46 UTC 2020

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

Log Message:
make(1): clean up Make_ExpandUse

The targets need to be copied to the 'examine' queue, not because the
targets list would be modified but because the queue is modified and the
targets list should not be affected by that.


To generate a diff of this commit:
cvs rdiff -u -r1.202 -r1.203 src/usr.bin/make/make.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/make.c
diff -u src/usr.bin/make/make.c:1.202 src/usr.bin/make/make.c:1.203
--- src/usr.bin/make/make.c:1.202	Sun Nov  8 11:28:44 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 11:37:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.202 2020/11/08 11:28:44 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.203 2020/11/08 11:37:46 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.202 2020/11/08 11:28:44 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.203 2020/11/08 11:37:46 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -1116,17 +1116,8 @@ ExamineLater(GNodeList *examine, GNodeLi
 void
 Make_ExpandUse(GNodeList *targs)
 {
-GNodeList *examine;		/* List of targets to examine */
-
-{
-	/* XXX: Why is it necessary to copy the list? There shouldn't be
-	 * any modifications to the list, at least the function name
-	 * ExpandUse doesn't suggest that. */
-	GNodeListNode *ln;
-	examine = Lst_New();
-	for (ln = targs->first; ln != NULL; ln = ln->next)
-	Lst_Append(examine, ln->datum);
-}
+GNodeList *examine = Lst_New();	/* Queue of targets to examine */
+Lst_AppendAll(examine, targs);
 
 /*
  * Make an initial downward pass over the graph, marking nodes to be made



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 11:28:44 UTC 2020

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

Log Message:
make(1): fix type of have_token in MakeStartJobs


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/usr.bin/make/make.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/make.c
diff -u src/usr.bin/make/make.c:1.201 src/usr.bin/make/make.c:1.202
--- src/usr.bin/make/make.c:1.201	Sun Nov  8 11:25:26 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 11:28:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.201 2020/11/08 11:25:26 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.202 2020/11/08 11:28:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.201 2020/11/08 11:25:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.202 2020/11/08 11:28:44 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -911,14 +911,14 @@ MakeBuildParent(void *v_pn, void *toBeMa
 static Boolean
 MakeStartJobs(void)
 {
-GNode	*gn;
-int		have_token = 0;
+GNode *gn;
+Boolean have_token = FALSE;
 
 while (!Lst_IsEmpty(toBeMade)) {
 	/* Get token now to avoid cycling job-list when we only have 1 token */
 	if (!have_token && !Job_TokenWithdraw())
 	break;
-	have_token = 1;
+	have_token = TRUE;
 
 	gn = Lst_Dequeue(toBeMade);
 	DEBUG2(MAKE, "Examining %s%s...\n", gn->name, gn->cohort_num);
@@ -957,7 +957,7 @@ MakeStartJobs(void)
 	}
 	Make_DoAllVar(gn);
 	Job_Make(gn);
-	have_token = 0;
+	have_token = FALSE;
 	} else {
 	DEBUG0(MAKE, "up-to-date\n");
 	gn->made = UPTODATE;



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 11:25:27 UTC 2020

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

Log Message:
make(1): inline MakeCheckOrder into IsWaitingForOrder

This gets rid of a few void pointers and an unnecessary and unused
function parameter.

The variable name "bn" may have meant "before", but that was not
obvious.  The new name "ogn" nicely matches the ".ORDER" in the debug
message.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/usr.bin/make/make.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/make.c
diff -u src/usr.bin/make/make.c:1.200 src/usr.bin/make/make.c:1.201
--- src/usr.bin/make/make.c:1.200	Sun Nov  8 11:05:58 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 11:25:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.200 2020/11/08 11:05:58 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.201 2020/11/08 11:25:26 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.200 2020/11/08 11:05:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.201 2020/11/08 11:25:26 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -118,7 +118,6 @@ static unsigned int checked = 1;
  * It is added to by Make_Update and subtracted from by MakeStartJobs */
 static GNodeList *toBeMade;
 
-static int MakeCheckOrder(void *, void *);
 static int MakeBuildParent(void *, void *);
 
 void
@@ -564,6 +563,25 @@ UpdateImplicitParentsVars(GNode *cgn, co
 }
 }
 
+/* See if a .ORDER rule stops us from building this node. */
+static Boolean
+IsWaitingForOrder(GNode *gn)
+{
+GNodeListNode *ln;
+
+for (ln = gn->order_pred->first; ln != NULL; ln = ln->next) {
+	GNode *ogn = ln->datum;
+
+	if (ogn->made >= MADE || !(ogn->flags & REMAKE))
+	continue;
+
+	DEBUG2(MAKE, "IsWaitingForOrder: Waiting for .ORDER node \"%s%s\"\n",
+	   ogn->name, ogn->cohort_num);
+	return TRUE;
+}
+return FALSE;
+}
+
 /* Perform update on the parents of a node. Used by JobFinish once
  * a node has been dealt with and by MakeStartJobs if it finds an
  * up-to-date node.
@@ -699,11 +717,10 @@ Make_Update(GNode *cgn)
 	DEBUG0(MAKE, "- not deferred\n");
 	continue;
 	}
-	assert(pgn->order_pred != NULL);
-	if (Lst_ForEachUntil(pgn->order_pred, MakeCheckOrder, NULL)) {
-	/* A .ORDER rule stops us building this */
+
+	if (IsWaitingForOrder(pgn))
 	continue;
-	}
+
 	if (DEBUG(MAKE)) {
 	debug_printf("- %s%s made, schedule %s%s (made %d)\n",
 			 cgn->name, cgn->cohort_num,
@@ -834,19 +851,6 @@ Make_DoAllVar(GNode *gn)
 }
 
 static int
-MakeCheckOrder(void *v_bn, void *ignore MAKE_ATTR_UNUSED)
-{
-GNode *bn = v_bn;
-
-if (bn->made >= MADE || !(bn->flags & REMAKE))
-	return 0;
-
-DEBUG2(MAKE, "MakeCheckOrder: Waiting for .ORDER node %s%s\n",
-	   bn->name, bn->cohort_num);
-return 1;
-}
-
-static int
 MakeBuildChild(void *v_cn, void *toBeMade_next)
 {
 GNode *cn = v_cn;
@@ -857,8 +861,7 @@ MakeBuildChild(void *v_cn, void *toBeMad
 	return 0;
 
 /* If this node is on the RHS of a .ORDER, check LHSs. */
-assert(cn->order_pred);
-if (Lst_ForEachUntil(cn->order_pred, MakeCheckOrder, NULL)) {
+if (IsWaitingForOrder(cn)) {
 	/* Can't build this (or anything else in this child list) yet */
 	cn->made = DEFERRED;
 	return 0;			/* but keep looking */



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 11:05:58 UTC 2020

Modified Files:
src/usr.bin/make: make.c
src/usr.bin/make/unit-tests: depsrc-optional.exp

Log Message:
make(1): inline MakeAddChild into ExamineLater

This gets rid of a few void pointers and unspecific variable names like
"l" for the list that should have rather been called "examine" all the
time.

Add quotes around placeholders in debug messages.  Especially for targets
like "all" the message had been syntactically misleading.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/usr.bin/make/make.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/depsrc-optional.exp

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

Modified files:

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.199 src/usr.bin/make/make.c:1.200
--- src/usr.bin/make/make.c:1.199	Sun Nov  8 10:50:50 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 11:05:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.199 2020/11/08 10:50:50 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.200 2020/11/08 11:05:58 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.199 2020/11/08 10:50:50 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.200 2020/11/08 11:05:58 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -341,21 +341,6 @@ GNode_IsOODate(GNode *gn)
 return oodate;
 }
 
-/* Add the node to the list if it needs to be examined. */
-static int
-MakeAddChild(void *gnp, void *lp)
-{
-GNode *gn = gnp;
-GNodeList *l = lp;
-
-if (!(gn->flags & REMAKE) && !(gn->type & (OP_USE|OP_USEBEFORE))) {
-	DEBUG2(MAKE, "MakeAddChild: need to examine %s%s\n",
-	   gn->name, gn->cohort_num);
-	Lst_Enqueue(l, gn);
-}
-return 0;
-}
-
 static void
 PretendAllChildrenAreMade(GNode *pgn)
 {
@@ -1101,6 +1086,25 @@ MakePrintStatusList(GNodeList *gnodes, i
 	break;
 }
 
+static void
+ExamineLater(GNodeList *examine, GNodeList *toBeExamined)
+{
+ListNode *ln;
+
+for (ln = toBeExamined->first; ln != NULL; ln = ln->next) {
+	GNode *gn = ln->datum;
+
+	if (gn->flags & REMAKE)
+	continue;
+	if (gn->type & (OP_USE | OP_USEBEFORE))
+	continue;
+
+	DEBUG2(MAKE, "ExamineLater: need to examine \"%s%s\"\n",
+	   gn->name, gn->cohort_num);
+	Lst_Enqueue(examine, gn);
+}
+}
+
 /* Expand .USE nodes and create a new targets list.
  *
  * Input:
@@ -1177,7 +1181,7 @@ Make_ExpandUse(GNodeList *targs)
 	}
 
 	if (gn->unmade != 0)
-	Lst_ForEachUntil(gn->children, MakeAddChild, examine);
+	ExamineLater(examine, gn->children);
 }
 
 Lst_Free(examine);

Index: src/usr.bin/make/unit-tests/depsrc-optional.exp
diff -u src/usr.bin/make/unit-tests/depsrc-optional.exp:1.4 src/usr.bin/make/unit-tests/depsrc-optional.exp:1.5
--- src/usr.bin/make/unit-tests/depsrc-optional.exp:1.4	Sun Nov  8 10:33:47 2020
+++ src/usr.bin/make/unit-tests/depsrc-optional.exp	Sun Nov  8 11:05:58 2020
@@ -1,8 +1,8 @@
 Make_ExpandUse: examine all
-MakeAddChild: need to examine important
+ExamineLater: need to examine "important"
 Make_ExpandUse: examine important
-MakeAddChild: need to examine optional
-MakeAddChild: need to examine optional-cohort
+ExamineLater: need to examine "optional"
+ExamineLater: need to examine "optional-cohort"
 Make_ExpandUse: examine optional
 Make_ExpandUse: examine optional-cohort
 Examining optional...non-existent...up-to-date.



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 10:50:50 UTC 2020

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

Log Message:
make(1): inline MakeFindChild into PretendAllChildrenAreMade

This gets rid of a few void pointers and some function calls.  The
documentation of MakeFindChild essentially repeated what the code does,
and the redundant parts of it have been removed.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/usr.bin/make/make.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/make.c
diff -u src/usr.bin/make/make.c:1.198 src/usr.bin/make/make.c:1.199
--- src/usr.bin/make/make.c:1.198	Sun Nov  8 10:40:07 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 10:50:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.198 2020/11/08 10:40:07 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.199 2020/11/08 10:50:50 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.198 2020/11/08 10:40:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.199 2020/11/08 10:50:50 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -356,31 +356,18 @@ MakeAddChild(void *gnp, void *lp)
 return 0;
 }
 
-/* Find the pathname of a child that was already made.
- *
- * The path and mtime of the node and the youngestChild of the parent are
- * updated; the unmade children count of the parent is decremented.
- *
- * Input:
- *	gnp		the node to find
- */
-static int
-MakeFindChild(void *gnp, void *pgnp)
+static void
+PretendAllChildrenAreMade(GNode *pgn)
 {
-GNode *gn = gnp;
-GNode *pgn = pgnp;
-
-Dir_UpdateMTime(gn, FALSE);
-GNode_UpdateYoungestChild(pgn, gn);
-pgn->unmade--;
+GNodeListNode *ln;
 
-return 0;
-}
+for (ln = pgn->children->first; ln != NULL; ln = ln->next) {
+	GNode *cgn = ln->datum;
 
-static void
-PretendAllChildrenAreMade(GNode *gn)
-{
-Lst_ForEachUntil(gn->children, MakeFindChild, gn);
+	Dir_UpdateMTime(cgn, FALSE);	/* cgn->path may get updated as well */
+	GNode_UpdateYoungestChild(pgn, cgn);
+	pgn->unmade--;
+}
 }
 
 /* Called by Make_Run and SuffApplyTransform on the downward pass to handle



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 10:40:07 UTC 2020

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

Log Message:
make(1): extract PretendAllChildrenAreMade from Make_ExpandUse


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/usr.bin/make/make.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/make.c
diff -u src/usr.bin/make/make.c:1.197 src/usr.bin/make/make.c:1.198
--- src/usr.bin/make/make.c:1.197	Sun Nov  8 10:33:47 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 10:40:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.197 2020/11/08 10:33:47 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.198 2020/11/08 10:40:07 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.197 2020/11/08 10:33:47 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.198 2020/11/08 10:40:07 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -377,6 +377,12 @@ MakeFindChild(void *gnp, void *pgnp)
 return 0;
 }
 
+static void
+PretendAllChildrenAreMade(GNode *gn)
+{
+Lst_ForEachUntil(gn->children, MakeFindChild, gn);
+}
+
 /* Called by Make_Run and SuffApplyTransform on the downward pass to handle
  * .USE and transformation nodes, by copying the child node's commands, type
  * flags and children to the parent node.
@@ -1177,8 +1183,7 @@ Make_ExpandUse(GNodeList *targs)
 	if (!(gn->type & OP_MADE))
 	Suff_FindDeps(gn);
 	else {
-	/* Pretend we made all this node's children */
-	Lst_ForEachUntil(gn->children, MakeFindChild, gn);
+	PretendAllChildrenAreMade(gn);
 	if (gn->unmade != 0)
 		printf("Warning: %s%s still has %d unmade children\n",
 			gn->name, gn->cohort_num, gn->unmade);



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 10:33:47 UTC 2020

Modified Files:
src/usr.bin/make: make.c make.h
src/usr.bin/make/unit-tests: depsrc-optional.exp depsrc-optional.mk

Log Message:
make(1): fix debug output in out-of-date for cohorts (since 2003-11-14)

Before, a wrong cause for being out-of-date was printed in the debug log,
for optional cohorts.  This was caused by having the same conditions
duplicated in the code, instead of putting them in a separate function.

Now the optional cohort is correctly identified as using the '::'
dependency operator.


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/usr.bin/make/make.c
cvs rdiff -u -r1.200 -r1.201 src/usr.bin/make/make.h
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/depsrc-optional.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/depsrc-optional.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/make.c
diff -u src/usr.bin/make/make.c:1.196 src/usr.bin/make/make.c:1.197
--- src/usr.bin/make/make.c:1.196	Sun Nov  8 10:17:55 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 10:33:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.196 2020/11/08 10:17:55 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.197 2020/11/08 10:33:47 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.196 2020/11/08 10:17:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.197 2020/11/08 10:33:47 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -192,21 +192,31 @@ GNode_UpdateYoungestChild(GNode *gn, GNo
 	gn->youngestChild = cgn;
 }
 
-/*
- * A node whose modification time is less than that of its
- * youngest child or that has no children (youngestChild == NULL) and
- * either doesn't exist (mtime == 0) and it isn't optional
- * or was the object of a * :: operator is out-of-date.
- * Why? Because that's the way Make does it.
- */
 static Boolean
-IsOlderThanYoungestChild(GNode *gn)
+IsOODateRegular(GNode *gn)
 {
-return (gn->youngestChild != NULL &&
-	gn->mtime < gn->youngestChild->mtime) ||
-	   (gn->youngestChild == NULL &&
-	((gn->mtime == 0 && !(gn->type & OP_OPTIONAL))
-	 || gn->type & OP_DOUBLEDEP));
+/* These rules are inherited from the original Make. */
+
+if (gn->youngestChild != NULL) {
+	if (gn->mtime < gn->youngestChild->mtime) {
+	DEBUG1(MAKE, "modified before source \"%s\"...",
+		   GNode_Path(gn->youngestChild));
+	return TRUE;
+	}
+	return FALSE;
+}
+
+if (gn->mtime == 0 && !(gn->type & OP_OPTIONAL)) {
+	DEBUG0(MAKE, "non-existent and no sources...");
+	return TRUE;
+}
+
+if (gn->type & OP_DOUBLEDEP) {
+	DEBUG0(MAKE, ":: operator and no sources...");
+	return TRUE;
+}
+
+return FALSE;
 }
 
 /* See if the node is out of date with respect to its sources.
@@ -292,18 +302,7 @@ GNode_IsOODate(GNode *gn)
 	}
 	}
 	oodate = TRUE;
-} else if (IsOlderThanYoungestChild(gn)) {
-	if (DEBUG(MAKE)) {
-	if (gn->youngestChild != NULL &&
-		gn->mtime < gn->youngestChild->mtime) {
-		debug_printf("modified before source \"%s\"...",
-			 GNode_Path(gn->youngestChild));
-	} else if (gn->mtime == 0) {
-		debug_printf("non-existent and no sources...");
-	} else {
-		debug_printf(":: operator and no sources...");
-	}
-	}
+} else if (IsOODateRegular(gn)) {
 	oodate = TRUE;
 } else {
 	/*

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.200 src/usr.bin/make/make.h:1.201
--- src/usr.bin/make/make.h:1.200	Sun Nov  8 08:33:07 2020
+++ src/usr.bin/make/make.h	Sun Nov  8 10:33:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.200 2020/11/08 08:33:07 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.201 2020/11/08 10:33:47 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -199,7 +199,8 @@ typedef enum GNodeType {
 OP_FORCE		= 1 << 1,
 /* The dependency operator '::' behaves like ':', except that it allows
  * multiple dependency groups to be defined.  Each of these groups is
- * executed on its own, independently from the others. */
+ * executed on its own, independently from the others.  Each individual
+ * dependency group is called a cohort. */
 OP_DOUBLEDEP	= 1 << 2,
 
 /* Matches the dependency operators ':', '!' and '::'. */

Index: src/usr.bin/make/unit-tests/depsrc-optional.exp
diff -u src/usr.bin/make/unit-tests/depsrc-optional.exp:1.3 src/usr.bin/make/unit-tests/depsrc-optional.exp:1.4
--- src/usr.bin/make/unit-tests/depsrc-optional.exp:1.3	Sun Nov  8 10:17:55 2020
+++ src/usr.bin/make/unit-tests/depsrc-optional.exp	Sun Nov  8 10:33:47 2020
@@ -6,8 +6,8 @@ MakeAddChild: need to examine optional-c
 Make_ExpandUse: examine optional
 Make_ExpandUse: examine optional-cohort
 Examining 

CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 10:17:55 UTC 2020

Modified Files:
src/usr.bin/make: make.c
src/usr.bin/make/unit-tests: depsrc-optional.exp depsrc-optional.mk

Log Message:
make(1): add test for wrong debug message in GNode_IsOODate


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/usr.bin/make/make.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/depsrc-optional.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/depsrc-optional.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/make.c
diff -u src/usr.bin/make/make.c:1.195 src/usr.bin/make/make.c:1.196
--- src/usr.bin/make/make.c:1.195	Sun Nov  8 09:48:52 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 10:17:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.195 2020/11/08 09:48:52 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.196 2020/11/08 10:17:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.195 2020/11/08 09:48:52 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.196 2020/11/08 10:17:55 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -296,7 +296,7 @@ GNode_IsOODate(GNode *gn)
 	if (DEBUG(MAKE)) {
 	if (gn->youngestChild != NULL &&
 		gn->mtime < gn->youngestChild->mtime) {
-		debug_printf("modified before source %s...",
+		debug_printf("modified before source \"%s\"...",
 			 GNode_Path(gn->youngestChild));
 	} else if (gn->mtime == 0) {
 		debug_printf("non-existent and no sources...");

Index: src/usr.bin/make/unit-tests/depsrc-optional.exp
diff -u src/usr.bin/make/unit-tests/depsrc-optional.exp:1.2 src/usr.bin/make/unit-tests/depsrc-optional.exp:1.3
--- src/usr.bin/make/unit-tests/depsrc-optional.exp:1.2	Sat Sep  5 15:57:12 2020
+++ src/usr.bin/make/unit-tests/depsrc-optional.exp	Sun Nov  8 10:17:55 2020
@@ -1,2 +1,20 @@
-`all' is up to date.
+Make_ExpandUse: examine all
+MakeAddChild: need to examine important
+Make_ExpandUse: examine important
+MakeAddChild: need to examine optional
+MakeAddChild: need to examine optional-cohort
+Make_ExpandUse: examine optional
+Make_ExpandUse: examine optional-cohort
+Examining optional...non-existent...up-to-date.
+Examining optional-cohort...non-existent...non-existent and no sources...out-of-date.
+: This is not executed.
+ recheck(optional-cohort): update time from  0:00:00 Jan 01, 1970 to now
+Examining important...non-existent...modified before source "optional-cohort"...out-of-date.
+: important is made.
+ recheck(important): update time from  0:00:00 Jan 01, 1970 to now
+Examining all...non-existent...modified before source "important"...out-of-date.
+: all is made.
+ recheck(all): update time from  0:00:00 Jan 01, 1970 to now
+Examining .END...non-existent...non-existent and no sources...out-of-date.
+ recheck(.END): update time from  0:00:00 Jan 01, 1970 to now
 exit status 0

Index: src/usr.bin/make/unit-tests/depsrc-optional.mk
diff -u src/usr.bin/make/unit-tests/depsrc-optional.mk:1.3 src/usr.bin/make/unit-tests/depsrc-optional.mk:1.4
--- src/usr.bin/make/unit-tests/depsrc-optional.mk:1.3	Sat Sep  5 15:57:12 2020
+++ src/usr.bin/make/unit-tests/depsrc-optional.mk	Sun Nov  8 10:17:55 2020
@@ -1,4 +1,4 @@
-# $NetBSD: depsrc-optional.mk,v 1.3 2020/09/05 15:57:12 rillig Exp $
+# $NetBSD: depsrc-optional.mk,v 1.4 2020/11/08 10:17:55 rillig Exp $
 #
 # Tests for the special source .OPTIONAL in dependency declarations,
 # which ignores the target if make cannot find out how to create it.
@@ -11,8 +11,15 @@
 all: important
 	: ${.TARGET} is made.
 
-important: optional
+important: optional optional-cohort
 	: ${.TARGET} is made.
 
 optional: .OPTIONAL
 	: This is not executed.
+
+# XXX: "non-existent and no sources" is wrong, should be ":: operator and
+# no sources..." instead.
+optional-cohort:: .OPTIONAL
+	: This is not executed.
+
+.MAKEFLAGS: -dm



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

2020-11-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Nov  8 10:08:28 UTC 2020

Modified Files:
src/sys/arch/riscv/riscv: locore.S

Log Message:
Fix register usage


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/riscv/riscv/locore.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/arch/riscv/riscv/locore.S
diff -u src/sys/arch/riscv/riscv/locore.S:1.19 src/sys/arch/riscv/riscv/locore.S:1.20
--- src/sys/arch/riscv/riscv/locore.S:1.19	Sun Nov  8 08:12:17 2020
+++ src/sys/arch/riscv/riscv/locore.S	Sun Nov  8 10:08:28 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.19 2020/11/08 08:12:17 skrll Exp $ */
+/* $NetBSD: locore.S,v 1.20 2020/11/08 10:08:28 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@ ENTRY_NP(start)
 
 	add	s1, s1, s10		// PAGE_SIZE
 	addi	s1, s1, -1		//   -1 == PAGE_MASK
-	neg	a1, a0			// -PAGE_SIZE
+	neg	a1, s10			// -PAGE_SIZE
 	and	s1, s1, a1		// s1 is page aligned end of kernel
 	// s1 = uarea
 	add	s2, s1, s9		// s2 = first PDE page



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 09:48:52 UTC 2020

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

Log Message:
make(1): extract condition from GNode_IsOODate into separate function


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/usr.bin/make/make.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/make.c
diff -u src/usr.bin/make/make.c:1.194 src/usr.bin/make/make.c:1.195
--- src/usr.bin/make/make.c:1.194	Sun Nov  8 09:34:55 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 09:48:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.194 2020/11/08 09:34:55 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.195 2020/11/08 09:48:52 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.194 2020/11/08 09:34:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.195 2020/11/08 09:48:52 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -192,6 +192,23 @@ GNode_UpdateYoungestChild(GNode *gn, GNo
 	gn->youngestChild = cgn;
 }
 
+/*
+ * A node whose modification time is less than that of its
+ * youngest child or that has no children (youngestChild == NULL) and
+ * either doesn't exist (mtime == 0) and it isn't optional
+ * or was the object of a * :: operator is out-of-date.
+ * Why? Because that's the way Make does it.
+ */
+static Boolean
+IsOlderThanYoungestChild(GNode *gn)
+{
+return (gn->youngestChild != NULL &&
+	gn->mtime < gn->youngestChild->mtime) ||
+	   (gn->youngestChild == NULL &&
+	((gn->mtime == 0 && !(gn->type & OP_OPTIONAL))
+	 || gn->type & OP_DOUBLEDEP));
+}
+
 /* See if the node is out of date with respect to its sources.
  *
  * Used by Make_Run when deciding which nodes to place on the
@@ -275,19 +292,7 @@ GNode_IsOODate(GNode *gn)
 	}
 	}
 	oodate = TRUE;
-} else if ((gn->youngestChild != NULL &&
-		gn->mtime < gn->youngestChild->mtime) ||
-	   (gn->youngestChild == NULL &&
-		((gn->mtime == 0 && !(gn->type & OP_OPTIONAL))
-		 || gn->type & OP_DOUBLEDEP)))
-{
-	/*
-	 * A node whose modification time is less than that of its
-	 * youngest child or that has no children (youngestChild == NULL) and
-	 * either doesn't exist (mtime == 0) and it isn't optional
-	 * or was the object of a * :: operator is out-of-date.
-	 * Why? Because that's the way Make does it.
-	 */
+} else if (IsOlderThanYoungestChild(gn)) {
 	if (DEBUG(MAKE)) {
 	if (gn->youngestChild != NULL &&
 		gn->mtime < gn->youngestChild->mtime) {



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 09:34:55 UTC 2020

Modified Files:
src/usr.bin/make: dir.c dir.h job.c make.c

Log Message:
make(1): change return type of Dir_MTime to void

Only some callers actually needed the updated time, and because of the
many branches, it was difficult to see that the return value was indeed
gn->mtime all the time.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/usr.bin/make/dir.c
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/make/dir.h
cvs rdiff -u -r1.314 -r1.315 src/usr.bin/make/job.c
cvs rdiff -u -r1.193 -r1.194 src/usr.bin/make/make.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/dir.c
diff -u src/usr.bin/make/dir.c:1.200 src/usr.bin/make/dir.c:1.201
--- src/usr.bin/make/dir.c:1.200	Sun Nov  8 09:15:19 2020
+++ src/usr.bin/make/dir.c	Sun Nov  8 09:34:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.200 2020/11/08 09:15:19 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.201 2020/11/08 09:34:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -100,9 +100,9 @@
  *			then all the directories above it in turn until
  *			the path is found or we reach the root ("/").
  *
- *	Dir_MTime	Return the modification time of a node. The file
- *			is searched for along the default search path.
- *			The path and mtime fields of the node are filled in.
+ *	Dir_UpdateMTime
+ *			Update the modification time and path of a node with
+ *			data from the file corresponding to the node.
  *
  *	Dir_AddDir	Add a directory to a search path.
  *
@@ -134,7 +134,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.200 2020/11/08 09:15:19 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.201 2020/11/08 09:34:55 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -204,7 +204,7 @@ MAKE_RCSID("$NetBSD: dir.c,v 1.200 2020/
  * Given that an access() is essentially a stat() without the copyout() call,
  * and that the same filesystem overhead would have to be incurred in
  * Dir_MTime, it made sense to replace the access() with a stat() and record
- * the mtime in a cache for when Dir_MTime was actually called.
+ * the mtime in a cache for when Dir_UpdateMTime was actually called.
  */
 
 typedef List CachedDirList;
@@ -1276,26 +1276,12 @@ Dir_FindHereOrAbove(const char *here, co
 return NULL;
 }
 
-/*-
- *---
- * Dir_MTime  --
- *	Find the modification time of the file described by gn along the
- *	search path dirSearchPath.
- *
- * Input:
- *	gn		the file whose modification time is desired
+/* Search gn along dirSearchPath and store its modification time in gn->mtime.
+ * If no file is found, store 0 instead.
  *
- * Results:
- *	The modification time or 0 if it doesn't exist
- *
- * Side Effects:
- *	The modification time is placed in the node's mtime slot.
- *	If the node didn't have a path entry before, and Dir_FindFile
- *	found one for it, the full name is placed in the path slot.
- *---
- */
-time_t
-Dir_MTime(GNode *gn, Boolean recheck)
+ * The found file is stored in gn->path, unless the node already had a path. */
+void
+Dir_UpdateMTime(GNode *gn, Boolean recheck)
 {
 char *fullName;		/* the full pathname of name */
 struct make_stat mst;	/* buffer for finding the mod time */
@@ -1303,11 +1289,15 @@ Dir_MTime(GNode *gn, Boolean recheck)
 
 if (gn->type & OP_ARCHV) {
 	Arch_UpdateMTime(gn);
-	return gn->mtime;
-} else if (gn->type & OP_PHONY) {
+	return;
+}
+
+if (gn->type & OP_PHONY) {
 	gn->mtime = 0;
-	return 0;
-} else if (gn->path == NULL) {
+	return;
+}
+
+if (gn->path == NULL) {
 	if (gn->type & OP_NOPATH)
 	fullName = NULL;
 	else {
@@ -1356,7 +1346,7 @@ Dir_MTime(GNode *gn, Boolean recheck)
 	if (fullName != gn->path)
 		free(fullName);
 	Arch_UpdateMemberMTime(gn);
-	return gn->mtime;
+	return;
 	}
 
 	mst.mst_mtime = 0;
@@ -1366,7 +1356,6 @@ Dir_MTime(GNode *gn, Boolean recheck)
 	gn->path = fullName;
 
 gn->mtime = mst.mst_mtime;
-return gn->mtime;
 }
 
 /* Read the list of filenames in the directory and store the result

Index: src/usr.bin/make/dir.h
diff -u src/usr.bin/make/dir.h:1.32 src/usr.bin/make/dir.h:1.33
--- src/usr.bin/make/dir.h:1.32	Sun Oct 25 10:00:20 2020
+++ src/usr.bin/make/dir.h	Sun Nov  8 09:34:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.h,v 1.32 2020/10/25 10:00:20 rillig Exp $	*/
+/*	$NetBSD: dir.h,v 1.33 2020/11/08 09:34:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -101,7 +101,7 @@ Boolean Dir_HasWildcards(const char *);
 void Dir_Expand(const char *, SearchPath *, StringList *);
 char 

CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 09:15:19 UTC 2020

Modified Files:
src/usr.bin/make: arch.c dir.c nonints.h

Log Message:
make(1): change return type of Arch_MTime to void

This makes it easier to prove that Dir_MTime always returns gn->mtime,
without looking at the implementation of Arch_UpdateMTime.


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/usr.bin/make/arch.c
cvs rdiff -u -r1.199 -r1.200 src/usr.bin/make/dir.c
cvs rdiff -u -r1.157 -r1.158 src/usr.bin/make/nonints.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/arch.c
diff -u src/usr.bin/make/arch.c:1.173 src/usr.bin/make/arch.c:1.174
--- src/usr.bin/make/arch.c:1.173	Sun Nov  8 09:06:22 2020
+++ src/usr.bin/make/arch.c	Sun Nov  8 09:15:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.173 2020/11/08 09:06:22 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.174 2020/11/08 09:15:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -93,10 +93,10 @@
  *			because it also updates the modification time
  *			of the library's table of contents.
  *
- *	Arch_MTime	Find the modification time of a member of
- *			an archive *in the archive*. The time is also
- *			placed in the member's GNode. Returns the
- *			modification time.
+ *	Arch_UpdateMTime
+ *			Find the modification time of a member of
+ *			an archive *in the archive* and place it in the
+ *			member's GNode.
  *
  *	Arch_UpdateMemberMTime
  *			Find the modification time of a member of
@@ -125,7 +125,7 @@
 #include "config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.173 2020/11/08 09:06:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.174 2020/11/08 09:15:19 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -889,21 +889,16 @@ Arch_TouchLib(GNode *gn MAKE_ATTR_UNUSED
 
 /* Update the mtime of the GNode with the mtime from the archive member on
  * disk (or in the cache). */
-time_t
-Arch_MTime(GNode *gn)
+void
+Arch_UpdateMTime(GNode *gn)
 {
 struct ar_hdr *arh;
-time_t modTime;
 
 arh = ArchStatMember(GNode_VarArchive(gn), GNode_VarMember(gn), TRUE);
-if (arh != NULL) {
-	modTime = (time_t)strtol(arh->ar_date, NULL, 10);
-} else {
-	modTime = 0;
-}
-
-gn->mtime = modTime;
-return modTime;
+if (arh != NULL)
+	gn->mtime = (time_t)strtol(arh->ar_date, NULL, 10);
+else
+	gn->mtime = 0;
 }
 
 /* Given a non-existent archive member's node, update gn->mtime from its
@@ -930,7 +925,8 @@ Arch_UpdateMemberMTime(GNode *gn)
 
 	if ((pgn->flags & REMAKE) &&
 		strncmp(nameStart, gn->name, nameLen) == 0) {
-		gn->mtime = Arch_MTime(pgn);
+		Arch_UpdateMTime(pgn);
+		gn->mtime = pgn->mtime;
 	}
 	} else if (pgn->flags & REMAKE) {
 	/*

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.199 src/usr.bin/make/dir.c:1.200
--- src/usr.bin/make/dir.c:1.199	Sun Nov  8 09:06:22 2020
+++ src/usr.bin/make/dir.c	Sun Nov  8 09:15:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.199 2020/11/08 09:06:22 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.200 2020/11/08 09:15:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -134,7 +134,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.199 2020/11/08 09:06:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.200 2020/11/08 09:15:19 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -1302,7 +1302,8 @@ Dir_MTime(GNode *gn, Boolean recheck)
 CachedStatsFlags flags;
 
 if (gn->type & OP_ARCHV) {
-	return Arch_MTime(gn);
+	Arch_UpdateMTime(gn);
+	return gn->mtime;
 } else if (gn->type & OP_PHONY) {
 	gn->mtime = 0;
 	return 0;

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.157 src/usr.bin/make/nonints.h:1.158
--- src/usr.bin/make/nonints.h:1.157	Sun Nov  8 09:06:23 2020
+++ src/usr.bin/make/nonints.h	Sun Nov  8 09:15:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.157 2020/11/08 09:06:23 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.158 2020/11/08 09:15:19 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -79,7 +79,7 @@ void Arch_End(void);
 Boolean Arch_ParseArchive(char **, GNodeList *, GNode *);
 void Arch_Touch(GNode *);
 void Arch_TouchLib(GNode *);
-time_t Arch_MTime(GNode *);
+void Arch_UpdateMTime(GNode *gn);
 void Arch_UpdateMemberMTime(GNode *gn);
 void Arch_FindLib(GNode *, SearchPath *);
 Boolean Arch_LibOODate(GNode *);



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 09:06:23 UTC 2020

Modified Files:
src/usr.bin/make: arch.c dir.c make.c nonints.h

Log Message:
make(1): change return type of Arch_MemberMTime to void

This makes it easier to prove that Dir_MTime always returns gn->mtime,
without looking at the implementation of Arch_UpdateMemberMTime.


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/usr.bin/make/arch.c
cvs rdiff -u -r1.198 -r1.199 src/usr.bin/make/dir.c
cvs rdiff -u -r1.192 -r1.193 src/usr.bin/make/make.c
cvs rdiff -u -r1.156 -r1.157 src/usr.bin/make/nonints.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/arch.c
diff -u src/usr.bin/make/arch.c:1.172 src/usr.bin/make/arch.c:1.173
--- src/usr.bin/make/arch.c:1.172	Sun Nov  8 08:33:07 2020
+++ src/usr.bin/make/arch.c	Sun Nov  8 09:06:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.172 2020/11/08 08:33:07 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.173 2020/11/08 09:06:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -98,7 +98,7 @@
  *			placed in the member's GNode. Returns the
  *			modification time.
  *
- *	Arch_MemberMTime
+ *	Arch_UpdateMemberMTime
  *			Find the modification time of a member of
  *			an archive. Called when the member doesn't
  *			already exist. Looks in the archive for the
@@ -125,7 +125,7 @@
 #include "config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.172 2020/11/08 08:33:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.173 2020/11/08 09:06:22 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -906,10 +906,10 @@ Arch_MTime(GNode *gn)
 return modTime;
 }
 
-/* Given a non-existent archive member's node, get its modification time from
- * its archived form, if it exists. gn->mtime is filled in as well. */
-time_t
-Arch_MemberMTime(GNode *gn)
+/* Given a non-existent archive member's node, update gn->mtime from its
+ * archived form, if it exists. */
+void
+Arch_UpdateMemberMTime(GNode *gn)
 {
 GNodeListNode *ln;
 
@@ -941,8 +941,6 @@ Arch_MemberMTime(GNode *gn)
 	break;
 	}
 }
-
-return gn->mtime;
 }
 
 /* Search for a library along the given search path.

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.198 src/usr.bin/make/dir.c:1.199
--- src/usr.bin/make/dir.c:1.198	Sat Nov  7 20:45:21 2020
+++ src/usr.bin/make/dir.c	Sun Nov  8 09:06:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.198 2020/11/07 20:45:21 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.199 2020/11/08 09:06:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -134,7 +134,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.198 2020/11/07 20:45:21 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.199 2020/11/08 09:06:22 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -1349,13 +1349,13 @@ Dir_MTime(GNode *gn, Boolean recheck)
 if (fullName == NULL)
 	fullName = bmake_strdup(gn->name);
 
-
 flags = recheck ? CST_UPDATE : CST_NONE;
 if (cached_stats(, fullName, , flags) < 0) {
 	if (gn->type & OP_MEMBER) {
 	if (fullName != gn->path)
 		free(fullName);
-	return Arch_MemberMTime(gn);
+	Arch_UpdateMemberMTime(gn);
+	return gn->mtime;
 	}
 
 	mst.mst_mtime = 0;

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.192 src/usr.bin/make/make.c:1.193
--- src/usr.bin/make/make.c:1.192	Sun Nov  8 08:55:25 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 09:06:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.192 2020/11/08 08:55:25 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.193 2020/11/08 09:06:23 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.192 2020/11/08 08:55:25 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.193 2020/11/08 09:06:23 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -553,6 +553,9 @@ Make_Recheck(GNode *gn)
 	   gn->name, Targ_FmtTime(gn->mtime));
 }
 #endif
+
+/* XXX: The returned mtime may differ from gn->mtime.
+ * Intentionally? */
 return mtime;
 }
 

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.156 src/usr.bin/make/nonints.h:1.157
--- src/usr.bin/make/nonints.h:1.156	Sat Nov  7 21:31:07 2020
+++ src/usr.bin/make/nonints.h	Sun Nov  8 09:06:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.156 2020/11/07 21:31:07 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.157 2020/11/08 09:06:23 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -80,7 +80,7 @@ Boolean Arch_ParseArchive(char **, GNode
 void Arch_Touch(GNode *);
 void Arch_TouchLib(GNode *);
 time_t 

CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 08:55:25 UTC 2020

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

Log Message:
make(1): clean up comments in Make_Recheck


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 src/usr.bin/make/make.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/make.c
diff -u src/usr.bin/make/make.c:1.191 src/usr.bin/make/make.c:1.192
--- src/usr.bin/make/make.c:1.191	Sun Nov  8 08:53:22 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 08:55:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.191 2020/11/08 08:53:22 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.192 2020/11/08 08:55:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.191 2020/11/08 08:53:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.192 2020/11/08 08:55:25 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -510,13 +510,11 @@ Make_Recheck(GNode *gn)
  * In this case, if the definitions produced by yacc haven't changed
  * from before, parse.h won't have been updated and gn->mtime will
  * reflect the current modification time for parse.h. This is
- * something of a kludge, I admit, but it's a useful one..
- * XXX: People like to use a rule like
+ * something of a kludge, I admit, but it's a useful one.
  *
- * FRC:
- *
- * To force things that depend on FRC to be made, so we have to
- * check for gn->children being empty as well...
+ * XXX: People like to use a rule like "FRC:" to force things that
+ * depend on FRC to be made, so we have to check for gn->children
+ * being empty as well.
  */
 if (!Lst_IsEmpty(gn->commands) || Lst_IsEmpty(gn->children)) {
 	gn->mtime = now;
@@ -541,8 +539,8 @@ Make_Recheck(GNode *gn)
  * -- ardeb 1/12/88
  */
 /*
- * Christos, 4/9/92: If we are  saving commands pretend that
- * the target is made now. Otherwise archives with ... rules
+ * Christos, 4/9/92: If we are saving commands, pretend that
+ * the target is made now. Otherwise archives with '...' rules
  * don't work!
  */
 if (!GNode_ShouldExecute(gn) || (gn->type & OP_SAVE_CMDS) ||



CVS commit: src/tests/lib/librumpclient

2020-11-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  8 08:54:50 UTC 2020

Modified Files:
src/tests/lib/librumpclient: t_exec.sh

Log Message:
PR 55338: re-enable threxec test for more test coverage.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/lib/librumpclient/t_exec.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/lib/librumpclient/t_exec.sh
diff -u src/tests/lib/librumpclient/t_exec.sh:1.11 src/tests/lib/librumpclient/t_exec.sh:1.12
--- src/tests/lib/librumpclient/t_exec.sh:1.11	Sat Aug 29 05:46:34 2020
+++ src/tests/lib/librumpclient/t_exec.sh	Sun Nov  8 08:54:50 2020
@@ -1,4 +1,4 @@
-#   $NetBSD: t_exec.sh,v 1.11 2020/08/29 05:46:34 martin Exp $
+#   $NetBSD: t_exec.sh,v 1.12 2020/11/08 08:54:50 martin Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -135,7 +135,7 @@ threxec_head()
 
 threxec_body()
 {
-	atf_skip "PR 55338: triggers a scheduler bug"
+	# atf_skip "PR 55338: triggers a scheduler bug"
 	atf_check -s exit:0 rump_server ${RUMP_SERVER}
 	atf_check -s exit:0 $(atf_get_srcdir)/h_execthr
 }



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 08:53:22 UTC 2020

Modified Files:
src/usr.bin/make: main.c make.c util.c

Log Message:
make(1): use common indentation style for else


To generate a diff of this commit:
cvs rdiff -u -r1.443 -r1.444 src/usr.bin/make/main.c
cvs rdiff -u -r1.190 -r1.191 src/usr.bin/make/make.c
cvs rdiff -u -r1.66 -r1.67 src/usr.bin/make/util.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/main.c
diff -u src/usr.bin/make/main.c:1.443 src/usr.bin/make/main.c:1.444
--- src/usr.bin/make/main.c:1.443	Sun Nov  8 02:56:43 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 08:53:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.443 2020/11/08 02:56:43 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.444 2020/11/08 08:53:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.443 2020/11/08 02:56:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.444 2020/11/08 08:53:22 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -258,12 +258,10 @@ parse_debug_options(const char *argvalue
 			if (modules[1] == '1') {
 opts.debug |= DEBUG_GRAPH1;
 ++modules;
-			}
-			else if (modules[1] == '2') {
+			} else if (modules[1] == '2') {
 opts.debug |= DEBUG_GRAPH2;
 ++modules;
-			}
-			else if (modules[1] == '3') {
+			} else if (modules[1] == '3') {
 opts.debug |= DEBUG_GRAPH3;
 ++modules;
 			}

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.190 src/usr.bin/make/make.c:1.191
--- src/usr.bin/make/make.c:1.190	Sun Nov  8 08:33:07 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 08:53:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.190 2020/11/08 08:33:07 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.191 2020/11/08 08:53:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.190 2020/11/08 08:33:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.191 2020/11/08 08:53:22 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -550,8 +550,7 @@ Make_Recheck(GNode *gn)
 	DEBUG2(MAKE, " recheck(%s): update time from %s to now\n",
 	   gn->name, Targ_FmtTime(gn->mtime));
 	gn->mtime = now;
-}
-else {
+} else {
 	DEBUG2(MAKE, " recheck(%s): current update time: %s\n",
 	   gn->name, Targ_FmtTime(gn->mtime));
 }

Index: src/usr.bin/make/util.c
diff -u src/usr.bin/make/util.c:1.66 src/usr.bin/make/util.c:1.67
--- src/usr.bin/make/util.c:1.66	Sat Nov  7 22:29:58 2020
+++ src/usr.bin/make/util.c	Sun Nov  8 08:53:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.66 2020/11/07 22:29:58 rillig Exp $	*/
+/*	$NetBSD: util.c,v 1.67 2020/11/08 08:53:22 rillig Exp $	*/
 
 /*
  * Missing stuff from OS's
@@ -15,7 +15,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: util.c,v 1.66 2020/11/07 22:29:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: util.c,v 1.67 2020/11/08 08:53:22 rillig Exp $");
 
 #if !defined(MAKE_NATIVE) && !defined(HAVE_STRERROR)
 extern int errno, sys_nerr;
@@ -28,8 +28,7 @@ strerror(int e)
 if (e < 0 || e >= sys_nerr) {
 	snprintf(buf, sizeof buf, "Unknown error %d", e);
 	return buf;
-}
-else
+} else
 	return sys_errlist[e];
 }
 #endif
@@ -291,8 +290,7 @@ getwd(char *pathname)
 	for (d = readdir(dp); d != NULL; d = readdir(dp))
 		if (d->d_fileno == st_cur.st_ino)
 		break;
-	}
-	else {
+	} else {
 	/*
 	 * Parent has a different device. This is a mount point so we
 	 * need to stat every member



CVS commit: [netbsd-9] src/doc

2020-11-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  8 08:40:01 UTC 2020

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

Log Message:
Ticket #1127


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

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

Modified files:

Index: src/doc/CHANGES-9.2
diff -u src/doc/CHANGES-9.2:1.1.2.8 src/doc/CHANGES-9.2:1.1.2.9
--- src/doc/CHANGES-9.2:1.1.2.8	Thu Nov  5 08:11:37 2020
+++ src/doc/CHANGES-9.2	Sun Nov  8 08:40:01 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.8 2020/11/05 08:11:37 sborrill Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.9 2020/11/08 08:40:01 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -1058,3 +1058,8 @@ usr.sbin/sysinst/util.c1.49-1.52
 	  work).
 	[martin, ticket #1121]
 
+sys/compat/linux/common/linux_socket.c		1.151
+
+	Fix compat with Linux programs that use longer namelen for sockets.
+	[kamil, ticket #1127]
+



CVS commit: [netbsd-9] src/sys/compat/linux/common

2020-11-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov  8 08:39:13 UTC 2020

Modified Files:
src/sys/compat/linux/common [netbsd-9]: linux_socket.c

Log Message:
Pull up following revision(s) (requested by kamil in ticket #1127):

sys/compat/linux/common/linux_socket.c: revision 1.151

Fix compat with Linux programs that use longer namelen for sockets

Linux is less strict than NetBSD and permits namelen to be larger
than valid struct sockaddr_in*.  If this is the case, truncate the value
to the correct size, so that NetBSD networking does not return an error.

Reviewed by kamil


To generate a diff of this commit:
cvs rdiff -u -r1.145.4.2 -r1.145.4.3 \
src/sys/compat/linux/common/linux_socket.c

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

Modified files:

Index: src/sys/compat/linux/common/linux_socket.c
diff -u src/sys/compat/linux/common/linux_socket.c:1.145.4.2 src/sys/compat/linux/common/linux_socket.c:1.145.4.3
--- src/sys/compat/linux/common/linux_socket.c:1.145.4.2	Fri Jul 17 15:24:48 2020
+++ src/sys/compat/linux/common/linux_socket.c	Sun Nov  8 08:39:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_socket.c,v 1.145.4.2 2020/07/17 15:24:48 martin Exp $	*/
+/*	$NetBSD: linux_socket.c,v 1.145.4.3 2020/11/08 08:39:12 martin Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.145.4.2 2020/07/17 15:24:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.145.4.3 2020/11/08 08:39:12 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1612,6 +1612,21 @@ linux_get_sa(struct lwp *l, int s, struc
 		sin6->sin6_scope_id = 0;
 	}
 
+	/*
+	 * Linux is less strict than NetBSD and permits namelen to be larger
+	 * than valid struct sockaddr_in*.  If this is the case, truncate
+	 * the value to the correct size, so that NetBSD networking does not
+	 * return an error.
+	 */
+	switch (bdom) {
+	case AF_INET:
+		namelen = MIN(namelen, sizeof(struct sockaddr_in));
+		break;
+	case AF_INET6:
+		namelen = MIN(namelen, sizeof(struct sockaddr_in6));
+		break;
+	}
+
 	sb->sb_family = bdom;
 	sb->sb_len = namelen;
 	ktrkuser("mbsoname", sb, namelen);



CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 08:33:07 UTC 2020

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

Log Message:
make(1): rename Make_OODate to GNode_IsOODate

It doesn't matter which of the make modules is in charge of determining
whether a node is out-of-date.  Therefore, remove the module name from
the function name.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/usr.bin/make/arch.c
cvs rdiff -u -r1.180 -r1.181 src/usr.bin/make/compat.c
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/make/make.c
cvs rdiff -u -r1.199 -r1.200 src/usr.bin/make/make.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/arch.c
diff -u src/usr.bin/make/arch.c:1.171 src/usr.bin/make/arch.c:1.172
--- src/usr.bin/make/arch.c:1.171	Sat Nov  7 14:04:49 2020
+++ src/usr.bin/make/arch.c	Sun Nov  8 08:33:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.171 2020/11/07 14:04:49 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.172 2020/11/08 08:33:07 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -125,7 +125,7 @@
 #include "config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.171 2020/11/07 14:04:49 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.172 2020/11/08 08:33:07 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -974,7 +974,7 @@ Arch_FindLib(GNode *gn, SearchPath *path
 }
 
 /* Decide if a node with the OP_LIB attribute is out-of-date. Called from
- * Make_OODate to make its life easier.
+ * GNode_IsOODate to make its life easier.
  * The library is cached if it hasn't been already.
  *
  * There are several ways for a library to be out-of-date that are

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.180 src/usr.bin/make/compat.c:1.181
--- src/usr.bin/make/compat.c:1.180	Sun Nov  8 08:26:22 2020
+++ src/usr.bin/make/compat.c	Sun Nov  8 08:33:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.180 2020/11/08 08:26:22 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.181 2020/11/08 08:33:07 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*	"@(#)compat.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: compat.c,v 1.180 2020/11/08 08:26:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.181 2020/11/08 08:33:07 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -497,10 +497,10 @@ Compat_Make(GNode *gn, GNode *pgn)
 	 * All the children were made ok. Now youngestChild->mtime contains the
 	 * modification time of the newest child, we need to find out if we
 	 * exist and when we were modified last. The criteria for datedness
-	 * are defined by the Make_OODate function.
+	 * are defined by GNode_IsOODate.
 	 */
 	DEBUG1(MAKE, "Examining %s...", gn->name);
-	if (!Make_OODate(gn)) {
+	if (!GNode_IsOODate(gn)) {
 	gn->made = UPTODATE;
 	DEBUG0(MAKE, "up-to-date.\n");
 	goto cohorts;

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.189 src/usr.bin/make/make.c:1.190
--- src/usr.bin/make/make.c:1.189	Sun Nov  8 08:26:22 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 08:33:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.189 2020/11/08 08:26:22 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.190 2020/11/08 08:33:07 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -95,7 +95,7 @@
  *			sure that any variable that needs to exist
  *			at the very least has the empty value.
  *
- *	Make_OODate	Determine if a target is out-of-date.
+ *	GNode_IsOODate	Determine if a target is out-of-date.
  *
  *	Make_HandleUse	See if a child is a .USE node for a parent
  *			and perform the .USE actions if so.
@@ -108,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.189 2020/11/08 08:26:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.190 2020/11/08 08:33:07 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -204,7 +204,7 @@ GNode_UpdateYoungestChild(GNode *gn, GNo
  * may be changed.
  */
 Boolean
-Make_OODate(GNode *gn)
+GNode_IsOODate(GNode *gn)
 {
 Boolean oodate;
 
@@ -962,7 +962,7 @@ MakeStartJobs(void)
 	}
 
 	gn->made = BEINGMADE;
-	if (Make_OODate(gn)) {
+	if (GNode_IsOODate(gn)) {
 	DEBUG0(MAKE, "out-of-date\n");
 	if (opts.queryFlag) {
 		return TRUE;

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.199 src/usr.bin/make/make.h:1.200
--- src/usr.bin/make/make.h:1.199	Sun Nov  8 08:26:22 2020
+++ src/usr.bin/make/make.h	Sun Nov  8 08:33:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.199 2020/11/08 08:26:22 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.200 2020/11/08 08:33:07 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -324,7 +324,7 @@ typedef struct GNode {
 int 

CVS commit: src/usr.bin/make

2020-11-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 08:26:22 UTC 2020

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

Log Message:
make(1): rename Make_TimeStamp to GNode_UpdateYoungestChild


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/usr.bin/make/compat.c
cvs rdiff -u -r1.188 -r1.189 src/usr.bin/make/make.c
cvs rdiff -u -r1.198 -r1.199 src/usr.bin/make/make.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.179 src/usr.bin/make/compat.c:1.180
--- src/usr.bin/make/compat.c:1.179	Sat Nov  7 14:32:12 2020
+++ src/usr.bin/make/compat.c	Sun Nov  8 08:26:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.179 2020/11/07 14:32:12 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.180 2020/11/08 08:26:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*	"@(#)compat.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: compat.c,v 1.179 2020/11/07 14:32:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.180 2020/11/08 08:26:22 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -570,7 +570,7 @@ Compat_Make(GNode *gn, GNode *pgn)
 		pgn->flags |= FORCE;
 	if (!(gn->type & OP_EXEC)) {
 		pgn->flags |= CHILDMADE;
-		Make_TimeStamp(pgn, gn);
+		GNode_UpdateYoungestChild(pgn, gn);
 	}
 	} else if (opts.keepgoing) {
 	pgn->flags &= ~(unsigned)REMAKE;
@@ -595,12 +595,12 @@ Compat_Make(GNode *gn, GNode *pgn)
 	case MADE:
 		if (!(gn->type & OP_EXEC)) {
 		pgn->flags |= CHILDMADE;
-		Make_TimeStamp(pgn, gn);
+		GNode_UpdateYoungestChild(pgn, gn);
 		}
 		break;
 	case UPTODATE:
 		if (!(gn->type & OP_EXEC))
-		Make_TimeStamp(pgn, gn);
+		GNode_UpdateYoungestChild(pgn, gn);
 		break;
 	default:
 		break;

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.188 src/usr.bin/make/make.c:1.189
--- src/usr.bin/make/make.c:1.188	Sat Nov  7 21:22:37 2020
+++ src/usr.bin/make/make.c	Sun Nov  8 08:26:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.188 2020/11/07 21:22:37 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.189 2020/11/08 08:26:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -86,8 +86,9 @@
  *			place the parent on the toBeMade queue if it
  *			should be.
  *
- *	Make_TimeStamp	Function to set the parent's youngestChild field
- *			based on a child's modification time.
+ *	GNode_UpdateYoungestChild
+ *			Update the node's youngestChild field based on the
+ *			child's modification time.
  *
  *	Make_DoAllVar	Set up the various local variables for a
  *			target, including the .ALLSRC variable, making
@@ -107,7 +108,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.188 2020/11/07 21:22:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.189 2020/11/08 08:26:22 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -185,11 +186,10 @@ GNode_ShouldExecute(GNode *gn)
 
 /* Update the youngest child of the node, according to the given child. */
 void
-Make_TimeStamp(GNode *pgn, GNode *cgn)
+GNode_UpdateYoungestChild(GNode *gn, GNode *cgn)
 {
-if (pgn->youngestChild == NULL || cgn->mtime > pgn->youngestChild->mtime) {
-	pgn->youngestChild = cgn;
-}
+if (gn->youngestChild == NULL || cgn->mtime > gn->youngestChild->mtime)
+	gn->youngestChild = cgn;
 }
 
 /* See if the node is out of date with respect to its sources.
@@ -331,7 +331,7 @@ Make_OODate(GNode *gn)
 if (!oodate) {
 	GNodeListNode *ln;
 	for (ln = gn->parents->first; ln != NULL; ln = ln->next)
-	Make_TimeStamp(ln->datum, gn);
+	GNode_UpdateYoungestChild(ln->datum, gn);
 }
 
 return oodate;
@@ -367,7 +367,7 @@ MakeFindChild(void *gnp, void *pgnp)
 GNode *pgn = pgnp;
 
 (void)Dir_MTime(gn, 0);
-Make_TimeStamp(pgn, gn);
+GNode_UpdateYoungestChild(pgn, gn);
 pgn->unmade--;
 
 return 0;
@@ -672,10 +672,10 @@ Make_Update(GNode *cgn)
 	continue;
 	}
 
-	if ( ! (cgn->type & (OP_EXEC|OP_USE|OP_USEBEFORE))) {
+	if (!(cgn->type & (OP_EXEC | OP_USE | OP_USEBEFORE))) {
 	if (cgn->made == MADE)
 		pgn->flags |= CHILDMADE;
-	(void)Make_TimeStamp(pgn, cgn);
+	GNode_UpdateYoungestChild(pgn, cgn);
 	}
 
 	/*

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.198 src/usr.bin/make/make.h:1.199
--- src/usr.bin/make/make.h:1.198	Sun Nov  8 01:39:24 2020
+++ src/usr.bin/make/make.h	Sun Nov  8 08:26:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.198 2020/11/08 01:39:24 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.199 2020/11/08 08:26:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -636,7 +636,7 @@ extern CmdOpts opts;
 
 #include "nonints.h"
 
-void Make_TimeStamp(GNode *, GNode *);
+void 

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

2020-11-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Nov  8 08:12:17 UTC 2020

Modified Files:
src/sys/arch/riscv/riscv: locore.S

Log Message:
Fix a typo


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/riscv/riscv/locore.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/arch/riscv/riscv/locore.S
diff -u src/sys/arch/riscv/riscv/locore.S:1.18 src/sys/arch/riscv/riscv/locore.S:1.19
--- src/sys/arch/riscv/riscv/locore.S:1.18	Sun Nov  8 08:11:15 2020
+++ src/sys/arch/riscv/riscv/locore.S	Sun Nov  8 08:12:17 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.18 2020/11/08 08:11:15 skrll Exp $ */
+/* $NetBSD: locore.S,v 1.19 2020/11/08 08:12:17 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@ ENTRY_NP(start)
 #ifdef _LP64
 	add	s3, s2, s10		// s3 = second PDE page (RV64 only)
 #else
-	mv	s3, 22
+	mv	s3, s2
 #endif
 	add	s4, s3, s10		// s4 = first kernel PTE page
 	add	s5, s1, s9		// s5 = kernel_end



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

2020-11-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Nov  8 08:11:15 UTC 2020

Modified Files:
src/sys/arch/riscv/riscv: locore.S

Log Message:
Remove unnecessary local labels


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/riscv/riscv/locore.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/arch/riscv/riscv/locore.S
diff -u src/sys/arch/riscv/riscv/locore.S:1.17 src/sys/arch/riscv/riscv/locore.S:1.18
--- src/sys/arch/riscv/riscv/locore.S:1.17	Sun Nov  8 08:07:43 2020
+++ src/sys/arch/riscv/riscv/locore.S	Sun Nov  8 08:11:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.17 2020/11/08 08:07:43 skrll Exp $ */
+/* $NetBSD: locore.S,v 1.18 2020/11/08 08:11:15 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@ ENTRY_NP(start)
 	// As a temporary hack, word 0 contains the amount of memory in MB
 	INT_L	a7, (zero)		// load memory size
 	slli	a7, a7, (20-PGSHIFT)	// convert MB to pages
-.L01:	PTR_LA	t0, physmem
+	PTR_LA	t0, physmem
 	INT_S	a7, (t0)		// store it in physmem
 
 	li	t4, PTE_V | PTE_SX | PTE_SW | PTE_SR | PTE_G
@@ -440,7 +440,7 @@ _C_LABEL(exception_userexit):
 	j	exception_kernexit
 
 trap_syscall:
-.L0:	PTR_LA	ra, exception_userexit
+	PTR_LA	ra, exception_userexit
 	PTR_L	t0, L_PROC(tp)		// get proc struct
 	PTR_L	t0, P_MD_SYSCALL(t0)	// get syscall address from proc
 	jr	t0			// and jump to it



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

2020-11-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Nov  8 08:07:43 UTC 2020

Modified Files:
src/sys/arch/riscv/riscv: locore.S

Log Message:
Use correct instruction to load address of exception_userexit into RA


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/riscv/riscv/locore.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/arch/riscv/riscv/locore.S
diff -u src/sys/arch/riscv/riscv/locore.S:1.16 src/sys/arch/riscv/riscv/locore.S:1.17
--- src/sys/arch/riscv/riscv/locore.S:1.16	Wed Nov  4 20:05:47 2020
+++ src/sys/arch/riscv/riscv/locore.S	Sun Nov  8 08:07:43 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.16 2020/11/04 20:05:47 skrll Exp $ */
+/* $NetBSD: locore.S,v 1.17 2020/11/08 08:07:43 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -440,7 +440,7 @@ _C_LABEL(exception_userexit):
 	j	exception_kernexit
 
 trap_syscall:
-.L0:	PTR_L	ra, exception_userexit
+.L0:	PTR_LA	ra, exception_userexit
 	PTR_L	t0, L_PROC(tp)		// get proc struct
 	PTR_L	t0, P_MD_SYSCALL(t0)	// get syscall address from proc
 	jr	t0			// and jump to it