CVS commit: src

2020-10-23 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Oct 24 05:01:58 UTC 2020

Modified Files:
src/distrib/sets/lists/base: mi
src/distrib/sets/lists/comp: mi
src/external/gpl3/gdb/bin/gdb: Makefile

Log Message:
Install the NetBSD XML syscall definitions


To generate a diff of this commit:
cvs rdiff -u -r1.1266 -r1.1267 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.2361 -r1.2362 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.18 -r1.19 src/external/gpl3/gdb/bin/gdb/Makefile

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1266 src/distrib/sets/lists/base/mi:1.1267
--- src/distrib/sets/lists/base/mi:1.1266	Thu Oct  8 14:22:21 2020
+++ src/distrib/sets/lists/base/mi	Sat Oct 24 05:01:57 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1266 2020/10/08 14:22:21 skrll Exp $
+# $NetBSD: mi,v 1.1267 2020/10/24 05:01:57 kamil Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -2366,6 +2366,8 @@
 ./usr/share/games/fortune			base-games-share
 ./usr/share/games/larnbase-games-share
 ./usr/share/games/quiz.db			base-games-share
+./usr/share/gdb	base-util-share
+./usr/share/gdb/syscalls			base-util-share
 ./usr/share/gnatsbase-gnats-share
 ./usr/share/gnats/netbsd			base-gnats-share	share
 ./usr/share/gnats/send-pr.el			base-gnats-share	share

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2361 src/distrib/sets/lists/comp/mi:1.2362
--- src/distrib/sets/lists/comp/mi:1.2361	Sat Oct  3 18:33:52 2020
+++ src/distrib/sets/lists/comp/mi	Sat Oct 24 05:01:57 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2361 2020/10/03 18:33:52 christos Exp $
+#	$NetBSD: mi,v 1.2362 2020/10/24 05:01:57 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -4154,6 +4154,7 @@
 ./usr/sbin/gspahextoccomp-obsolete		obsolete
 ./usr/sbin/kgmoncomp-debug-sbin
 ./usr/share/examples/openssl/CA.sh		comp-obsolete	openssl=11,obsolete
+./usr/share/gdb/syscalls/netbsd.xml		comp-debug-bin		gdb=1100
 ./usr/share/ldscripts/elf32_sparc.x		comp-obsolete		obsolete
 ./usr/share/ldscripts/elf32_sparc.xbn		comp-obsolete		obsolete
 ./usr/share/ldscripts/elf32_sparc.xn		comp-obsolete		obsolete

Index: src/external/gpl3/gdb/bin/gdb/Makefile
diff -u src/external/gpl3/gdb/bin/gdb/Makefile:1.18 src/external/gpl3/gdb/bin/gdb/Makefile:1.19
--- src/external/gpl3/gdb/bin/gdb/Makefile:1.18	Thu Sep 17 20:26:22 2020
+++ src/external/gpl3/gdb/bin/gdb/Makefile	Sat Oct 24 05:01:57 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.18 2020/09/17 20:26:22 christos Exp $
+#	$NetBSD: Makefile,v 1.19 2020/10/24 05:01:57 kamil Exp $
 
 NOCTF=
 .include 
@@ -41,6 +41,9 @@ gdb-cfg.texi: ${DIST}/gdb/doc/all-cfg.te
 CLEANFILES+= GDBvn.texi gdb-cfg.texi
 stabs.info gdb.info: gdb-cfg.texi GDBvn.texi
 
+FILES=		netbsd.xml
+FILESDIR=	/usr/share/gdb/syscalls
+
 .include "../../Makefile.inc"
 .include 
 
@@ -109,4 +112,5 @@ CC:=			${CXX}
 CFLAGS:=		${CXXFLAGS} -std=gnu++11 -Wno-error=stack-protector
 
 .PATH: ${DIST}/gdb ${DIST}/gdb/mi ${DIST}/gdb/cli ${DIST}/gdb/tui \
-${DIST}/gdb/signals ${DIST}/gdb/doc ${.CURDIR}/../arch/${GDB_MACHINE_ARCH}
+${DIST}/gdb/signals ${DIST}/gdb/syscalls ${DIST}/gdb/doc \
+${.CURDIR}/../arch/${GDB_MACHINE_ARCH}



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct 24 04:51:19 UTC 2020

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

Log Message:
make(1): clean up comments in cond.c


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 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.167 src/usr.bin/make/cond.c:1.168
--- src/usr.bin/make/cond.c:1.167	Fri Oct 23 18:36:09 2020
+++ src/usr.bin/make/cond.c	Sat Oct 24 04:51:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.167 2020/10/23 18:36:09 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.168 2020/10/24 04:51:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -72,12 +72,12 @@
 /* Handling of conditionals in a makefile.
  *
  * Interface:
- *	Cond_EvalLine	Evaluate the conditional in the passed line.
+ *	Cond_EvalLine	Evaluate the conditional.
  *
  *	Cond_EvalCondition
- *			Evaluate the conditional in the passed line, which
- *			is either the argument of one of the .if directives
- *			or the condition in a :?true:false variable modifier.
+ *			Evaluate the conditional, which is either the argument
+ *			of one of the .if directives or the condition in a
+ *			':?then:else' variable modifier.
  *
  *	Cond_save_depth
  *	Cond_restore_depth
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.167 2020/10/23 18:36:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.168 2020/10/24 04:51:19 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:



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

2020-10-23 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Sat Oct 24 04:47:43 UTC 2020

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

Log Message:
Add new tests and check files for libcurses from the Google Summoer of Code
project.


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

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.950 src/distrib/sets/lists/tests/mi:1.951
--- src/distrib/sets/lists/tests/mi:1.950	Sat Oct 24 02:25:02 2020
+++ src/distrib/sets/lists/tests/mi	Sat Oct 24 04:47:43 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.950 2020/10/24 02:25:02 rillig Exp $
+# $NetBSD: mi,v 1.951 2020/10/24 04:47:43 blymn Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3257,132 +3257,262 @@
 ./usr/tests/lib/libcurses/Atffile			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/Kyuafile			tests-lib-tests		compattestfile,atf,kyua
 ./usr/tests/lib/libcurses/check_files			tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/add_wch1.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/add_wch2.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/addch.chk			tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/addchstr.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/addchstr2.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/addstr.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/attributes.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/background1.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/background2.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/background3.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/background4.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/background5.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/bell.chk			tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/bkgdset1.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/box_standout.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/chgat1.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/chgat2.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/chgat3.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/clear1.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/clear10.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/clear2.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/clear3.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/clear4.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/clear5.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/clear6.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/clear7.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/clear8.chk		tests-lib-tests		compattestfile,atf
-./usr/tests/lib/libcurses/check_files/clear9.chk		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/add_wch1.chk	tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/add_wch2.chk	tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/add_wch3.chk	tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/addch.chk		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/addchstr.chk	tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/addchstr2.chk	tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/addchstr3.chk	tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/addnwstr1.chk	tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/addnwstr2.chk	tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/addstr.chk	tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/addwstr1.chk	tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/addwstr2.chk	tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/addwstr3.chk	tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/attributes.chk	tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/background1.chk	tests-lib-tests		compattestfile,atf

CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct 24 04:40:45 UTC 2020

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

Log Message:
make(1): clean up code style in compat.c


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

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

Modified files:

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.167 src/usr.bin/make/compat.c:1.168
--- src/usr.bin/make/compat.c:1.167	Fri Oct 23 19:48:17 2020
+++ src/usr.bin/make/compat.c	Sat Oct 24 04:40:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.167 2020/10/23 19:48:17 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.168 2020/10/24 04:40:45 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.167 2020/10/23 19:48:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.168 2020/10/24 04:40:45 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -175,7 +175,7 @@ CompatInterrupt(int signo)
  *	0 if the command succeeded, 1 if an error occurred.
  */
 int
-Compat_RunCommand(const char *cmdp, struct GNode *gn)
+Compat_RunCommand(const char *cmdp, GNode *gn)
 {
 char *cmdStart;		/* Start of expanded command */
 char *bp;
@@ -412,7 +412,7 @@ Compat_RunCommand(const char *cmdp, stru
 }
 
 
-if (!WIFEXITED(reason) || (status != 0)) {
+if (!WIFEXITED(reason) || status != 0) {
 	if (errCheck) {
 #ifdef USE_META
 	if (useMeta) {
@@ -421,16 +421,13 @@ Compat_RunCommand(const char *cmdp, stru
 #endif
 	gn->made = ERROR;
 	if (keepgoing) {
-		/*
-		 * Abort the current target, but let others continue.
-		 */
+		/* Abort the current target, but let others continue. */
 		printf(" (continuing)\n");
 	} else {
 		printf("\n");
 	}
-	if (deleteOnError) {
-		CompatDeleteTarget(gn);
-	}
+	if (deleteOnError)
+		CompatDeleteTarget(gn);
 	} else {
 	/*
 	 * Continue executing commands for this target.
@@ -544,12 +541,10 @@ Compat_Make(GNode *gn, GNode *pgn)
 	 * Alter our type to tell if errors should be ignored or things
 	 * should not be printed so CompatRunCommand knows what to do.
 	 */
-	if (Targ_Ignore(gn)) {
+	if (Targ_Ignore(gn))
 	gn->type |= OP_IGNORE;
-	}
-	if (Targ_Silent(gn)) {
+	if (Targ_Silent(gn))
 	gn->type |= OP_SILENT;
-	}
 
 	if (Job_CheckCommands(gn, Fatal)) {
 	/*
@@ -598,10 +593,7 @@ Compat_Make(GNode *gn, GNode *pgn)
 	exit(1);
 	}
 } else if (gn->made == ERROR) {
-	/*
-	 * Already had an error when making this beastie. Tell the parent
-	 * to abort.
-	 */
+	/* Already had an error when making this. Tell the parent to abort. */
 	pgn->flags &= ~(unsigned)REMAKE;
 } else {
 	if (Lst_FindDatum(gn->implicitParents, pgn) != NULL) {
@@ -650,18 +642,14 @@ Compat_Run(GNodeList *targs)
 if (!shellName)
 	Shell_Init();
 
-if (bmake_signal(SIGINT, SIG_IGN) != SIG_IGN) {
+if (bmake_signal(SIGINT, SIG_IGN) != SIG_IGN)
 	bmake_signal(SIGINT, CompatInterrupt);
-}
-if (bmake_signal(SIGTERM, SIG_IGN) != SIG_IGN) {
+if (bmake_signal(SIGTERM, SIG_IGN) != SIG_IGN)
 	bmake_signal(SIGTERM, CompatInterrupt);
-}
-if (bmake_signal(SIGHUP, SIG_IGN) != SIG_IGN) {
+if (bmake_signal(SIGHUP, SIG_IGN) != SIG_IGN)
 	bmake_signal(SIGHUP, CompatInterrupt);
-}
-if (bmake_signal(SIGQUIT, SIG_IGN) != SIG_IGN) {
+if (bmake_signal(SIGQUIT, SIG_IGN) != SIG_IGN)
 	bmake_signal(SIGQUIT, CompatInterrupt);
-}
 
 /* Create the .END node now, to keep the (debug) output of the
  * counter.mk test the same as before 2020-09-23.  This implementation



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct 24 04:31:53 UTC 2020

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

Log Message:
make(1): remove redundant parameter from meta_name


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/usr.bin/make/meta.c

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

Modified files:

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.127 src/usr.bin/make/meta.c:1.128
--- src/usr.bin/make/meta.c:1.127	Mon Oct 19 21:57:37 2020
+++ src/usr.bin/make/meta.c	Sat Oct 24 04:31:53 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: meta.c,v 1.127 2020/10/19 21:57:37 rillig Exp $ */
+/*  $NetBSD: meta.c,v 1.128 2020/10/24 04:31:53 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -236,7 +236,7 @@ eat_dots(char *buf, size_t bufsz, int do
 }
 
 static char *
-meta_name(struct GNode *gn, char *mname, size_t mnamelen,
+meta_name(char *mname, size_t mnamelen,
 	  const char *dname,
 	  const char *tname,
 	  const char *cwd)
@@ -510,7 +510,7 @@ meta_create(BuildMon *pbm, GNode *gn)
 	/* Don't create meta data. */
 	goto out;
 
-fname = meta_name(gn, pbm->meta_fname, sizeof(pbm->meta_fname),
+fname = meta_name(pbm->meta_fname, sizeof(pbm->meta_fname),
 		  dname, tname, objdir);
 
 #ifdef DEBUG_META_MODE
@@ -1113,7 +1113,7 @@ meta_oodate(GNode *gn, Boolean oodate)
  */
 Make_DoAllVar(gn);
 
-meta_name(gn, fname, sizeof(fname), dname, tname, dname);
+meta_name(fname, sizeof(fname), dname, tname, dname);
 
 #ifdef DEBUG_META_MODE
 DEBUG1(META, "meta_oodate: %s\n", fname);



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct 24 04:27:24 UTC 2020

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

Log Message:
make(1): clean up comments in buf.c


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/make/buf.c

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

Modified files:

Index: src/usr.bin/make/buf.c
diff -u src/usr.bin/make/buf.c:1.40 src/usr.bin/make/buf.c:1.41
--- src/usr.bin/make/buf.c:1.40	Sun Sep 27 16:59:02 2020
+++ src/usr.bin/make/buf.c	Sat Oct 24 04:27:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.c,v 1.40 2020/09/27 16:59:02 rillig Exp $	*/
+/*	$NetBSD: buf.c,v 1.41 2020/10/24 04:27:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -69,15 +69,15 @@
  * SUCH DAMAGE.
  */
 
-/* Functions for automatically-expanded null-terminated buffers. */
+/* Automatically-expanding null-terminated buffers. */
 
 #include 
 #include "make.h"
 
 /*	"@(#)buf.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: buf.c,v 1.40 2020/09/27 16:59:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: buf.c,v 1.41 2020/10/24 04:27:24 rillig Exp $");
 
-/* Extend the buffer for adding a single byte. */
+/* Make space in the buffer for adding a single byte. */
 void
 Buf_Expand_1(Buffer *buf)
 {
@@ -85,7 +85,7 @@ Buf_Expand_1(Buffer *buf)
 buf->data = bmake_realloc(buf->data, buf->cap);
 }
 
-/* Add the given bytes to the buffer. */
+/* Add the bytes to the buffer. */
 void
 Buf_AddBytes(Buffer *buf, const char *bytes, size_t bytes_len)
 {
@@ -110,14 +110,14 @@ Buf_AddBytesBetween(Buffer *buf, const c
 Buf_AddBytes(buf, start, (size_t)(end - start));
 }
 
-/* Add the given string to the buffer. */
+/* Add the string to the buffer. */
 void
 Buf_AddStr(Buffer *buf, const char *str)
 {
 Buf_AddBytes(buf, str, strlen(str));
 }
 
-/* Add the given number to the buffer. */
+/* Add the number to the buffer. */
 void
 Buf_AddInt(Buffer *buf, int n)
 {
@@ -138,8 +138,7 @@ Buf_AddInt(Buffer *buf, int n)
  * The returned data is valid until the next modifying operation
  * on the buffer.
  *
- * Returns the pointer to the data and optionally the length of the
- * data in the buffer. */
+ * Returns the data and optionally the length of the data. */
 char *
 Buf_GetAll(Buffer *buf, size_t *out_len)
 {



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct 24 04:20:50 UTC 2020

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

Log Message:
make(1): clean up code layout in arch.c

Combining #ifdef with else if is bad style.  Mixing spaces and tabs in
indentation is bad style as well.

The generated code stays exactly the same.


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

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

Modified files:

Index: src/usr.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.144 src/usr.bin/make/arch.c:1.145
--- src/usr.bin/make/arch.c:1.144	Sat Oct 24 04:03:04 2020
+++ src/usr.bin/make/arch.c	Sat Oct 24 04:20:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.144 2020/10/24 04:03:04 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.145 2020/10/24 04:20:50 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include"config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.144 2020/10/24 04:03:04 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.145 2020/10/24 04:20:50 rillig Exp $");
 
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
@@ -744,6 +744,7 @@ ArchFindMember(const char *archive, cons
 }
 
 while (fread((char *)arhPtr, sizeof(struct ar_hdr), 1, arch) == 1) {
+
 	if (strncmp(arhPtr->ar_fmag, ARFMAG, sizeof(arhPtr->ar_fmag)) != 0) {
 	/*
 	 * The header is bogus, so the archive is bad
@@ -751,7 +752,9 @@ ArchFindMember(const char *archive, cons
 	 */
 	fclose(arch);
 	return NULL;
-	} else if (strncmp(member, arhPtr->ar_name, tlen) == 0) {
+	}
+
+	if (strncmp(member, arhPtr->ar_name, tlen) == 0) {
 	/*
 	 * If the member's name doesn't take up the entire 'name' field,
 	 * we have to be careful of matching prefixes. Names are space-
@@ -759,80 +762,76 @@ ArchFindMember(const char *archive, cons
 	 * of the matched string is anything but a space, this isn't the
 	 * member we sought.
 	 */
-	if (tlen != sizeof(arhPtr->ar_name) &&
-		arhPtr->ar_name[tlen] != ' ') {
+	if (tlen != sizeof arhPtr->ar_name && arhPtr->ar_name[tlen] != ' ')
 		goto skip;
-	} else {
-		/*
-		 * To make life easier, we reposition the file at the start
-		 * of the header we just read before we return the stream.
-		 * In a more general situation, it might be better to leave
-		 * the file at the actual member, rather than its header, but
-		 * not here...
-		 */
-		if (fseek(arch, -(long)sizeof(struct ar_hdr), SEEK_CUR) != 0) {
-		fclose(arch);
-		return NULL;
-		}
-		return arch;
+
+	/*
+	 * To make life easier, we reposition the file at the start
+	 * of the header we just read before we return the stream.
+	 * In a more general situation, it might be better to leave
+	 * the file at the actual member, rather than its header, but
+	 * not here...
+	 */
+	if (fseek(arch, -(long)sizeof(struct ar_hdr), SEEK_CUR) != 0) {
+		fclose(arch);
+		return NULL;
 	}
-	} else
+	return arch;
+	}
+
 #ifdef AR_EFMT1
-		/*
-		 * BSD 4.4 extended AR format: #1/, with name as the
-		 * first  bytes of the file
-		 */
-	if (strncmp(arhPtr->ar_name, AR_EFMT1,
-	sizeof(AR_EFMT1) - 1) == 0 &&
-		ch_isdigit(arhPtr->ar_name[sizeof(AR_EFMT1) - 1])) {
-
-		int elen = atoi(>ar_name[sizeof(AR_EFMT1)-1]);
-		char ename[MAXPATHLEN + 1];
-
-		if ((unsigned int)elen > MAXPATHLEN) {
-			fclose(arch);
-			return NULL;
-		}
-		if (fread(ename, (size_t)elen, 1, arch) != 1) {
-			fclose(arch);
-			return NULL;
-		}
-		ename[elen] = '\0';
-		if (DEBUG(ARCH) || DEBUG(MAKE)) {
-		debug_printf("ArchFind: Extended format entry for %s\n", ename);
-		}
-		if (strncmp(ename, member, len) == 0) {
-			/* Found as extended name */
-			if (fseek(arch, -(long)sizeof(struct ar_hdr) - elen,
-SEEK_CUR) != 0) {
-			fclose(arch);
-			return NULL;
-			}
-			return arch;
-		}
-		if (fseek(arch, -elen, SEEK_CUR) != 0) {
+	/*
+	 * BSD 4.4 extended AR format: #1/, with name as the
+	 * first  bytes of the file
+	 */
+	if (strncmp(arhPtr->ar_name, AR_EFMT1, sizeof(AR_EFMT1) - 1) == 0 &&
+	ch_isdigit(arhPtr->ar_name[sizeof(AR_EFMT1) - 1]))
+	{
+	int elen = atoi(>ar_name[sizeof(AR_EFMT1) - 1]);
+	char ename[MAXPATHLEN + 1];
+
+	if ((unsigned int)elen > MAXPATHLEN) {
+		fclose(arch);
+		return NULL;
+	}
+	if (fread(ename, (size_t)elen, 1, arch) != 1) {
+		fclose(arch);
+		return NULL;
+	}
+	ename[elen] = '\0';
+	if (DEBUG(ARCH) || DEBUG(MAKE)) {
+		debug_printf("ArchFind: Extended format entry for %s\n", ename);
+	}
+	if (strncmp(ename, member, len) == 0) {
+		/* Found as extended name */
+		if (fseek(arch, -(long)sizeof(struct ar_hdr) - elen,
+			  SEEK_CUR) != 0) {
 		fclose(arch);
 		return NULL;
 		}
-		goto skip;
-	} else
-#endif
-	{
-skip:
-	/*
-	 * This isn't the member we're after, so we need to 

CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct 24 04:03:04 UTC 2020

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

Log Message:
make(1): fix local variable name for determining the basename


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/usr.bin/make/arch.c

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

Modified files:

Index: src/usr.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.143 src/usr.bin/make/arch.c:1.144
--- src/usr.bin/make/arch.c:1.143	Sat Oct 24 04:00:56 2020
+++ src/usr.bin/make/arch.c	Sat Oct 24 04:03:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.143 2020/10/24 04:00:56 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.144 2020/10/24 04:03:04 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include"config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.143 2020/10/24 04:00:56 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.144 2020/10/24 04:03:04 rillig Exp $");
 
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
@@ -431,9 +431,9 @@ ArchStatMember(const char *archive, cons
  * Because of space constraints and similar things, files are archived
  * using their basename, not the entire path.
  */
-const char *base = strrchr(member, '/');
-if (base != NULL)
-	member = base + 1;
+const char *lastSlash = strrchr(member, '/');
+if (lastSlash != NULL)
+	member = lastSlash + 1;
 
 for (ln = archives->first; ln != NULL; ln = ln->next) {
 	const Arch *archPtr = ln->datum;
@@ -714,7 +714,7 @@ ArchFindMember(const char *archive, cons
 int size;			/* Size of archive member */
 char magic[SARMAG];
 size_t len, tlen;
-const char *base;
+const char *lastSlash;
 
 arch = fopen(archive, mode);
 if (arch == NULL)
@@ -734,9 +734,9 @@ ArchFindMember(const char *archive, cons
  * Because of space constraints and similar things, files are archived
  * using their basename, not the entire path.
  */
-base = strrchr(member, '/');
-if (base != NULL)
-	member = base + 1;
+lastSlash = strrchr(member, '/');
+if (lastSlash != NULL)
+	member = lastSlash + 1;
 
 len = tlen = strlen(member);
 if (len > sizeof(arhPtr->ar_name)) {



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct 24 04:00:56 UTC 2020

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

Log Message:
make(1): clean up comments and braces in arch.c


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/usr.bin/make/arch.c

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

Modified files:

Index: src/usr.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.142 src/usr.bin/make/arch.c:1.143
--- src/usr.bin/make/arch.c:1.142	Sat Oct 24 03:48:09 2020
+++ src/usr.bin/make/arch.c	Sat Oct 24 04:00:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.142 2020/10/24 03:48:09 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.143 2020/10/24 04:00:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include"config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.142 2020/10/24 03:48:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.143 2020/10/24 04:00:56 rillig Exp $");
 
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
@@ -403,25 +403,16 @@ Arch_ParseArchive(char **linePtr, GNodeL
 return TRUE;
 }
 
-/*-
- *---
- * ArchStatMember --
- *	Locate a member of an archive, given the path of the archive and
- *	the path of the desired member.
+/* Locate a member of an archive, given the path of the archive and the path
+ * of the desired member.
  *
  * Input:
  *	archive		Path to the archive
- *	member		Name of member. If it is a path, only the last
- *			component is used.
+ *	member		Name of member; only its basename is used.
  *	hash		TRUE if archive should be hashed if not already so.
  *
  * Results:
- *	A pointer to the current struct ar_hdr structure for the member. Note
- *	That no position is returned, so this is not useful for touching
- *	archive members. This is mostly because we have no assurances that
- *	The archive will remain constant after we read all the headers, so
- *	there's not much point in remembering the position...
- *---
+ *	The ar_hdr for the member.
  */
 static struct ar_hdr *
 ArchStatMember(const char *archive, const char *member, Boolean hash)
@@ -438,14 +429,11 @@ ArchStatMember(const char *archive, cons
 
 /*
  * Because of space constraints and similar things, files are archived
- * using their final path components, not the entire thing, so we need
- * to point 'member' to the final component, if there is one, to make
- * the comparisons easier...
+ * using their basename, not the entire path.
  */
 const char *base = strrchr(member, '/');
-if (base != NULL) {
+if (base != NULL)
 	member = base + 1;
-}
 
 for (ln = archives->first; ln != NULL; ln = ln->next) {
 	const Arch *archPtr = ln->datum;
@@ -486,13 +474,11 @@ ArchStatMember(const char *archive, cons
 	static struct ar_hdr sarh;
 
 	arch = ArchFindMember(archive, member, , "r");
-
-	if (arch == NULL) {
+	if (arch == NULL)
 	return NULL;
-	} else {
-	fclose(arch);
-	return 
-	}
+
+	fclose(arch);
+	return 
 }
 
 /*
@@ -500,9 +486,8 @@ ArchStatMember(const char *archive, cons
  * everything that's in it and cache it so we can get at it quickly.
  */
 arch = fopen(archive, "r");
-if (arch == NULL) {
+if (arch == NULL)
 	return NULL;
-}
 
 /*
  * We use the ARMAG string to make sure this is an archive we
@@ -732,9 +717,8 @@ ArchFindMember(const char *archive, cons
 const char *base;
 
 arch = fopen(archive, mode);
-if (arch == NULL) {
+if (arch == NULL)
 	return NULL;
-}
 
 /*
  * We use the ARMAG string to make sure this is an archive we
@@ -748,14 +732,12 @@ ArchFindMember(const char *archive, cons
 
 /*
  * Because of space constraints and similar things, files are archived
- * using their final path components, not the entire thing, so we need
- * to point 'member' to the final component, if there is one, to make
- * the comparisons easier...
+ * using their basename, not the entire path.
  */
 base = strrchr(member, '/');
-if (base != NULL) {
+if (base != NULL)
 	member = base + 1;
-}
+
 len = tlen = strlen(member);
 if (len > sizeof(arhPtr->ar_name)) {
 	tlen = sizeof(arhPtr->ar_name);



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct 24 03:48:09 UTC 2020

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

Log Message:
make(1): make Arch_ParseArchive simpler

Neither '\0' nor ')' have ever been space characters.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/usr.bin/make/arch.c

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

Modified files:

Index: src/usr.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.141 src/usr.bin/make/arch.c:1.142
--- src/usr.bin/make/arch.c:1.141	Sat Oct 24 03:45:02 2020
+++ src/usr.bin/make/arch.c	Sat Oct 24 03:48:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.141 2020/10/24 03:45:02 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.142 2020/10/24 03:48:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include"config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.141 2020/10/24 03:45:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.142 2020/10/24 03:48:09 rillig Exp $");
 
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
@@ -255,9 +255,8 @@ Arch_ParseArchive(char **linePtr, GNodeL
 	 */
 	Boolean doSubst = FALSE; /* TRUE if need to substitute in memName */
 
-	while (*cp != '\0' && *cp != ')' && ch_isspace(*cp)) {
-	cp++;
-	}
+	pp_skip_whitespace();
+
 	memName = cp;
 	while (*cp != '\0' && *cp != ')' && !ch_isspace(*cp)) {
 	if (*cp == '$') {



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct 24 03:45:02 UTC 2020

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

Log Message:
make(1): remove lengthy comments from archive handling

The relevant information is already documented on OP_ARCHV, but only
since a few weeks.


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/usr.bin/make/arch.c
cvs rdiff -u -r1.168 -r1.169 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.140 src/usr.bin/make/arch.c:1.141
--- src/usr.bin/make/arch.c:1.140	Fri Oct 23 19:48:17 2020
+++ src/usr.bin/make/arch.c	Sat Oct 24 03:45:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.140 2020/10/23 19:48:17 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.141 2020/10/24 03:45:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include"config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.140 2020/10/23 19:48:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.141 2020/10/24 03:45:02 rillig Exp $");
 
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
@@ -345,17 +345,12 @@ Arch_ParseArchive(char **linePtr, GNodeL
 		Lst_Append(nodeLst, gn);
 
 	} else if (!Arch_ParseArchive(, nodeLst, ctxt)) {
-		/*
-		 * Error in nested call -- free buffer and return FALSE
-		 * ourselves.
-		 */
+		/* Error in nested call. */
 		free(buf);
 		return FALSE;
 	}
-	/*
-	 * Free buffer and continue with our work.
-	 */
 	free(buf);
+
 	} else if (Dir_HasWildcards(memName)) {
 	StringList *members = Lst_New();
 	Dir_Expand(memName, dirSearchPath, members);
@@ -368,17 +363,11 @@ Arch_ParseArchive(char **linePtr, GNodeL
 		gn = Targ_GetNode(fullname);
 		free(fullname);
 
-		/*
-		 * We've found the node, but have to make sure the rest of
-		 * the world knows it's an archive member, without having
-		 * to constantly check for parentheses, so we type the
-		 * thing with the OP_ARCHV bit before we place it on the
-		 * end of the provided list.
-		 */
 		gn->type |= OP_ARCHV;
 		Lst_Append(nodeLst, gn);
 	}
 	Lst_Free(members);
+
 	} else {
 	char *fullname = str_concat4(libName, "(", memName, ")");
 	gn = Targ_GetNode(fullname);

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.168 src/usr.bin/make/make.h:1.169
--- src/usr.bin/make/make.h:1.168	Fri Oct 23 20:14:50 2020
+++ src/usr.bin/make/make.h	Sat Oct 24 03:45:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.168 2020/10/23 20:14:50 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.169 2020/10/24 03:45:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -254,12 +254,14 @@ typedef enum GNodeType {
 /* The node is a transformation rule */
 OP_TRANSFORM	= 1 << 31,
 /* Target is a member of an archive */
+/* XXX: How does this differ from OP_ARCHV? */
 OP_MEMBER		= 1 << 30,
-/* Target is a library;
- * the node's name has the form "-l" */
+/* The node is a library,
+ * its name has the form "-l" */
 OP_LIB		= 1 << 29,
-/* Target is an archive construct;
- * the node's name has the form "archive(member)" */
+/* The node is an archive member,
+ * its name has the form "archive(member)" */
+/* XXX: How does this differ from OP_MEMBER? */
 OP_ARCHV		= 1 << 28,
 /* Target has all the commands it should. Used when parsing to catch
  * multiple command groups for a target.  Only applies to the dependency



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct 24 03:30:26 UTC 2020

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

Log Message:
make(1): don't modify GNode name while rebuilding the suffix graph


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

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

Modified files:

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.220 src/usr.bin/make/suff.c:1.221
--- src/usr.bin/make/suff.c:1.220	Sat Oct 24 03:01:19 2020
+++ src/usr.bin/make/suff.c	Sat Oct 24 03:30:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.220 2020/10/24 03:01:19 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.221 2020/10/24 03:30:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -129,7 +129,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.220 2020/10/24 03:01:19 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.221 2020/10/24 03:30:25 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -244,11 +244,11 @@ SuffStrIsPrefix(const char *pref, const 
  * Results:
  *	NULL if it ain't, pointer to the start of suffix in str if it is.
  */
-static char *
-SuffSuffGetSuffix(const Suff *s, size_t nameLen, char *nameEnd)
+static const char *
+SuffSuffGetSuffix(const Suff *s, size_t nameLen, const char *nameEnd)
 {
-char *p1;			/* Pointer into suffix name */
-char *p2;			/* Pointer into string being examined */
+const char *p1;		/* Pointer into suffix name */
+const char *p2;		/* Pointer into string being examined */
 
 if (nameLen < s->nameLen)
 	return NULL;		/* this string is shorter than the suffix */
@@ -273,18 +273,24 @@ SuffSuffIsSuffix(const Suff *suff, size_
 }
 
 static Suff *
-FindSuffByName(const char *name)
+FindSuffByNameLen(const char *name, size_t nameLen)
 {
 SuffListNode *ln;
 
 for (ln = sufflist->first; ln != NULL; ln = ln->next) {
 	Suff *suff = ln->datum;
-	if (strcmp(suff->name, name) == 0)
+	if (suff->nameLen == nameLen && memcmp(suff->name, name, nameLen) == 0)
 	return suff;
 }
 return NULL;
 }
 
+static Suff *
+FindSuffByName(const char *name)
+{
+return FindSuffByNameLen(name, strlen(name));
+}
+
 static GNode *
 FindTransformByName(const char *name)
 {
@@ -608,17 +614,16 @@ Suff_EndTransform(GNode *gn)
 static void
 SuffRebuildGraph(GNode *transform, Suff *suff)
 {
-char *name = transform->name;
+const char *name = transform->name;
 size_t nameLen = strlen(name);
-char *prefixName;
-const char *suffixName;
+const char *toName;
 
 /*
  * First see if it is a transformation from this suffix.
  */
-suffixName = SuffStrIsPrefix(suff->name, name);
-if (suffixName != NULL) {
-	Suff *to = FindSuffByName(suffixName);
+toName = SuffStrIsPrefix(suff->name, name);
+if (toName != NULL) {
+	Suff *to = FindSuffByName(toName);
 	if (to != NULL) {
 	/* Link in and return, since it can't be anything else. */
 	SuffInsert(to->children, suff);
@@ -630,15 +635,9 @@ SuffRebuildGraph(GNode *transform, Suff 
 /*
  * Not from, maybe to?
  */
-prefixName = SuffSuffGetSuffix(suff, nameLen, name + nameLen);
-if (prefixName != NULL) {
-	Suff *from;
-
-	/* Null-terminate the source suffix in order to find it. */
-	/* XXX: don't modify strings, not even temporarily */
-	prefixName[0] = '\0';
-	from = FindSuffByName(name);
-	prefixName[0] = suff->name[0];	/* restore */
+toName = SuffSuffGetSuffix(suff, nameLen, name + nameLen);
+if (toName != NULL) {
+	Suff *from = FindSuffByNameLen(name, (size_t)(toName - name));
 
 	if (from != NULL) {
 	/* establish the proper relationship */



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

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct 24 03:18:22 UTC 2020

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

Log Message:
make(1): extend test suff-lookup.mk

This test ensures that FindSuffByName behaves correctly.

In order to convert some char pointers to const char pointers, there
needs to be FindSuffByNameLen, and to make sure that this function
actually uses the given length, this test has the suffixes ".sho" and
".short".  Without the proper string comparison in FindSuffByNameLen,
the suffix ".short" might be found when searching for ".sho".


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/suff-lookup.exp \
src/usr.bin/make/unit-tests/suff-lookup.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/suff-lookup.exp
diff -u src/usr.bin/make/unit-tests/suff-lookup.exp:1.1 src/usr.bin/make/unit-tests/suff-lookup.exp:1.2
--- src/usr.bin/make/unit-tests/suff-lookup.exp:1.1	Sat Oct 24 02:25:02 2020
+++ src/usr.bin/make/unit-tests/suff-lookup.exp	Sat Oct 24 03:18:22 2020
@@ -14,22 +14,36 @@ defining transformation from `.sho' to `
 inserting ".sho" (5) at end of list
 inserting ".c" (1) at end of list
 transformation .sho.c complete
+defining transformation from `.dead-end' to `.short'
+inserting ".dead-end" (6) at end of list
+inserting ".short" (4) at end of list
+transformation .dead-end.short complete
+inserting ".ccc" (3) at end of list
+inserting ".cc" (2) at end of list
+inserting ".c" (1) at end of list
+inserting ".ccc" (3) at end of list
+inserting ".short" (4) at end of list
+inserting ".c" (1) at end of list
+inserting ".sho" (5) at end of list
+inserting ".c" (1) at end of list
+inserting ".dead-end" (6) at end of list
+inserting ".short" (4) at end of list
 Wildcard expanding "all"...SuffFindDeps (all)
 	No known suffix on all. Using .NULL suffix
 adding suffix rules
-Wildcard expanding "suff-main.cc"...suffix is ".cc"...SuffFindDeps (suff-main.cc)
-	trying suff-main.ccc...not there
-	trying suff-main.c...not there
-	trying suff-main.short...not there
-	trying suff-main.sho...got it
-	applying .sho -> .c to "suff-main.c"
-	applying .c -> .ccc to "suff-main.ccc"
-	applying .ccc -> .cc to "suff-main.cc"
-suffix is ".ccc"...suffix is ".c"...suffix is ".sho"...SuffFindDeps (suff-main.sho)
-suffix is ".sho"...: 'Making suff-main.sho out of nothing.'
-: 'Making suff-main.c from suff-main.sho.'
-: 'Making suff-main.ccc from suff-main.c.'
-: 'Making suff-main.cc from suff-main.ccc.'
+Wildcard expanding "suff-lookup.cc"...suffix is ".cc"...SuffFindDeps (suff-lookup.cc)
+	trying suff-lookup.ccc...not there
+	trying suff-lookup.c...not there
+	trying suff-lookup.short...not there
+	trying suff-lookup.sho...got it
+	applying .sho -> .c to "suff-lookup.c"
+	applying .c -> .ccc to "suff-lookup.ccc"
+	applying .ccc -> .cc to "suff-lookup.cc"
+suffix is ".ccc"...suffix is ".c"...suffix is ".sho"...SuffFindDeps (suff-lookup.sho)
+suffix is ".sho"...: 'Making suff-lookup.sho out of nothing.'
+: 'Making suff-lookup.c from suff-lookup.sho.'
+: 'Making suff-lookup.ccc from suff-lookup.c.'
+: 'Making suff-lookup.cc from suff-lookup.ccc.'
 Wildcard expanding "all"...SuffFindDeps (.END)
 	No known suffix on .END. Using .NULL suffix
 adding suffix rules
Index: src/usr.bin/make/unit-tests/suff-lookup.mk
diff -u src/usr.bin/make/unit-tests/suff-lookup.mk:1.1 src/usr.bin/make/unit-tests/suff-lookup.mk:1.2
--- src/usr.bin/make/unit-tests/suff-lookup.mk:1.1	Sat Oct 24 02:25:02 2020
+++ src/usr.bin/make/unit-tests/suff-lookup.mk	Sat Oct 24 03:18:22 2020
@@ -1,4 +1,4 @@
-# $NetBSD: suff-lookup.mk,v 1.1 2020/10/24 02:25:02 rillig Exp $
+# $NetBSD: suff-lookup.mk,v 1.2 2020/10/24 03:18:22 rillig Exp $
 #
 # Demonstrate name resolution for suffixes.
 #
@@ -7,14 +7,14 @@
 
 .MAKEFLAGS: -ds
 
-all: suff-main.cc
+all: suff-lookup.cc
 
 .SUFFIXES: .c .cc .ccc
 
 # Register '.short' before '.sho'.  When searching for the transformation
 # '.sho.c', the suffix '.short' must not be found even though it starts with
 # the correct characters.
-.SUFFIXES: .short .sho
+.SUFFIXES: .short .sho .dead-end
 
 # From long to short suffix.
 .ccc.cc:
@@ -28,7 +28,13 @@ all: suff-main.cc
 	: 'Making ${.TARGET} from ${.IMPSRC}.'
 .sho.c:
 	: 'Making ${.TARGET} from ${.IMPSRC}.'
+.dead-end.short:
+	: 'Making ${.TARGET} from ${.IMPSRC}.'
 
-suff-main.sho:
+suff-lookup.sho:
 	: 'Making ${.TARGET} out of nothing.'
 
+# Deleting all suffixes and adding them again rebuilds all of the above
+# transformation rules.
+.SUFFIXES:
+.SUFFIXES: .c .cc .ccc .short .sho .dead-end



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct 24 03:01:19 UTC 2020

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

Log Message:
make(1): improve local variable names in SuffFindThem


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

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

Modified files:

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.219 src/usr.bin/make/suff.c:1.220
--- src/usr.bin/make/suff.c:1.219	Fri Oct 23 20:15:19 2020
+++ src/usr.bin/make/suff.c	Sat Oct 24 03:01:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.219 2020/10/23 20:15:19 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.220 2020/10/24 03:01:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -129,7 +129,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.219 2020/10/23 20:15:19 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.220 2020/10/24 03:01:19 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -978,48 +978,47 @@ SuffRemoveSrc(SrcList *l)
 static Src *
 SuffFindThem(SrcList *srcs, SrcList *slst)
 {
-Src*s;		/* current Src */
-Src		   *rs;		/* returned Src */
-char	   *ptr;
-
-rs = NULL;
+Src *retsrc = NULL;
 
 while (!Lst_IsEmpty(srcs)) {
-	s = Lst_Dequeue(srcs);
+	Src *src = Lst_Dequeue(srcs);
 
-	SUFF_DEBUG1("\ttrying %s...", s->file);
+	SUFF_DEBUG1("\ttrying %s...", src->file);
 
 	/*
 	 * A file is considered to exist if either a node exists in the
 	 * graph for it or the file actually exists.
 	 */
-	if (Targ_FindNode(s->file) != NULL) {
+	if (Targ_FindNode(src->file) != NULL) {
 #ifdef DEBUG_SRC
-	debug_printf("remove %p from %p\n", s, srcs);
+	debug_printf("remove %p from %p\n", src, srcs);
 #endif
-	rs = s;
+	retsrc = src;
 	break;
 	}
 
-	if ((ptr = Dir_FindFile(s->file, s->suff->searchPath)) != NULL) {
-	rs = s;
+	{
+	char *file = Dir_FindFile(src->file, src->suff->searchPath);
+	if (file != NULL) {
+		retsrc = src;
 #ifdef DEBUG_SRC
-	debug_printf("remove %p from %p\n", s, srcs);
+		debug_printf("remove %p from %p\n", src, srcs);
 #endif
-	free(ptr);
-	break;
+		free(file);
+		break;
+	}
 	}
 
 	SUFF_DEBUG0("not there\n");
 
-	SuffAddLevel(srcs, s);
-	Lst_Append(slst, s);
+	SuffAddLevel(srcs, src);
+	Lst_Append(slst, src);
 }
 
-if (rs) {
+if (retsrc) {
 	SUFF_DEBUG0("got it\n");
 }
-return rs;
+return retsrc;
 }
 
 /* See if any of the children of the target in the Src structure is one from



CVS commit: src

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct 24 02:25:02 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: suff-lookup.exp suff-lookup.mk

Log Message:
make(1): add test for looking up suffixes


To generate a diff of this commit:
cvs rdiff -u -r1.949 -r1.950 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.174 -r1.175 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/suff-lookup.exp \
src/usr.bin/make/unit-tests/suff-lookup.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.949 src/distrib/sets/lists/tests/mi:1.950
--- src/distrib/sets/lists/tests/mi:1.949	Fri Oct 23 19:54:35 2020
+++ src/distrib/sets/lists/tests/mi	Sat Oct 24 02:25:02 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.949 2020/10/23 19:54:35 rillig Exp $
+# $NetBSD: mi,v 1.950 2020/10/24 02:25:02 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4999,6 +4999,8 @@
 ./usr/tests/usr.bin/make/unit-tests/suff-clear-regular.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-clear-single.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-clear-single.mk			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-lookup.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-lookup.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-main.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-main.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-rebuild.exptests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.174 src/usr.bin/make/unit-tests/Makefile:1.175
--- src/usr.bin/make/unit-tests/Makefile:1.174	Fri Oct 23 19:54:35 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sat Oct 24 02:25:02 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.174 2020/10/23 19:54:35 rillig Exp $
+# $NetBSD: Makefile,v 1.175 2020/10/24 02:25:02 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -254,6 +254,7 @@ TESTS+=		shell-sh
 TESTS+=		suff-add-later
 TESTS+=		suff-clear-regular
 TESTS+=		suff-clear-single
+TESTS+=		suff-lookup
 TESTS+=		suff-main
 TESTS+=		suff-rebuild
 TESTS+=		suff-transform-endless

Added files:

Index: src/usr.bin/make/unit-tests/suff-lookup.exp
diff -u /dev/null src/usr.bin/make/unit-tests/suff-lookup.exp:1.1
--- /dev/null	Sat Oct 24 02:25:02 2020
+++ src/usr.bin/make/unit-tests/suff-lookup.exp	Sat Oct 24 02:25:02 2020
@@ -0,0 +1,37 @@
+defining transformation from `.ccc' to `.cc'
+inserting ".ccc" (3) at end of list
+inserting ".cc" (2) at end of list
+transformation .ccc.cc complete
+defining transformation from `.c' to `.ccc'
+inserting ".c" (1) at end of list
+inserting ".ccc" (3) at end of list
+transformation .c.ccc complete
+defining transformation from `.short' to `.c'
+inserting ".short" (4) at end of list
+inserting ".c" (1) at end of list
+transformation .short.c complete
+defining transformation from `.sho' to `.c'
+inserting ".sho" (5) at end of list
+inserting ".c" (1) at end of list
+transformation .sho.c complete
+Wildcard expanding "all"...SuffFindDeps (all)
+	No known suffix on all. Using .NULL suffix
+adding suffix rules
+Wildcard expanding "suff-main.cc"...suffix is ".cc"...SuffFindDeps (suff-main.cc)
+	trying suff-main.ccc...not there
+	trying suff-main.c...not there
+	trying suff-main.short...not there
+	trying suff-main.sho...got it
+	applying .sho -> .c to "suff-main.c"
+	applying .c -> .ccc to "suff-main.ccc"
+	applying .ccc -> .cc to "suff-main.cc"
+suffix is ".ccc"...suffix is ".c"...suffix is ".sho"...SuffFindDeps (suff-main.sho)
+suffix is ".sho"...: 'Making suff-main.sho out of nothing.'
+: 'Making suff-main.c from suff-main.sho.'
+: 'Making suff-main.ccc from suff-main.c.'
+: 'Making suff-main.cc from suff-main.ccc.'
+Wildcard expanding "all"...SuffFindDeps (.END)
+	No known suffix on .END. Using .NULL suffix
+adding suffix rules
+Wildcard expanding ".END"...
+exit status 0
Index: src/usr.bin/make/unit-tests/suff-lookup.mk
diff -u /dev/null src/usr.bin/make/unit-tests/suff-lookup.mk:1.1
--- /dev/null	Sat Oct 24 02:25:02 2020
+++ src/usr.bin/make/unit-tests/suff-lookup.mk	Sat Oct 24 02:25:02 2020
@@ -0,0 +1,34 @@
+# $NetBSD: suff-lookup.mk,v 1.1 2020/10/24 02:25:02 rillig Exp $
+#
+# Demonstrate name resolution for suffixes.
+#
+# See also:
+#	FindSuffByName
+
+.MAKEFLAGS: -ds
+
+all: suff-main.cc
+
+.SUFFIXES: .c .cc .ccc
+
+# Register '.short' before '.sho'.  When searching for the transformation
+# '.sho.c', the suffix '.short' must not be 

CVS commit: src/sys/arch/hppa/dev

2020-10-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Oct 23 22:14:47 UTC 2020

Modified Files:
src/sys/arch/hppa/dev: dino.c

Log Message:
support mmap()


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hppa/dev/dino.c

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

Modified files:

Index: src/sys/arch/hppa/dev/dino.c
diff -u src/sys/arch/hppa/dev/dino.c:1.9 src/sys/arch/hppa/dev/dino.c:1.10
--- src/sys/arch/hppa/dev/dino.c:1.9	Fri Oct 16 18:27:34 2020
+++ src/sys/arch/hppa/dev/dino.c	Fri Oct 23 22:14:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dino.c,v 1.9 2020/10/16 18:27:34 skrll Exp $ */
+/*	$NetBSD: dino.c,v 1.10 2020/10/23 22:14:47 macallan Exp $ */
 
 /*	$OpenBSD: dino.c,v 1.5 2004/02/13 20:39:31 mickey Exp $	*/
 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dino.c,v 1.9 2020/10/16 18:27:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dino.c,v 1.10 2020/10/23 22:14:47 macallan Exp $");
 
 /* #include "cardbus.h" */
 
@@ -617,7 +617,7 @@ dino_vaddr(void *v, bus_space_handle_t h
 paddr_t
 dino_mmap(void *v, bus_addr_t addr, off_t off, int prot, int flags)
 {
-	return -1;
+	return btop(addr + off);
 }
 
 uint8_t



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 20:15:20 UTC 2020

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

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


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

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

Modified files:

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.218 src/usr.bin/make/suff.c:1.219
--- src/usr.bin/make/suff.c:1.218	Fri Oct 23 18:36:09 2020
+++ src/usr.bin/make/suff.c	Fri Oct 23 20:15:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.218 2020/10/23 18:36:09 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.219 2020/10/23 20:15:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -129,7 +129,7 @@
 #include "dir.h"
 
 /*	"@(#)suff.c	8.4 (Berkeley) 3/21/94"	*/
-MAKE_RCSID("$NetBSD: suff.c,v 1.218 2020/10/23 18:36:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.219 2020/10/23 20:15:19 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -603,25 +603,26 @@ Suff_EndTransform(GNode *gn)
  *
  * Input:
  *	transform	Transformation to test
- *	s		Suffix to rebuild
+ *	suff		Suffix to rebuild
  */
 static void
-SuffRebuildGraph(GNode *transform, Suff *s)
+SuffRebuildGraph(GNode *transform, Suff *suff)
 {
 char *name = transform->name;
 size_t nameLen = strlen(name);
-char *cp;
+char *prefixName;
+const char *suffixName;
 
 /*
  * First see if it is a transformation from this suffix.
  */
-cp = UNCONST(SuffStrIsPrefix(s->name, name));
-if (cp != NULL) {
-	Suff *s2 = FindSuffByName(cp);
-	if (s2 != NULL) {
+suffixName = SuffStrIsPrefix(suff->name, name);
+if (suffixName != NULL) {
+	Suff *to = FindSuffByName(suffixName);
+	if (to != NULL) {
 	/* Link in and return, since it can't be anything else. */
-	SuffInsert(s2->children, s);
-	SuffInsert(s->parents, s2);
+	SuffInsert(to->children, suff);
+	SuffInsert(suff->parents, to);
 	return;
 	}
 }
@@ -629,20 +630,20 @@ SuffRebuildGraph(GNode *transform, Suff 
 /*
  * Not from, maybe to?
  */
-cp = SuffSuffGetSuffix(s, nameLen, name + nameLen);
-if (cp != NULL) {
-	Suff *s2;
+prefixName = SuffSuffGetSuffix(suff, nameLen, name + nameLen);
+if (prefixName != NULL) {
+	Suff *from;
 
 	/* Null-terminate the source suffix in order to find it. */
 	/* XXX: don't modify strings, not even temporarily */
-	cp[0] = '\0';
-	s2 = FindSuffByName(name);
-	cp[0] = s->name[0];		/* restore */
+	prefixName[0] = '\0';
+	from = FindSuffByName(name);
+	prefixName[0] = suff->name[0];	/* restore */
 
-	if (s2 != NULL) {
+	if (from != NULL) {
 	/* establish the proper relationship */
-	SuffInsert(s->children, s2);
-	SuffInsert(s2->parents, s);
+	SuffInsert(suff->children, from);
+	SuffInsert(from->parents, suff);
 	}
 }
 }



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 20:14:50 UTC 2020

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

Log Message:
make(1): fix typos in comments


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 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.167 src/usr.bin/make/make.h:1.168
--- src/usr.bin/make/make.h:1.167	Fri Oct 23 20:04:56 2020
+++ src/usr.bin/make/make.h	Fri Oct 23 20:14:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.167 2020/10/23 20:04:56 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.168 2020/10/23 20:14:50 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -428,13 +428,13 @@ extern SearchPath *dirSearchPath;
 extern Boolean	compatMake;	/* True if we are make compatible */
 extern Boolean	ignoreErrors;	/* True if should ignore all errors */
 extern Boolean  beSilent;	/* True if should print no commands */
-extern Boolean  noExecute;	/* True if should execute nothing */
+extern Boolean  noExecute;	/* True if should execute almost nothing */
 extern Boolean  noRecursiveExecute;
 /* True if should execute nothing */
 extern Boolean  allPrecious;	/* True if every target is precious */
 extern Boolean  deleteOnError;	/* True if failed targets should be deleted */
 extern Boolean  keepgoing;	/* True if should continue on unaffected
- * portions of the graph when have an error
+ * portions of the graph when an error occurs
  * in one portion */
 extern Boolean	touchFlag;	/* TRUE if targets should just be 'touched'
  * if out of date. Set by the -t flag */



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 20:04:56 UTC 2020

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

Log Message:
make(1): convert error level for Parse_Error to an enum


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/usr.bin/make/make.h
cvs rdiff -u -r1.145 -r1.146 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.397 -r1.398 src/usr.bin/make/parse.c

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

Modified files:

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.166 src/usr.bin/make/make.h:1.167
--- src/usr.bin/make/make.h:1.166	Fri Oct 23 19:48:17 2020
+++ src/usr.bin/make/make.h	Fri Oct 23 20:04:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.166 2020/10/23 19:48:17 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.167 2020/10/23 20:04:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -379,12 +379,14 @@ typedef struct GNode {
 
 /*
  * Error levels for parsing. PARSE_FATAL means the process cannot continue
- * once the makefile has been parsed. PARSE_WARNING means it can. Passed
- * as the first argument to Parse_Error.
+ * once the top-level makefile has been parsed. PARSE_WARNING and PARSE_INFO
+ * mean it can.
  */
-#define PARSE_INFO	3
-#define PARSE_WARNING	2
-#define PARSE_FATAL	1
+typedef enum ParseErrorLevel {
+PARSE_FATAL = 1,
+PARSE_WARNING,
+PARSE_INFO
+} ParseErrorLevel;
 
 /*
  * Values returned by Cond_EvalLine and Cond_EvalCondition.

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.145 src/usr.bin/make/nonints.h:1.146
--- src/usr.bin/make/nonints.h:1.145	Mon Oct 19 23:43:55 2020
+++ src/usr.bin/make/nonints.h	Fri Oct 23 20:04:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.145 2020/10/19 23:43:55 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.146 2020/10/23 20:04:56 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@ typedef struct VarAssign {
 
 typedef char *(*NextBufProc)(void *, size_t *);
 
-void Parse_Error(int, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
+void Parse_Error(ParseErrorLevel, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
 Boolean Parse_IsVar(const char *, VarAssign *out_var);
 void Parse_DoVar(VarAssign *, GNode *);
 void Parse_AddIncludeDir(const char *);

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.397 src/usr.bin/make/parse.c:1.398
--- src/usr.bin/make/parse.c:1.397	Fri Oct 23 18:36:09 2020
+++ src/usr.bin/make/parse.c	Fri Oct 23 20:04:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.397 2020/10/23 18:36:09 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.398 2020/10/23 20:04:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.397 2020/10/23 18:36:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.398 2020/10/23 20:04:56 rillig Exp $");
 
 /* types and constants */
 
@@ -645,8 +645,8 @@ PrintLocation(FILE *f, const char *filen
  * until the end of the current top-level makefile, then exit (see
  * Parse_File). */
 static void
-ParseVErrorInternal(FILE *f, const char *cfname, size_t clineno, int type,
-const char *fmt, va_list ap)
+ParseVErrorInternal(FILE *f, const char *cfname, size_t clineno,
+		ParseErrorLevel type, const char *fmt, va_list ap)
 {
 	static Boolean fatal_warning_error_printed = FALSE;
 
@@ -671,7 +671,7 @@ ParseVErrorInternal(FILE *f, const char 
 }
 
 static void
-ParseErrorInternal(const char *cfname, size_t clineno, int type,
+ParseErrorInternal(const char *cfname, size_t clineno, ParseErrorLevel type,
 		   const char *fmt, ...)
 {
 	va_list ap;
@@ -693,7 +693,7 @@ ParseErrorInternal(const char *cfname, s
  *
  * Fmt is given without a trailing newline. */
 void
-Parse_Error(int type, const char *fmt, ...)
+Parse_Error(ParseErrorLevel type, const char *fmt, ...)
 {
 	va_list ap;
 	const char *fname;



CVS commit: src

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 19:54:35 UTC 2020

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

Log Message:
make(1): add test for dependencies of the form '%.o: %.c'


To generate a diff of this commit:
cvs rdiff -u -r1.948 -r1.949 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.173 -r1.174 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/dep-percent.exp \
src/usr.bin/make/unit-tests/dep-percent.mk
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/dep-wildcards.exp

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.948 src/distrib/sets/lists/tests/mi:1.949
--- src/distrib/sets/lists/tests/mi:1.948	Fri Oct 23 19:23:00 2020
+++ src/distrib/sets/lists/tests/mi	Fri Oct 23 19:54:35 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.948 2020/10/23 19:23:00 rillig Exp $
+# $NetBSD: mi,v 1.949 2020/10/23 19:54:35 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4635,6 +4635,8 @@
 ./usr/tests/usr.bin/make/unit-tests/dep-exclam.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-none.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-none.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/dep-percent.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/dep-percent.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-var.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-var.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-wildcards.exptests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.173 src/usr.bin/make/unit-tests/Makefile:1.174
--- src/usr.bin/make/unit-tests/Makefile:1.173	Fri Oct 23 19:23:01 2020
+++ src/usr.bin/make/unit-tests/Makefile	Fri Oct 23 19:54:35 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.173 2020/10/23 19:23:01 rillig Exp $
+# $NetBSD: Makefile,v 1.174 2020/10/23 19:54:35 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -78,6 +78,7 @@ TESTS+=		dep-double-colon
 TESTS+=		dep-double-colon-indep
 TESTS+=		dep-exclam
 TESTS+=		dep-none
+TESTS+=		dep-percent
 TESTS+=		dep-var
 TESTS+=		dep-wildcards
 TESTS+=		depsrc

Index: src/usr.bin/make/unit-tests/dep-wildcards.exp
diff -u src/usr.bin/make/unit-tests/dep-wildcards.exp:1.4 src/usr.bin/make/unit-tests/dep-wildcards.exp:1.5
--- src/usr.bin/make/unit-tests/dep-wildcards.exp:1.4	Fri Oct 23 19:11:30 2020
+++ src/usr.bin/make/unit-tests/dep-wildcards.exp	Fri Oct 23 19:54:35 2020
@@ -4,6 +4,7 @@ dep-double-colon-indep.mk
 dep-double-colon.mk
 dep-exclam.mk
 dep-none.mk
+dep-percent.mk
 dep-var.mk
 dep-wildcards.mk
 exit status 0

Added files:

Index: src/usr.bin/make/unit-tests/dep-percent.exp
diff -u /dev/null src/usr.bin/make/unit-tests/dep-percent.exp:1.1
--- /dev/null	Fri Oct 23 19:54:36 2020
+++ src/usr.bin/make/unit-tests/dep-percent.exp	Fri Oct 23 19:54:35 2020
@@ -0,0 +1,3 @@
+make: don't know how to make dep-percent.o (continuing)
+`all' not remade because of errors.
+exit status 0
Index: src/usr.bin/make/unit-tests/dep-percent.mk
diff -u /dev/null src/usr.bin/make/unit-tests/dep-percent.mk:1.1
--- /dev/null	Fri Oct 23 19:54:36 2020
+++ src/usr.bin/make/unit-tests/dep-percent.mk	Fri Oct 23 19:54:35 2020
@@ -0,0 +1,14 @@
+# $NetBSD: dep-percent.mk,v 1.1 2020/10/23 19:54:35 rillig Exp $
+#
+# Test for transformation rules of the form '%.o: %.c', which are supported
+# by GNU make but not this make.
+
+.SUFFIXES: .c .o
+
+all: dep-percent.o
+
+%.o: %.c
+	: 'Making ${.TARGET} from ${.IMPSRC} or ${.ALLSRC}.'
+
+dep-percent.c:
+	: 'Making ${.TARGET} out of nothing.'



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 19:48:17 UTC 2020

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

Log Message:
make(1): rename GNode.cmgn to youngestChild

The name is longer than before but also clearer.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/usr.bin/make/arch.c
cvs rdiff -u -r1.166 -r1.167 src/usr.bin/make/compat.c
cvs rdiff -u -r1.177 -r1.178 src/usr.bin/make/make.c
cvs rdiff -u -r1.165 -r1.166 src/usr.bin/make/make.h
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/make/targ.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.139 src/usr.bin/make/arch.c:1.140
--- src/usr.bin/make/arch.c:1.139	Fri Oct 23 18:36:09 2020
+++ src/usr.bin/make/arch.c	Fri Oct 23 19:48:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.139 2020/10/23 18:36:09 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.140 2020/10/23 19:48:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include"config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.139 2020/10/23 18:36:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.140 2020/10/23 19:48:17 rillig Exp $");
 
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
@@ -1060,7 +1060,7 @@ Arch_FindLib(GNode *gn, SearchPath *path
  * given that it is a target on a dependency line somewhere:
  *
  *	Its modification time is less than that of one of its sources
- *	(gn->mtime < gn->cmgn->mtime).
+ *	(gn->mtime < gn->youngestChild->mtime).
  *
  *	Its modification time is greater than the time at which the make
  *	began (i.e. it's been modified in the course of the make, probably
@@ -1088,9 +1088,10 @@ Arch_LibOODate(GNode *gn)
 	oodate = TRUE;
 } else if (!GNode_IsTarget(gn) && Lst_IsEmpty(gn->children)) {
 	oodate = FALSE;
-} else if ((!Lst_IsEmpty(gn->children) && gn->cmgn == NULL) ||
+} else if ((!Lst_IsEmpty(gn->children) && gn->youngestChild == NULL) ||
 	   (gn->mtime > now) ||
-	   (gn->cmgn != NULL && gn->mtime < gn->cmgn->mtime)) {
+	   (gn->youngestChild != NULL &&
+		gn->mtime < gn->youngestChild->mtime)) {
 	oodate = TRUE;
 } else {
 #ifdef RANLIBMAG
@@ -1105,7 +1106,7 @@ Arch_LibOODate(GNode *gn)
 	if (DEBUG(ARCH) || DEBUG(MAKE)) {
 		debug_printf("%s modified %s...", RANLIBMAG, Targ_FmtTime(modTimeTOC));
 	}
-	oodate = (gn->cmgn == NULL || gn->cmgn->mtime > modTimeTOC);
+	oodate = (gn->youngestChild == NULL || gn->youngestChild->mtime > modTimeTOC);
 	} else {
 	/*
 	 * A library w/o a table of contents is out-of-date

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.166 src/usr.bin/make/compat.c:1.167
--- src/usr.bin/make/compat.c:1.166	Sun Oct 18 07:46:04 2020
+++ src/usr.bin/make/compat.c	Fri Oct 23 19:48:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.166 2020/10/18 07:46:04 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.167 2020/10/23 19:48:17 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.166 2020/10/18 07:46:04 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.167 2020/10/23 19:48:17 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -512,7 +512,7 @@ Compat_Make(GNode *gn, GNode *pgn)
 	}
 
 	/*
-	 * All the children were made ok. Now cmgn->mtime contains the
+	 * 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.

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.177 src/usr.bin/make/make.c:1.178
--- src/usr.bin/make/make.c:1.177	Fri Oct 23 18:36:09 2020
+++ src/usr.bin/make/make.c	Fri Oct 23 19:48:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.177 2020/10/23 18:36:09 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.178 2020/10/23 19:48:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -81,12 +81,12 @@
  *
  *	Make_Update	Update all parents of a given child. Performs
  *			various bookkeeping chores like the updating
- *			of the cmgn field of the parent, filling
+ *			of the youngestChild field of the parent, filling
  *			of the IMPSRC context variable, etc. It will
  *			place the parent on the toBeMade queue if it
  *			should be.
  *
- *	Make_TimeStamp	Function to set the parent's cmgn field
+ *	Make_TimeStamp	Function to set the parent's youngestChild field
  *			based on a child's modification time.
  *
  *	Make_DoAllVar	Set up the various local variables for a
@@ -107,7 +107,7 @@
 #include"job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 

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

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 19:28:17 UTC 2020

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

Log Message:
make(1): add test for .END depending on another target


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/deptgt-end.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/deptgt-end.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/deptgt-end.exp
diff -u src/usr.bin/make/unit-tests/deptgt-end.exp:1.3 src/usr.bin/make/unit-tests/deptgt-end.exp:1.4
--- src/usr.bin/make/unit-tests/deptgt-end.exp:1.3	Tue Sep 22 19:41:09 2020
+++ src/usr.bin/make/unit-tests/deptgt-end.exp	Fri Oct 23 19:28:17 2020
@@ -1,7 +1,9 @@
 : .BEGIN '${VAR}'
 : all '${VAR}'
+: end-action '${VAR}'
 : .END '${VAR}'
 : .END '${VAR}' deferred
 : .BEGIN 'Should not be expanded.' deferred
 : all 'Should not be expanded.' deferred
+: end-action 'Should not be expanded.' deferred
 exit status 0

Index: src/usr.bin/make/unit-tests/deptgt-end.mk
diff -u src/usr.bin/make/unit-tests/deptgt-end.mk:1.5 src/usr.bin/make/unit-tests/deptgt-end.mk:1.6
--- src/usr.bin/make/unit-tests/deptgt-end.mk:1.5	Wed Sep 23 03:06:38 2020
+++ src/usr.bin/make/unit-tests/deptgt-end.mk	Fri Oct 23 19:28:17 2020
@@ -1,4 +1,4 @@
-# $NetBSD: deptgt-end.mk,v 1.5 2020/09/23 03:06:38 rillig Exp $
+# $NetBSD: deptgt-end.mk,v 1.6 2020/10/23 19:28:17 rillig Exp $
 #
 # Tests for the special target .END in dependency declarations,
 # which is run after making the desired targets.
@@ -18,6 +18,13 @@ VAR=	Should not be expanded.
 	...
 	: $@ '$${VAR}' deferred
 
+# The .END node can define dependencies, just like a regular target.
+.END: end-action
+end-action: .NOTMAIN
+	: $@ '$${VAR}'
+	...
+	: $@ '$${VAR}' deferred
+
 all:
 	: $@ '$${VAR}'
 	...



CVS commit: src

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 19:23:01 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: depsrc-end.exp depsrc-end.mk

Log Message:
make(1): add test case in which .BEGIN depends on .END

Just for fun.


To generate a diff of this commit:
cvs rdiff -u -r1.947 -r1.948 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.172 -r1.173 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/depsrc-end.exp \
src/usr.bin/make/unit-tests/depsrc-end.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.947 src/distrib/sets/lists/tests/mi:1.948
--- src/distrib/sets/lists/tests/mi:1.947	Fri Oct 23 19:11:30 2020
+++ src/distrib/sets/lists/tests/mi	Fri Oct 23 19:23:00 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.947 2020/10/23 19:11:30 rillig Exp $
+# $NetBSD: mi,v 1.948 2020/10/23 19:23:00 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4641,6 +4641,8 @@
 ./usr/tests/usr.bin/make/unit-tests/dep-wildcards.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/depsrc-end.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/depsrc-end.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/depsrc-exec.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/depsrc-exec.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/depsrc-ignore.exptests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.172 src/usr.bin/make/unit-tests/Makefile:1.173
--- src/usr.bin/make/unit-tests/Makefile:1.172	Fri Oct 23 19:11:30 2020
+++ src/usr.bin/make/unit-tests/Makefile	Fri Oct 23 19:23:01 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.172 2020/10/23 19:11:30 rillig Exp $
+# $NetBSD: Makefile,v 1.173 2020/10/23 19:23:01 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -81,6 +81,7 @@ TESTS+=		dep-none
 TESTS+=		dep-var
 TESTS+=		dep-wildcards
 TESTS+=		depsrc
+TESTS+=		depsrc-end
 TESTS+=		depsrc-exec
 TESTS+=		depsrc-ignore
 TESTS+=		depsrc-made

Added files:

Index: src/usr.bin/make/unit-tests/depsrc-end.exp
diff -u /dev/null src/usr.bin/make/unit-tests/depsrc-end.exp:1.1
--- /dev/null	Fri Oct 23 19:23:01 2020
+++ src/usr.bin/make/unit-tests/depsrc-end.exp	Fri Oct 23 19:23:01 2020
@@ -0,0 +1,4 @@
+: 'Making .END.'
+: 'Making .BEGIN.'
+: 'Making all.'
+exit status 0
Index: src/usr.bin/make/unit-tests/depsrc-end.mk
diff -u /dev/null src/usr.bin/make/unit-tests/depsrc-end.mk:1.1
--- /dev/null	Fri Oct 23 19:23:01 2020
+++ src/usr.bin/make/unit-tests/depsrc-end.mk	Fri Oct 23 19:23:01 2020
@@ -0,0 +1,14 @@
+# $NetBSD: depsrc-end.mk,v 1.1 2020/10/23 19:23:01 rillig Exp $
+#
+# Demonstrate the edge case that .BEGIN depends on .END, which sounds a bit
+# paradox but works since these special nodes are not in the dependency
+# hierarchy where the cycles are detected.
+
+.BEGIN:
+	: 'Making ${.TARGET}.'
+.END:
+	: 'Making ${.TARGET}.'
+all:
+	: 'Making ${.TARGET}.'
+
+.BEGIN: .END



CVS commit: src

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 19:11:30 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make: make.h
src/usr.bin/make/unit-tests: Makefile dep-wildcards.exp
Added Files:
src/usr.bin/make/unit-tests: dep-double-colon-indep.exp
dep-double-colon-indep.mk

Log Message:
make(1): add test for the '::' dependency operator


To generate a diff of this commit:
cvs rdiff -u -r1.946 -r1.947 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.164 -r1.165 src/usr.bin/make/make.h
cvs rdiff -u -r1.171 -r1.172 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/dep-double-colon-indep.exp \
src/usr.bin/make/unit-tests/dep-double-colon-indep.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/dep-wildcards.exp

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.946 src/distrib/sets/lists/tests/mi:1.947
--- src/distrib/sets/lists/tests/mi:1.946	Fri Oct 23 14:24:51 2020
+++ src/distrib/sets/lists/tests/mi	Fri Oct 23 19:11:30 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.946 2020/10/23 14:24:51 rillig Exp $
+# $NetBSD: mi,v 1.947 2020/10/23 19:11:30 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4627,6 +4627,8 @@
 ./usr/tests/usr.bin/make/unit-tests/dep-colon-bug-cross-file.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-colon.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-colon.mktests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/dep-double-colon-indep.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/dep-double-colon-indep.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-double-colon.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-double-colon.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-exclam.exptests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.164 src/usr.bin/make/make.h:1.165
--- src/usr.bin/make/make.h:1.164	Fri Oct 23 18:36:09 2020
+++ src/usr.bin/make/make.h	Fri Oct 23 19:11:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.164 2020/10/23 18:36:09 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.165 2020/10/23 19:11:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -191,11 +191,15 @@ typedef enum  {
  *
  * Some of the OP_ constants can be combined, others cannot. */
 typedef enum GNodeType {
-/* Execution of commands depends on children (:) */
+/* The dependency operator ':' is the most common one.  The commands of
+ * this node are executed if any child is out-of-date. */
 OP_DEPENDS		= 1 << 0,
-/* Always execute commands (!) */
+/* The dependency operator '!' always executes its commands, even if
+ * its children are up-to-date. */
 OP_FORCE		= 1 << 1,
-/* Execution of commands depends on children per line (::) */
+/* 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. */
 OP_DOUBLEDEP	= 1 << 2,
 
 /* Matches the dependency operators ':', '!' and '::'. */

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.171 src/usr.bin/make/unit-tests/Makefile:1.172
--- src/usr.bin/make/unit-tests/Makefile:1.171	Fri Oct 23 14:38:39 2020
+++ src/usr.bin/make/unit-tests/Makefile	Fri Oct 23 19:11:30 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.171 2020/10/23 14:38:39 rillig Exp $
+# $NetBSD: Makefile,v 1.172 2020/10/23 19:11:30 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -75,6 +75,7 @@ TESTS+=		dep
 TESTS+=		dep-colon
 TESTS+=		dep-colon-bug-cross-file
 TESTS+=		dep-double-colon
+TESTS+=		dep-double-colon-indep
 TESTS+=		dep-exclam
 TESTS+=		dep-none
 TESTS+=		dep-var

Index: src/usr.bin/make/unit-tests/dep-wildcards.exp
diff -u src/usr.bin/make/unit-tests/dep-wildcards.exp:1.3 src/usr.bin/make/unit-tests/dep-wildcards.exp:1.4
--- src/usr.bin/make/unit-tests/dep-wildcards.exp:1.3	Fri Sep 25 23:24:49 2020
+++ src/usr.bin/make/unit-tests/dep-wildcards.exp	Fri Oct 23 19:11:30 2020
@@ -1,5 +1,6 @@
 dep-colon-bug-cross-file.mk
 dep-colon.mk
+dep-double-colon-indep.mk
 dep-double-colon.mk
 dep-exclam.mk
 dep-none.mk

Added files:

Index: src/usr.bin/make/unit-tests/dep-double-colon-indep.exp
diff -u /dev/null src/usr.bin/make/unit-tests/dep-double-colon-indep.exp:1.1
--- /dev/null	Fri Oct 23 19:11:30 2020
+++ src/usr.bin/make/unit-tests/dep-double-colon-indep.exp	Fri Oct 23 19:11:30 2020
@@ -0,0 +1,3 @@
+: 'Making 1400 

CVS commit: src/usr.sbin/sysinst/arch/i386

2020-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 23 19:03:43 UTC 2020

Modified Files:
src/usr.sbin/sysinst/arch/i386: md.c

Log Message:
Do not force bootselector MBR code for installs with only a single named
partition.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/sysinst/arch/i386/md.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.sbin/sysinst/arch/i386/md.c
diff -u src/usr.sbin/sysinst/arch/i386/md.c:1.32 src/usr.sbin/sysinst/arch/i386/md.c:1.33
--- src/usr.sbin/sysinst/arch/i386/md.c:1.32	Mon Oct 12 16:14:34 2020
+++ src/usr.sbin/sysinst/arch/i386/md.c	Fri Oct 23 19:03:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.32 2020/10/12 16:14:34 martin Exp $ */
+/*	$NetBSD: md.c,v 1.33 2020/10/23 19:03:42 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -573,12 +573,14 @@ md_check_mbr(struct disk_partitions *par
 	}
 
 	/* Sort out the name of the mbr code we need */
-	if (names > 0 || fl & (NETBSD_NAMED | ACTIVE_NAMED)) {
+	if (names > 1 ||
+	(parts->num_part > 1 && (fl & (NETBSD_NAMED | ACTIVE_NAMED {
 		/* Need bootselect code */
 		fl |= MBR_BS_ACTIVE;
 		bootcode = fl & MBR_BS_EXTLBA ? _PATH_BOOTEXT : _PATH_BOOTSEL;
-	} else
+	} else {
 		bootcode = _PATH_MBR;
+	}
 
 	fl &=  MBR_BS_ACTIVE | MBR_BS_EXTLBA;
 



CVS commit: src/usr.sbin/sysinst

2020-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 23 19:02:58 UTC 2020

Modified Files:
src/usr.sbin/sysinst: mbr.c

Log Message:
Do not force alignment of the first partition by default (which is
treated special to skip the first track), unless an existing partition
table hints at it.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/sysinst/mbr.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.sbin/sysinst/mbr.c
diff -u src/usr.sbin/sysinst/mbr.c:1.36 src/usr.sbin/sysinst/mbr.c:1.37
--- src/usr.sbin/sysinst/mbr.c:1.36	Mon Oct 12 16:14:32 2020
+++ src/usr.sbin/sysinst/mbr.c	Fri Oct 23 19:02:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.c,v 1.36 2020/10/12 16:14:32 martin Exp $ */
+/*	$NetBSD: mbr.c,v 1.37 2020/10/23 19:02:58 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -889,16 +889,15 @@ mbr_init_default_alignments(struct mbr_d
 	if (parts->dp.disk_size < 0)
 		return;
 
+	parts->ptn_0_offset = parts->geo_sec;
+
 	/* Use 1MB offset/alignemnt for large (>128GB) disks */
 	if (parts->dp.disk_size > HUGE_DISK_SIZE) {
 		parts->ptn_alignment = 2048;
-		parts->ptn_0_offset = 2048;
 	} else if (parts->dp.disk_size > TINY_DISK_SIZE) {
 		parts->ptn_alignment = 64;
-		parts->ptn_0_offset = parts->geo_sec;
 	} else {
 		parts->ptn_alignment = 1;
-		parts->ptn_0_offset = parts->geo_sec;
 	}
 	parts->ext_ptn_alignment = track;
 }



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 18:36:10 UTC 2020

Modified Files:
src/usr.bin/make: arch.c cond.c job.c make.c make.h parse.c suff.c
targ.c

Log Message:
make(1): negate OP_NOP and rename it to GNode_IsTarget


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/usr.bin/make/arch.c
cvs rdiff -u -r1.166 -r1.167 src/usr.bin/make/cond.c
cvs rdiff -u -r1.276 -r1.277 src/usr.bin/make/job.c
cvs rdiff -u -r1.176 -r1.177 src/usr.bin/make/make.c
cvs rdiff -u -r1.163 -r1.164 src/usr.bin/make/make.h
cvs rdiff -u -r1.396 -r1.397 src/usr.bin/make/parse.c
cvs rdiff -u -r1.217 -r1.218 src/usr.bin/make/suff.c
cvs rdiff -u -r1.120 -r1.121 src/usr.bin/make/targ.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.138 src/usr.bin/make/arch.c:1.139
--- src/usr.bin/make/arch.c:1.138	Thu Oct 22 05:50:02 2020
+++ src/usr.bin/make/arch.c	Fri Oct 23 18:36:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.138 2020/10/22 05:50:02 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.139 2020/10/23 18:36:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include"config.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.138 2020/10/22 05:50:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.139 2020/10/23 18:36:09 rillig Exp $");
 
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
@@ -1086,7 +1086,7 @@ Arch_LibOODate(GNode *gn)
 
 if (gn->type & OP_PHONY) {
 	oodate = TRUE;
-} else if (OP_NOP(gn->type) && Lst_IsEmpty(gn->children)) {
+} else if (!GNode_IsTarget(gn) && Lst_IsEmpty(gn->children)) {
 	oodate = FALSE;
 } else if ((!Lst_IsEmpty(gn->children) && gn->cmgn == NULL) ||
 	   (gn->mtime > now) ||

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.166 src/usr.bin/make/cond.c:1.167
--- src/usr.bin/make/cond.c:1.166	Fri Oct 23 06:57:41 2020
+++ src/usr.bin/make/cond.c	Fri Oct 23 18:36:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.166 2020/10/23 06:57:41 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.167 2020/10/23 18:36:09 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.166 2020/10/23 06:57:41 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.167 2020/10/23 18:36:09 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -323,7 +323,7 @@ static Boolean
 FuncTarget(size_t argLen MAKE_ATTR_UNUSED, const char *arg)
 {
 GNode *gn = Targ_FindNode(arg);
-return gn != NULL && !OP_NOP(gn->type);
+return gn != NULL && GNode_IsTarget(gn);
 }
 
 /* See if the given node exists and is an actual target with commands
@@ -332,7 +332,7 @@ static Boolean
 FuncCommands(size_t argLen MAKE_ATTR_UNUSED, const char *arg)
 {
 GNode *gn = Targ_FindNode(arg);
-return gn != NULL && !OP_NOP(gn->type) && !Lst_IsEmpty(gn->commands);
+return gn != NULL && GNode_IsTarget(gn) && !Lst_IsEmpty(gn->commands);
 }
 
 /*-

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.276 src/usr.bin/make/job.c:1.277
--- src/usr.bin/make/job.c:1.276	Fri Oct 23 17:05:40 2020
+++ src/usr.bin/make/job.c	Fri Oct 23 18:36:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.276 2020/10/23 17:05:40 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.277 2020/10/23 18:36:09 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.276 2020/10/23 17:05:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.277 2020/10/23 18:36:09 rillig Exp $");
 
 # define STATIC static
 
@@ -1179,7 +1179,7 @@ Job_Touch(GNode *gn, Boolean silent)
 Boolean
 Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...))
 {
-if (OP_NOP(gn->type) && Lst_IsEmpty(gn->commands) &&
+if (!GNode_IsTarget(gn) && Lst_IsEmpty(gn->commands) &&
 	((gn->type & OP_LIB) == 0 || Lst_IsEmpty(gn->children))) {
 	/*
 	 * No commands. Look for .DEFAULT rule from which we might infer

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.176 src/usr.bin/make/make.c:1.177
--- src/usr.bin/make/make.c:1.176	Fri Oct 23 04:58:33 2020
+++ src/usr.bin/make/make.c	Fri Oct 23 18:36:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.176 2020/10/23 04:58:33 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.177 2020/10/23 18:36:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
 #include"job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.176 2020/10/23 04:58:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.177 2020/10/23 18:36:09 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static 

CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 18:10:39 UTC 2020

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

Log Message:
make(1): merge duplicate documentation for OP_NOP


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 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.162 src/usr.bin/make/make.h:1.163
--- src/usr.bin/make/make.h:1.162	Fri Oct 23 18:05:35 2020
+++ src/usr.bin/make/make.h	Fri Oct 23 18:10:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.162 2020/10/23 18:05:35 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.163 2020/10/23 18:10:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -189,10 +189,7 @@ typedef enum  {
  * communicating to other parts of the program the way in which a target
  * should be made.
  *
- * These constants are bitwise-OR'ed together and placed in the 'type' field
- * of each node. Any node that has a 'type' field which satisfies the OP_NOP
- * function was never never on the left-hand side of an operator, though it
- * may have been on the right-hand side... */
+ * Some of the OP_ constants can be combined, others cannot. */
 typedef enum GNodeType {
 /* Execution of commands depends on children (:) */
 OP_DEPENDS		= 1 << 0,
@@ -579,7 +576,7 @@ Boolean NoExecute(GNode *gn);
 
 /*
  * See if the node with the given type was never seen on the left-hand side
- * of a dependency operator.
+ * of a dependency operator, though it may have been on the right-hand side.
  */
 static Boolean MAKE_ATTR_UNUSED
 OP_NOP(GNodeType t)



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 18:05:35 UTC 2020

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

Log Message:
make(1): only define TRUE and FALSE if necessary

For -DUSE_ENUM_BOOLEAN, the macros are not necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 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.161 src/usr.bin/make/make.h:1.162
--- src/usr.bin/make/make.h:1.161	Fri Oct 23 17:59:25 2020
+++ src/usr.bin/make/make.h	Fri Oct 23 18:05:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.161 2020/10/23 17:59:25 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.162 2020/10/23 18:05:35 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -138,6 +138,8 @@
 #ifdef USE_DOUBLE_BOOLEAN
 /* During development, to find type mismatches in function declarations. */
 typedef double Boolean;
+#define TRUE 1.0
+#define FALSE 0.0
 #elif defined(USE_UCHAR_BOOLEAN)
 /* During development, to find code that depends on the exact value of TRUE or
  * that stores other values in Boolean variables. */
@@ -154,13 +156,13 @@ typedef char Boolean;
 typedef enum Boolean { FALSE, TRUE } Boolean;
 #else
 typedef int Boolean;
-#endif
 #ifndef TRUE
 #define TRUE	1
 #endif
 #ifndef FALSE
 #define FALSE	0
 #endif
+#endif
 
 #include "lst.h"
 #include "enum.h"



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 17:59:25 UTC 2020

Modified Files:
src/usr.bin/make: make.h test-variants.sh

Log Message:
make(1): allow compilation with Boolean implemented as char


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/usr.bin/make/make.h
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/test-variants.sh

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.160 src/usr.bin/make/make.h:1.161
--- src/usr.bin/make/make.h:1.160	Mon Oct 19 23:43:55 2020
+++ src/usr.bin/make/make.h	Fri Oct 23 17:59:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.160 2020/10/19 23:43:55 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.161 2020/10/23 17:59:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -144,6 +144,12 @@ typedef double Boolean;
 typedef unsigned char Boolean;
 #define TRUE ((unsigned char)0xFF)
 #define FALSE ((unsigned char)0x00)
+#elif defined(USE_CHAR_BOOLEAN)
+/* During development, to find code that uses a boolean as array index, via
+ * -Wchar-subscripts. */
+typedef char Boolean;
+#define TRUE ((char)-1)
+#define FALSE ((char)0x00)
 #elif defined(USE_ENUM_BOOLEAN)
 typedef enum Boolean { FALSE, TRUE } Boolean;
 #else

Index: src/usr.bin/make/test-variants.sh
diff -u src/usr.bin/make/test-variants.sh:1.4 src/usr.bin/make/test-variants.sh:1.5
--- src/usr.bin/make/test-variants.sh:1.4	Mon Sep 21 04:20:35 2020
+++ src/usr.bin/make/test-variants.sh	Fri Oct 23 17:59:25 2020
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: test-variants.sh,v 1.4 2020/09/21 04:20:35 rillig Exp $
+# $NetBSD: test-variants.sh,v 1.5 2020/10/23 17:59:25 rillig Exp $
 #
 # Build several variants of make and run the tests on them.
 #
@@ -43,6 +43,10 @@ testcase USER_CPPFLAGS="-DUSE_DOUBLE_BOO
 #
 testcase USER_CPPFLAGS="-DUSE_UCHAR_BOOLEAN"
 
+# Ensure that variables of type Boolean are not used as array index.
+#
+testcase USER_CPPFLAGS="-DUSE_CHAR_BOOLEAN"
+
 # Try a different compiler, with slightly different warnings and error
 # messages.  One feature that is missing from GCC is a little stricter
 # checks for enums.



CVS commit: src/sys/arch/sparc64/sparc64

2020-10-23 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Oct 23 17:53:07 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: ofw_patch.c

Log Message:
Add missing prop_object_release() to the E250/E450 patches.
Use the recently added (in r1.2) functions for SPARCle i2c devices too.
Simplify adding "compatible" entries and handle cases where there is none.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc64/sparc64/ofw_patch.c

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

Modified files:

Index: src/sys/arch/sparc64/sparc64/ofw_patch.c
diff -u src/sys/arch/sparc64/sparc64/ofw_patch.c:1.2 src/sys/arch/sparc64/sparc64/ofw_patch.c:1.3
--- src/sys/arch/sparc64/sparc64/ofw_patch.c:1.2	Fri Oct 23 15:18:10 2020
+++ src/sys/arch/sparc64/sparc64/ofw_patch.c	Fri Oct 23 17:53:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_patch.c,v 1.2 2020/10/23 15:18:10 jdc Exp $ */
+/*	$NetBSD: ofw_patch.c,v 1.3 2020/10/23 17:53:07 jdc Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.2 2020/10/23 15:18:10 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.3 2020/10/23 17:53:07 jdc Exp $");
 
 #include 
 
@@ -75,15 +75,14 @@ add_i2c_device(prop_array_t cfg, const c
 uint32_t addr, uint64_t node)
 {
 	prop_dictionary_t dev;
-	prop_data_t data;
 
 	DPRINTF(ACDB_PROBE, ("\nAdding i2c device: %s (%s) @ 0x%x (%lx)\n",
-	name, compat, addr, node & 0x));
+	name, compat == NULL ? "NULL" : compat, addr, node & 0x));
 	dev = prop_dictionary_create();
 	prop_dictionary_set_string(dev, "name", name);
-	data = prop_data_create_copy(compat, strlen(compat) + 1);
-	prop_dictionary_set(dev, "compatible", data);
-	prop_object_release(data);
+	if (compat != NULL)
+		prop_dictionary_set_data(dev, "compatible", compat,
+		strlen(compat) + 1);
 	prop_dictionary_set_uint32(dev, "addr", addr);
 	prop_dictionary_set_uint64(dev, "cookie", node);
 	prop_array_add(cfg, dev);
@@ -146,20 +145,14 @@ add_drivebay_props_v210(device_t dev, in
 void
 add_spdmem_props_sparcle(device_t busdev)
 {
-	prop_dictionary_t props = device_properties(busdev);
-	prop_array_t cfg = prop_array_create();
+	prop_array_t cfg;
 	int i;
 
 	DPRINTF(ACDB_PROBE, ("\nAdding spdmem for SPARCle "));
-	for (i = 0x50; i <= 0x51; i++) {
-		prop_dictionary_t spd = prop_dictionary_create();
-		prop_dictionary_set_string(spd, "name", "dimm-spd");
-		prop_dictionary_set_uint32(spd, "addr", i);
-		prop_dictionary_set_uint64(spd, "cookie", 0);
-		prop_array_add(cfg, spd);
-		prop_object_release(spd);
-	}
-	prop_dictionary_set(props, "i2c-child-devices", cfg);
+
+	cfg = create_i2c_dict(busdev);
+	for (i = 0x50; i <= 0x51; i++)
+		add_i2c_device(cfg, "dimm-spd", NULL, i, 0);
 	prop_object_release(cfg);
 }
 
@@ -205,6 +198,8 @@ add_i2c_props_e450(device_t busdev, uint
 
 	/* CPU temperatures. */
 	add_i2c_device(cfg, "CPU", "ecadc", 0x4f, node);
+
+	prop_object_release(cfg);
 }
 
 void
@@ -219,6 +214,8 @@ add_i2c_props_e250(device_t busdev, uint
 	add_i2c_device(cfg, "PSU", "ecadc", 0x4a, node);
 	/* CPU & system board temperature */
 	add_i2c_device(cfg, "CPU", "ecadc", 0x4f, node);
+
+	prop_object_release(cfg);
 }
 
 /* Hardware specific device properties */



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

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 17:53:01 UTC 2020

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

Log Message:
make(1): add tests for the variable named ""


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

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

Modified files:

Index: src/usr.bin/make/unit-tests/varname-empty.exp
diff -u src/usr.bin/make/unit-tests/varname-empty.exp:1.3 src/usr.bin/make/unit-tests/varname-empty.exp:1.4
--- src/usr.bin/make/unit-tests/varname-empty.exp:1.3	Sat Aug 22 21:22:24 2020
+++ src/usr.bin/make/unit-tests/varname-empty.exp	Fri Oct 23 17:53:01 2020
@@ -6,6 +6,8 @@ Var_Set("", "appended", ...) name expand
 Var_Set("", "", ...) name expands to empty string - ignored
 Var_Set("", "subst", ...) name expands to empty string - ignored
 Var_Set("", "shell-output", ...) name expands to empty string - ignored
+Var_Set("${:U}", "assigned indirectly", ...) name expands to empty string - ignored
+Var_Set("", "assigned", ...) name expands to empty string - ignored
 out: fallback
 out: 1 2 3
 exit status 0

Index: src/usr.bin/make/unit-tests/varname-empty.mk
diff -u src/usr.bin/make/unit-tests/varname-empty.mk:1.6 src/usr.bin/make/unit-tests/varname-empty.mk:1.7
--- src/usr.bin/make/unit-tests/varname-empty.mk:1.6	Thu Sep 24 06:03:44 2020
+++ src/usr.bin/make/unit-tests/varname-empty.mk	Fri Oct 23 17:53:01 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varname-empty.mk,v 1.6 2020/09/24 06:03:44 rillig Exp $
+# $NetBSD: varname-empty.mk,v 1.7 2020/10/23 17:53:01 rillig Exp $
 #
 # Tests for the special variable with the empty name.
 #
@@ -16,22 +16,39 @@
 # The only places where a variable is assigned a value are Var_Set and
 # Var_Append, and these places protect the variable named "" from being
 # defined.  This is different from read-only variables, as that flag can
-# only apply to variables that are defined.
+# only apply to variables that are defined.  The variable named "" must
+# never be defined though.
 #
-# This is because it is heavily used in the .for loop expansion,
-# as well as to generate arbitrary strings, as in ${:Ufallback}.
+# See also:
+#	The special variables @F or ^D, in var-class-local.mk
 
 # Until 2020-08-22 it was possible to assign a value to the variable with
-# the empty name, leading to all kinds of unexpected effects.
-#
-# Before 2020-08-22, the simple assignment operator '=' had an off-by-one
-# bug that caused unrelated memory to be read in Parse_DoVar, invoking
-# undefined behavior.
+# the empty name, leading to all kinds of unexpected effects in .for loops
+# and other places that assume that ${:Ufallback} expands to "fallback".
+# The bug in Var_Set was that only expanded variables had been checked for
+# the empty name, but not the direct assignments with an empty name.
 ?=	default
 =	assigned	# undefined behavior until 2020-08-22
 +=	appended
 :=	subst
 !=	echo 'shell-output'
+.if ${:Ufallback} != "fallback"
+.  error
+.endif
+
+${:U}=	assigned indirectly
+.if ${:Ufallback} != "fallback"
+.  error
+.endif
+
+# Before 2020-08-22, the simple assignment operator '=' after an empty
+# variable name had an off-by-one bug in Parse_DoVar.  The code that was
+# supposed to "skip to operator character" started its search _after_ the
+# assignment operator, assuming that the variable name would be at least
+# one character long.  It then looked for the next occurrence of a '=', which
+# could be several lines away or not occur at all.  While looking for the
+# '=', some whitespace was nulled out, leading to out-of-bounds write.
+=	assigned	# undefined behavior until 2020-08-22
 
 # The .for loop expands the expression ${i} to ${:U1}, ${:U2} and so on.
 # This only works if the variable with the empty name is guaranteed to



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

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 17:21:22 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: var-class-local.mk

Log Message:
make(1): add test for variable name aliasing


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/var-class-local.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-class-local.mk
diff -u src/usr.bin/make/unit-tests/var-class-local.mk:1.2 src/usr.bin/make/unit-tests/var-class-local.mk:1.3
--- src/usr.bin/make/unit-tests/var-class-local.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/var-class-local.mk	Fri Oct 23 17:21:22 2020
@@ -1,8 +1,28 @@
-# $NetBSD: var-class-local.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: var-class-local.mk,v 1.3 2020/10/23 17:21:22 rillig Exp $
 #
 # Tests for target-local variables, such as ${.TARGET} or $@.
 
 # TODO: Implementation
 
+# Ensure that the name of the variable is exactly the given one.
+# The variable "@" is an alias for ".TARGET", so the implementation might
+# canonicalize these aliases at some point, and that might be surprising.
+# This aliasing happens for single-character variable names like $@ or $<
+# (see VarFind, CanonicalVarname), but not for braced or parenthesized
+# expressions like ${@}, ${.TARGET} ${VAR:Mpattern} (see Var_Parse,
+# ParseVarname).
+.if ${@:L} != "@"
+.  error
+.endif
+.if ${.TARGET:L} != ".TARGET"
+.  error
+.endif
+.if ${@F:L} != "@F"
+.  error
+.endif
+.if ${@D:L} != "@D"
+.  error
+.endif
+
 all:
 	@:;



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 17:05:40 UTC 2020

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

Log Message:
make(1): rename Shell fields

Some of them should have been in an anonymous union, or should just kept
as separate fields.  There is only a small, fixed number of shells,
therefore it doesn't make sense to squeeze two completely separate
meanings into a single field just because that field happens to have a
fitting data type.


To generate a diff of this commit:
cvs rdiff -u -r1.275 -r1.276 src/usr.bin/make/job.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.275 src/usr.bin/make/job.c:1.276
--- src/usr.bin/make/job.c:1.275	Fri Oct 23 16:45:34 2020
+++ src/usr.bin/make/job.c	Fri Oct 23 17:05:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.275 2020/10/23 16:45:34 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.276 2020/10/23 17:05:40 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.275 2020/10/23 16:45:34 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.276 2020/10/23 17:05:40 rillig Exp $");
 
 # define STATIC static
 
@@ -163,14 +163,14 @@ MAKE_RCSID("$NetBSD: job.c,v 1.275 2020/
  * it is filtered out using noPrint and noPrintLen.
  *
  * The error checking for individual commands is controlled using hasErrCtl,
- * errCheck, ignErr and errOut.
+ * errOnOrEcho, errOffOrExecIgnore and errExit.
  *
- * If a shell doesn't have error control, errCheck becomes a printf template
- * for echoing the command, should echoing be on and ignErr becomes another
- * printf template for executing the command while ignoring the return
- * status. Finally errOut is a printf template for running the command and
+ * If a shell doesn't have error control, errOnOrEcho becomes a printf template
+ * for echoing the command, should echoing be on; errOffOrExecIgnore becomes
+ * another printf template for executing the command while ignoring the return
+ * status. Finally errExit is a printf template for running the command and
  * causing the shell to exit on error. If any of these strings are empty when
- * hasErrCtl is FALSE, the command will be executed anyway as is and if it
+ * hasErrCtl is FALSE, the command will be executed anyway as is, and if it
  * causes an error, so be it. Any templates setup to echo the command will
  * escape any '$ ` \ "' characters in the command string to avoid common
  * problems with echo "%s\n" as a template.
@@ -196,9 +196,11 @@ typedef struct Shell {
 
 Boolean hasErrCtl;		/* set if can control error checking for
  * individual commands */
-const char *errCheck;	/* string to turn on error checking */
-const char *ignErr;		/* string to turn off error checking */
-const char *errOut;		/* string to use for testing exit code */
+/* XXX: split into errOn and echoCmd */
+const char *errOnOrEcho;	/* template to turn on error checking */
+/* XXX: split into errOff and execIgnore */
+const char *errOffOrExecIgnore; /* template to turn off error checking */
+const char *errExit;	/* template to use for testing exit code */
 
 /* string literal that results in a newline character when it appears
  * outside of any 'quote' or "quote" characters */
@@ -287,9 +289,9 @@ static Shellshells[] = {
 "",/* .noPrint */
 0,/* .noPrintLen */
 FALSE,			/* .hasErrCtl */
-"echo \"%s\"\n",		/* .errCheck */
-"%s\n",			/* .ignErr */
-"{ %s \n} || exit $?\n",	/* .errOut */
+"echo \"%s\"\n",		/* .errOnOrEcho */
+"%s\n",			/* .errOffOrExecIgnore */
+"{ %s \n} || exit $?\n",	/* .errExit */
 "'\n'",			/* .newline */
 '#',			/* .commentChar */
 "",/* .echo */
@@ -308,9 +310,9 @@ static Shellshells[] = {
 "",/* .noPrint */
 0,/* .noPrintLen */
 FALSE,			/* .hasErrCtl */
-"echo \"%s\"\n", 		/* .errCheck */
-"%s\n",			/* .ignErr */
-"{ %s \n} || exit $?\n",	/* .errOut */
+"echo \"%s\"\n", 		/* .errOnOrEcho */
+"%s\n",			/* .errOffOrExecIgnore */
+"{ %s \n} || exit $?\n",	/* .errExit */
 "'\n'",			/* .newline */
 '#',			/* .commentChar*/
 #if defined(MAKE_NATIVE) && defined(__NetBSD__)
@@ -331,9 +333,9 @@ static Shellshells[] = {
 "set +v",			/* .noPrint */
 6,/* .noPrintLen */
 FALSE,			/* .hasErrCtl */
-"echo \"%s\"\n",		/* .errCheck */
-"%s\n",			/* .ignErr */
-"{ %s \n} || exit $?\n",	/* .errOut */
+"echo \"%s\"\n",		/* .errOnOrEcho */
+"%s\n",			/* .errOffOrExecIgnore */
+"{ %s \n} || exit $?\n",	/* .errExit */
 "'\n'",			/* .newline */
 '#',			/* .commentChar */
 "v",			/* .echo */
@@ -352,9 +354,10 @@ static Shellshells[] = {
 "unset verbose", 		/* 

CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 16:45:34 UTC 2020

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

Log Message:
make(1): describe the Shell fields by topic

Describing each field in isolation does not help to understand how these
fields work together.


To generate a diff of this commit:
cvs rdiff -u -r1.274 -r1.275 src/usr.bin/make/job.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.274 src/usr.bin/make/job.c:1.275
--- src/usr.bin/make/job.c:1.274	Fri Oct 23 16:00:23 2020
+++ src/usr.bin/make/job.c	Fri Oct 23 16:45:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.274 2020/10/23 16:00:23 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.275 2020/10/23 16:45:34 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,39 +143,42 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.274 2020/10/23 16:00:23 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.275 2020/10/23 16:45:34 rillig Exp $");
 
 # define STATIC static
 
-/*-
- * Shell Specifications:
- * Each shell type has associated with it the following information:
- *	1) The string which must match the last character of the shell name
- *	   for the shell to be considered of this type. The longest match
- *	   wins.
- *	2) A command to issue to turn off echoing of command lines
- *	3) A command to issue to turn echoing back on again
- *	4) What the shell prints, and its length, when given the echo-off
- *	   command. This line will not be printed when received from the shell
- *	5) A boolean to tell if the shell has the ability to control
- *	   error checking for individual commands.
- *	6) The string to turn this checking on.
- *	7) The string to turn it off.
- *	8) The command-flag to give to cause the shell to start echoing
- *	   commands right away.
- *	9) The command-flag to cause the shell to Lib_Exit when an error is
- *	   detected in one of the commands.
- *
- * Some special stuff goes on if a shell doesn't have error control. In such
- * a case, errCheck becomes a printf template for echoing the command,
- * should echoing be on and ignErr becomes another printf template for
- * executing the command while ignoring the return status. Finally errOut
- * is a printf template for running the command and causing the shell to
- * exit on error. If any of these strings are empty when hasErrCtl is FALSE,
- * the command will be executed anyway as is and if it causes an error, so be
- * it. Any templates setup to echo the command will escape any '$ ` \ "'i
- * characters in the command string to avoid common problems with
- * echo "%s\n" as a template.
+/* 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
+ * the commands from it.  The commands are written to the file using a few
+ * templates for echo control and error control.
+ *
+ * The name of the shell is the basename for the predefined shells, such as
+ * "sh", "csh", "bash".  For custom shells, it is the full pathname, and its
+ * basename is used to select the type of shell; the longest match wins.
+ * So /usr/pkg/bin/bash has type sh, /usr/local/bin/tcsh has type csh.
+ *
+ * The echoing of command lines is controlled using hasEchoCtl, echoOff,
+ * echoOn, noPrint and noPrintLen.  When echoOff is executed by the shell, it
+ * still outputs something, but this something is not interesting, therefore
+ * it is filtered out using noPrint and noPrintLen.
+ *
+ * The error checking for individual commands is controlled using hasErrCtl,
+ * errCheck, ignErr and errOut.
+ *
+ * If a shell doesn't have error control, errCheck becomes a printf template
+ * for echoing the command, should echoing be on and ignErr becomes another
+ * printf template for executing the command while ignoring the return
+ * status. Finally errOut is a printf template for running the command and
+ * causing the shell to exit on error. If any of these strings are empty when
+ * hasErrCtl is FALSE, the command will be executed anyway as is and if it
+ * causes an error, so be it. Any templates setup to echo the command will
+ * escape any '$ ` \ "' characters in the command string to avoid common
+ * problems with echo "%s\n" as a template.
+ *
+ * The command-line flags "echo" and "exit" also control the behavior.  The
+ * "echo" flag causes the shell to start echoing commands right away.  The
+ * "exit" flag causes the shell to exit when an error is detected in one of
+ * the commands.
  */
 typedef struct Shell {
 
@@ -197,9 +200,9 @@ typedef struct Shell {
 const char *ignErr;		/* string to turn off error checking */
 const char *errOut;		/* string to use for testing exit code */
 
-const char *newline;	/* string literal that results in a 

CVS commit: src/usr.bin/renice

2020-10-23 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Oct 23 16:16:10 UTC 2020

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

Log Message:
renice: Make usage match man page more.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/renice/renice.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/renice/renice.c
diff -u src/usr.bin/renice/renice.c:1.19 src/usr.bin/renice/renice.c:1.20
--- src/usr.bin/renice/renice.c:1.19	Thu Oct 22 19:34:12 2020
+++ src/usr.bin/renice/renice.c	Fri Oct 23 16:16:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: renice.c,v 1.19 2020/10/22 19:34:12 dholland Exp $	*/
+/*	$NetBSD: renice.c,v 1.20 2020/10/23 16:16:10 wiz Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1993
@@ -37,7 +37,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 
 #ifndef lint
 /*static char sccsid[] = "from: @(#)renice.c	8.1 (Berkeley) 6/9/93";*/
-__RCSID("$NetBSD: renice.c,v 1.19 2020/10/22 19:34:12 dholland Exp $");
+__RCSID("$NetBSD: renice.c,v 1.20 2020/10/23 16:16:10 wiz Exp $");
 #endif /* not lint */
 
 #include 
@@ -175,7 +175,6 @@ usage(void)
 
 	(void)fprintf(stderr, "Usage: %s [ | -n ] ",
 	getprogname());
-	(void)fprintf(stderr, "[[-p] ...] [-g ...] ");
-	(void)fprintf(stderr, "[-u ...]\n");
+	(void)fprintf(stderr, "[[-gpu] who ...] ...\n");
 	exit(1);
 }



CVS commit: src/usr.bin/renice

2020-10-23 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Oct 23 16:14:41 UTC 2020

Modified Files:
src/usr.bin/renice: renice.8

Log Message:
Fix macro use, sort.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/renice/renice.8

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/renice/renice.8
diff -u src/usr.bin/renice/renice.8:1.17 src/usr.bin/renice/renice.8:1.18
--- src/usr.bin/renice/renice.8:1.17	Thu Oct 22 20:13:02 2020
+++ src/usr.bin/renice/renice.8	Fri Oct 23 16:14:40 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: renice.8,v 1.17 2020/10/22 20:13:02 dholland Exp $
+.\"	$NetBSD: renice.8,v 1.18 2020/10/23 16:14:40 wiz Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -39,7 +39,7 @@
 .Nm
 .Ar priority
 .Oo
-.Op Fl pgu
+.Op Fl gpu
 .Ar who ...
 .Oc
 .Ar ...
@@ -47,7 +47,7 @@
 .Fl n
 .Ar increment
 .Oo
-.Op Fl pgu
+.Op Fl gpu
 .Ar who ...
 .Oc
 .Ar ...
@@ -66,22 +66,22 @@ The following
 parameters name the target processes, as either process IDs, process
 group IDs, or user names.
 The
-.It pgf
+.Fl gpu
 options control the interpretation as follows:
 .Bl -tag -width Ds
 .It Fl g
 Interpret
 .Ar who
 parameters as process group ID's.
-.It Fl u
-Interpret
-.Ar who
-parameters as user names.
 .It Fl p
 Interpret
 .Ar who
 parameters as process IDs.
 This is the default.
+.It Fl u
+Interpret
+.Ar who
+parameters as user names.
 .El
 .Pp
 Each
@@ -96,6 +96,11 @@ If an
 .Ar increment
 is used, the increment is added to the highest priority found among
 the members of the process group prior to the change.
+.It with Fl p
+The named process is updated to the selected priority.
+If an
+.Ar increment
+is used, the increment is added to the process's previous priority.
 .It with Fl u
 All processes belonging to the specified user are updated to the
 selected priority.
@@ -103,11 +108,6 @@ If an
 .Ar increment
 is used, the increment is added to the highest priority found among
 the processes belonging to the user prior to the change.
-.It with Fl p
-The named process is updated to the selected priority.
-If an
-.Ar increment
-is used, the increment is added to the process's previous priority.
 .El
 .Pp
 In conventional terminology a



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 16:00:23 UTC 2020

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

Log Message:
make(1): add field names in declaration of DEFSHELL_CUSTOM


To generate a diff of this commit:
cvs rdiff -u -r1.273 -r1.274 src/usr.bin/make/job.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.273 src/usr.bin/make/job.c:1.274
--- src/usr.bin/make/job.c:1.273	Fri Oct 23 15:54:17 2020
+++ src/usr.bin/make/job.c	Fri Oct 23 16:00:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.273 2020/10/23 15:54:17 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.274 2020/10/23 16:00:23 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.273 2020/10/23 15:54:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.274 2020/10/23 16:00:23 rillig Exp $");
 
 # define STATIC static
 
@@ -277,11 +277,20 @@ static Shellshells[] = {
  * sh-compatible shells.
  */
 {
-DEFSHELL_CUSTOM,
-FALSE, "", "", "", 0,
-FALSE, "echo \"%s\"\n", "%s\n", "{ %s \n} || exit $?\n", "'\n'", '#',
-"",
-"",
+DEFSHELL_CUSTOM,		/* .name */
+FALSE,			/* .hasEchoCtl */
+"",/* .echoOff */
+"",/* .echoOn */
+"",/* .noPrint */
+0,/* .noPrintLen */
+FALSE,			/* .hasErrCtl */
+"echo \"%s\"\n",		/* .errCheck */
+"%s\n",			/* .ignErr */
+"{ %s \n} || exit $?\n",	/* .errOut */
+"'\n'",			/* .newline */
+'#',			/* .commentChar */
+"",/* .echo */
+"",/* .exit */
 },
 #endif /* DEFSHELL_CUSTOM */
 /*



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 15:54:18 UTC 2020

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

Log Message:
make(1): remove unused null shell


To generate a diff of this commit:
cvs rdiff -u -r1.272 -r1.273 src/usr.bin/make/job.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.272 src/usr.bin/make/job.c:1.273
--- src/usr.bin/make/job.c:1.272	Fri Oct 23 15:19:51 2020
+++ src/usr.bin/make/job.c	Fri Oct 23 15:54:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.272 2020/10/23 15:19:51 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.273 2020/10/23 15:54:17 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.272 2020/10/23 15:19:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.273 2020/10/23 15:54:17 rillig Exp $");
 
 # define STATIC static
 
@@ -347,15 +347,6 @@ static Shellshells[] = {
 '#',			/* .commentChar */
 "v", 			/* .echo */
 "e",			/* .exit */
-},
-/*
- * UNKNOWN.
- */
-{
-NULL,
-FALSE, NULL, NULL, NULL, 0,
-FALSE, NULL, NULL, NULL, NULL, '\0',
-NULL, NULL,
 }
 };
 
@@ -2207,9 +2198,10 @@ static void JobSigReset(void)
 static Shell *
 JobMatchShell(const char *name)
 {
-Shell	*sh;
+Shell *sh = shells;
+const Shell *shellsEnd = sh + sizeof shells / sizeof shells[0];
 
-for (sh = shells; sh->name != NULL; sh++) {
+for (sh = shells; sh < shellsEnd; sh++) {
 	if (strcmp(name, sh->name) == 0)
 		return sh;
 }



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 15:44:38 UTC 2020

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

Log Message:
make(1): add target-specific COPTS when generating cpre or casm


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

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

Modified files:

Index: src/usr.bin/make/Makefile
diff -u src/usr.bin/make/Makefile:1.104 src/usr.bin/make/Makefile:1.105
--- src/usr.bin/make/Makefile:1.104	Sun Oct 18 19:11:35 2020
+++ src/usr.bin/make/Makefile	Fri Oct 23 15:44:38 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.104 2020/10/18 19:11:35 rillig Exp $
+#	$NetBSD: Makefile,v 1.105 2020/10/23 15:44:38 rillig Exp $
 #	@(#)Makefile	5.2 (Berkeley) 12/28/90
 
 PROG=	make
@@ -189,6 +189,6 @@ retest:
 # Just out of curiosity, during development.
 .SUFFIXES: .cpre .casm
 .c.cpre:
-	${COMPILE.c:S,^-c$,-E,} ${.IMPSRC} -o ${.TARGET}
+	${COMPILE.c:S,^-c$,-E,} ${COPTS.${.IMPSRC}} ${.IMPSRC} -o ${.TARGET}
 .c.casm:
-	${COMPILE.c:S,^-c$,-S,} ${.IMPSRC} -o ${.TARGET}
+	${COMPILE.c:S,^-c$,-S,} ${COPTS.${.IMPSRC}} ${.IMPSRC} -o ${.TARGET}



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 15:19:51 UTC 2020

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

Log Message:
make(1): decorate shell declarations with field names

Without these names, the declarations were hard to read, even though
they were already grouped into lines.  This grouping was inconsistent
though and the many string literals were hard to tell apart.


To generate a diff of this commit:
cvs rdiff -u -r1.271 -r1.272 src/usr.bin/make/job.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.271 src/usr.bin/make/job.c:1.272
--- src/usr.bin/make/job.c:1.271	Fri Oct 23 07:14:32 2020
+++ src/usr.bin/make/job.c	Fri Oct 23 15:19:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.271 2020/10/23 07:14:32 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.272 2020/10/23 15:19:51 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.271 2020/10/23 07:14:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.272 2020/10/23 15:19:51 rillig Exp $");
 
 # define STATIC static
 
@@ -178,24 +178,25 @@ MAKE_RCSID("$NetBSD: job.c,v 1.271 2020/
  * echo "%s\n" as a template.
  */
 typedef struct Shell {
-const char *name;		/* the name of the shell. For Bourne and C
- * shells, this is used only to find the
- * shell description when used as the single
- * source of a .SHELL target. For user-defined
- * shells, this is the full path of the shell.
- */
+
+/* The name of the shell. For Bourne and C shells, this is used only to
+ * find the shell description when used as the single source of a .SHELL
+ * target. For user-defined shells, this is the full path of the shell. */
+const char *name;
+
 Boolean hasEchoCtl;		/* True if both echoOff and echoOn defined */
 const char *echoOff;	/* command to turn off echo */
 const char *echoOn;		/* command to turn it back on again */
-const char *noPrint;	/* command to skip when printing output from
- * shell. This is usually the command which
- * was executed to turn off echoing */
+const char *noPrint;	/* text to skip when printing output from
+ * shell. This is usually the same as echoOff */
 size_t noPrintLen;		/* length of noPrint command */
+
 Boolean hasErrCtl;		/* set if can control error checking for
  * individual commands */
 const char *errCheck;	/* string to turn on error checking */
 const char *ignErr;		/* string to turn off error checking */
 const char *errOut;		/* string to use for testing exit code */
+
 const char *newline;	/* string literal that results in a newline
  * character when it appears outside of any
  * 'quote' or "quote" characters */
@@ -288,25 +289,43 @@ static Shellshells[] = {
  * sun UNIX anyway, one can even control error checking.
  */
 {
-"sh",
-FALSE, "", "", "", 0,
-FALSE, "echo \"%s\"\n", "%s\n", "{ %s \n} || exit $?\n", "'\n'", '#',
+"sh",			/* .name */
+FALSE,			/* .hasEchoCtl */
+"",/* .echoOff */
+"",/* .echoOn */
+"",/* .noPrint */
+0,/* .noPrintLen */
+FALSE,			/* .hasErrCtl */
+"echo \"%s\"\n", 		/* .errCheck */
+"%s\n",			/* .ignErr */
+"{ %s \n} || exit $?\n",	/* .errOut */
+"'\n'",			/* .newline */
+'#',			/* .commentChar*/
 #if defined(MAKE_NATIVE) && defined(__NetBSD__)
-"q",
+"q",			/* .echo */
 #else
-"",
+"",/* .echo */
 #endif
-"",
+"",/* .exit */
 },
 /*
  * KSH description.
  */
 {
-"ksh",
-TRUE, "set +v", "set -v", "set +v", 6,
-FALSE, "echo \"%s\"\n", "%s\n", "{ %s \n} || exit $?\n", "'\n'", '#',
-"v",
-"",
+"ksh",			/* .name */
+TRUE,			/* .hasEchoCtl */
+"set +v",			/* .echoOff */
+"set -v",			/* .echoOn */
+"set +v",			/* .noPrint */
+6,/* .noPrintLen */
+FALSE,			/* .hasErrCtl */
+"echo \"%s\"\n",		/* .errCheck */
+"%s\n",			/* .ignErr */
+"{ %s \n} || exit $?\n",	/* .errOut */
+"'\n'",			/* .newline */
+'#',			/* .commentChar */
+"v",			/* .echo */
+"",/* .exit */
 },
 /*
  * CSH description. The csh can do echo control by playing
@@ -314,10 +333,20 @@ static Shellshells[] = {
  * however, it is unable to do error control nicely.
  */
 {
-"csh",
-TRUE, "unset verbose", "set verbose", "unset verbose", 13,
-FALSE, "echo \"%s\"\n", "csh -c \"%s || exit 0\"\n", "", "'\\\n'", '#',
-"v", "e",
+"csh",			/* .name */
+TRUE,			/* .hasEchoCtl */
+"unset verbose",		/* .echoOff */
+"set verbose",		/* .echoOn */
+"unset verbose", 		/* .noPrint */
+13,/* .noPrintLen */
+FALSE, 			/* .hasErrCtl */
+"echo \"%s\"\n", 		

CVS commit: src/sys/arch/sparc64

2020-10-23 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Oct 23 15:18:10 UTC 2020

Modified Files:
src/sys/arch/sparc64/dev: pcfiic_ebus.c
src/sys/arch/sparc64/sparc64: autoconf.c ofw_patch.c ofw_patch.h

Log Message:
Move E250 and E450 i2c patches from dev/pcfiic_ebus.c to sparc64/ofw_patch.c.
They are now co-located with the other OFW patch routines.
New i2c devices are created for E250/E450 and v210/v240, so create new
functions to avoid duplicate code.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc64/dev/pcfiic_ebus.c
cvs rdiff -u -r1.225 -r1.226 src/sys/arch/sparc64/sparc64/autoconf.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/sparc64/sparc64/ofw_patch.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc64/sparc64/ofw_patch.h

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

Modified files:

Index: src/sys/arch/sparc64/dev/pcfiic_ebus.c
diff -u src/sys/arch/sparc64/dev/pcfiic_ebus.c:1.6 src/sys/arch/sparc64/dev/pcfiic_ebus.c:1.7
--- src/sys/arch/sparc64/dev/pcfiic_ebus.c:1.6	Fri Jun 12 03:41:57 2020
+++ src/sys/arch/sparc64/dev/pcfiic_ebus.c	Fri Oct 23 15:18:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcfiic_ebus.c,v 1.6 2020/06/12 03:41:57 thorpej Exp $	*/
+/*	$NetBSD: pcfiic_ebus.c,v 1.7 2020/10/23 15:18:10 jdc Exp $	*/
 /*	$OpenBSD: pcfiic_ebus.c,v 1.13 2008/06/08 03:07:40 deraadt Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcfiic_ebus.c,v 1.6 2020/06/12 03:41:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcfiic_ebus.c,v 1.7 2020/10/23 15:18:10 jdc Exp $");
 
 /*
  * Device specific driver for the EBus i2c devices found on some sun4u
@@ -57,11 +57,6 @@ struct pcfiic_ebus_softc {
 CFATTACH_DECL_NEW(pcfiic, sizeof(struct pcfiic_ebus_softc),
 	pcfiic_ebus_match, pcfiic_ebus_attach, NULL, NULL);
 
-static prop_array_t create_dict(device_t);
-static void add_prop(prop_array_t, const char *, const char *, u_int, int);
-static void envctrl_props(prop_array_t, int);
-static void envctrltwo_props(prop_array_t, int);
-
 int
 pcfiic_ebus_match(device_t parent, struct cfdata *match, void *aux)
 {
@@ -103,6 +98,11 @@ pcfiic_ebus_attach(device_t parent, devi
 		return;
 	}
 
+	/* E450 and E250 have a different clock */
+	if ((strcmp(ea->ea_name, "SUNW,envctrl") == 0) ||
+	(strcmp(ea->ea_name, "SUNW,envctrltwo") == 0))
+		clock = PCF8584_CLK_12 | PCF8584_SCL_45;
+
 	sc->sc_dev = self;
 	if (OF_getprop(ea->ea_node, "compatible", compat, sizeof(compat)) > 0 &&
 	strcmp(compat, "SUNW,bbc-i2c") == 0) {
@@ -160,65 +160,5 @@ pcfiic_ebus_attach(device_t parent, devi
 	if (esc->esc_ih == NULL)
 		sc->sc_poll = 1;
 
-	if (strcmp(ea->ea_name, "SUNW,envctrl") == 0) {
-		envctrl_props(create_dict(self), ea->ea_node);
-		pcfiic_attach(sc, 0x55, PCF8584_CLK_12 | PCF8584_SCL_45, 0);
-	} else if (strcmp(ea->ea_name, "SUNW,envctrltwo") == 0) {
-		envctrltwo_props(create_dict(self), ea->ea_node);
-		pcfiic_attach(sc, 0x55, PCF8584_CLK_12 | PCF8584_SCL_45, 0);
-	} else
-		pcfiic_attach(sc, (i2c_addr_t)(addr >> 1), clock, swapregs);
-}
-
-static prop_array_t
-create_dict(device_t parent)
-{
-	prop_dictionary_t props = device_properties(parent);
-	prop_array_t cfg = prop_dictionary_get(props, "i2c-child-devices");
-	if (cfg) return cfg;
-	cfg = prop_array_create();
-	prop_dictionary_set(props, "i2c-child-devices", cfg);
-	prop_object_release(cfg);
-	return cfg;
-}
-
-static void
-add_prop(prop_array_t c, const char *name, const char *compat, u_int addr,
-	int node)
-{
-	prop_dictionary_t dev;
-
-	dev = prop_dictionary_create();
-	prop_dictionary_set_string(dev, "name", name);
-	prop_dictionary_set_data(dev, "compatible", compat, strlen(compat)+1);
-	prop_dictionary_set_uint32(dev, "addr", addr);
-	prop_dictionary_set_uint64(dev, "cookie", node);
-	prop_array_add(c, dev);
-	prop_object_release(dev);
-}
-
-static void
-envctrl_props(prop_array_t c, int node)
-{
-	/* Power supply 1 temperature. */
-	add_prop(c, "PSU-1", "ecadc", 0x48, node);
-
-	/* Power supply 2 termperature. */
-	add_prop(c, "PSU-2", "ecadc", 0x49, node);
-
-	/* Power supply 3 tempterature. */
-	add_prop(c, "PSU-3", "ecadc", 0x4a, node);
-
-	/* Ambient tempterature. */
-	add_prop(c, "ambient", "i2c-lm75", 0x4d, node);
-
-	/* CPU temperatures. */
-	add_prop(c, "CPU", "ecadc", 0x4f, node);
-}
-
-static void
-envctrltwo_props(prop_array_t c, int node)
-{
-	add_prop(c, "PSU", "ecadc", 0x4a, node);
-	add_prop(c, "CPU", "ecadc", 0x4f, node);
+	pcfiic_attach(sc, (i2c_addr_t)(addr >> 1), clock, swapregs);
 }

Index: src/sys/arch/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.225 src/sys/arch/sparc64/sparc64/autoconf.c:1.226
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.225	Sat Oct 17 08:10:31 2020
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Fri Oct 23 15:18:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.225 2020/10/17 08:10:31 jdc Exp $ */
+/*	$NetBSD: autoconf.c,v 1.226 2020/10/23 15:18:10 jdc Exp 

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

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 14:48:49 UTC 2020

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

Log Message:
make(1): add test for dollar in .MAKEFLAGS target


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/deptgt-makeflags.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/deptgt-makeflags.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/deptgt-makeflags.exp
diff -u src/usr.bin/make/unit-tests/deptgt-makeflags.exp:1.1 src/usr.bin/make/unit-tests/deptgt-makeflags.exp:1.2
--- src/usr.bin/make/unit-tests/deptgt-makeflags.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/deptgt-makeflags.exp	Fri Oct 23 14:48:49 2020
@@ -1 +1,9 @@
+Global:delete DOLLAR (not found)
+Command:DOLLAR = 
+Global:.MAKEOVERRIDES =  VAR DOLLAR
+CondParser_Eval: ${DOLLAR} != "\$\$"
+Var_Parse: ${DOLLAR} != "\$\$" with VARE_UNDEFERR|VARE_WANTRES
+lhs = "$$", rhs = "$$", op = !=
+Global:.MAKEFLAGS =  -r -k -D VAR -D VAR -d cv -d
+Global:.MAKEFLAGS =  -r -k -D VAR -D VAR -d cv -d 0
 exit status 0

Index: src/usr.bin/make/unit-tests/deptgt-makeflags.mk
diff -u src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.3 src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.4
--- src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.3	Thu Sep 10 21:22:07 2020
+++ src/usr.bin/make/unit-tests/deptgt-makeflags.mk	Fri Oct 23 14:48:49 2020
@@ -1,4 +1,4 @@
-# $NetBSD: deptgt-makeflags.mk,v 1.3 2020/09/10 21:22:07 rillig Exp $
+# $NetBSD: deptgt-makeflags.mk,v 1.4 2020/10/23 14:48:49 rillig Exp $
 #
 # Tests for the special target .MAKEFLAGS in dependency declarations,
 # which adds command line options later, at parse time.
@@ -37,5 +37,15 @@
 .  error
 .endif
 
+# When parsing this line, each '$$' becomes '$', resulting in ''.
+# This is assigned to the variable DOLLAR.
+# In the condition, that variable is expanded, and at that point, each '$$'
+# becomes '$' again, the final expression is thus '$$'.
+.MAKEFLAGS: -dcv
+.MAKEFLAGS: DOLLAR=
+.if ${DOLLAR} != "\$\$"
+.endif
+.MAKEFLAGS: -d0
+
 all:
 	@:;



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

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 14:38:39 UTC 2020

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

Log Message:
make(1): move tests from cond2.mk to varmod-ifelse.mk (fixup)


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

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

Modified files:

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.170 src/usr.bin/make/unit-tests/Makefile:1.171
--- src/usr.bin/make/unit-tests/Makefile:1.170	Fri Oct 23 06:18:23 2020
+++ src/usr.bin/make/unit-tests/Makefile	Fri Oct 23 14:38:39 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.170 2020/10/23 06:18:23 rillig Exp $
+# $NetBSD: Makefile,v 1.171 2020/10/23 14:38:39 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -69,7 +69,6 @@ TESTS+=		cond-token-string
 TESTS+=		cond-token-var
 TESTS+=		cond-undef-lint
 TESTS+=		cond1
-TESTS+=		cond2
 TESTS+=		counter
 TESTS+=		counter-append
 TESTS+=		dep

Index: src/usr.bin/make/unit-tests/varmod-ifelse.exp
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.2 src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.3
--- src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.2	Fri Oct 23 14:24:51 2020
+++ src/usr.bin/make/unit-tests/varmod-ifelse.exp	Fri Oct 23 14:38:39 2020
@@ -1,6 +1,8 @@
 make: Bad conditional expression `variable expression == "literal"' in variable expression == "literal"?bad:bad
-make: "varmod-ifelse.mk" line 28: Malformed conditional (${${:Uvariable expression} == "literal":?bad:bad})
-make: Bad conditional expression ` == ""' in  == ""?oops:oops
+make: "varmod-ifelse.mk" line 27: Malformed conditional (${${:Uvariable expression} == "literal":?bad:bad})
+make: Bad conditional expression ` == ""' in  == ""?bad-assign:bad-assign
+make: Bad conditional expression ` == ""' in  == ""?bad-cond:bad-cond
+make: "varmod-ifelse.mk" line 44: Malformed conditional (${${UNDEF} == "":?bad-cond:bad-cond})
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1



CVS commit: src

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 14:24:51 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: varmod-ifelse.exp varmod-ifelse.mk
Removed Files:
src/usr.bin/make/unit-tests: cond2.exp cond2.mk

Log Message:
make(1): move tests from cond2.mk to varmod-ifelse.mk


To generate a diff of this commit:
cvs rdiff -u -r1.945 -r1.946 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.1 -r0 src/usr.bin/make/unit-tests/cond2.exp
cvs rdiff -u -r1.2 -r0 src/usr.bin/make/unit-tests/cond2.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-ifelse.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-ifelse.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.945 src/distrib/sets/lists/tests/mi:1.946
--- src/distrib/sets/lists/tests/mi:1.945	Fri Oct 23 06:18:23 2020
+++ src/distrib/sets/lists/tests/mi	Fri Oct 23 14:24:51 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.945 2020/10/23 06:18:23 rillig Exp $
+# $NetBSD: mi,v 1.946 2020/10/23 14:24:51 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4617,8 +4617,8 @@
 ./usr/tests/usr.bin/make/unit-tests/cond-undef-lint.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond1.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond1.mk	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/cond2.exp	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/cond2.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond2.exp	obsolete-tests		obsolete
+./usr/tests/usr.bin/make/unit-tests/cond2.mk	obsolete-tests		obsolete
 ./usr/tests/usr.bin/make/unit-tests/counter-append.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/counter-append.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/counter.exp	tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/varmod-ifelse.exp
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.1 src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-ifelse.exp	Fri Oct 23 14:24:51 2020
@@ -1 +1,6 @@
-exit status 0
+make: Bad conditional expression `variable expression == "literal"' in variable expression == "literal"?bad:bad
+make: "varmod-ifelse.mk" line 28: Malformed conditional (${${:Uvariable expression} == "literal":?bad:bad})
+make: Bad conditional expression ` == ""' in  == ""?oops:oops
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1

Index: src/usr.bin/make/unit-tests/varmod-ifelse.mk
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.4 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.5
--- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.4	Fri Oct  9 07:03:20 2020
+++ src/usr.bin/make/unit-tests/varmod-ifelse.mk	Fri Oct 23 14:24:51 2020
@@ -1,10 +1,52 @@
-# $NetBSD: varmod-ifelse.mk,v 1.4 2020/10/09 07:03:20 rillig Exp $
+# $NetBSD: varmod-ifelse.mk,v 1.5 2020/10/23 14:24:51 rillig Exp $
 #
 # Tests for the ${cond:?then:else} variable modifier, which evaluates either
 # the then-expression or the else-expression, depending on the condition.
+#
+# The modifier was added on 1998-04-01.
+#
+# Until 2015-10-11, the modifier always evaluated both the "then" and the
+# "else" expressions.
 
 # TODO: Implementation
 
+# The variable name of the expression is expanded and then taken as the
+# condition.  In this case it becomes:
+#
+#	variable expression == "variable expression"
+#
+# This confuses the parser, which expects an operator instead of the bare
+# word "expression".  If the name were expanded lazily, everything would be
+# fine since the condition would be:
+#
+#	${:Uvariable expression} == "literal"
+#
+# Evaluating the variable name lazily would require additional code in
+# Var_Parse and ParseVarname, it would be more useful and predictable
+# though.
+.if ${${:Uvariable expression} == "literal":?bad:bad}
+.  error
+.else
+.  error
+.endif
+
+# In a variable assignment, undefined variables are not an error.
+# Because of the early expansion, the whole condition evaluates to
+# ' == ""' though, which cannot be parsed because the left-hand side looks
+# empty.
+COND:=	${${UNDEF} == "":?bad-assign:bad-assign}
+
+# In a condition, undefined variables generate a "Malformed conditional"
+# error.  That error message is wrong though.  In lint mode, the correct
+# "Undefined variable" error message is generated.
+# The difference to the ':=' variable assignment is the additional
+# "Malformed conditional" error message.
+.if ${${UNDEF} == 

CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 13:38:17 UTC 2020

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

Log Message:
make(1): move comment in Var_Set_with_flags

Until 2000-05-11, that comment was just above a VarFind call.  20 years
later, it is back again where it belongs.


To generate a diff of this commit:
cvs rdiff -u -r1.581 -r1.582 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.581 src/usr.bin/make/var.c:1.582
--- src/usr.bin/make/var.c:1.581	Thu Oct 22 05:50:02 2020
+++ src/usr.bin/make/var.c	Fri Oct 23 13:38:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.581 2020/10/22 05:50:02 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.582 2020/10/23 13:38:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include"metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.581 2020/10/22 05:50:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.582 2020/10/23 13:38:17 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -762,11 +762,6 @@ Var_Set_with_flags(const char *name, con
 
 assert(val != NULL);
 
-/*
- * We only look for a variable in the given context since anything set
- * here will override anything in a lower context, so there's not much
- * point in searching them all just to save a bit of memory...
- */
 if (strchr(name, '$') != NULL) {
 	(void)Var_Subst(name, ctxt, VARE_WANTRES, _freeIt);
 	/* TODO: handle errors */
@@ -792,6 +787,11 @@ Var_Set_with_flags(const char *name, con
 	}
 }
 
+/*
+ * We only look for a variable in the given context since anything set
+ * here will override anything in a lower context, so there's not much
+ * point in searching them all just to save a bit of memory...
+ */
 v = VarFind(name, ctxt, 0);
 if (v == NULL) {
 	if (ctxt == VAR_CMD && !(flags & VAR_NO_EXPORT)) {



CVS commit: src/lib/libossaudio

2020-10-23 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Oct 23 12:13:04 UTC 2020

Modified Files:
src/lib/libossaudio: ossaudio.c

Log Message:
Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/lib/libossaudio/ossaudio.c

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

Modified files:

Index: src/lib/libossaudio/ossaudio.c
diff -u src/lib/libossaudio/ossaudio.c:1.56 src/lib/libossaudio/ossaudio.c:1.57
--- src/lib/libossaudio/ossaudio.c:1.56	Fri Oct 23 09:05:20 2020
+++ src/lib/libossaudio/ossaudio.c	Fri Oct 23 12:13:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.56 2020/10/23 09:05:20 nia Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.57 2020/10/23 12:13:04 wiz Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: ossaudio.c,v 1.56 2020/10/23 09:05:20 nia Exp $");
+__RCSID("$NetBSD: ossaudio.c,v 1.57 2020/10/23 12:13:04 wiz Exp $");
 
 /*
  * This is an Open Sound System compatibility layer, which provides
@@ -1179,7 +1179,7 @@ mixer_oss4_ioctl(int fd, unsigned long c
 		 * OSSv4 does not document this ioctl, and claims it should
 		 * not be used by applications and is provided for "utiltiy
 		 * programs included in OSS". We follow the Solaris
-		 * implementation (which is doucmented) and leave these fields
+		 * implementation (which is documented) and leave these fields
 		 * unset.
 		 */
 		cardinfo->flags = 0;



CVS commit: src/sys/dev/acpi

2020-10-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Oct 23 11:00:09 UTC 2020

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

Log Message:
Use MI acpi_intr_establish_irq instead of MD intr_establish


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/acpi_ged.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_ged.c
diff -u src/sys/dev/acpi/acpi_ged.c:1.1 src/sys/dev/acpi/acpi_ged.c:1.2
--- src/sys/dev/acpi/acpi_ged.c:1.1	Mon Oct 22 22:36:19 2018
+++ src/sys/dev/acpi/acpi_ged.c	Fri Oct 23 11:00:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_ged.c,v 1.1 2018/10/22 22:36:19 jmcneill Exp $ */
+/* $NetBSD: acpi_ged.c,v 1.2 2020/10/23 11:00:09 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_ged.c,v 1.1 2018/10/22 22:36:19 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ged.c,v 1.2 2020/10/23 11:00:09 jmcneill Exp $");
 
 #include 
 #include 
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_ged.c,v
 #include 
 #include 
 #include 
+#include 
 
 static int	acpi_ged_match(device_t, cfdata_t, void *);
 static void	acpi_ged_attach(device_t, device_t, void *);
@@ -83,8 +84,8 @@ acpi_ged_register_event(void *priv, stru
 	device_t dev = priv;
 	void *ih;
 
-	const int type = (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL;
-	ih = intr_establish(irq->ar_irq, IPL_VM, type, acpi_ged_intr, ev);
+	ih = acpi_intr_establish_irq(dev, irq, IPL_VM, true,
+	acpi_ged_intr, ev, device_xname(dev));
 	if (ih == NULL) {
 		aprint_error_dev(dev, "couldn't establish interrupt (irq %d)\n", irq->ar_irq);
 		return;



CVS commit: src/sys/dev/acpi

2020-10-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Oct 23 10:59:37 UTC 2020

Modified Files:
src/sys/dev/acpi: acpi_intr.h acpi_util.c

Log Message:
Add acpi_intr_establish_irq, which is like acpi_intr_establish except
it takes a struct acpi_irq * instead of ACPI_HANDLE. Useful if a device
has more than one IRQ resource (acpi_intr_establish always picks the
first).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/acpi_intr.h
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/acpi/acpi_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/sys/dev/acpi/acpi_intr.h
diff -u src/sys/dev/acpi/acpi_intr.h:1.4 src/sys/dev/acpi/acpi_intr.h:1.5
--- src/sys/dev/acpi/acpi_intr.h:1.4	Sun Dec 22 15:57:07 2019
+++ src/sys/dev/acpi/acpi_intr.h	Fri Oct 23 10:59:37 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_intr.h,v 1.4 2019/12/22 15:57:07 thorpej Exp $ */
+/* $NetBSD: acpi_intr.h,v 1.5 2020/10/23 10:59:37 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -34,6 +34,8 @@
 
 void *		acpi_intr_establish(device_t, uint64_t, int, bool,
 		int (*intr)(void *), void *, const char *);
+void *		acpi_intr_establish_irq(device_t, struct acpi_irq *, int,
+		bool, int (*intr)(void *), void *, const char *);
 void		acpi_intr_mask(void *);
 void		acpi_intr_unmask(void *);
 void 		acpi_intr_disestablish(void *);

Index: src/sys/dev/acpi/acpi_util.c
diff -u src/sys/dev/acpi/acpi_util.c:1.18 src/sys/dev/acpi/acpi_util.c:1.19
--- src/sys/dev/acpi/acpi_util.c:1.18	Tue Dec 31 09:10:15 2019
+++ src/sys/dev/acpi/acpi_util.c	Fri Oct 23 10:59:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_util.c,v 1.18 2019/12/31 09:10:15 mlelstv Exp $ */
+/*	$NetBSD: acpi_util.c,v 1.19 2020/10/23 10:59:37 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.18 2019/12/31 09:10:15 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.19 2020/10/23 10:59:37 jmcneill Exp $");
 
 #include 
 #include 
@@ -550,7 +550,6 @@ out:
 }
 
 struct acpi_irq_handler {
-	ACPI_HANDLE aih_hdl;
 	uint32_t aih_irq;
 	void *aih_ih;
 };
@@ -563,8 +562,7 @@ acpi_intr_establish(device_t dev, uint64
 	ACPI_HANDLE hdl = (void *)(uintptr_t)c;
 	struct acpi_resources res;
 	struct acpi_irq *irq;
-	struct acpi_irq_handler *aih = NULL;
-	void *ih;
+	void *aih = NULL;
 
 	rv = acpi_resource_parse(dev, hdl, "_CRS", ,
 	_resource_parse_ops_quiet);
@@ -575,18 +573,31 @@ acpi_intr_establish(device_t dev, uint64
 	if (irq == NULL)
 		goto end;
 
+	aih = acpi_intr_establish_irq(dev, irq, ipl, mpsafe,
+	intr, iarg, xname);
+
+end:
+	acpi_resource_cleanup();
+
+	return aih;
+}
+
+void *
+acpi_intr_establish_irq(device_t dev, struct acpi_irq *irq, int ipl,
+bool mpsafe, int (*intr)(void *), void *iarg, const char *xname)
+{
+	struct acpi_irq_handler *aih;
+	void *ih;
+
 	const int type = (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL;
 	ih = acpi_md_intr_establish(irq->ar_irq, ipl, type, intr, iarg, mpsafe, xname);
 	if (ih == NULL)
-		goto end;
+		return NULL;
 
 	aih = kmem_alloc(sizeof(struct acpi_irq_handler), KM_SLEEP);
-	aih->aih_hdl = hdl;
 	aih->aih_irq = irq->ar_irq;
 	aih->aih_ih = ih;
 
-end:
-	acpi_resource_cleanup();
 	return aih;
 }
 



CVS commit: src/lib/libossaudio

2020-10-23 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri Oct 23 09:05:20 UTC 2020

Modified Files:
src/lib/libossaudio: ossaudio.c soundcard.h

Log Message:
ossaudio(3): Add an implementation of SNDCTL_CARDINFO

Correct some of the counts returned by SNDCTL_SYSINFO so this works.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/lib/libossaudio/ossaudio.c
cvs rdiff -u -r1.30 -r1.31 src/lib/libossaudio/soundcard.h

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

Modified files:

Index: src/lib/libossaudio/ossaudio.c
diff -u src/lib/libossaudio/ossaudio.c:1.55 src/lib/libossaudio/ossaudio.c:1.56
--- src/lib/libossaudio/ossaudio.c:1.55	Thu Oct 22 19:39:48 2020
+++ src/lib/libossaudio/ossaudio.c	Fri Oct 23 09:05:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.55 2020/10/22 19:39:48 nia Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.56 2020/10/23 09:05:20 nia Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: ossaudio.c,v 1.55 2020/10/22 19:39:48 nia Exp $");
+__RCSID("$NetBSD: ossaudio.c,v 1.56 2020/10/23 09:05:20 nia Exp $");
 
 /*
  * This is an Open Sound System compatibility layer, which provides
@@ -67,6 +67,7 @@ __RCSID("$NetBSD: ossaudio.c,v 1.55 2020
 
 static struct audiodevinfo *getdevinfo(int);
 
+static int getaudiocount(void);
 static int getmixercount(void);
 static int getmixercontrolcount(int);
 
@@ -1016,6 +1017,7 @@ static int
 mixer_oss4_ioctl(int fd, unsigned long com, void *argp)
 {
 	oss_audioinfo *tmpai;
+	oss_card_info *cardinfo;
 	oss_mixext *ext;
 	oss_mixext_root root;
 	oss_mixer_enuminfo *ei;
@@ -1147,6 +1149,43 @@ mixer_oss4_ioctl(int fd, unsigned long c
 		argp = tmpai;
 		close(newfd);
 		break;
+	case SNDCTL_CARDINFO:
+		cardinfo = (oss_card_info *)argp;
+		if (cardinfo == NULL)
+			return EINVAL;
+		if (cardinfo->card != -1) {
+			snprintf(devname, sizeof(devname),
+			"/dev/audio%d", cardinfo->card);
+			newfd = open(devname, O_RDONLY);
+			if (newfd < 0)
+return retval;
+		} else {
+			newfd = fd;
+		}
+		retval = ioctl(newfd, AUDIO_GETDEV, );
+		tmperrno = errno;
+		if (newfd != fd)
+			close(newfd);
+		if (retval < 0) {
+			errno = tmperrno;
+			return retval;
+		}
+		strlcpy(cardinfo->shortname, dev.name,
+		sizeof(cardinfo->shortname));
+		snprintf(cardinfo->longname, sizeof(cardinfo->longname),
+		"%s %s %s", dev.name, dev.version, dev.config);
+		memset(cardinfo->hw_info, 0, sizeof(cardinfo->hw_info));
+		/*
+		 * OSSv4 does not document this ioctl, and claims it should
+		 * not be used by applications and is provided for "utiltiy
+		 * programs included in OSS". We follow the Solaris
+		 * implementation (which is doucmented) and leave these fields
+		 * unset.
+		 */
+		cardinfo->flags = 0;
+		cardinfo->intr_count = 0;
+		cardinfo->ack_count = 0;
+		break;
 	case SNDCTL_SYSINFO:
 		memset(, 0, sizeof(sysinfo));
 		strlcpy(sysinfo.product,
@@ -1156,13 +1195,14 @@ mixer_oss4_ioctl(int fd, unsigned long c
 		strlcpy(sysinfo.license,
 		"BSD", sizeof(sysinfo.license));
 		sysinfo.versionnum = SOUND_VERSION;
-		sysinfo.numaudios = OSS_MAX_AUDIO_DEVS;
+		sysinfo.numaudios = 
+		sysinfo.numcards =
+			getaudiocount();
 		sysinfo.numaudioengines = 1;
 		sysinfo.numsynths = 1;
 		sysinfo.nummidis = -1;
 		sysinfo.numtimers = -1;
-		sysinfo.nummixers = OSS_MAX_AUDIO_DEVS;
-		sysinfo.numcards = 1;
+		sysinfo.nummixers = getmixercount();
 		*(struct oss_sysinfo *)argp = sysinfo;
 		break;
 	case SNDCTL_MIXERINFO:
@@ -1553,6 +1593,27 @@ global_oss4_ioctl(int fd, unsigned long 
 }
 
 static int
+getaudiocount(void)
+{
+	char devname[32];
+	int ndevs = 0;
+	int tmpfd;
+	int tmperrno = errno;
+
+	do {
+		snprintf(devname, sizeof(devname),
+		"/dev/audio%d", ndevs);
+		if ((tmpfd = open(devname, O_RDONLY)) != -1 ||
+		(tmpfd = open(devname, O_WRONLY)) != -1) {
+			ndevs++;
+			close(tmpfd);
+		}
+	} while (tmpfd != -1);
+	errno = tmperrno;
+	return ndevs;
+}
+
+static int
 getmixercount(void)
 {
 	char devname[32];

Index: src/lib/libossaudio/soundcard.h
diff -u src/lib/libossaudio/soundcard.h:1.30 src/lib/libossaudio/soundcard.h:1.31
--- src/lib/libossaudio/soundcard.h:1.30	Tue Oct 20 08:57:45 2020
+++ src/lib/libossaudio/soundcard.h	Fri Oct 23 09:05:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: soundcard.h,v 1.30 2020/10/20 08:57:45 nia Exp $	*/
+/*	$NetBSD: soundcard.h,v 1.31 2020/10/23 09:05:20 nia Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2020 The NetBSD Foundation, Inc.
@@ -407,6 +407,17 @@ typedef struct oss_audioinfo {
 	int filler[184];			/* For expansion */
 } oss_audioinfo;
 
+typedef struct oss_card_info {
+	int card;
+	char shortname[16];
+	char longname[128];
+	int flags;
+	char hw_info[400];
+	int intr_count;
+	int ack_count;
+	int filler[154];
+} oss_card_info;
+
 #define SNDCTL_SYSINFO		_IOR ('X', 1, oss_sysinfo)
 #define OSS_SYSINFO		SNDCTL_SYSINFO /* Old name */
 #define 

CVS commit: [netbsd-9] src/doc

2020-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 23 08:41:00 UTC 2020

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

Log Message:
Ammend ticket #1118 and note release doc changes.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 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.2 src/doc/CHANGES-9.2:1.1.2.3
--- src/doc/CHANGES-9.2:1.1.2.2	Thu Oct 22 11:28:40 2020
+++ src/doc/CHANGES-9.2	Fri Oct 23 08:41:00 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.2 2020/10/22 11:28:40 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.3 2020/10/23 08:41:00 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -860,7 +860,15 @@ xsrc/external/mit/freetype/dist/src/winf
 xsrc/external/mit/freetype/dist/src/winfonts/rules.mk up to 1.5
 xsrc/external/mit/freetype/dist/src/winfonts/winfnt.c up to 1.5
 xsrc/external/mit/freetype/dist/src/winfonts/winfnt.h up to 1.5
+external/mit/xorg/lib/freetype/freetype/config/Makefile 1.4
 distrib/sets/lists/xcomp/mi(apply patch)
 
 	Update freetype to 2.10.4.
 	[maya, ticket #1118]
+
+distrib/notes/common/main(manually edited)
+
+	Remove 9.0 release dedication - new releases will not be 9.0 any more.
+	[martin]
+
+



CVS commit: [netbsd-9] src/external/mit/xorg/lib/freetype/freetype/config

2020-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 23 08:37:06 UTC 2020

Modified Files:
src/external/mit/xorg/lib/freetype/freetype/config [netbsd-9]: Makefile

Log Message:
Pull up following revision(s) (requested by maya in ticket #1118):

external/mit/xorg/lib/freetype/freetype/config/Makefile: revision 1.4

Build fixes for freetype 2.10.4


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.18.1 \
src/external/mit/xorg/lib/freetype/freetype/config/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/mit/xorg/lib/freetype/freetype/config/Makefile
diff -u src/external/mit/xorg/lib/freetype/freetype/config/Makefile:1.3 src/external/mit/xorg/lib/freetype/freetype/config/Makefile:1.3.18.1
--- src/external/mit/xorg/lib/freetype/freetype/config/Makefile:1.3	Mon May 16 22:19:10 2016
+++ src/external/mit/xorg/lib/freetype/freetype/config/Makefile	Fri Oct 23 08:37:06 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2016/05/16 22:19:10 christos Exp $
+#	$NetBSD: Makefile,v 1.3.18.1 2020/10/23 08:37:06 martin Exp $
 
 .include 
 
@@ -7,6 +7,7 @@
 INCSDIR=${X11INCDIR}/freetype2/freetype/config
 
 INCS=	ftconfig.h ftheader.h ftmodule.h ftoption.h ftstdlib.h
+INCS+=	integer-types.h mac-support.h public-macros.h
 
 .include 
 .include 



CVS commit: [netbsd-9] src/distrib/notes/common

2020-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 23 08:32:27 UTC 2020

Modified Files:
src/distrib/notes/common [netbsd-9]: main

Log Message:
Comment out (and fix typo in) dedication for 9.0 release


To generate a diff of this commit:
cvs rdiff -u -r1.551.2.9 -r1.551.2.10 src/distrib/notes/common/main

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

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.551.2.9 src/distrib/notes/common/main:1.551.2.10
--- src/distrib/notes/common/main:1.551.2.9	Wed Aug  5 14:29:59 2020
+++ src/distrib/notes/common/main	Fri Oct 23 08:32:27 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: main,v 1.551.2.9 2020/08/05 14:29:59 martin Exp $
+.\"	$NetBSD: main,v 1.551.2.10 2020/10/23 08:32:27 martin Exp $
 .\"
 .\" Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -515,28 +515,28 @@ possible,
 would not exist.
 .
 .if \n[FOR_RELEASE] \{\
-.Ss "Dedication"
-.Pp
-.
-.Nx
-9.0 is dedicated to the memory of Matthias Drochner, who
-passed away in August 2018 and Eric Schnoebelen, who
-passed away in March 2019.
-.Pp
-Matthias' technical contributions are too many to list here in full.
-He was a long term contributor and commited more than 3000 changes all
-over the
-.Nx
-source tree and lately was especially active in keeping some of our most weired
-ancient VME architectures in shape.
-.Pp
-Eric was a long term pkgsrc developer and well known community member.
-.Pp
-Beyond their technical contributions, Eric and Matthias were always
-helpful and friendly.
-Their example encouraged users to contribute to the project and share their
-work with the community.
-.Pp
+.\" .Ss "Dedication"
+.\" .Pp
+.\" .
+.\" .Nx
+.\" 9.0 is dedicated to the memory of Matthias Drochner, who
+.\" passed away in August 2018 and Eric Schnoebelen, who
+.\" passed away in March 2019.
+.\" .Pp
+.\" Matthias' technical contributions are too many to list here in full.
+.\" He was a long term contributor and commited more than 3000 changes all
+.\" over the
+.\" .Nx
+.\" source tree and lately was especially active in keeping some of our most weird
+.\" ancient VME architectures in shape.
+.\" .Pp
+.\" Eric was a long term pkgsrc developer and well known community member.
+.\" .Pp
+.\" Beyond their technical contributions, Eric and Matthias were always
+.\" helpful and friendly.
+.\" Their example encouraged users to contribute to the project and share their
+.\" work with the community.
+.\" .Pp
 .\} \"  \n[FOR_RELEASE]
 .ie \n[RELEASE_BRANCH] .Ss Changes Between The NetBSD \n[oldvers] \
 and \n[major] Releases



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 07:14:32 UTC 2020

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

Log Message:
make(1): convert JobState and JobFlags to enum types

Both GCC and Clang complained when JobFindPid had its parameter "status"
as an int.  Strangely both compilers complained about a comparison
between unsigned and signed int, even though enums are defined to be
int, not unsigned.


To generate a diff of this commit:
cvs rdiff -u -r1.270 -r1.271 src/usr.bin/make/job.c
cvs rdiff -u -r1.56 -r1.57 src/usr.bin/make/job.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/job.c
diff -u src/usr.bin/make/job.c:1.270 src/usr.bin/make/job.c:1.271
--- src/usr.bin/make/job.c:1.270	Fri Oct 23 05:27:33 2020
+++ src/usr.bin/make/job.c	Fri Oct 23 07:14:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.270 2020/10/23 05:27:33 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.271 2020/10/23 07:14:32 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.270 2020/10/23 05:27:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.271 2020/10/23 07:14:32 rillig Exp $");
 
 # define STATIC static
 
@@ -592,7 +592,7 @@ JobPassSig_suspend(int signo)
 }
 
 static Job *
-JobFindPid(int pid, int status, Boolean isJobs)
+JobFindPid(int pid, JobState status, Boolean isJobs)
 {
 Job *job;
 

Index: src/usr.bin/make/job.h
diff -u src/usr.bin/make/job.h:1.56 src/usr.bin/make/job.h:1.57
--- src/usr.bin/make/job.h:1.56	Mon Oct 19 23:07:22 2020
+++ src/usr.bin/make/job.h	Fri Oct 23 07:14:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.h,v 1.56 2020/10/19 23:07:22 rillig Exp $	*/
+/*	$NetBSD: job.h,v 1.57 2020/10/23 07:14:32 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -117,6 +117,27 @@ struct pollfd;
 # include "meta.h"
 #endif
 
+typedef enum JobState {
+JOB_ST_FREE =	0,	/* Job is available */
+JOB_ST_SETUP =	1,	/* Job is allocated but otherwise invalid */
+JOB_ST_RUNNING =	3,	/* Job is running, pid valid */
+JOB_ST_FINISHED =	4	/* Job is done (ie after SIGCHILD) */
+} JobState;
+
+typedef enum JobFlags {
+/* Ignore non-zero exits */
+JOB_IGNERR =	0x001,
+/* no output */
+JOB_SILENT =	0x002,
+/* Target is a special one. i.e. run it locally
+ * if we can't export it and maxLocal is 0 */
+JOB_SPECIAL =	0x004,
+/* Ignore "..." lines when processing commands */
+JOB_IGNDOTS	=	0x008,
+/* we've sent 'set -x' */
+JOB_TRACED =	0x400
+} JobFlags;
+
 /* A Job manages the shell commands that are run to create a single target.
  * Each job is run in a separate subprocess by a shell.  Several jobs can run
  * in parallel.
@@ -146,22 +167,11 @@ typedef struct Job {
 
 int exit_status;		/* from wait4() in signal handler */
 
-char job_state;		/* status of the job entry */
-#define JOB_ST_FREE	0	/* Job is available */
-#define JOB_ST_SETUP	1	/* Job is allocated but otherwise invalid */
-#define JOB_ST_RUNNING	3	/* Job is running, pid valid */
-#define JOB_ST_FINISHED	4	/* Job is done (ie after SIGCHILD) */
+JobState job_state;		/* status of the job entry */
 
 char job_suspended;
 
-int flags;			/* Flags to control treatment of job */
-#define	JOB_IGNERR	0x001	/* Ignore non-zero exits */
-#define	JOB_SILENT	0x002	/* no output */
-#define JOB_SPECIAL	0x004	/* Target is a special one. i.e. run it locally
- * if we can't export it and maxLocal is 0 */
-#define JOB_IGNDOTS	0x008	/* Ignore "..." lines when processing
- * commands */
-#define JOB_TRACED	0x400	/* we've sent 'set -x' */
+JobFlags flags;		/* Flags to control treatment of job */
 
 int inPipe;			/* Pipe for reading output from job */
 int outPipe;		/* Pipe for writing control commands */



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 06:57:41 UTC 2020

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

Log Message:
make(1): inline CondFindStrMatch into FuncMake


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 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.165 src/usr.bin/make/cond.c:1.166
--- src/usr.bin/make/cond.c:1.165	Thu Oct 22 05:50:02 2020
+++ src/usr.bin/make/cond.c	Fri Oct 23 06:57:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.165 2020/10/22 05:50:02 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.166 2020/10/23 06:57:41 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.165 2020/10/22 05:50:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.166 2020/10/23 06:57:41 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -288,18 +288,16 @@ FuncDefined(size_t argLen MAKE_ATTR_UNUS
 return result;
 }
 
-/* Wrapper around Str_Match, to be used by Lst_Find. */
-static Boolean
-CondFindStrMatch(const void *string, const void *pattern)
-{
-return Str_Match(string, pattern);
-}
-
 /* See if the given target is being made. */
 static Boolean
 FuncMake(size_t argLen MAKE_ATTR_UNUSED, const char *arg)
 {
-return Lst_Find(create, CondFindStrMatch, arg) != NULL;
+StringListNode *ln;
+
+for (ln = create->first; ln != NULL; ln = ln->next)
+	if (Str_Match(ln->datum, arg))
+	return TRUE;
+return FALSE;
 }
 
 /* See if the given file exists. */



CVS commit: src/usr.bin/make

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 06:27:39 UTC 2020

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

Log Message:
make(1): remove void pointers from addErrorCMD


To generate a diff of this commit:
cvs rdiff -u -r1.384 -r1.385 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.384 src/usr.bin/make/main.c:1.385
--- src/usr.bin/make/main.c:1.384	Thu Oct 22 07:12:13 2020
+++ src/usr.bin/make/main.c	Fri Oct 23 06:27:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.384 2020/10/22 07:12:13 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.385 2020/10/23 06:27:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.384 2020/10/22 07:12:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.385 2020/10/23 06:27:39 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -2024,16 +2024,6 @@ cached_realpath(const char *pathname, ch
 return rp ? resolved : NULL;
 }
 
-
-static int
-addErrorCMD(void *cmdp, void *gnp)
-{
-if (cmdp == NULL)
-	return 1;			/* stop */
-Var_Append(".ERROR_CMD", cmdp, VAR_GLOBAL);
-return 0;
-}
-
 /*
  * Return true if we should die without noise.
  * For example our failing child was a sub-make
@@ -2055,6 +2045,26 @@ dieQuietly(GNode *gn, int bf)
 return quietly;
 }
 
+static void
+SetErrorVars(GNode *gn)
+{
+StringListNode *ln;
+
+/*
+ * We can print this even if there is no .ERROR target.
+ */
+Var_Set(".ERROR_TARGET", gn->name, VAR_GLOBAL);
+Var_Delete(".ERROR_CMD", VAR_GLOBAL);
+
+for (ln = gn->commands->first; ln != NULL; ln = ln->next) {
+	const char *cmd = ln->datum;
+
+	if (cmd == NULL)
+	break;
+	Var_Append(".ERROR_CMD", cmd, VAR_GLOBAL);
+}
+}
+
 void
 PrintOnError(GNode *gn, const char *s)
 {
@@ -2078,14 +2088,8 @@ PrintOnError(GNode *gn, const char *s)
 
 if (en)
 	return;/* we've been here! */
-if (gn) {
-	/*
-	 * We can print this even if there is no .ERROR target.
-	 */
-	Var_Set(".ERROR_TARGET", gn->name, VAR_GLOBAL);
-	Var_Delete(".ERROR_CMD", VAR_GLOBAL);
-	Lst_ForEachUntil(gn->commands, addErrorCMD, gn);
-}
+if (gn)
+SetErrorVars(gn);
 expr = "${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'\n@}";
 (void)Var_Subst(expr, VAR_GLOBAL, VARE_WANTRES, );
 /* TODO: handle errors */



CVS commit: src

2020-10-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct 23 06:18:23 UTC 2020

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

Log Message:
make(1): add test for .ERROR_CMD in jobs mode


To generate a diff of this commit:
cvs rdiff -u -r1.944 -r1.945 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.169 -r1.170 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 \
src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.exp \
src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.mk
cvs rdiff -u -r1.3 -r1.4 \
src/usr.bin/make/unit-tests/varname-make_print_var_on_error.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.944 src/distrib/sets/lists/tests/mi:1.945
--- src/distrib/sets/lists/tests/mi:1.944	Tue Oct 20 20:36:53 2020
+++ src/distrib/sets/lists/tests/mi	Fri Oct 23 06:18:23 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.944 2020/10/20 20:36:53 rillig Exp $
+# $NetBSD: mi,v 1.945 2020/10/23 06:18:23 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5203,6 +5203,8 @@
 ./usr/tests/usr.bin/make/unit-tests/varname-empty.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varname-make.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varname-make.mktests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varname-make_print_var_on_error.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varname-makefile.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.169 src/usr.bin/make/unit-tests/Makefile:1.170
--- src/usr.bin/make/unit-tests/Makefile:1.169	Tue Oct 20 20:36:53 2020
+++ src/usr.bin/make/unit-tests/Makefile	Fri Oct 23 06:18:23 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.169 2020/10/20 20:36:53 rillig Exp $
+# $NetBSD: Makefile,v 1.170 2020/10/23 06:18:23 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -358,6 +358,7 @@ TESTS+=		varname-dot-targets
 TESTS+=		varname-empty
 TESTS+=		varname-make
 TESTS+=		varname-make_print_var_on_error
+TESTS+=		varname-make_print_var_on_error-jobs
 TESTS+=		varname-makefile
 TESTS+=		varname-makeflags
 TESTS+=		varname-pwd

Index: src/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk
diff -u src/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk:1.3 src/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk:1.4
--- src/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk:1.3	Fri Oct 23 05:44:02 2020
+++ src/usr.bin/make/unit-tests/varname-make_print_var_on_error.mk	Fri Oct 23 06:18:23 2020
@@ -1,15 +1,16 @@
-# $NetBSD: varname-make_print_var_on_error.mk,v 1.3 2020/10/23 05:44:02 rillig Exp $
+# $NetBSD: varname-make_print_var_on_error.mk,v 1.4 2020/10/23 06:18:23 rillig Exp $
 #
 # Tests for the special MAKE_PRINT_VAR_ON_ERROR variable, which prints the
 # values of selected variables on error.
 
+# XXX: As of 2020-10-23, the .ERROR_CMD variable is pointless in compat mode
+# since at the point where it is filled in PrintOnError, the first command in
+# gn->commands has been set to NULL already.  This leaves .ERROR_CMD an empty
+# list.
+
 MAKE_PRINT_VAR_ON_ERROR=	.ERROR_TARGET .ERROR_CMD
 
 all:
 	@: command before
 	@echo fail; false
 	@: command after
-
-# XXX: As of 2020-10-23, the .ERROR_CMD variable seems pointless since at
-# that point, the first command in gn->commands has been set to NULL already.
-# And because of this, .ERROR_CMD stays an empty list.

Added files:

Index: src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.exp
diff -u /dev/null src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.exp:1.1
--- /dev/null	Fri Oct 23 06:18:23 2020
+++ src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.exp	Fri Oct 23 06:18:23 2020
@@ -0,0 +1,7 @@
+fail
+*** [all] Error code 1
+
+make: stopped in unit-tests
+.ERROR_TARGET='all'
+.ERROR_CMD='@: command before @echo fail; false @: command after, with variable expressions expanded'
+exit status 1
Index: src/usr.bin/make/unit-tests/varname-make_print_var_on_error-jobs.mk
diff -u /dev/null