CVS commit: src/sys/compat/netbsd32

2020-11-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Nov  8 07:30:09 UTC 2020

Modified Files:
src/sys/compat/netbsd32: netbsd32_core.c

Log Message:
Fix typo; s/__LP64/_LP64/


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/compat/netbsd32/netbsd32_core.c

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_core.c
diff -u src/sys/compat/netbsd32/netbsd32_core.c:1.17 src/sys/compat/netbsd32/netbsd32_core.c:1.18
--- src/sys/compat/netbsd32/netbsd32_core.c:1.17	Wed Nov  4 20:54:20 2020
+++ src/sys/compat/netbsd32/netbsd32_core.c	Sun Nov  8 07:30:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_core.c,v 1.17 2020/11/04 20:54:20 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_core.c,v 1.18 2020/11/08 07:30:09 rin Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_core.c,v 1.17 2020/11/04 20:54:20 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_core.c,v 1.18 2020/11/08 07:30:09 rin Exp $");
 
 #include 
 #include 
@@ -72,13 +72,13 @@ compat_netbsd32_coredump_modcmd(modcmd_t
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 		MODULE_HOOK_SET(coredump_netbsd32_hook, real_coredump_netbsd32);
-#if defined(EXEC_ELF32) && defined(__LP64)
+#if defined(EXEC_ELF32) && defined(_LP64)
 		MODULE_HOOK_SET(coredump_elf32_hook, real_coredump_elf32);
 #endif
 		return 0;
 	case MODULE_CMD_FINI:
 		MODULE_HOOK_UNSET(coredump_netbsd32_hook);
-#if defined(EXEC_ELF32) && defined(__LP64)
+#if defined(EXEC_ELF32) && defined(_LP64)
 		MODULE_HOOK_UNSET(coredump_elf32_hook);
 #endif
 		return 0;



CVS commit: src/sys/compat/netbsd32

2020-11-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Nov  8 07:30:09 UTC 2020

Modified Files:
src/sys/compat/netbsd32: netbsd32_core.c

Log Message:
Fix typo; s/__LP64/_LP64/


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/compat/netbsd32/netbsd32_core.c

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 02:56:43 UTC 2020

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

Log Message:
make(1): split ReadMakefiles into separate functions

This keeps the indentation of the code small.

It also reduces the possible confusion about the two similar branches in
that function that differ in a small but important detail:
ReadAllMakefiles reads all the makefiles while ReadFirstDefaultMakefile
stops after the first existing makefile.


To generate a diff of this commit:
cvs rdiff -u -r1.442 -r1.443 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.442 src/usr.bin/make/main.c:1.443
--- src/usr.bin/make/main.c:1.442	Sun Nov  8 02:05:34 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 02:56:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.442 2020/11/08 02:05:34 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.443 2020/11/08 02:56:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.442 2020/11/08 02:05:34 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.443 2020/11/08 02:56:43 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1275,29 +1275,35 @@ InitVpath(void)
 }
 
 static void
-ReadMakefiles(void)
+ReadAllMakefiles(StringList *makefiles)
 {
-	if (opts.makefiles->first != NULL) {
-		StringListNode *ln;
+	StringListNode *ln;
 
-		for (ln = opts.makefiles->first; ln != NULL; ln = ln->next) {
-			if (ReadMakefile(ln->datum) != 0)
-Fatal("%s: cannot open %s.",
-  progname, (char *)ln->datum);
-		}
-	} else {
-		char *p1;
-		(void)Var_Subst("${" MAKE_MAKEFILE_PREFERENCE "}",
-VAR_CMDLINE, VARE_WANTRES, );
-		/* TODO: handle errors */
-		(void)str2Lst_Append(opts.makefiles, p1, NULL);
-		(void)Lst_ForEachUntil(opts.makefiles,
-   ReadMakefileSucceeded, NULL);
-		free(p1);
+	for (ln = makefiles->first; ln != NULL; ln = ln->next) {
+		const char *fname = ln->datum;
+		if (ReadMakefile(fname) != 0)
+			Fatal("%s: cannot open %s.", progname, fname);
 	}
 }
 
 static void
+ReadFirstDefaultMakefile(void)
+{
+	char *prefs;
+	(void)Var_Subst("${" MAKE_MAKEFILE_PREFERENCE "}",
+			VAR_CMDLINE, VARE_WANTRES, );
+	/* TODO: handle errors */
+
+	/* XXX: This should use a local list instead of opts.makefiles
+	 * since these makefiles do not come from the command line.  They
+	 * also have different semantics in that only the first file that
+	 * is found is processed.  See ReadAllMakefiles. */
+	(void)str2Lst_Append(opts.makefiles, prefs, NULL);
+	(void)Lst_ForEachUntil(opts.makefiles, ReadMakefileSucceeded, NULL);
+	free(prefs);
+}
+
+static void
 CleanUp(void)
 {
 #ifdef CLEANUP
@@ -1541,7 +1547,10 @@ main(int argc, char **argv)
 	 */
 	if (!opts.noBuiltins)
 		ReadBuiltinRules();
-	ReadMakefiles();
+	if (!Lst_IsEmpty(opts.makefiles))
+		ReadAllMakefiles(opts.makefiles);
+	else
+		ReadFirstDefaultMakefile();
 
 	/* In particular suppress .depend for '-r -V .OBJDIR -f /dev/null' */
 	if (!opts.noBuiltins || opts.printVars == PVM_NONE) {



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 02:56:43 UTC 2020

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

Log Message:
make(1): split ReadMakefiles into separate functions

This keeps the indentation of the code small.

It also reduces the possible confusion about the two similar branches in
that function that differ in a small but important detail:
ReadAllMakefiles reads all the makefiles while ReadFirstDefaultMakefile
stops after the first existing makefile.


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



CVS commit: src/usr.bin/make

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

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

Log Message:
make(1): inline strncmp in Parse_IsVar

The usual compilers don't do this themselves.


To generate a diff of this commit:
cvs rdiff -u -r1.432 -r1.433 src/usr.bin/make/parse.c

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

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.432 src/usr.bin/make/parse.c:1.433
--- src/usr.bin/make/parse.c:1.432	Sat Nov  7 23:41:38 2020
+++ src/usr.bin/make/parse.c	Sun Nov  8 02:37:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.432 2020/11/07 23:41:38 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.433 2020/11/08 02:37:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.432 2020/11/07 23:41:38 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.433 2020/11/08 02:37:22 rillig Exp $");
 
 /* types and constants */
 
@@ -1854,7 +1854,7 @@ Parse_IsVar(const char *p, VarAssign *ou
 	ch = *p++;
 
 #ifdef SUNSHCMD
-	if (ch == ':' && strncmp(p, "sh", 2) == 0) {
+	if (ch == ':' && p[0] == 's' && p[1] == 'h') {
 	p += 2;
 	continue;
 	}



CVS commit: src/usr.bin/make

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

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

Log Message:
make(1): inline strncmp in Parse_IsVar

The usual compilers don't do this themselves.


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



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

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

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

Log Message:
make(1): add newly added test to file list


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



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

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

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

Log Message:
make(1): add newly added test to file list


To generate a diff of this commit:
cvs rdiff -u -r1.962 -r1.963 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.962 src/distrib/sets/lists/tests/mi:1.963
--- src/distrib/sets/lists/tests/mi:1.962	Sat Nov  7 20:01:17 2020
+++ src/distrib/sets/lists/tests/mi	Sun Nov  8 02:33:18 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.962 2020/11/07 20:01:17 rillig Exp $
+# $NetBSD: mi,v 1.963 2020/11/08 02:33:18 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5087,6 +5087,8 @@
 ./usr/tests/usr.bin/make/unit-tests/forloop.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/forsubst.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/forsubst.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/gnode-submake.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/gnode-submake.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/hanoi-include.exptests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/hanoi-include.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/hash.exp	tests-obsolete		obsolete



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

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 02:31:24 UTC 2020

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

Log Message:
make(1): add more tests for parsing .MAKEFLAGS lines


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/deptgt-makeflags.exp
cvs rdiff -u -r1.4 -r1.5 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.



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

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 02:31:24 UTC 2020

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

Log Message:
make(1): add more tests for parsing .MAKEFLAGS lines


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/deptgt-makeflags.exp
cvs rdiff -u -r1.4 -r1.5 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.2 src/usr.bin/make/unit-tests/deptgt-makeflags.exp:1.3
--- src/usr.bin/make/unit-tests/deptgt-makeflags.exp:1.2	Fri Oct 23 14:48:49 2020
+++ src/usr.bin/make/unit-tests/deptgt-makeflags.exp	Sun Nov  8 02:31:24 2020
@@ -6,4 +6,5 @@ Var_Parse: ${DOLLAR} != "\$\$" with VARE
 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
+make: Unterminated quoted string [make VAR=initial UNBALANCED=']
 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.4 src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.5
--- src/usr.bin/make/unit-tests/deptgt-makeflags.mk:1.4	Fri Oct 23 14:48:49 2020
+++ src/usr.bin/make/unit-tests/deptgt-makeflags.mk	Sun Nov  8 02:31:24 2020
@@ -1,4 +1,4 @@
-# $NetBSD: deptgt-makeflags.mk,v 1.4 2020/10/23 14:48:49 rillig Exp $
+# $NetBSD: deptgt-makeflags.mk,v 1.5 2020/11/08 02:31:24 rillig Exp $
 #
 # Tests for the special target .MAKEFLAGS in dependency declarations,
 # which adds command line options later, at parse time.
@@ -6,25 +6,27 @@
 # The -D option sets a variable in the "Global" scope and thus can be
 # undefined later.
 .MAKEFLAGS: -D VAR
-
 .if ${VAR} != 1
 .  error
 .endif
 
+# Variables that are set via the -D command line option are normal global
+# variables and can thus be undefined later.
 .undef VAR
-
 .if defined(VAR)
 .  error
 .endif
 
+# The -D command line option can define a variable again, after it has been
+# undefined.
 .MAKEFLAGS: -D VAR
-
 .if ${VAR} != 1
 .  error
 .endif
 
+# The "dependency" for .MAKEFLAGS is split into words, interpreting the usual
+# quotes and escape sequences from the backslash.
 .MAKEFLAGS: VAR="value"' with'\ spaces
-
 .if ${VAR} != "value with spaces"
 .  error
 .endif
@@ -32,7 +34,6 @@
 # Variables set on the command line as VAR=value are placed in the
 # "Command" scope and thus cannot be undefined.
 .undef VAR
-
 .if ${VAR} != "value with spaces"
 .  error
 .endif
@@ -47,5 +48,43 @@
 .endif
 .MAKEFLAGS: -d0
 
+# An empty command line is skipped.
+.MAKEFLAGS: # none
+
+# Escape sequences like \n are interpreted.
+# The following line looks as if it assigned a newline to nl, but it doesn't.
+# Instead, the \n ends up as a line that is then interpreted as a variable
+# assignment.  At that point, the line is simply "nl=\n", and the \n is
+# skipped since it is whitespace (see Parse_IsVar).
+.MAKEFLAGS: nl="\n"
+.if ${nl} != ""
+.  error
+.endif
+
+# Next try at defining another newline variable.  Since whitespace around the
+# variable value is trimmed, two empty variable expressions surround the
+# literal newline now.  This prevents the newline from being skipped during
+# parsing.  The ':=' assignment operator expands the empty variable
+# expressions, leaving only the newline as the variable value.
+#
+# This is one of the very few ways (maybe even the only one) to inject literal
+# newlines into a line that is being parsed.  This may confuse the parser.
+# For example, in cond.c the parser only expects horizontal whitespace (' '
+# and '\t'), but no newlines.
+#.MAKEFLAGS: -dcpv
+.MAKEFLAGS: nl:="$${:U}\n$${:U}"
+.if ${nl} != ${.newline}
+.  error
+.endif
+#.MAKEFLAGS: -d0
+
+# Unbalanced quotes produce an error message.  If they occur anywhere in the
+# command line, the whole command line is skipped.
+.MAKEFLAGS: VAR=previous
+.MAKEFLAGS: VAR=initial UNBALANCED='
+.if ${VAR} != "previous"
+.  error
+.endif
+
 all:
 	@:;



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 02:05:34 UTC 2020

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

Log Message:
make(1): fix unrealistic memory leak in Main_ParseArgLine

It's unlikely that anyone ever defines an environment variable named
".MAKE" and then runs make with the -e option, which would make the
environment variable stronger than the built-in global variable.


To generate a diff of this commit:
cvs rdiff -u -r1.441 -r1.442 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.441 src/usr.bin/make/main.c:1.442
--- src/usr.bin/make/main.c:1.441	Sun Nov  8 01:56:54 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 02:05:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.441 2020/11/08 01:56:54 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.442 2020/11/08 02:05:34 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.441 2020/11/08 01:56:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.442 2020/11/08 02:05:34 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -663,19 +663,21 @@ void
 Main_ParseArgLine(const char *line)
 {
 	Words words;
-	void *p1;
-	const char *argv0 = Var_Value(".MAKE", VAR_GLOBAL, );
 	char *buf;
 
 	if (line == NULL)
 		return;
 	for (; *line == ' '; ++line)
 		continue;
-	if (!*line)
+	if (line[0] == '\0')
 		return;
 
-	buf = str_concat3(argv0, " ", line);
-	free(p1);
+	{
+		void *freeIt;
+		const char *argv0 = Var_Value(".MAKE", VAR_GLOBAL, );
+		buf = str_concat3(argv0, " ", line);
+		free(freeIt);
+	}
 
 	words = Str_Words(buf, TRUE);
 	if (words.words == NULL) {



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 02:05:34 UTC 2020

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

Log Message:
make(1): fix unrealistic memory leak in Main_ParseArgLine

It's unlikely that anyone ever defines an environment variable named
".MAKE" and then runs make with the -e option, which would make the
environment variable stronger than the built-in global variable.


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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 01:56:54 UTC 2020

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

Log Message:
make(1): add remarks for missing command line options in MAKEFLAGS


To generate a diff of this commit:
cvs rdiff -u -r1.440 -r1.441 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.440 src/usr.bin/make/main.c:1.441
--- src/usr.bin/make/main.c:1.440	Sun Nov  8 01:52:24 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 01:56:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.440 2020/11/08 01:52:24 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.441 2020/11/08 01:56:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.440 2020/11/08 01:52:24 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.441 2020/11/08 01:56:54 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -487,6 +487,7 @@ MainParseArg(char c, const char *argvalu
 		break;
 	case 'W':
 		opts.parseWarnFatal = TRUE;
+		/* XXX: why no Var_Append? */
 		break;
 	case 'X':
 		opts.varNoExportEnv = TRUE;
@@ -522,6 +523,7 @@ MainParseArg(char c, const char *argvalu
 		break;
 	case 'm':
 		MainParseArgSysInc(argvalue);
+		/* XXX: why no Var_Append? */
 		break;
 	case 'n':
 		opts.noExecute = TRUE;



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 01:56:54 UTC 2020

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

Log Message:
make(1): add remarks for missing command line options in MAKEFLAGS


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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 01:52:24 UTC 2020

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

Log Message:
make(1): parse the internal option -J strictly


To generate a diff of this commit:
cvs rdiff -u -r1.439 -r1.440 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.439 src/usr.bin/make/main.c:1.440
--- src/usr.bin/make/main.c:1.439	Sun Nov  8 01:43:58 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 01:52:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.439 2020/11/08 01:43:58 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.440 2020/11/08 01:52:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.439 2020/11/08 01:43:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.440 2020/11/08 01:52:24 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -215,7 +215,7 @@ parse_debug_option_F(const char *modules
 	snprintf(fname + len - 2, 20, "%d", getpid());
 
 opts.debug_file = fopen(fname, mode);
-if (!opts.debug_file) {
+if (opts.debug_file == NULL) {
 	fprintf(stderr, "Cannot open debug file %s\n",
 		fname);
 	usage();
@@ -375,7 +375,8 @@ MainParseArgChdir(const char *argvalue)
 static void
 MainParseArgJobsInternal(const char *argvalue)
 {
-	if (sscanf(argvalue, "%d,%d", _0, _1) != 2) {
+	char end;
+	if (sscanf(argvalue, "%d,%d%c", _0, _1, ) != 2) {
 		(void)fprintf(stderr,
 			  "%s: internal error -- J option malformed (%s)\n",
 			  progname, argvalue);



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 01:52:24 UTC 2020

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

Log Message:
make(1): parse the internal option -J strictly


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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 01:43:58 UTC 2020

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

Log Message:
make(1): merge duplicate code in is_relpath


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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 01:43:58 UTC 2020

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

Log Message:
make(1): merge duplicate code in is_relpath


To generate a diff of this commit:
cvs rdiff -u -r1.438 -r1.439 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.438 src/usr.bin/make/main.c:1.439
--- src/usr.bin/make/main.c:1.438	Sun Nov  8 01:40:01 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 01:43:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.438 2020/11/08 01:40:01 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.439 2020/11/08 01:43:58 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.438 2020/11/08 01:40:01 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.439 2020/11/08 01:43:58 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -151,7 +151,7 @@ static int errors = 0;
 
 /*
  * For compatibility with the POSIX version of MAKEFLAGS that includes
- * all the options with out -, convert flags to -f -l -a -g -s.
+ * all the options without '-', convert 'flags' to '-f -l -a -g -s'.
  */
 static char *
 explode(const char *flags)
@@ -341,12 +341,10 @@ is_relpath(const char *path)
 	cp = path;
 	while ((cp = strstr(cp, "/.")) != NULL) {
 		cp += 2;
+		if (*cp == '.')
+		cp++;
 		if (cp[0] == '/' || cp[0] == '\0')
 			return TRUE;
-		else if (cp[0] == '.') {
-			if (cp[1] == '/' || cp[1] == '\0')
-return TRUE;
-		}
 	}
 	return FALSE;
 }



CVS commit: src/usr.bin/make

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

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

Log Message:
make(1): clean up overview comment in main.c


To generate a diff of this commit:
cvs rdiff -u -r1.437 -r1.438 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.437 src/usr.bin/make/main.c:1.438
--- src/usr.bin/make/main.c:1.437	Sun Nov  8 01:39:24 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 01:40:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.437 2020/11/08 01:39:24 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.438 2020/11/08 01:40:01 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -68,31 +68,22 @@
  * SUCH DAMAGE.
  */
 
-/*-
- * main.c --
- *	The main file for this entire program. Exit routines etc
- *	reside here.
+/* The main file for this entire program. Exit routines etc. reside here.
  *
  * Utility functions defined in this file:
- *	Main_ParseArgLine	Takes a line of arguments, breaks them and
- *treats them as if they were given when first
- *invoked. Used by the parse module to implement
- *the .MFLAGS target.
- *
- *	Error			Print a tagged error message. The global
- *MAKE variable must have been defined. This
- *takes a format string and optional arguments
- *for it.
  *
- *	Fatal			Print an error message and exit. Also takes
- *a format string and arguments for it.
+ *	Main_ParseArgLine	Parse and process command line arguments from
+ *a single string.  Used to implement the
+ *special targets .MFLAGS and .MAKEFLAGS.
+ *
+ *	Error			Print a tagged error message.
+ *
+ *	Fatal			Print an error message and exit.
  *
- *	Punt			Aborts all jobs and exits with a message. Also
- *takes a format string and arguments for it.
+ *	Punt			Abort all jobs and exit with a message.
  *
  *	Finish			Finish things up by printing the number of
- *errors which occurred, as passed to it, and
- *exiting.
+ *errors which occurred, and exit.
  */
 
 #include 
@@ -118,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.437 2020/11/08 01:39:24 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.438 2020/11/08 01:40:01 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "



CVS commit: src/usr.bin/make

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

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

Log Message:
make(1): clean up overview comment in main.c


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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 01:39:24 UTC 2020

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.436 -r1.437 src/usr.bin/make/main.c
cvs rdiff -u -r1.197 -r1.198 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/main.c
diff -u src/usr.bin/make/main.c:1.436 src/usr.bin/make/main.c:1.437
--- src/usr.bin/make/main.c:1.436	Sat Nov  7 21:40:08 2020
+++ src/usr.bin/make/main.c	Sun Nov  8 01:39:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.436 2020/11/07 21:40:08 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.437 2020/11/08 01:39:24 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.436 2020/11/07 21:40:08 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.437 2020/11/08 01:39:24 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -489,7 +489,7 @@ MainParseArg(char c, const char *argvalu
 		break;
 	case 'V':
 	case 'v':
-		opts.printVars = c == 'v' ? EXPAND_VARS : COMPAT_VARS;
+		opts.printVars = c == 'v' ? PVM_EXPANDED : PVM_UNEXPANDED;
 		Lst_Append(opts.variables, bmake_strdup(argvalue));
 		/* XXX: Why always -V? */
 		Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL);
@@ -891,7 +891,7 @@ doPrintVars(void)
 	StringListNode *ln;
 	Boolean expandVars;
 
-	if (opts.printVars == EXPAND_VARS)
+	if (opts.printVars == PVM_EXPANDED)
 		expandVars = TRUE;
 	else if (opts.debugVflag)
 		expandVars = FALSE;
@@ -1131,7 +1131,7 @@ CmdOpts_Init(void)
 	opts.noBuiltins = FALSE;	/* Read the built-in rules */
 	opts.beSilent = FALSE;		/* Print commands as executed */
 	opts.touchFlag = FALSE;		/* Actually update targets */
-	opts.printVars = 0;
+	opts.printVars = PVM_NONE;
 	opts.variables = Lst_New();
 	opts.parseWarnFatal = FALSE;
 	opts.enterFlag = FALSE;
@@ -1550,7 +1550,7 @@ main(int argc, char **argv)
 	ReadMakefiles();
 
 	/* In particular suppress .depend for '-r -V .OBJDIR -f /dev/null' */
-	if (!opts.noBuiltins || !opts.printVars) {
+	if (!opts.noBuiltins || opts.printVars == PVM_NONE) {
 	/* ignore /dev/null and anything starting with "no" */
 	(void)Var_Subst("${.MAKE.DEPENDFILE:N/dev/null:Nno*:T}",
 			VAR_CMDLINE, VARE_WANTRES, );
@@ -1590,7 +1590,7 @@ main(int argc, char **argv)
 	DEBUG5(JOB, "job_pipe %d %d, maxjobs %d, tokens %d, compat %d\n",
 	   jp_0, jp_1, opts.maxJobs, maxJobTokens, opts.compatMake ? 1 : 0);
 
-	if (!opts.printVars)
+	if (opts.printVars == PVM_NONE)
 	Main_ExportMAKEFLAGS(TRUE);	/* initial export */
 
 	InitVpath();
@@ -1611,7 +1611,7 @@ main(int argc, char **argv)
 		Targ_PrintGraph(1);
 
 	/* print the values of any variables requested by the user */
-	if (opts.printVars) {
+	if (opts.printVars != PVM_NONE) {
 		doPrintVars();
 		outOfDate = FALSE;
 	} else {

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.197 src/usr.bin/make/make.h:1.198
--- src/usr.bin/make/make.h:1.197	Sat Nov  7 10:44:53 2020
+++ src/usr.bin/make/make.h	Sun Nov  8 01:39:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.197 2020/11/07 10:44:53 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.198 2020/11/08 01:39:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -554,8 +554,9 @@ void debug_printf(const char *, ...) MAK
 else debug_printf(fmt, arg1, arg2, arg3, arg4, arg5)
 
 typedef enum PrintVarsMode {
-COMPAT_VARS = 1,
-EXPAND_VARS
+PVM_NONE,
+PVM_UNEXPANDED,
+PVM_EXPANDED
 } PrintVarsMode;
 
 /* Command line options */



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 01:39:24 UTC 2020

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.436 -r1.437 src/usr.bin/make/main.c
cvs rdiff -u -r1.197 -r1.198 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.



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 01:29:26 UTC 2020

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

Log Message:
make(1): rename list node to ln

That's the name that is used for list nodes outside lst.c, and there is
no reason to use a different name in the implementation of lists.  Sure,
the "l" of the name "ln" is redundant, but it's still shorter than
"node", and the latter sounds too similar to GNode.


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

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

Modified files:

Index: src/usr.bin/make/lst.c
diff -u src/usr.bin/make/lst.c:1.91 src/usr.bin/make/lst.c:1.92
--- src/usr.bin/make/lst.c:1.91	Wed Oct 28 02:43:16 2020
+++ src/usr.bin/make/lst.c	Sun Nov  8 01:29:26 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.91 2020/10/28 02:43:16 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.92 2020/11/08 01:29:26 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -34,16 +34,16 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.91 2020/10/28 02:43:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.92 2020/11/08 01:29:26 rillig Exp $");
 
 static ListNode *
 LstNodeNew(ListNode *prev, ListNode *next, void *datum)
 {
-ListNode *node = bmake_malloc(sizeof *node);
-node->prev = prev;
-node->next = next;
-node->datum = datum;
-return node;
+ListNode *ln = bmake_malloc(sizeof *ln);
+ln->prev = prev;
+ln->next = next;
+ln->datum = datum;
+return ln;
 }
 
 /* Create and initialize a new, empty list. */
@@ -62,12 +62,11 @@ Lst_New(void)
 void
 Lst_Free(List *list)
 {
-ListNode *node;
-ListNode *next;
+ListNode *ln, *next;
 
-for (node = list->first; node != NULL; node = next) {
-	next = node->next;
-	free(node);
+for (ln = list->first; ln != NULL; ln = next) {
+	next = ln->next;
+	free(ln);
 }
 
 free(list);
@@ -78,37 +77,32 @@ Lst_Free(List *list)
 void
 Lst_Destroy(List *list, LstFreeProc freeProc)
 {
-ListNode *node;
-ListNode *next;
+ListNode *ln, *next;
 
-for (node = list->first; node != NULL; node = next) {
-	next = node->next;
-	freeProc(node->datum);
-	free(node);
+for (ln = list->first; ln != NULL; ln = next) {
+	next = ln->next;
+	freeProc(ln->datum);
+	free(ln);
 }
 
 free(list);
 }
 
-/*
- * Functions to modify a list
- */
-
 /* Insert a new node with the datum before the given node. */
 void
-Lst_InsertBefore(List *list, ListNode *node, void *datum)
+Lst_InsertBefore(List *list, ListNode *ln, void *datum)
 {
 ListNode *newNode;
 
 assert(datum != NULL);
 
-newNode = LstNodeNew(node->prev, node, datum);
+newNode = LstNodeNew(ln->prev, ln, datum);
 
-if (node->prev != NULL)
-	node->prev->next = newNode;
-node->prev = newNode;
+if (ln->prev != NULL)
+	ln->prev->next = newNode;
+ln->prev = newNode;
 
-if (node == list->first)
+if (ln == list->first)
 	list->first = newNode;
 }
 
@@ -116,18 +110,18 @@ Lst_InsertBefore(List *list, ListNode *n
 void
 Lst_Prepend(List *list, void *datum)
 {
-ListNode *node;
+ListNode *ln;
 
 assert(datum != NULL);
 
-node = LstNodeNew(NULL, list->first, datum);
+ln = LstNodeNew(NULL, list->first, datum);
 
 if (list->first == NULL) {
-	list->first = node;
-	list->last = node;
+	list->first = ln;
+	list->last = ln;
 } else {
-	list->first->prev = node;
-	list->first = node;
+	list->first->prev = ln;
+	list->first = ln;
 }
 }
 
@@ -135,71 +129,69 @@ Lst_Prepend(List *list, void *datum)
 void
 Lst_Append(List *list, void *datum)
 {
-ListNode *node;
+ListNode *ln;
 
 assert(datum != NULL);
 
-node = LstNodeNew(list->last, NULL, datum);
+ln = LstNodeNew(list->last, NULL, datum);
 
 if (list->last == NULL) {
-	list->first = node;
-	list->last = node;
+	list->first = ln;
+	list->last = ln;
 } else {
-	list->last->next = node;
-	list->last = node;
+	list->last->next = ln;
+	list->last = ln;
 }
 }
 
 /* Remove the given node from the given list.
  * The datum stored in the node must be freed by the caller, if necessary. */
 void
-Lst_Remove(List *list, ListNode *node)
+Lst_Remove(List *list, ListNode *ln)
 {
 /* unlink it from its neighbors */
-if (node->next != NULL)
-	node->next->prev = node->prev;
-if (node->prev != NULL)
-	node->prev->next = node->next;
+if (ln->next != NULL)
+	ln->next->prev = ln->prev;
+if (ln->prev != NULL)
+	ln->prev->next = ln->next;
 
 /* unlink it from the list */
-if (list->first == node)
-	list->first = node->next;
-if (list->last == node)
-	list->last = node->prev;
+if (list->first == ln)
+	list->first = ln->next;
+if (list->last == ln)
+	list->last = ln->prev;
 }
 
 /* Replace the datum in the given node with the new datum. */
 void
-LstNode_Set(ListNode *node, void *datum)
+LstNode_Set(ListNode *ln, void *datum)
 {
 

CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 01:29:26 UTC 2020

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

Log Message:
make(1): rename list node to ln

That's the name that is used for list nodes outside lst.c, and there is
no reason to use a different name in the implementation of lists.  Sure,
the "l" of the name "ln" is redundant, but it's still shorter than
"node", and the latter sounds too similar to GNode.


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

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



Re: CVS commit: src/sys

2020-11-07 Thread Paul Goyette

Thanks for checking!

I agree with your proposed changes.  If noone else objects, please
go ahead and commit.


On Sun, 8 Nov 2020, Rin Okuyama wrote:


Thanks Paul for finding out the bug!

Then, compat_netbsd32 and compat_netbsd32_coredump modules are
successfully load for kernel without COMPAT_NETBSD32 option.

However, OABI binaries still do not work. I found this is due to
there remains ``#ifdef COMPAT_NETBSD32'' codes in sys/arch/arm.

By fixing them, OABI binaries work and dump valid core files!

I changed two files.

(1) arm_netbsd_elf32_probe() in arm/cpu_exec.c

Previously, determine whether emulation is native or netbsd32 by
testing ``epp->ep_esch->es_emul == _netbsd32''. This requires
COMPAT_NETBSD32 option. However, we can use
``epp->ep_esch->es_emul != _netbsd'' for this purpose.

(2) arm_netbsd_elf32_coredump_setup() in arm/core_machdep.c

This seems simply a mistake; kernel sets EABI flag to OABI core
files. We can remove entire COMPAT_NETBSD32 codes.

I will commit them soon if there's no objection.

Thanks,
rin

On 2020/11/08 6:53, Paul Goyette wrote:

Thanks for fixing ...

On Sat, 7 Nov 2020, Christos Zoulas wrote:


/usr/obj/evbarm-earmv7/tools/bin/nbmake-evbarm -V MACHINE_ARCH
earmv7


christos


On Nov 7, 2020, at 4:27 PM, Paul Goyette  wrote:

OK, I think I found the problem, but I don't know how to solve it...

All of the undefined symbols are supposed to be provided by

.../sys/arch/arm/arm32/netbsd32_machdep.c

but there is no netbsd32_machdep.o included in the compat_netbsd32
module.?? This file should be included by the following code in 
.../sys/modules/compat_netbsd32/Makefile


.if ${MACHINE_ARCH} == "arm"
.PATH:?? ${S}/arch/arm/arm32
SRCS+=?? netbsd32_machdep.c
.endif

but it seems not to work (or at least, it doesn't do what it was
intended to do).






On Thu, 5 Nov 2020, Rin Okuyama wrote:


On 2020/11/05 5:43, Paul Goyette wrote:

BTW, the patch you submitted with the initial message in this thread
looks good for avoiding the issue.?? But I'm not sure it is a complete
solution.
In particular, you would need to build a 32-bit arm that contains ``no
options COMPAT_NETBSD32'' and then boot and load the compat_netbsd32
and compat_netbsd32_coredump modules

?? modload compat_netbsd32
?? modload compat_netbsd32_coredump
Then see if emulation of the old ABI still works, and check if core-
dump works for old-ADI programs; the test program I've been using for
core-dump checking is

?? #include 
?? int main(int argc, void *argv) { abort(); }
I really have to leave and take care of some personal business, so I
would greatly appreciate if you can check this out.


Hmm, ``modload compat_netbsd32'' does not work on evbarmv6hf-el:


# uname -ap
NetBSD?? 9.99.75 NetBSD 9.99.75 (RPI0) #11: Thu Nov?? 5 20:26:39 JST 
2020 rin@latipes:/sys/arch/evbarm/compile/RPI0 evbarm earmv6hf

# modload compat_netbsd32
[?? 29.6328410] kobj_checksyms, 994: [compat_netbsd32]: linker error: 
symbol `netbsd32_vm_default_addr' not found
[?? 29.6460400] kobj_checksyms, 994: [compat_netbsd32]: linker error: 
symbol `netbsd32_machdep_md_init' not found
[?? 29.6560750] kobj_checksyms, 994: [compat_netbsd32]: linker error: 
symbol `netbsd32_sendsig' not found
[?? 29.6661200] kobj_checksyms, 994: [compat_netbsd32]: linker error: 
symbol `cpu_mcontext32_validate' not found
[?? 29.6791570] kobj_checksyms, 994: [compat_netbsd32]: linker error: 
symbol `cpu_setmcontext32' not found
[?? 29.6791570] kobj_checksyms, 994: [compat_netbsd32]: linker error: 
symbol `netbsd32_machdep_md_fini' not found
[?? 29.6948370] kobj_checksyms, 994: [compat_netbsd32]: linker error: 
symbol `startlwp32' not found
[?? 29.7048770] kobj_checksyms, 994: [compat_netbsd32]: linker error: 
symbol `cpu_getmcontext32' not found
[?? 29.7168550] kobj_checksyms, 994: [compat_netbsd32]: linker error: 
symbol `machine32' not found
[?? 29.7168550] kobj_checksyms, 994: [compat_netbsd32]: linker error: 
symbol `netbsd32_sysarch' not found
[?? 29.7318320] WARNING: module error: unable to affix module 
`compat_netbsd32', error 8

modload: compat_netbsd32: Exec format error


This should be because there are ``#ifdef COMPAT_NETBSD32'' codes in 
files

not included in compat_netbsd32 module. compat_netbsd32 module must not
work also for aarch64 and mips64 for the same reason, whereas amd64 and
sparc64 seem OK.

Thanks,
rin






++--+---+
| Paul Goyette | PGP Key fingerprint: | E-mail 
addresses: |
| (Retired)?? | FA29 0E3B 35AF E8AE 6651 | 
p...@whooppee.com |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org 
|

++--+---+





++--+---+
| Paul Goyette | PGP Key fingerprint: | E-mail 
addresses: |
| 

CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 01:16:04 UTC 2020

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

Log Message:
make(1): remove unused JOB_IGNDOTS

It had been used in 1993 at least, don't know when it was finally
removed.


To generate a diff of this commit:
cvs rdiff -u -r1.313 -r1.314 src/usr.bin/make/job.c
cvs rdiff -u -r1.60 -r1.61 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.313 src/usr.bin/make/job.c:1.314
--- src/usr.bin/make/job.c:1.313	Sun Nov  8 01:07:00 2020
+++ src/usr.bin/make/job.c	Sun Nov  8 01:16:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.313 2020/11/08 01:07:00 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.314 2020/11/08 01:16:04 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.313 2020/11/08 01:07:00 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.314 2020/11/08 01:16:04 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -900,12 +900,11 @@ JobPrintCommands(Job *job)
 
 	if (strcmp(cmd, "...") == 0) {
 	job->node->type |= OP_SAVE_CMDS;
-	if (!(job->flags & JOB_IGNDOTS)) {
-		job->tailCmds = ln->next;
-		break;
-	}
-	} else
-	JobPrintCommand(job, ln->datum);
+	job->tailCmds = ln->next;
+	break;
+	}
+
+	JobPrintCommand(job, ln->datum);
 }
 }
 
@@ -1473,7 +1472,6 @@ JobMakeArgv(Job *job, char **argv)
  * Input:
  *	gn		target to create
  *	flags		flags for the job to override normal ones.
- *			e.g. JOB_SPECIAL or JOB_IGNDOTS
  *	previous	The previous Job structure for this node, if any.
  *
  * Results:
@@ -1485,9 +1483,7 @@ JobMakeArgv(Job *job, char **argv)
  *	A new Job node is created and added to the list of running
  *	jobs. PMake is forked and a child shell created.
  *
- * NB: I'm fairly sure that this code is never called with JOB_SPECIAL set
- * JOB_IGNDOTS is never set (dsl)
- * Also the return value is ignored by everyone.
+ * NB: The return value is ignored by everyone.
  *---
  */
 static JobStartResult

Index: src/usr.bin/make/job.h
diff -u src/usr.bin/make/job.h:1.60 src/usr.bin/make/job.h:1.61
--- src/usr.bin/make/job.h:1.60	Sat Nov  7 21:24:33 2020
+++ src/usr.bin/make/job.h	Sun Nov  8 01:16:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.h,v 1.60 2020/11/07 21:24:33 rillig Exp $	*/
+/*	$NetBSD: job.h,v 1.61 2020/11/08 01:16:04 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -134,8 +134,6 @@ typedef enum JobFlags {
 /* Target is a special one. i.e. run it locally
  * if we can't export it and maxLocal is 0 */
 JOB_SPECIAL	= 1 << 2,
-/* Ignore "..." lines when processing commands */
-JOB_IGNDOTS	= 1 << 3,
 /* we've sent 'set -x' */
 JOB_TRACED	= 1 << 10
 } JobFlags;



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 01:16:04 UTC 2020

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

Log Message:
make(1): remove unused JOB_IGNDOTS

It had been used in 1993 at least, don't know when it was finally
removed.


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



CVS commit: src/usr.sbin/syslogd

2020-11-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Nov  8 01:12:46 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
syslogd: in die(), don't call die() again recursively.

Particularly not for something as immaterial as close failing.

PR 55795


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/usr.sbin/syslogd/syslogd.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/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.135 src/usr.sbin/syslogd/syslogd.c:1.136
--- src/usr.sbin/syslogd/syslogd.c:1.135	Sat Nov  7 17:46:56 2020
+++ src/usr.sbin/syslogd/syslogd.c	Sun Nov  8 01:12:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.135 2020/11/07 17:46:56 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.136 2020/11/08 01:12:46 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.135 2020/11/07 17:46:56 christos Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.136 2020/11/08 01:12:46 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -3012,10 +3012,7 @@ die(int fd, short event, void *ev)
 	 */
 	if (finet) {
 		for (i = 0; i < finet->fd; i++) {
-			if (close(finet[i+1].fd) < 0) {
-logerror("close() failed");
-die(0, 0, NULL);
-			}
+			(void)close(finet[i+1].fd);
 			DEL_EVENT(finet[i+1].ev);
 			FREEPTR(finet[i+1].ev);
 		}



CVS commit: src/usr.sbin/syslogd

2020-11-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Nov  8 01:12:46 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
syslogd: in die(), don't call die() again recursively.

Particularly not for something as immaterial as close failing.

PR 55795


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/usr.sbin/syslogd/syslogd.c

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



CVS commit: src/usr.bin/make

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

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

Log Message:
make(1): format source code in JobStart and JobDoOutput


To generate a diff of this commit:
cvs rdiff -u -r1.312 -r1.313 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.312 src/usr.bin/make/job.c:1.313
--- src/usr.bin/make/job.c:1.312	Sun Nov  8 01:00:25 2020
+++ src/usr.bin/make/job.c	Sun Nov  8 01:07:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.312 2020/11/08 01:00:25 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.313 2020/11/08 01:07:00 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.312 2020/11/08 01:00:25 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.313 2020/11/08 01:07:00 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -1533,7 +1533,7 @@ JobStart(GNode *gn, JobFlags flags)
  * we just set the file to be stdout. Cute, huh?
  */
 if (((gn->type & OP_MAKE) && !opts.noRecursiveExecute) ||
-	(!opts.noExecute && !opts.touchFlag)) {
+	(!opts.noExecute && !opts.touchFlag)) {
 	/*
 	 * tfile is the name of a file into which all shell commands are
 	 * put. It is removed before the child shell is executed, unless
@@ -1553,13 +1553,13 @@ JobStart(GNode *gn, JobFlags flags)
 	JobSigLock();
 	tfd = mkTempFile(TMPPAT, );
 	if (!DEBUG(SCRIPT))
-		(void)eunlink(tfile);
+	(void)eunlink(tfile);
 	JobSigUnlock();
 
 	job->cmdFILE = fdopen(tfd, "w+");
-	if (job->cmdFILE == NULL) {
+	if (job->cmdFILE == NULL)
 	Punt("Could not fdopen %s", tfile);
-	}
+
 	(void)fcntl(fileno(job->cmdFILE), F_SETFD, FD_CLOEXEC);
 	/*
 	 * Send the commands to the command file, flush all its buffers then
@@ -1570,9 +1570,8 @@ JobStart(GNode *gn, JobFlags flags)
 #ifdef USE_META
 	if (useMeta) {
 	meta_job_start(job, gn);
-	if (Targ_Silent(gn)) {	/* might have changed */
+	if (Targ_Silent(gn))	/* might have changed */
 		job->flags |= JOB_SILENT;
-	}
 	}
 #endif
 	/*
@@ -1619,7 +1618,7 @@ JobStart(GNode *gn, JobFlags flags)
 	 * up the graph.
 	 */
 	job->cmdFILE = stdout;
-	Job_Touch(gn, job->flags_SILENT);
+	Job_Touch(gn, job->flags & JOB_SILENT);
 	noExec = TRUE;
 }
 /* Just in case it isn't already... */
@@ -1749,7 +1748,7 @@ end_loop:
 fbuf = FALSE;
 
 nRead = read(job->inPipe, >outBuf[job->curPos],
-		 JOB_BUFSIZE - job->curPos);
+		 JOB_BUFSIZE - job->curPos);
 if (nRead < 0) {
 	if (errno == EAGAIN)
 	return;



CVS commit: src/usr.bin/make

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

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

Log Message:
make(1): format source code in JobStart and JobDoOutput


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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 01:00:25 UTC 2020

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

Log Message:
make(1): fix indentation in JobExec


To generate a diff of this commit:
cvs rdiff -u -r1.311 -r1.312 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.311 src/usr.bin/make/job.c:1.312
--- src/usr.bin/make/job.c:1.311	Sun Nov  8 00:54:06 2020
+++ src/usr.bin/make/job.c	Sun Nov  8 01:00:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.311 2020/11/08 00:54:06 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.312 2020/11/08 01:00:25 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.311 2020/11/08 00:54:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.312 2020/11/08 01:00:25 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -1272,7 +1272,7 @@ static void
 JobExec(Job *job, char **argv)
 {
 int cpid;			/* ID of new child */
-sigset_t	  mask;
+sigset_t mask;
 
 job->flags &= ~JOB_TRACED;
 
@@ -1340,13 +1340,13 @@ JobExec(Job *job, char **argv)
 	execDie("lseek to 0", "stdin");
 
 	if (job->node->type & (OP_MAKE | OP_SUBMAKE)) {
-		/*
-		 * Pass job token pipe to submakes.
-		 */
-		if (fcntl(tokenWaitJob.inPipe, F_SETFD, 0) == -1)
-		execDie("clear close-on-exec", "tokenWaitJob.inPipe");
-		if (fcntl(tokenWaitJob.outPipe, F_SETFD, 0) == -1)
-		execDie("clear close-on-exec", "tokenWaitJob.outPipe");
+	/*
+	 * Pass job token pipe to submakes.
+	 */
+	if (fcntl(tokenWaitJob.inPipe, F_SETFD, 0) == -1)
+		execDie("clear close-on-exec", "tokenWaitJob.inPipe");
+	if (fcntl(tokenWaitJob.outPipe, F_SETFD, 0) == -1)
+		execDie("clear close-on-exec", "tokenWaitJob.outPipe");
 	}
 
 	/*



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 01:00:25 UTC 2020

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

Log Message:
make(1): fix indentation in JobExec


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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 00:54:06 UTC 2020

Modified Files:
src/usr.bin/make: job.c
src/usr.bin/make/unit-tests: opt-debug-jobs.exp

Log Message:
make(1): clean up debug output for running jobs

There is no remote anymore, therefore mentioning locally is redundant.
It was a bad idea anyway to build format strings that work with parts of
words.


To generate a diff of this commit:
cvs rdiff -u -r1.310 -r1.311 src/usr.bin/make/job.c
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/opt-debug-jobs.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/job.c
diff -u src/usr.bin/make/job.c:1.310 src/usr.bin/make/job.c:1.311
--- src/usr.bin/make/job.c:1.310	Sat Nov  7 21:24:33 2020
+++ src/usr.bin/make/job.c	Sun Nov  8 00:54:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.310 2020/11/07 21:24:33 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.311 2020/11/08 00:54:06 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.310 2020/11/07 21:24:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.311 2020/11/08 00:54:06 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -1279,7 +1279,7 @@ JobExec(Job *job, char **argv)
 if (DEBUG(JOB)) {
 	int i;
 
-	debug_printf("Running %s %sly\n", job->node->name, "local");
+	debug_printf("Running %s\n", job->node->name);
 	debug_printf("\tCommand: ");
 	for (i = 0; argv[i] != NULL; i++) {
 	debug_printf("%s ", argv[i]);

Index: src/usr.bin/make/unit-tests/opt-debug-jobs.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-jobs.exp:1.5 src/usr.bin/make/unit-tests/opt-debug-jobs.exp:1.6
--- src/usr.bin/make/unit-tests/opt-debug-jobs.exp:1.5	Thu Oct  8 17:54:20 2020
+++ src/usr.bin/make/unit-tests/opt-debug-jobs.exp	Sun Nov  8 00:54:06 2020
@@ -10,7 +10,7 @@ echo ":  variable"
 echo ": 'single' and \"double\" quotes"
 { : 'single' and "double" quotes 
 } || exit $?
-Running all locally
+Running all
 	Command: sh 
 JobExec(all): pid  added to jobs table
 job table @ job started



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 00:54:06 UTC 2020

Modified Files:
src/usr.bin/make: job.c
src/usr.bin/make/unit-tests: opt-debug-jobs.exp

Log Message:
make(1): clean up debug output for running jobs

There is no remote anymore, therefore mentioning locally is redundant.
It was a bad idea anyway to build format strings that work with parts of
words.


To generate a diff of this commit:
cvs rdiff -u -r1.310 -r1.311 src/usr.bin/make/job.c
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/opt-debug-jobs.exp

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



Re: CVS commit: src/sys

2020-11-07 Thread Rin Okuyama

Thanks Paul for finding out the bug!

Then, compat_netbsd32 and compat_netbsd32_coredump modules are
successfully load for kernel without COMPAT_NETBSD32 option.

However, OABI binaries still do not work. I found this is due to
there remains ``#ifdef COMPAT_NETBSD32'' codes in sys/arch/arm.

By fixing them, OABI binaries work and dump valid core files!

I changed two files.

(1) arm_netbsd_elf32_probe() in arm/cpu_exec.c

Previously, determine whether emulation is native or netbsd32 by
testing ``epp->ep_esch->es_emul == _netbsd32''. This requires
COMPAT_NETBSD32 option. However, we can use
``epp->ep_esch->es_emul != _netbsd'' for this purpose.

(2) arm_netbsd_elf32_coredump_setup() in arm/core_machdep.c

This seems simply a mistake; kernel sets EABI flag to OABI core
files. We can remove entire COMPAT_NETBSD32 codes.

I will commit them soon if there's no objection.

Thanks,
rin

On 2020/11/08 6:53, Paul Goyette wrote:

Thanks for fixing ...

On Sat, 7 Nov 2020, Christos Zoulas wrote:


/usr/obj/evbarm-earmv7/tools/bin/nbmake-evbarm -V MACHINE_ARCH
earmv7


christos


On Nov 7, 2020, at 4:27 PM, Paul Goyette  wrote:

OK, I think I found the problem, but I don't know how to solve it...

All of the undefined symbols are supposed to be provided by

.../sys/arch/arm/arm32/netbsd32_machdep.c

but there is no netbsd32_machdep.o included in the compat_netbsd32
module.  This file should be included by the following code in 
.../sys/modules/compat_netbsd32/Makefile

.if ${MACHINE_ARCH} == "arm"
.PATH:  ${S}/arch/arm/arm32
SRCS+=  netbsd32_machdep.c
.endif

but it seems not to work (or at least, it doesn't do what it was
intended to do).






On Thu, 5 Nov 2020, Rin Okuyama wrote:


On 2020/11/05 5:43, Paul Goyette wrote:

BTW, the patch you submitted with the initial message in this thread
looks good for avoiding the issue.  But I'm not sure it is a complete
solution.
In particular, you would need to build a 32-bit arm that contains ``no
options COMPAT_NETBSD32'' and then boot and load the compat_netbsd32
and compat_netbsd32_coredump modules

    modload compat_netbsd32
    modload compat_netbsd32_coredump
Then see if emulation of the old ABI still works, and check if core-
dump works for old-ADI programs; the test program I've been using for
core-dump checking is

    #include 
    int main(int argc, void *argv) { abort(); }
I really have to leave and take care of some personal business, so I
would greatly appreciate if you can check this out.


Hmm, ``modload compat_netbsd32'' does not work on evbarmv6hf-el:


# uname -ap
NetBSD  9.99.75 NetBSD 9.99.75 (RPI0) #11: Thu Nov  5 20:26:39 JST 2020 
rin@latipes:/sys/arch/evbarm/compile/RPI0 evbarm earmv6hf
# modload compat_netbsd32
[  29.6328410] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_vm_default_addr' not found
[  29.6460400] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_machdep_md_init' not found
[  29.6560750] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_sendsig' not found
[  29.6661200] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`cpu_mcontext32_validate' not found
[  29.6791570] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`cpu_setmcontext32' not found
[  29.6791570] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_machdep_md_fini' not found
[  29.6948370] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`startlwp32' not found
[  29.7048770] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`cpu_getmcontext32' not found
[  29.7168550] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`machine32' not found
[  29.7168550] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_sysarch' not found
[  29.7318320] WARNING: module error: unable to affix module `compat_netbsd32', 
error 8
modload: compat_netbsd32: Exec format error


This should be because there are ``#ifdef COMPAT_NETBSD32'' codes in files
not included in compat_netbsd32 module. compat_netbsd32 module must not
work also for aarch64 and mips64 for the same reason, whereas amd64 and
sparc64 seem OK.

Thanks,
rin

!DSPAM:5fa3f309175521945872603!




++--+---+
| Paul Goyette   | PGP Key fingerprint: | E-mail addresses: |
| (Retired)  | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org   |
++--+---+





++--+---+
| Paul Goyette   | PGP Key fingerprint: | E-mail addresses: |
| (Retired)  | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org   |
++--+---+

CVS commit: src/usr.bin/make

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

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

Log Message:
make(1): rename Src.children to numChildren

There are several other types that have a field named 'children' that is
a list.  To avoid confusion, rename this one to differentiate them.


To generate a diff of this commit:
cvs rdiff -u -r1.233 -r1.234 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.233 src/usr.bin/make/suff.c:1.234
--- src/usr.bin/make/suff.c:1.233	Sun Nov  8 00:26:06 2020
+++ src/usr.bin/make/suff.c	Sun Nov  8 00:28:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.233 2020/11/08 00:26:06 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.234 2020/11/08 00:28:52 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.233 2020/11/08 00:26:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.234 2020/11/08 00:28:52 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -191,7 +191,7 @@ typedef struct Src {
 Suff *suff;			/* The suffix on the file */
 struct Src *parent;		/* The Src for which this is a source */
 GNode *node;		/* The node describing the file */
-int children;		/* Count of existing children (so we don't free
+int numChildren;		/* Count of existing children (so we don't free
  * this thing too early or never nuke it) */
 #ifdef DEBUG_SRC
 SrcList *childrenList;
@@ -842,7 +842,7 @@ SrcNew(char *name, char *pref, Suff *suf
 src->suff = suff;
 src->parent = parent;
 src->node = gn;
-src->children = 0;
+src->numChildren = 0;
 #ifdef DEBUG_SRC
 src->childrenList = Lst_New();
 #endif
@@ -852,11 +852,11 @@ SrcNew(char *name, char *pref, Suff *suf
 
 static void
 SuffAddSrc(Suff *suff, SrcList *srcList, Src *targ, char *srcName,
-	   const char *debug_tag)
+	   const char *debug_tag MAKE_ATTR_UNUSED)
 {
 Src *s2 = SrcNew(srcName, targ->pref, suff, targ, NULL);
 suff->refCount++;
-targ->children++;
+targ->numChildren++;
 Lst_Append(srcList, s2);
 #ifdef DEBUG_SRC
 Lst_Append(targ->childrenList, s2);
@@ -920,7 +920,7 @@ SuffRemoveSrc(SrcList *l)
 for (ln = l->first; ln != NULL; ln = ln->next) {
 	Src *src = ln->datum;
 
-	if (src->children == 0) {
+	if (src->numChildren == 0) {
 	free(src->file);
 	if (src->parent == NULL)
 		free(src->pref);
@@ -930,7 +930,7 @@ SuffRemoveSrc(SrcList *l)
 		if (ln2 != NULL)
 		Lst_Remove(src->parent->childrenList, ln2);
 #endif
-		src->parent->children--;
+		src->parent->numChildren--;
 	}
 #ifdef DEBUG_SRC
 	debug_printf("free: list %p src %p children %d\n",
@@ -1085,7 +1085,7 @@ SuffFindCmds(Src *targ, SrcList *slst)
  */
 ret = SrcNew(bmake_strdup(sgn->name), targ->pref, suff, targ, sgn);
 suff->refCount++;
-targ->children++;
+targ->numChildren++;
 #ifdef DEBUG_SRC
 debug_printf("3 add targ %p ret %p\n", targ, ret);
 Lst_Append(targ->childrenList, ret);



CVS commit: src/usr.bin/make

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

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

Log Message:
make(1): rename Src.children to numChildren

There are several other types that have a field named 'children' that is
a list.  To avoid confusion, rename this one to differentiate them.


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

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 00:26:06 UTC 2020

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

Log Message:
make(1): clean up local variable names in suffix handling

The file suff.c defines both Src and Suff, which makes the variable name
s ambiguous.

The word 'target' is ambiguous as well since it could mean a GNode or the
target suffix of a transformation.  Therefore, make the variable names
longer but more precise.

The comment about the nil return and the beanhead had been outdated
already in 1993.  There is no nil return anywhere nearby.  The longer
variable names make the rest of the comment redundant.


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

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Nov  8 00:26:06 UTC 2020

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

Log Message:
make(1): clean up local variable names in suffix handling

The file suff.c defines both Src and Suff, which makes the variable name
s ambiguous.

The word 'target' is ambiguous as well since it could mean a GNode or the
target suffix of a transformation.  Therefore, make the variable names
longer but more precise.

The comment about the nil return and the beanhead had been outdated
already in 1993.  There is no nil return anywhere nearby.  The longer
variable names make the rest of the comment redundant.


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 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.232 src/usr.bin/make/suff.c:1.233
--- src/usr.bin/make/suff.c:1.232	Sat Nov  7 10:44:53 2020
+++ src/usr.bin/make/suff.c	Sun Nov  8 00:26:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.232 2020/11/07 10:44:53 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.233 2020/11/08 00:26:06 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.232 2020/11/07 10:44:53 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.233 2020/11/08 00:26:06 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -318,28 +318,28 @@ SuffUnRef(SuffList *list, Suff *suff)
 static void
 SuffFree(void *sp)
 {
-Suff *s = sp;
+Suff *suff = sp;
 
-if (s == suffNull)
+if (suff == suffNull)
 	suffNull = NULL;
 
-if (s == emptySuff)
+if (suff == emptySuff)
 	emptySuff = NULL;
 
 #if 0
 /* We don't delete suffixes in order, so we cannot use this */
-if (s->refCount)
-	Punt("Internal error deleting suffix `%s' with refcount = %d", s->name,
-	s->refCount);
+if (suff->refCount)
+	Punt("Internal error deleting suffix `%s' with refcount = %d",
+	 suff->name, suff->refCount);
 #endif
 
-Lst_Free(s->ref);
-Lst_Free(s->children);
-Lst_Free(s->parents);
-Lst_Destroy(s->searchPath, Dir_Destroy);
+Lst_Free(suff->ref);
+Lst_Free(suff->children);
+Lst_Free(suff->parents);
+Lst_Destroy(suff->searchPath, Dir_Destroy);
 
-free(s->name);
-free(s);
+free(suff->name);
+free(suff);
 }
 
 /* Remove the suffix from the list, and free if it is otherwise unused. */
@@ -387,19 +387,19 @@ SuffInsert(SuffList *list, Suff *suff)
 static Suff *
 SuffNew(const char *name)
 {
-Suff *s = bmake_malloc(sizeof *s);
+Suff *suff = bmake_malloc(sizeof *suff);
 
-s->name = bmake_strdup(name);
-s->nameLen = strlen(s->name);
-s->searchPath = Lst_New();
-s->children = Lst_New();
-s->parents = Lst_New();
-s->ref = Lst_New();
-s->sNum = sNum++;
-s->flags = 0;
-s->refCount = 1;
+suff->name = bmake_strdup(name);
+suff->nameLen = strlen(suff->name);
+suff->searchPath = Lst_New();
+suff->children = Lst_New();
+suff->parents = Lst_New();
+suff->ref = Lst_New();
+suff->sNum = sNum++;
+suff->flags = 0;
+suff->refCount = 1;
 
-return s;
+return suff;
 }
 
 /* This is gross. Nuke the list of suffixes but keep all transformation
@@ -500,12 +500,10 @@ Suff_IsTransform(const char *str)
 GNode *
 Suff_AddTransform(const char *name)
 {
-GNode *gn;		/* GNode of transformation rule */
-Suff  *s,		/* source suffix */
-		  *t;		/* target suffix */
-Boolean ok;
+Suff *srcSuff;
+Suff *targSuff;
 
-gn = FindTransformByName(name);
+GNode *gn = FindTransformByName(name);
 if (gn == NULL) {
 	/*
 	 * Make a new graph node for the transformation. It will be filled in
@@ -528,17 +526,19 @@ Suff_AddTransform(const char *name)
 
 gn->type = OP_TRANSFORM;
 
-ok = SuffParseTransform(name, , );
-assert(ok);
-(void)ok;
+{
+	Boolean ok = SuffParseTransform(name, , );
+	assert(ok);
+	(void)ok;
+}
 
 /*
  * link the two together in the proper relationship and order
  */
 SUFF_DEBUG2("defining transformation from `%s' to `%s'\n",
-		s->name, t->name);
-SuffInsert(t->children, s);
-SuffInsert(s->parents, t);
+		srcSuff->name, targSuff->name);
+SuffInsert(targSuff->children, srcSuff);
+SuffInsert(srcSuff->parents, targSuff);
 
 return gn;
 }
@@ -560,37 +560,22 @@ Suff_EndTransform(GNode *gn)
 if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) &&
 	Lst_IsEmpty(gn->children))
 {
-	Suff	*s, *t;
+	Suff *srcSuff, *targSuff;
 
 	/*
 	 * SuffParseTransform() may fail for special rules which are not
 	 * actual transformation rules. (e.g. .DEFAULT)
 	 */
-	if (SuffParseTransform(gn->name, , )) {
-	SuffList *p;
-
-	

CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 23:41:39 UTC 2020

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

Log Message:
make(1): replace strstr in ParseMaybeSubMake with optimized code

This code is called for each command that is parsed.  Calling strstr with
4 strings that all start with the same character is unnecessary work.
Therefore, replace strstr with manually optimized code.  Neither GCC
5.5.0 nor GCC 10 inlines strncmp like this, otherwise I would have used
that.

Change in behavior: previously, a${MAKE}b would not be considered to be a
sub-make command, which is probably correct but does not occur in
practice.  The check for non-alphanumeric characters around the found
string was probably meant only for the plain word "make".


To generate a diff of this commit:
cvs rdiff -u -r1.431 -r1.432 src/usr.bin/make/parse.c

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

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.431 src/usr.bin/make/parse.c:1.432
--- src/usr.bin/make/parse.c:1.431	Sat Nov  7 22:26:42 2020
+++ src/usr.bin/make/parse.c	Sat Nov  7 23:41:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.431 2020/11/07 22:26:42 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.432 2020/11/07 23:41:38 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.431 2020/11/07 22:26:42 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.432 2020/11/07 23:41:38 rillig Exp $");
 
 /* types and constants */
 
@@ -2031,36 +2031,41 @@ Parse_DoVar(VarAssign *var, GNode *ctxt)
 }
 
 
-/*
- * ParseMaybeSubMake --
- *	Scan the command string to see if it a possible submake node
- * Input:
- *	cmd		the command to scan
- * Results:
- *	TRUE if the command is possibly a submake, FALSE if not.
- */
+/* See if the command possibly calls a sub-make by using the variable
+ * expressions ${.MAKE}, ${MAKE} or the plain word "make". */
 static Boolean
-ParseMaybeSubMake(const char *cmd)
+MaybeSubMake(const char *cmd)
 {
-size_t i;
-static struct {
-	const char *name;
-	size_t len;
-} vals[] = {
-#define MKV(A)	{	A, sizeof (A) - 1	}
-	MKV("${MAKE}"),
-	MKV("${.MAKE}"),
-	MKV("$(MAKE)"),
-	MKV("$(.MAKE)"),
-	MKV("make"),
-};
-for (i = 0; i < sizeof vals / sizeof vals[0]; i++) {
-	char *ptr;
-	if ((ptr = strstr(cmd, vals[i].name)) == NULL)
+const char *start;
+
+for (start = cmd; *start != '\0'; start++) {
+	const char *p = start;
+	char endc;
+
+	/* XXX: What if progname != "make"? */
+	if (p[0] == 'm' && p[1] == 'a' && p[2] == 'k' && p[3] == 'e')
+	if (start == cmd || !ch_isalnum(p[-1]))
+		if (!ch_isalnum(p[4]))
+		return TRUE;
+
+	if (*p != '$')
 	continue;
-	if ((ptr == cmd || !ch_isalnum(ptr[-1]))
-	&& !ch_isalnum(ptr[vals[i].len]))
-	return TRUE;
+	p++;
+
+	if (*p == '{')
+	endc = '}';
+	else if (*p == '(')
+	endc = ')';
+	else
+	continue;
+	p++;
+
+	if (*p == '.')		/* Accept either ${.MAKE} or ${MAKE}. */
+	p++;
+
+	if (p[0] == 'M' && p[1] == 'A' && p[2] == 'K' && p[3] == 'E')
+	if (p[4] == endc)
+		return TRUE;
 }
 return FALSE;
 }
@@ -2079,7 +2084,7 @@ ParseAddCmd(GNode *gn, char *cmd)
 /* if target already supplied, ignore commands */
 if (!(gn->type & OP_HAS_COMMANDS)) {
 	Lst_Append(gn->commands, cmd);
-	if (ParseMaybeSubMake(cmd))
+	if (MaybeSubMake(cmd))
 	gn->type |= OP_SUBMAKE;
 	ParseMark(gn);
 } else {



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 23:41:39 UTC 2020

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

Log Message:
make(1): replace strstr in ParseMaybeSubMake with optimized code

This code is called for each command that is parsed.  Calling strstr with
4 strings that all start with the same character is unnecessary work.
Therefore, replace strstr with manually optimized code.  Neither GCC
5.5.0 nor GCC 10 inlines strncmp like this, otherwise I would have used
that.

Change in behavior: previously, a${MAKE}b would not be considered to be a
sub-make command, which is probably correct but does not occur in
practice.  The check for non-alphanumeric characters around the found
string was probably meant only for the plain word "make".


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



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

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 23:25:06 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: gnode-submake.exp gnode-submake.mk

Log Message:
make(1): add test for OP_SUBMAKE


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/gnode-submake.exp \
src/usr.bin/make/unit-tests/gnode-submake.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.189 src/usr.bin/make/unit-tests/Makefile:1.190
--- src/usr.bin/make/unit-tests/Makefile:1.189	Sat Nov  7 20:01:17 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sat Nov  7 23:25:06 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.189 2020/11/07 20:01:17 rillig Exp $
+# $NetBSD: Makefile,v 1.190 2020/11/07 23:25:06 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -172,6 +172,7 @@ TESTS+=		export-env
 TESTS+=		export-variants
 TESTS+=		forloop
 TESTS+=		forsubst
+TESTS+=		gnode-submake
 TESTS+=		hanoi-include
 TESTS+=		impsrc
 TESTS+=		include-main
@@ -440,6 +441,7 @@ SED_CMDS.varname-dot-shell+=	-e 's,\[/[^
 # Some tests need an additional round of postprocessing.
 POSTPROC.deptgt-suffixes= \
 			${TOOL_SED} -n -e '/^\#\*\*\* Suffixes/,/^\#\*/p'
+POSTPROC.gnode-submake=	awk '/Input graph/, /^$$/'
 POSTPROC.varname-empty=	${TOOL_SED} -n -e '/^Var_Set/p' -e '/^out:/p'
 
 # Some tests reuse other tests, which makes them unnecessarily fragile.

Added files:

Index: src/usr.bin/make/unit-tests/gnode-submake.exp
diff -u /dev/null src/usr.bin/make/unit-tests/gnode-submake.exp:1.1
--- /dev/null	Sat Nov  7 23:25:06 2020
+++ src/usr.bin/make/unit-tests/gnode-submake.exp	Sat Nov  7 23:25:06 2020
@@ -0,0 +1,11 @@
+#*** Input graph:
+# all, made UNMADE, type OP_DEPENDS, flags none
+# makeinfo, made UNMADE, type OP_DEPENDS|OP_HAS_COMMANDS, flags none
+# make-index, made UNMADE, type OP_DEPENDS|OP_SUBMAKE|OP_HAS_COMMANDS, flags none
+# braces-dot, made UNMADE, type OP_DEPENDS|OP_SUBMAKE|OP_HAS_COMMANDS, flags none
+# braces-no-dot, made UNMADE, type OP_DEPENDS|OP_SUBMAKE|OP_HAS_COMMANDS, flags none
+# braces-no-dot-modifier, made UNMADE, type OP_DEPENDS|OP_HAS_COMMANDS, flags none
+# parentheses-dot, made UNMADE, type OP_DEPENDS|OP_SUBMAKE|OP_HAS_COMMANDS, flags none
+# parentheses-no-dot, made UNMADE, type OP_DEPENDS|OP_SUBMAKE|OP_HAS_COMMANDS, flags none
+
+exit status 0
Index: src/usr.bin/make/unit-tests/gnode-submake.mk
diff -u /dev/null src/usr.bin/make/unit-tests/gnode-submake.mk:1.1
--- /dev/null	Sat Nov  7 23:25:06 2020
+++ src/usr.bin/make/unit-tests/gnode-submake.mk	Sat Nov  7 23:25:06 2020
@@ -0,0 +1,42 @@
+# $NetBSD: gnode-submake.mk,v 1.1 2020/11/07 23:25:06 rillig Exp $
+#
+# Test whether OP_SUBMAKE is determined correctly.  If it is, this node's
+# shell commands are connected to the make process via pipes, to coordinate
+# the number of running jobs.
+#
+# Determining whether a node is a sub-make node happens when the node is
+# parsed.  This information is only used in parallel mode, but the result
+# from parsing is available in compat mode as well.
+
+.MAKEFLAGS: -n -dg1
+
+all: makeinfo make-index
+all: braces-dot braces-no-dot
+all: braces-no-dot-modifier
+all: parentheses-dot parentheses-no-dot
+
+makeinfo:
+	# The command contains the substring "make", but not as a whole word.
+	: makeinfo submake
+
+make-index:
+	# The command contains the word "make", therefore it is considered a
+	# possible sub-make.  It isn't really, but that doesn't hurt.
+	: make-index
+
+braces-dot:
+	: ${.MAKE}
+
+braces-no-dot:
+	: ${MAKE}
+
+braces-no-dot-modifier:
+	# The command refers to MAKE, but not in its pure form.  Therefore it
+	# is not considered a sub-make.
+	: ${MAKE:T}
+
+parentheses-dot:
+	: $(.MAKE)
+
+parentheses-no-dot:
+	: $(MAKE)



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

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 23:25:06 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: gnode-submake.exp gnode-submake.mk

Log Message:
make(1): add test for OP_SUBMAKE


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/gnode-submake.exp \
src/usr.bin/make/unit-tests/gnode-submake.mk

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 22:29:58 UTC 2020

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

Log Message:
make(1): clean up spacing in fallback implementation of vsnprintf


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.bin/make/util.c

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

Modified files:

Index: src/usr.bin/make/util.c
diff -u src/usr.bin/make/util.c:1.65 src/usr.bin/make/util.c:1.66
--- src/usr.bin/make/util.c:1.65	Thu Nov  5 17:27:16 2020
+++ src/usr.bin/make/util.c	Sat Nov  7 22:29:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.65 2020/11/05 17:27:16 rillig Exp $	*/
+/*	$NetBSD: util.c,v 1.66 2020/11/07 22:29:58 rillig Exp $	*/
 
 /*
  * Missing stuff from OS's
@@ -15,7 +15,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: util.c,v 1.65 2020/11/05 17:27:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: util.c,v 1.66 2020/11/07 22:29:58 rillig Exp $");
 
 #if !defined(MAKE_NATIVE) && !defined(HAVE_STRERROR)
 extern int errno, sys_nerr;
@@ -371,14 +371,14 @@ vsnprintf(char *s, size_t n, const char 
 	 * We cast to void * to make everyone happy.
 	 */
 	fakebuf._ptr = (void *)s;
-	fakebuf._cnt = n-1;
+	fakebuf._cnt = n - 1;
 	fakebuf._file = -1;
 	_doprnt(fmt, args, );
 	fakebuf._cnt++;
 	putc('\0', );
-	if (fakebuf._cnt<0)
+	if (fakebuf._cnt < 0)
 	fakebuf._cnt = 0;
-	return n-fakebuf._cnt-1;
+	return n - fakebuf._cnt - 1;
 #else
 	(void)vsprintf(s, fmt, args);
 	return strlen(s);



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 22:29:58 UTC 2020

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

Log Message:
make(1): clean up spacing in fallback implementation of vsnprintf


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.bin/make/util.c

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 22:28:24 UTC 2020

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.674 -r1.675 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.674 src/usr.bin/make/var.c:1.675
--- src/usr.bin/make/var.c:1.674	Sat Nov  7 21:31:07 2020
+++ src/usr.bin/make/var.c	Sat Nov  7 22:28:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.674 2020/11/07 21:31:07 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.675 2020/11/07 22:28:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.674 2020/11/07 21:31:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.675 2020/11/07 22:28:24 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -261,6 +261,7 @@ typedef enum VarExportedMode {
 static VarExportedMode var_exportedVars = VAR_EXPORTED_NONE;
 
 typedef enum VarExportFlags {
+VAR_EXPORT_NORMAL = 0,
 /*
  * We pass this to Var_Export when doing the initial export
  * or after updating an exported var.
@@ -597,7 +598,7 @@ Var_ExportVars(void)
 	HashIter_Init(, _GLOBAL->context);
 	while (HashIter_Next() != NULL) {
 	Var *var = hi.entry->value;
-	Var_Export1(var->name, 0);
+	Var_Export1(var->name, VAR_EXPORT_NORMAL);
 	}
 	return;
 }
@@ -609,7 +610,7 @@ Var_ExportVars(void)
 	size_t i;
 
 	for (i = 0; i < words.len; i++)
-	Var_Export1(words.words[i], 0);
+	Var_Export1(words.words[i], VAR_EXPORT_NORMAL);
 	Words_Free(words);
 }
 free(val);



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 22:28:24 UTC 2020

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.674 -r1.675 src/usr.bin/make/var.c

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 22:26:42 UTC 2020

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

Log Message:
make(1): remove redundant empty lines from parse.c


To generate a diff of this commit:
cvs rdiff -u -r1.430 -r1.431 src/usr.bin/make/parse.c

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

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.430 src/usr.bin/make/parse.c:1.431
--- src/usr.bin/make/parse.c:1.430	Sat Nov  7 22:25:19 2020
+++ src/usr.bin/make/parse.c	Sat Nov  7 22:26:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.430 2020/11/07 22:25:19 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.431 2020/11/07 22:26:42 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.430 2020/11/07 22:25:19 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.431 2020/11/07 22:26:42 rillig Exp $");
 
 /* types and constants */
 
@@ -380,7 +380,6 @@ loadedfile_destroy(struct loadedfile *lf
 	}
 	free(lf);
 }
-/* deleteme */
 
 /*
  * nextbuf() operation for loadedfile, as needed by the weird and twisted
@@ -428,9 +427,6 @@ load_getsize(int fd, size_t *ret)
 	*ret = (size_t)st.st_size;
 	return TRUE;
 }
-/* deleteme */
-/* deleteme */
-/* deleteme */
 
 static Boolean
 loadedfile_mmap(struct loadedfile *lf, int fd)
@@ -477,8 +473,6 @@ loadedfile_mmap(struct loadedfile *lf, i
 
 	return TRUE;
 }
-/* deleteme */
-/* deleteme */
 
 /*
  * Read in a file.
@@ -611,9 +605,6 @@ ParseFindKeyword(const char *str)
 
 return -1;
 }
-/* deleteme */
-/* deleteme */
-/* deleteme */
 
 static void
 PrintLocation(FILE *f, const char *filename, size_t lineno)
@@ -976,7 +967,6 @@ ParseDoSrcOther(const char *src, GNodeTy
 else
 	LinkToTargets(gn, specType != SP_NOT);
 }
-/* deleteme */
 
 /* Given the name of a source in a dependency line, figure out if it is an
  * attribute (such as .SILENT) and apply it to the targets if it is. Else
@@ -1128,12 +1118,10 @@ ParseDoDependencyTargetSpecial(ParseSpec
 	*inout_paths = Lst_New();
 	Lst_Append(*inout_paths, dirSearchPath);
 	break;
-/* deleteme */
 case SP_MAIN:
 	if (!Lst_IsEmpty(opts.create))
 	*inout_specType = SP_NOT;
 	break;
-/* deleteme */
 case SP_BEGIN:
 case SP_END:
 case SP_STALE:
@@ -1285,7 +1273,6 @@ ParseDoDependencyTargetExtraWarn(char **
 
 *pp = cp;
 }
-/* deleteme */
 
 static void
 ParseDoDependencyCheckSpec(ParseSpecial specType)
@@ -1543,7 +1530,6 @@ ParseDoDependencyTargets(char **inout_cp
 *inout_line = line;
 return TRUE;
 }
-/* deleteme */
 
 static void
 ParseDoDependencySourcesSpecial(char *start, char *end,
@@ -2027,7 +2013,6 @@ VarAssignSpecial(const char *name, const
 else if (strcmp(name, MAKE_EXPORTED) == 0)
 	Var_Export(avalue, FALSE);
 }
-/* deleteme */
 
 /* Perform the variable variable assignment in the given context. */
 void
@@ -2232,8 +2217,6 @@ Parse_include_file(char *file, Boolean i
 if (depinc)
 	doing_depend = depinc;	/* only turn it on */
 }
-/* deleteme */
-/* deleteme */
 
 static void
 ParseDoInclude(char *line)
@@ -2989,12 +2972,6 @@ FindSemicolon(char *p)
 }
 return p;
 }
-/* deleteme */
-/* deleteme */
-/* deleteme */
-/* deleteme */
-/* deleteme */
-/* deleteme */
 
 /* dependency	-> target... op [source...]
  * op		-> ':' | '::' | '!' */



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 22:26:42 UTC 2020

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

Log Message:
make(1): remove redundant empty lines from parse.c


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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 22:25:20 UTC 2020

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

Log Message:
make(1): clean up parse.c

The generated code stays exactly the same.  The only changes will be the
line numbers of assertions.  To preserve them, the removed lines have
been filled up with comments and will be removed in the follow-up commit.


To generate a diff of this commit:
cvs rdiff -u -r1.429 -r1.430 src/usr.bin/make/parse.c

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

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.429 src/usr.bin/make/parse.c:1.430
--- src/usr.bin/make/parse.c:1.429	Sat Nov  7 10:44:53 2020
+++ src/usr.bin/make/parse.c	Sat Nov  7 22:25:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.429 2020/11/07 10:44:53 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.430 2020/11/07 22:25:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.429 2020/11/07 10:44:53 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.430 2020/11/07 22:25:19 rillig Exp $");
 
 /* types and constants */
 
@@ -373,14 +373,14 @@ static void
 loadedfile_destroy(struct loadedfile *lf)
 {
 	if (lf->buf != NULL) {
-		if (lf->maplen > 0) {
+		if (lf->maplen > 0)
 			munmap(lf->buf, lf->maplen);
-		} else {
+		else
 			free(lf->buf);
-		}
 	}
 	free(lf);
 }
+/* deleteme */
 
 /*
  * nextbuf() operation for loadedfile, as needed by the weird and twisted
@@ -391,9 +391,9 @@ loadedfile_nextbuf(void *x, size_t *len)
 {
 	struct loadedfile *lf = x;
 
-	if (lf->used) {
+	if (lf->used)
 		return NULL;
-	}
+
 	lf->used = TRUE;
 	*len = lf->len;
 	return lf->buf;
@@ -407,13 +407,11 @@ load_getsize(int fd, size_t *ret)
 {
 	struct stat st;
 
-	if (fstat(fd, ) < 0) {
+	if (fstat(fd, ) < 0)
 		return FALSE;
-	}
 
-	if (!S_ISREG(st.st_mode)) {
+	if (!S_ISREG(st.st_mode))
 		return FALSE;
-	}
 
 	/*
 	 * st_size is an off_t, which is 64 bits signed; *ret is
@@ -424,60 +422,63 @@ load_getsize(int fd, size_t *ret)
 	 *
 	 * While we're at it reject negative sizes too, just in case.
 	 */
-	if (st.st_size < 0 || st.st_size > 0x7fff) {
+	if (st.st_size < 0 || st.st_size > 0x7fff)
 		return FALSE;
-	}
 
 	*ret = (size_t)st.st_size;
 	return TRUE;
 }
+/* deleteme */
+/* deleteme */
+/* deleteme */
 
 static Boolean
 loadedfile_mmap(struct loadedfile *lf, int fd)
 {
 	static unsigned long pagesize = 0;
 
-	if (load_getsize(fd, >len)) {
+	if (!load_getsize(fd, >len))
+		return FALSE;
 
-		/* found a size, try mmap */
-		if (pagesize == 0)
-			pagesize = (unsigned long)sysconf(_SC_PAGESIZE);
-		if (pagesize == 0 || pagesize == (unsigned long)-1) {
-			pagesize = 0x1000;
-		}
-		/* round size up to a page */
-		lf->maplen = pagesize * ((lf->len + pagesize - 1) / pagesize);
+	/* found a size, try mmap */
+	if (pagesize == 0)
+		pagesize = (unsigned long)sysconf(_SC_PAGESIZE);
+	if (pagesize == 0 || pagesize == (unsigned long)-1)
+		pagesize = 0x1000;
 
-		/*
-		 * XXX hack for dealing with empty files; remove when
-		 * we're no longer limited by interfacing to the old
-		 * logic elsewhere in this file.
-		 */
-		if (lf->maplen == 0) {
-			lf->maplen = pagesize;
-		}
+	/* round size up to a page */
+	lf->maplen = pagesize * ((lf->len + pagesize - 1) / pagesize);
 
-		/*
-		 * FUTURE: remove PROT_WRITE when the parser no longer
-		 * needs to scribble on the input.
-		 */
-		lf->buf = mmap(NULL, lf->maplen, PROT_READ|PROT_WRITE,
-			   MAP_FILE|MAP_COPY, fd, 0);
-		if (lf->buf != MAP_FAILED) {
-			/* succeeded */
-			if (lf->len == lf->maplen && lf->buf[lf->len - 1] != '\n') {
-char *b = bmake_malloc(lf->len + 1);
-b[lf->len] = '\n';
-memcpy(b, lf->buf, lf->len++);
-munmap(lf->buf, lf->maplen);
-lf->maplen = 0;
-lf->buf = b;
-			}
-			return TRUE;
-		}
+	/*
+	 * XXX hack for dealing with empty files; remove when
+	 * we're no longer limited by interfacing to the old
+	 * logic elsewhere in this file.
+	 */
+	if (lf->maplen == 0)
+		lf->maplen = pagesize;
+
+	/*
+	 * FUTURE: remove PROT_WRITE when the parser no longer
+	 * needs to scribble on the input.
+	 */
+	lf->buf = mmap(NULL, lf->maplen, PROT_READ|PROT_WRITE,
+		   MAP_FILE|MAP_COPY, fd, 0);
+	if (lf->buf == MAP_FAILED)
+		return FALSE;
+
+	if (lf->len == lf->maplen && lf->buf[lf->len - 1] != '\n') {
+		char *b = bmake_malloc(lf->len + 1);
+		b[lf->len] = '\n';
+		memcpy(b, lf->buf, lf->len++);
+		munmap(lf->buf, lf->maplen);
+		lf->maplen = 0;
+		lf->buf = b;
 	}
-	return FALSE;
+
+	return TRUE;
 }
+/* deleteme */
+/* deleteme */
 
 /*
  * Read in a file.
@@ -486,8 +487,7 @@ loadedfile_mmap(struct loadedfile *lf, i
  * being in the caller in another source file, we need to have the fd
  * passed in already open. Bleh.
  *
- * If the path is NULL use stdin and (to insure 

CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 22:25:20 UTC 2020

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

Log Message:
make(1): clean up parse.c

The generated code stays exactly the same.  The only changes will be the
line numbers of assertions.  To preserve them, the removed lines have
been filled up with comments and will be removed in the follow-up commit.


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



Re: CVS commit: src/sys

2020-11-07 Thread Paul Goyette

Thanks for fixing ...

On Sat, 7 Nov 2020, Christos Zoulas wrote:


/usr/obj/evbarm-earmv7/tools/bin/nbmake-evbarm -V MACHINE_ARCH
earmv7


christos


On Nov 7, 2020, at 4:27 PM, Paul Goyette  wrote:

OK, I think I found the problem, but I don't know how to solve it...

All of the undefined symbols are supposed to be provided by

.../sys/arch/arm/arm32/netbsd32_machdep.c

but there is no netbsd32_machdep.o included in the compat_netbsd32
module.  This file should be included by the following code in 
.../sys/modules/compat_netbsd32/Makefile

.if ${MACHINE_ARCH} == "arm"
.PATH:  ${S}/arch/arm/arm32
SRCS+=  netbsd32_machdep.c
.endif

but it seems not to work (or at least, it doesn't do what it was
intended to do).






On Thu, 5 Nov 2020, Rin Okuyama wrote:


On 2020/11/05 5:43, Paul Goyette wrote:

BTW, the patch you submitted with the initial message in this thread
looks good for avoiding the issue.  But I'm not sure it is a complete
solution.
In particular, you would need to build a 32-bit arm that contains ``no
options COMPAT_NETBSD32'' and then boot and load the compat_netbsd32
and compat_netbsd32_coredump modules

modload compat_netbsd32
modload compat_netbsd32_coredump
Then see if emulation of the old ABI still works, and check if core-
dump works for old-ADI programs; the test program I've been using for
core-dump checking is

#include 
int main(int argc, void *argv) { abort(); }
I really have to leave and take care of some personal business, so I
would greatly appreciate if you can check this out.


Hmm, ``modload compat_netbsd32'' does not work on evbarmv6hf-el:


# uname -ap
NetBSD  9.99.75 NetBSD 9.99.75 (RPI0) #11: Thu Nov  5 20:26:39 JST 2020 
rin@latipes:/sys/arch/evbarm/compile/RPI0 evbarm earmv6hf
# modload compat_netbsd32
[  29.6328410] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_vm_default_addr' not found
[  29.6460400] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_machdep_md_init' not found
[  29.6560750] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_sendsig' not found
[  29.6661200] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`cpu_mcontext32_validate' not found
[  29.6791570] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`cpu_setmcontext32' not found
[  29.6791570] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_machdep_md_fini' not found
[  29.6948370] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`startlwp32' not found
[  29.7048770] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`cpu_getmcontext32' not found
[  29.7168550] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`machine32' not found
[  29.7168550] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_sysarch' not found
[  29.7318320] WARNING: module error: unable to affix module `compat_netbsd32', 
error 8
modload: compat_netbsd32: Exec format error


This should be because there are ``#ifdef COMPAT_NETBSD32'' codes in files
not included in compat_netbsd32 module. compat_netbsd32 module must not
work also for aarch64 and mips64 for the same reason, whereas amd64 and
sparc64 seem OK.

Thanks,
rin

!DSPAM:5fa3f309175521945872603!




++--+---+
| Paul Goyette   | PGP Key fingerprint: | E-mail addresses: |
| (Retired)  | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org   |
++--+---+





++--+---+
| Paul Goyette   | PGP Key fingerprint: | E-mail addresses: |
| (Retired)  | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org   |
++--+---+


re: CVS commit: src/sys

2020-11-07 Thread matthew green
>   .if ${MACHINE_ARCH} == "arm"

this is wrong.  it should use MACHINE_CPU.


.mrg.


CVS commit: src/sys/modules/compat_netbsd32

2020-11-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  7 21:42:32 UTC 2020

Modified Files:
src/sys/modules/compat_netbsd32: Makefile

Log Message:
fix arm test


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/modules/compat_netbsd32/Makefile

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

Modified files:

Index: src/sys/modules/compat_netbsd32/Makefile
diff -u src/sys/modules/compat_netbsd32/Makefile:1.36 src/sys/modules/compat_netbsd32/Makefile:1.37
--- src/sys/modules/compat_netbsd32/Makefile:1.36	Sun Nov  1 13:51:03 2020
+++ src/sys/modules/compat_netbsd32/Makefile	Sat Nov  7 16:42:32 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.36 2020/11/01 18:51:03 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.37 2020/11/07 21:42:32 christos Exp $
 
 .include "../Makefile.inc"
 .include "../Makefile.assym"
@@ -62,7 +62,7 @@ SRCS+=	netbsd32_sigcode.S
 SRCS+=	netbsd32_machdep.c
 .endif
 
-.if ${MACHINE_ARCH} == "arm"
+.if !empty(MACHINE_ARCH:M*arm*)
 .PATH:	${S}/arch/arm/arm32
 SRCS+=	netbsd32_machdep.c
 .endif



CVS commit: src/sys/modules/compat_netbsd32

2020-11-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  7 21:42:32 UTC 2020

Modified Files:
src/sys/modules/compat_netbsd32: Makefile

Log Message:
fix arm test


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/modules/compat_netbsd32/Makefile

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



Re: CVS commit: src/sys

2020-11-07 Thread Christos Zoulas
/usr/obj/evbarm-earmv7/tools/bin/nbmake-evbarm -V MACHINE_ARCH
earmv7


christos

> On Nov 7, 2020, at 4:27 PM, Paul Goyette  wrote:
> 
> OK, I think I found the problem, but I don't know how to solve it...
> 
> All of the undefined symbols are supposed to be provided by
> 
>   .../sys/arch/arm/arm32/netbsd32_machdep.c
> 
> but there is no netbsd32_machdep.o included in the compat_netbsd32
> module.  This file should be included by the following code in 
> .../sys/modules/compat_netbsd32/Makefile
> 
>   .if ${MACHINE_ARCH} == "arm"
>   .PATH:  ${S}/arch/arm/arm32
>   SRCS+=  netbsd32_machdep.c
>   .endif
> 
> but it seems not to work (or at least, it doesn't do what it was
> intended to do).
> 
> 
> 
> 
> 
> 
> On Thu, 5 Nov 2020, Rin Okuyama wrote:
> 
>> On 2020/11/05 5:43, Paul Goyette wrote:
>>> BTW, the patch you submitted with the initial message in this thread
>>> looks good for avoiding the issue.  But I'm not sure it is a complete
>>> solution.
>>> In particular, you would need to build a 32-bit arm that contains ``no
>>> options COMPAT_NETBSD32'' and then boot and load the compat_netbsd32
>>> and compat_netbsd32_coredump modules
>>> 
>>> modload compat_netbsd32
>>> modload compat_netbsd32_coredump
>>> Then see if emulation of the old ABI still works, and check if core-
>>> dump works for old-ADI programs; the test program I've been using for
>>> core-dump checking is
>>> 
>>> #include 
>>> int main(int argc, void *argv) { abort(); }
>>> I really have to leave and take care of some personal business, so I
>>> would greatly appreciate if you can check this out.
>> 
>> Hmm, ``modload compat_netbsd32'' does not work on evbarmv6hf-el:
>> 
>> 
>> # uname -ap
>> NetBSD  9.99.75 NetBSD 9.99.75 (RPI0) #11: Thu Nov  5 20:26:39 JST 2020 
>> rin@latipes:/sys/arch/evbarm/compile/RPI0 evbarm earmv6hf
>> # modload compat_netbsd32
>> [  29.6328410] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
>> `netbsd32_vm_default_addr' not found
>> [  29.6460400] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
>> `netbsd32_machdep_md_init' not found
>> [  29.6560750] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
>> `netbsd32_sendsig' not found
>> [  29.6661200] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
>> `cpu_mcontext32_validate' not found
>> [  29.6791570] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
>> `cpu_setmcontext32' not found
>> [  29.6791570] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
>> `netbsd32_machdep_md_fini' not found
>> [  29.6948370] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
>> `startlwp32' not found
>> [  29.7048770] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
>> `cpu_getmcontext32' not found
>> [  29.7168550] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
>> `machine32' not found
>> [  29.7168550] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
>> `netbsd32_sysarch' not found
>> [  29.7318320] WARNING: module error: unable to affix module 
>> `compat_netbsd32', error 8
>> modload: compat_netbsd32: Exec format error
>> 
>> 
>> This should be because there are ``#ifdef COMPAT_NETBSD32'' codes in files
>> not included in compat_netbsd32 module. compat_netbsd32 module must not
>> work also for aarch64 and mips64 for the same reason, whereas amd64 and
>> sparc64 seem OK.
>> 
>> Thanks,
>> rin
>> 
>> !DSPAM:5fa3f309175521945872603!
>> 
>> 
> 
> ++--+---+
> | Paul Goyette   | PGP Key fingerprint: | E-mail addresses: |
> | (Retired)  | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com |
> | Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org   |
> ++--+---+



signature.asc
Description: Message signed with OpenPGP


CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 21:40:08 UTC 2020

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

Log Message:
make(1): remove trailing whitespace


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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 21:40:08 UTC 2020

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

Log Message:
make(1): remove trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.435 -r1.436 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.435 src/usr.bin/make/main.c:1.436
--- src/usr.bin/make/main.c:1.435	Sat Nov  7 14:11:58 2020
+++ src/usr.bin/make/main.c	Sat Nov  7 21:40:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.435 2020/11/07 14:11:58 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.436 2020/11/07 21:40:08 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.435 2020/11/07 14:11:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.436 2020/11/07 21:40:08 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -1548,7 +1548,7 @@ main(int argc, char **argv)
 	if (!opts.noBuiltins)
 		ReadBuiltinRules();
 	ReadMakefiles();
-	
+
 	/* In particular suppress .depend for '-r -V .OBJDIR -f /dev/null' */
 	if (!opts.noBuiltins || !opts.printVars) {
 	/* ignore /dev/null and anything starting with "no" */



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 21:31:08 UTC 2020

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.673 -r1.674 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/nonints.h
diff -u src/usr.bin/make/nonints.h:1.155 src/usr.bin/make/nonints.h:1.156
--- src/usr.bin/make/nonints.h:1.155	Sat Nov  7 13:13:19 2020
+++ src/usr.bin/make/nonints.h	Sat Nov  7 21:31:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.155 2020/11/07 13:13:19 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.156 2020/11/07 21:31:07 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -227,9 +227,11 @@ typedef enum VarEvalFlags {
 VARE_ASSIGN		= 1 << 2
 } VarEvalFlags;
 
-typedef enum VarSet_Flags {
+typedef enum VarSetFlags {
+VAR_SET_NONE	= 0,
+
 /* do not export */
-VAR_NO_EXPORT	= 1 << 0,
+VAR_SET_NO_EXPORT	= 1 << 0,
 
 /* Make the variable read-only. No further modification is possible,
  * except for another call to Var_Set with the same flag. */

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.673 src/usr.bin/make/var.c:1.674
--- src/usr.bin/make/var.c:1.673	Sat Nov  7 14:11:58 2020
+++ src/usr.bin/make/var.c	Sat Nov  7 21:31:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.673 2020/11/07 14:11:58 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.674 2020/11/07 21:31:07 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.673 2020/11/07 14:11:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.674 2020/11/07 21:31:07 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -808,7 +808,7 @@ Var_SetWithFlags(const char *name, const
  */
 v = VarFind(name, ctxt, FALSE);
 if (v == NULL) {
-	if (ctxt == VAR_CMDLINE && !(flags & VAR_NO_EXPORT)) {
+	if (ctxt == VAR_CMDLINE && !(flags & VAR_SET_NO_EXPORT)) {
 	/*
 	 * This var would normally prevent the same name being added
 	 * to VAR_GLOBAL, so delete it from there if needed.
@@ -837,7 +837,7 @@ Var_SetWithFlags(const char *name, const
  * to the environment (as per POSIX standard)
  * Other than internals.
  */
-if (ctxt == VAR_CMDLINE && !(flags & VAR_NO_EXPORT) && name[0] != '.') {
+if (ctxt == VAR_CMDLINE && !(flags & VAR_SET_NO_EXPORT) && name[0] != '.') {
 	if (v == NULL)
 	v = VarFind(name, ctxt, FALSE); /* we just added it */
 	v->flags |= VAR_FROM_CMD;
@@ -889,7 +889,7 @@ out:
 void
 Var_Set(const char *name, const char *val, GNode *ctxt)
 {
-Var_SetWithFlags(name, val, ctxt, 0);
+Var_SetWithFlags(name, val, ctxt, VAR_SET_NONE);
 }
 
 /*-
@@ -1457,7 +1457,7 @@ ModifyWord_Loop(const char *word, SepBuf
 	return;
 
 args = data;
-Var_SetWithFlags(args->tvar, word, args->ctx, VAR_NO_EXPORT);
+Var_SetWithFlags(args->tvar, word, args->ctx, VAR_SET_NO_EXPORT);
 (void)Var_Subst(args->str, args->ctx, args->eflags, );
 /* TODO: handle errors */
 



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 21:31:08 UTC 2020

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.673 -r1.674 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.



Re: CVS commit: src/sys

2020-11-07 Thread Paul Goyette

OK, I think I found the problem, but I don't know how to solve it...

All of the undefined symbols are supposed to be provided by

.../sys/arch/arm/arm32/netbsd32_machdep.c

but there is no netbsd32_machdep.o included in the compat_netbsd32
module.  This file should be included by the following code in 
.../sys/modules/compat_netbsd32/Makefile


.if ${MACHINE_ARCH} == "arm"
.PATH:  ${S}/arch/arm/arm32
SRCS+=  netbsd32_machdep.c
.endif

but it seems not to work (or at least, it doesn't do what it was
intended to do).






On Thu, 5 Nov 2020, Rin Okuyama wrote:


On 2020/11/05 5:43, Paul Goyette wrote:

BTW, the patch you submitted with the initial message in this thread
looks good for avoiding the issue.  But I'm not sure it is a complete
solution.

In particular, you would need to build a 32-bit arm that contains ``no
options COMPAT_NETBSD32'' and then boot and load the compat_netbsd32
and compat_netbsd32_coredump modules

 modload compat_netbsd32
 modload compat_netbsd32_coredump

Then see if emulation of the old ABI still works, and check if core-
dump works for old-ADI programs; the test program I've been using for
core-dump checking is

 #include 
 int main(int argc, void *argv) { abort(); }

I really have to leave and take care of some personal business, so I
would greatly appreciate if you can check this out.


Hmm, ``modload compat_netbsd32'' does not work on evbarmv6hf-el:


# uname -ap
NetBSD  9.99.75 NetBSD 9.99.75 (RPI0) #11: Thu Nov  5 20:26:39 JST 2020 
rin@latipes:/sys/arch/evbarm/compile/RPI0 evbarm earmv6hf

# modload compat_netbsd32
[  29.6328410] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_vm_default_addr' not found
[  29.6460400] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_machdep_md_init' not found
[  29.6560750] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_sendsig' not found
[  29.6661200] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`cpu_mcontext32_validate' not found
[  29.6791570] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`cpu_setmcontext32' not found
[  29.6791570] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_machdep_md_fini' not found
[  29.6948370] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`startlwp32' not found
[  29.7048770] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`cpu_getmcontext32' not found
[  29.7168550] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`machine32' not found
[  29.7168550] kobj_checksyms, 994: [compat_netbsd32]: linker error: symbol 
`netbsd32_sysarch' not found
[  29.7318320] WARNING: module error: unable to affix module 
`compat_netbsd32', error 8

modload: compat_netbsd32: Exec format error


This should be because there are ``#ifdef COMPAT_NETBSD32'' codes in files
not included in compat_netbsd32 module. compat_netbsd32 module must not
work also for aarch64 and mips64 for the same reason, whereas amd64 and
sparc64 seem OK.

Thanks,
rin

!DSPAM:5fa3f309175521945872603!




++--+---+
| Paul Goyette   | PGP Key fingerprint: | E-mail addresses: |
| (Retired)  | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com |
| Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org   |
++--+---+


CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 21:26:44 UTC 2020

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

Log Message:
make(1): fix inconsistent indentation after #ifdef

Combining #ifdef with regular if-then-else calls for trouble.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 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.139 src/usr.bin/make/meta.c:1.140
--- src/usr.bin/make/meta.c:1.139	Sat Nov  7 10:16:19 2020
+++ src/usr.bin/make/meta.c	Sat Nov  7 21:26:43 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: meta.c,v 1.139 2020/11/07 10:16:19 rillig Exp $ */
+/*  $NetBSD: meta.c,v 1.140 2020/11/07 21:26:43 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -860,9 +860,11 @@ meta_cmd_finish(void *pbmp)
 	error = x;
 	pbm->mon_fd = -1;
 	pbm->filemon = NULL;
-} else
+	return error;
+}
 #endif
-	fprintf(pbm->mfp, "\n");	/* ensure end with newline */
+
+fprintf(pbm->mfp, "\n");	/* ensure end with newline */
 return error;
 }
 



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 21:26:44 UTC 2020

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

Log Message:
make(1): fix inconsistent indentation after #ifdef

Combining #ifdef with regular if-then-else calls for trouble.


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

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 21:24:33 UTC 2020

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

Log Message:
make(1): fix type of Job.suspended


To generate a diff of this commit:
cvs rdiff -u -r1.309 -r1.310 src/usr.bin/make/job.c
cvs rdiff -u -r1.59 -r1.60 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.309 src/usr.bin/make/job.c:1.310
--- src/usr.bin/make/job.c:1.309	Sat Nov  7 20:03:56 2020
+++ src/usr.bin/make/job.c	Sat Nov  7 21:24:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.309 2020/11/07 20:03:56 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.310 2020/11/07 21:24:33 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.309 2020/11/07 20:03:56 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.310 2020/11/07 21:24:33 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -1959,7 +1959,7 @@ JobReapChild(pid_t pid, int status, Bool
 		(void)printf("*** [%s] Stopped -- signal %d\n",
 			 job->node->name, WSTOPSIG(status));
 	}
-	job->job_suspended = 1;
+	job->suspended = TRUE;
 	}
 	(void)fflush(stdout);
 	return;
@@ -2568,13 +2568,13 @@ JobRestartJobs(void)
 
 for (job = job_table; job < job_table_end; job++) {
 	if (job->job_state == JOB_ST_RUNNING &&
-		(make_suspended || job->job_suspended)) {
+		(make_suspended || job->suspended)) {
 	DEBUG1(JOB, "Restarting stopped job pid %d.\n", job->pid);
-	if (job->job_suspended) {
+	if (job->suspended) {
 		(void)printf("*** [%s] Continued\n", job->node->name);
 		(void)fflush(stdout);
 	}
-	job->job_suspended = 0;
+	job->suspended = FALSE;
 	if (KILLPG(job->pid, SIGCONT) != 0 && DEBUG(JOB)) {
 		debug_printf("Failed to send SIGCONT to %d\n", job->pid);
 	}

Index: src/usr.bin/make/job.h
diff -u src/usr.bin/make/job.h:1.59 src/usr.bin/make/job.h:1.60
--- src/usr.bin/make/job.h:1.59	Sat Nov  7 20:03:56 2020
+++ src/usr.bin/make/job.h	Sat Nov  7 21:24:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.h,v 1.59 2020/11/07 20:03:56 rillig Exp $	*/
+/*	$NetBSD: job.h,v 1.60 2020/11/07 21:24:33 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -120,6 +120,7 @@ struct pollfd;
 typedef enum JobState {
 JOB_ST_FREE =	0,	/* Job is available */
 JOB_ST_SETUP =	1,	/* Job is allocated but otherwise invalid */
+/* XXX: What about the 2? */
 JOB_ST_RUNNING =	3,	/* Job is running, pid valid */
 JOB_ST_FINISHED =	4	/* Job is done (ie after SIGCHILD) */
 } JobState;
@@ -170,7 +171,7 @@ typedef struct Job {
 
 JobState job_state;		/* status of the job entry */
 
-char job_suspended;
+Boolean suspended;
 
 JobFlags flags;		/* Flags to control treatment of job */
 



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 21:24:33 UTC 2020

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

Log Message:
make(1): fix type of Job.suspended


To generate a diff of this commit:
cvs rdiff -u -r1.309 -r1.310 src/usr.bin/make/job.c
cvs rdiff -u -r1.59 -r1.60 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.



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 21:22:37 UTC 2020

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

Log Message:
make(1): clean up Make_OODate and Make_Run


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

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 21:22:37 UTC 2020

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

Log Message:
make(1): clean up Make_OODate and Make_Run


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

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

Modified files:

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.187 src/usr.bin/make/make.c:1.188
--- src/usr.bin/make/make.c:1.187	Sat Nov  7 10:16:18 2020
+++ src/usr.bin/make/make.c	Sat Nov  7 21:22:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.187 2020/11/07 10:16:18 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.188 2020/11/07 21:22:37 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.187 2020/11/07 10:16:18 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.188 2020/11/07 21:22:37 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -215,11 +215,10 @@ Make_OODate(GNode *gn)
 if (!(gn->type & (OP_JOIN|OP_USE|OP_USEBEFORE|OP_EXEC))) {
 	(void)Dir_MTime(gn, 1);
 	if (DEBUG(MAKE)) {
-	if (gn->mtime != 0) {
+	if (gn->mtime != 0)
 		debug_printf("modified %s...", Targ_FmtTime(gn->mtime));
-	} else {
+	else
 		debug_printf("non-existent...");
-	}
 	}
 }
 
@@ -244,8 +243,7 @@ Make_OODate(GNode *gn)
 	 */
 	DEBUG0(MAKE, ".USE node...");
 	oodate = FALSE;
-} else if ((gn->type & OP_LIB) &&
-	   ((gn->mtime==0) || Arch_IsLib(gn))) {
+} else if ((gn->type & OP_LIB) && (gn->mtime == 0 || Arch_IsLib(gn))) {
 	DEBUG0(MAKE, "library...");
 
 	/*
@@ -1353,9 +1351,9 @@ Make_Run(GNodeList *targs)
 	MakePrintStatusList(targs, );
 	if (DEBUG(MAKE)) {
 	debug_printf("done: errors %d\n", errors);
-	if (errors != 0)
+	if (errors > 0)
 		Targ_PrintGraph(4);
 	}
 }
-return errors != 0;
+return errors > 0;
 }



CVS commit: xsrc/external/mit/libdrm/dist

2020-11-07 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Sat Nov  7 21:20:46 UTC 2020

Added Files:
xsrc/external/mit/libdrm/dist: configure

Log Message:
add minimal 'configure' script that finds the versions, and
doesn't end up with an empty version in the .pc file.

pointed out by Michael Scholz in private email.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.3 xsrc/external/mit/libdrm/dist/configure

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

Added files:

Index: xsrc/external/mit/libdrm/dist/configure
diff -u /dev/null xsrc/external/mit/libdrm/dist/configure:1.3
--- /dev/null	Sat Nov  7 21:20:46 2020
+++ xsrc/external/mit/libdrm/dist/configure	Sat Nov  7 21:20:46 2020
@@ -0,0 +1,8 @@
+# XXX hack for netbsd pkgconfig processing.
+
+# Identity of this package.
+PACKAGE_NAME='libdrm'
+PACKAGE_TARNAME='libdrm'
+PACKAGE_VERSION='2.4.102'
+PACKAGE_STRING='libdrm 2.4.102'
+PACKAGE_URL=''



CVS commit: xsrc/external/mit/libdrm/dist

2020-11-07 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Sat Nov  7 21:20:46 UTC 2020

Added Files:
xsrc/external/mit/libdrm/dist: configure

Log Message:
add minimal 'configure' script that finds the versions, and
doesn't end up with an empty version in the .pc file.

pointed out by Michael Scholz in private email.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.3 xsrc/external/mit/libdrm/dist/configure

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 21:04:44 UTC 2020

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

Log Message:
make(1): clean up Buf_AddEscaped in .for loops

All this dance of determining the needed escape characters before
iterating, saving them upfront, evaluating them later using complicated
boolean expressions was not necessary at all.  All that is needed is a
simple NeedsEscapes, called at just the right time.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/usr.bin/make/for.c

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 21:04:44 UTC 2020

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

Log Message:
make(1): clean up Buf_AddEscaped in .for loops

All this dance of determining the needed escape characters before
iterating, saving them upfront, evaluating them later using complicated
boolean expressions was not necessary at all.  All that is needed is a
simple NeedsEscapes, called at just the right time.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/usr.bin/make/for.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/for.c
diff -u src/usr.bin/make/for.c:1.114 src/usr.bin/make/for.c:1.115
--- src/usr.bin/make/for.c:1.114	Sat Nov  7 14:11:58 2020
+++ src/usr.bin/make/for.c	Sat Nov  7 21:04:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.114 2020/11/07 14:11:58 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.115 2020/11/07 21:04:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -60,15 +60,7 @@
 #include "make.h"
 
 /*	"@(#)for.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: for.c,v 1.114 2020/11/07 14:11:58 rillig Exp $");
-
-/* The .for loop substitutes the items as ${:U...}, which means
- * that characters that break this syntax must be backslash-escaped. */
-typedef enum ForEscapes {
-FOR_SUB_ESCAPE_CHAR = 0x0001,
-FOR_SUB_ESCAPE_BRACE = 0x0002,
-FOR_SUB_ESCAPE_PAREN = 0x0004
-} ForEscapes;
+MAKE_RCSID("$NetBSD: for.c,v 1.115 2020/11/07 21:04:43 rillig Exp $");
 
 static int forLevel = 0;	/* Nesting level */
 
@@ -120,30 +112,6 @@ For_Free(For *f)
 free(f);
 }
 
-static ForEscapes
-GetEscapes(const char *word)
-{
-const char *p;
-ForEscapes escapes = 0;
-
-for (p = word; *p != '\0'; p++) {
-	switch (*p) {
-	case ':':
-	case '$':
-	case '\\':
-	escapes |= FOR_SUB_ESCAPE_CHAR;
-	break;
-	case ')':
-	escapes |= FOR_SUB_ESCAPE_PAREN;
-	break;
-	case '}':
-	escapes |= FOR_SUB_ESCAPE_BRACE;
-	break;
-	}
-}
-return escapes;
-}
-
 static Boolean
 IsFor(const char *p)
 {
@@ -326,18 +294,30 @@ for_var_len(const char *var)
 return 0;
 }
 
+/* The .for loop substitutes the items as ${:U...}, which means
+ * that characters that break this syntax must be backslash-escaped. */
+static Boolean
+NeedsEscapes(const char *word, char endc)
+{
+const char *p;
+
+for (p = word; *p != '\0'; p++) {
+	if (*p == ':' || *p == '$' || *p == '\\' || *p == endc)
+	return TRUE;
+}
+return FALSE;
+}
+
 /* While expanding the body of a .for loop, write the item in the ${:U...}
- * expression, escaping characters as needed. See ApplyModifier_Defined. */
+ * expression, escaping characters as needed.
+ *
+ * The result is later unescaped by ApplyModifier_Defined. */
 static void
 Buf_AddEscaped(Buffer *cmds, const char *item, char ech)
 {
-ForEscapes escapes = GetEscapes(item);
 char ch;
 
-/* If there were no escapes, or the only escape is the other variable
- * terminator, then just substitute the full string */
-if (!(escapes & (ech == ')' ? ~(unsigned)FOR_SUB_ESCAPE_BRACE
-: ~(unsigned)FOR_SUB_ESCAPE_PAREN))) {
+if (!NeedsEscapes(item, ech)) {
 	Buf_AddStr(cmds, item);
 	return;
 }



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 20:45:21 UTC 2020

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

Log Message:
make(1): use proper enum constant instead of 0 for CachedStatsFlags


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/usr.bin/make/dir.c

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

Modified files:

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.197 src/usr.bin/make/dir.c:1.198
--- src/usr.bin/make/dir.c:1.197	Sat Nov  7 14:11:58 2020
+++ src/usr.bin/make/dir.c	Sat Nov  7 20:45:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.197 2020/11/07 14:11:58 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.198 2020/11/07 20:45:21 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -134,7 +134,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.197 2020/11/07 14:11:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.198 2020/11/07 20:45:21 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -312,8 +312,9 @@ struct cache_st {
 
 /* minimize changes below */
 typedef enum CachedStatsFlags {
-CST_LSTAT = 0x01,		/* call lstat(2) instead of stat(2) */
-CST_UPDATE = 0x02		/* ignore existing cached entry */
+CST_NONE	= 0,
+CST_LSTAT	= 1 << 0,	/* call lstat(2) instead of stat(2) */
+CST_UPDATE	= 1 << 1	/* ignore existing cached entry */
 } CachedStatsFlags;
 
 /* Returns 0 and the result of stat(2) or lstat(2) in *mst, or -1 on error. */
@@ -377,7 +378,7 @@ cached_stats(HashTable *htp, const char 
 int
 cached_stat(const char *pathname, struct make_stat *st)
 {
-return cached_stats(, pathname, st, 0);
+return cached_stats(, pathname, st, CST_NONE);
 }
 
 int
@@ -1298,6 +1299,7 @@ Dir_MTime(GNode *gn, Boolean recheck)
 {
 char *fullName;		/* the full pathname of name */
 struct make_stat mst;	/* buffer for finding the mod time */
+CachedStatsFlags flags;
 
 if (gn->type & OP_ARCHV) {
 	return Arch_MTime(gn);
@@ -1344,18 +1346,19 @@ Dir_MTime(GNode *gn, Boolean recheck)
 	fullName = gn->path;
 }
 
-if (fullName == NULL) {
+if (fullName == NULL)
 	fullName = bmake_strdup(gn->name);
-}
 
-if (cached_stats(, fullName, , recheck ? CST_UPDATE : 0) < 0) {
+
+flags = recheck ? CST_UPDATE : CST_NONE;
+if (cached_stats(, fullName, , flags) < 0) {
 	if (gn->type & OP_MEMBER) {
 	if (fullName != gn->path)
 		free(fullName);
 	return Arch_MemberMTime(gn);
-	} else {
-	mst.mst_mtime = 0;
 	}
+
+	mst.mst_mtime = 0;
 }
 
 if (fullName != NULL && gn->path == NULL)



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 20:45:21 UTC 2020

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

Log Message:
make(1): use proper enum constant instead of 0 for CachedStatsFlags


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/usr.bin/make/dir.c

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 20:39:56 UTC 2020

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

Log Message:
make(1): clean up CondParser_Comparison


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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 20:39:56 UTC 2020

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

Log Message:
make(1): clean up CondParser_Comparison


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 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.184 src/usr.bin/make/cond.c:1.185
--- src/usr.bin/make/cond.c:1.184	Sat Nov  7 20:35:04 2020
+++ src/usr.bin/make/cond.c	Sat Nov  7 20:39:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.184 2020/11/07 20:35:04 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.185 2020/11/07 20:39:56 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.184 2020/11/07 20:35:04 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.185 2020/11/07 20:39:56 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -622,43 +622,34 @@ CondParser_Comparison(CondParser *par, B
 {
 Token t = TOK_ERROR;
 const char *lhs, *op, *rhs;
-void *lhsFree, *rhsFree;
+void *lhs_freeIt, *rhs_freeIt;
 Boolean lhsQuoted, rhsQuoted;
 
-rhs = NULL;
-lhsFree = rhsFree = NULL;
-lhsQuoted = rhsQuoted = FALSE;
-
 /*
  * Parse the variable spec and skip over it, saving its
  * value in lhs.
  */
-lhs = CondParser_String(par, doEval, lhsStrict, , );
-if (!lhs)
-	goto done;
+lhs = CondParser_String(par, doEval, lhsStrict, , _freeIt);
+if (lhs == NULL)
+	goto done_lhs;
 
 CondParser_SkipWhitespace(par);
 
-/*
- * Make sure the operator is a valid one. If it isn't a
- * known relational operator, pretend we got a
- * != 0 comparison.
- */
 op = par->p;
 switch (par->p[0]) {
 case '!':
 case '=':
 case '<':
 case '>':
-	if (par->p[1] == '=') {
+	if (par->p[1] == '=')
 	par->p += 2;
-	} else {
+	else
 	par->p++;
-	}
 	break;
 default:
-	t = doEval ? EvalNotEmpty(par, lhs, lhsQuoted) : TOK_FALSE;
-	goto done;
+	/* Unknown operator, compare against an empty string or 0. */
+	t = ToToken(doEval && EvalNotEmpty(par, lhs, lhsQuoted));
+	goto done_lhs;
 }
 
 CondParser_SkipWhitespace(par);
@@ -666,23 +657,24 @@ CondParser_Comparison(CondParser *par, B
 if (par->p[0] == '\0') {
 	Parse_Error(PARSE_WARNING, "Missing right-hand-side of operator");
 	/* The PARSE_FATAL is done as a follow-up by CondEvalExpression. */
-	goto done;
+	goto done_lhs;
 }
 
-rhs = CondParser_String(par, doEval, FALSE, , );
+rhs = CondParser_String(par, doEval, FALSE, , _freeIt);
 if (rhs == NULL)
-	goto done;
+	goto done_rhs;
 
 if (!doEval) {
 	t = TOK_FALSE;
-	goto done;
+	goto done_rhs;
 }
 
 t = EvalCompare(lhs, lhsQuoted, op, rhs, rhsQuoted);
 
-done:
-free(lhsFree);
-free(rhsFree);
+done_rhs:
+free(rhs_freeIt);
+done_lhs:
+free(lhs_freeIt);
 return t;
 }
 



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 20:35:04 UTC 2020

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

Log Message:
make(1): reword condition in CondParser_String

The parentheses were confusing for human readers.

The compiler doesn't really care about the wording of the condition, GCC
5 on amd64 generates non-obvious but nice code anyway, replacing the
logical or with a logical and.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 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.183 src/usr.bin/make/cond.c:1.184
--- src/usr.bin/make/cond.c:1.183	Sat Nov  7 20:14:15 2020
+++ src/usr.bin/make/cond.c	Sat Nov  7 20:35:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.183 2020/11/07 20:14:15 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.184 2020/11/07 20:35:04 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.183 2020/11/07 20:14:15 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.184 2020/11/07 20:35:04 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -442,8 +442,10 @@ CondParser_String(CondParser *par, Boole
 	continue;
 	case '$':
 	/* if we are in quotes, an undefined variable is ok */
-	eflags = ((!qt && doEval) ? VARE_UNDEFERR : 0) |
-		 (doEval ? VARE_WANTRES : 0);
+	eflags = doEval && !qt ? VARE_UNDEFERR | VARE_WANTRES :
+		 doEval ? VARE_WANTRES :
+		 VARE_NONE;
+
 	nested_p = par->p;
 	atStart = nested_p == start;
 	parseResult = Var_Parse(_p, VAR_CMDLINE, eflags, ,



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 20:35:04 UTC 2020

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

Log Message:
make(1): reword condition in CondParser_String

The parentheses were confusing for human readers.

The compiler doesn't really care about the wording of the condition, GCC
5 on amd64 generates non-obvious but nice code anyway, replacing the
logical or with a logical and.


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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 20:14:15 UTC 2020

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

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

Even though the C boolean and Token are encoded the same, the code should
still distinguish them, for the benefit of human readers.


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 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.182 src/usr.bin/make/cond.c:1.183
--- src/usr.bin/make/cond.c:1.182	Sat Nov  7 20:11:32 2020
+++ src/usr.bin/make/cond.c	Sat Nov  7 20:14:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.182 2020/11/07 20:11:32 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.183 2020/11/07 20:14:15 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.182 2020/11/07 20:11:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.183 2020/11/07 20:14:15 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -173,6 +173,12 @@ is_token(const char *str, const char *to
 return strncmp(str, tok, len) == 0 && !ch_isalpha(str[len]);
 }
 
+static Token
+ToToken(Boolean cond)
+{
+return cond ? TOK_TRUE : TOK_FALSE;
+}
+
 /* Push back the most recent token read. We only need one level of this. */
 static void
 CondParser_PushBack(CondParser *par, Token t)
@@ -524,7 +530,7 @@ If_Eval(const struct If *if_info, const 
 
 /* Evaluate a "comparison without operator", such as in ".if ${VAR}" or
  * ".if 0". */
-static Token
+static Boolean
 EvalNotEmpty(CondParser *par, const char *lhs, Boolean lhsQuoted)
 {
 double left;
@@ -558,18 +564,18 @@ EvalCompareNum(double lhs, const char *o
 	/* The PARSE_FATAL is done as a follow-up by CondEvalExpression. */
 	return TOK_ERROR;
 	}
-	return lhs != rhs;
+	return ToToken(lhs != rhs);
 case '=':
 	if (op[1] != '=') {
 	Parse_Error(PARSE_WARNING, "Unknown operator");
 	/* The PARSE_FATAL is done as a follow-up by CondEvalExpression. */
 	return TOK_ERROR;
 	}
-	return lhs == rhs;
+	return ToToken(lhs == rhs);
 case '<':
-	return op[1] == '=' ? lhs <= rhs : lhs < rhs;
+	return ToToken(op[1] == '=' ? lhs <= rhs : lhs < rhs);
 case '>':
-	return op[1] == '=' ? lhs >= rhs : lhs > rhs;
+	return ToToken(op[1] == '=' ? lhs >= rhs : lhs > rhs);
 }
 return TOK_ERROR;
 }
@@ -585,7 +591,7 @@ EvalCompareStr(const char *lhs, const ch
 }
 
 DEBUG3(COND, "lhs = \"%s\", rhs = \"%s\", op = %.2s\n", lhs, rhs, op);
-return (*op == '=') == (strcmp(lhs, rhs) == 0);
+return ToToken((*op == '=') == (strcmp(lhs, rhs) == 0));
 }
 
 /* Evaluate a comparison, such as "${VAR} == 12345". */
@@ -690,7 +696,7 @@ ParseEmptyArg(const char **pp, Boolean d
 *out_arg = NULL;
 
 (*pp)--;			/* Make (*pp)[1] point to the '('. */
-(void)Var_Parse(pp, VAR_CMDLINE, doEval ? VARE_WANTRES : 0,
+(void)Var_Parse(pp, VAR_CMDLINE, doEval ? VARE_WANTRES : VARE_NONE,
 		, _freeIt);
 /* TODO: handle errors */
 /* If successful, *pp points beyond the closing ')' now. */
@@ -1008,7 +1014,7 @@ CondEvalExpression(const struct If *info
 {
 static const struct If *dflt_info;
 CondParser par;
-int rval;
+CondEvalResult rval;
 
 lhsStrict = strictLHS;
 



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 20:14:15 UTC 2020

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

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

Even though the C boolean and Token are encoded the same, the code should
still distinguish them, for the benefit of human readers.


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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 20:11:32 UTC 2020

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

Log Message:
make(1): fix type mismatch in If_Eval

No practical consequences since TOK_FALSE == 0 and TOK_TRUE == 1.


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 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.181 src/usr.bin/make/cond.c:1.182
--- src/usr.bin/make/cond.c:1.181	Sat Nov  7 14:40:51 2020
+++ src/usr.bin/make/cond.c	Sat Nov  7 20:11:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.181 2020/11/07 14:40:51 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.182 2020/11/07 20:11:32 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.181 2020/11/07 14:40:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.182 2020/11/07 20:11:32 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -519,7 +519,7 @@ static Boolean
 If_Eval(const struct If *if_info, const char *arg, size_t arglen)
 {
 Boolean res = if_info->defProc(arglen, arg);
-return (if_info->doNot ? !res : res) ? TOK_TRUE : TOK_FALSE;
+return if_info->doNot ? !res : res;
 }
 
 /* Evaluate a "comparison without operator", such as in ".if ${VAR}" or



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 20:11:32 UTC 2020

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

Log Message:
make(1): fix type mismatch in If_Eval

No practical consequences since TOK_FALSE == 0 and TOK_TRUE == 1.


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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 20:03:56 UTC 2020

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

Log Message:
make(1): clean up JobStart

Initialize the fields in declaration order.
Initialize Job.flags in a single assignment.


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/usr.bin/make/job.c
cvs rdiff -u -r1.58 -r1.59 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.308 src/usr.bin/make/job.c:1.309
--- src/usr.bin/make/job.c:1.308	Sat Nov  7 13:53:12 2020
+++ src/usr.bin/make/job.c	Sat Nov  7 20:03:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.308 2020/11/07 13:53:12 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.309 2020/11/07 20:03:56 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.308 2020/11/07 13:53:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.309 2020/11/07 20:03:56 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -1491,7 +1491,7 @@ JobMakeArgv(Job *job, char **argv)
  *---
  */
 static JobStartResult
-JobStart(GNode *gn, int flags)
+JobStart(GNode *gn, JobFlags flags)
 {
 Job *job;			/* new job descriptor */
 char *argv[10];		/* Argument vector to shell */
@@ -1507,26 +1507,17 @@ JobStart(GNode *gn, int flags)
 	Punt("JobStart no job slots vacant");
 
 memset(job, 0, sizeof *job);
-job->job_state = JOB_ST_SETUP;
-if (gn->type & OP_SPECIAL)
-	flags |= JOB_SPECIAL;
-
 job->node = gn;
 job->tailCmds = NULL;
+job->job_state = JOB_ST_SETUP;
 
-/*
- * Set the initial value of the flags for this job based on the global
- * ones and the node's attributes... Any flags supplied by the caller
- * are also added to the field.
- */
-job->flags = 0;
-if (Targ_Ignore(gn)) {
-	job->flags |= JOB_IGNERR;
-}
-if (Targ_Silent(gn)) {
-	job->flags |= JOB_SILENT;
-}
-job->flags |= flags;
+if (gn->type & OP_SPECIAL)
+	flags |= JOB_SPECIAL;
+if (Targ_Ignore(gn))
+	flags |= JOB_IGNERR;
+if (Targ_Silent(gn))
+	flags |= JOB_SILENT;
+job->flags = flags;
 
 /*
  * Check the commands now so any attributes from .DEFAULT have a chance
@@ -2053,7 +2044,7 @@ Job_CatchOutput(void)
 void
 Job_Make(GNode *gn)
 {
-(void)JobStart(gn, 0);
+(void)JobStart(gn, JOB_NONE);
 }
 
 void

Index: src/usr.bin/make/job.h
diff -u src/usr.bin/make/job.h:1.58 src/usr.bin/make/job.h:1.59
--- src/usr.bin/make/job.h:1.58	Mon Oct 26 21:34:10 2020
+++ src/usr.bin/make/job.h	Sat Nov  7 20:03:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.h,v 1.58 2020/10/26 21:34:10 rillig Exp $	*/
+/*	$NetBSD: job.h,v 1.59 2020/11/07 20:03:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -125,17 +125,18 @@ typedef enum JobState {
 } JobState;
 
 typedef enum JobFlags {
+JOB_NONE	= 0,
 /* Ignore non-zero exits */
-JOB_IGNERR =	0x001,
+JOB_IGNERR	= 1 << 0,
 /* no output */
-JOB_SILENT =	0x002,
+JOB_SILENT	= 1 << 1,
 /* Target is a special one. i.e. run it locally
  * if we can't export it and maxLocal is 0 */
-JOB_SPECIAL =	0x004,
+JOB_SPECIAL	= 1 << 2,
 /* Ignore "..." lines when processing commands */
-JOB_IGNDOTS	=	0x008,
+JOB_IGNDOTS	= 1 << 3,
 /* we've sent 'set -x' */
-JOB_TRACED =	0x400
+JOB_TRACED	= 1 << 10
 } JobFlags;
 
 /* A Job manages the shell commands that are run to create a single target.



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 20:03:56 UTC 2020

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

Log Message:
make(1): clean up JobStart

Initialize the fields in declaration order.
Initialize Job.flags in a single assignment.


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/usr.bin/make/job.c
cvs rdiff -u -r1.58 -r1.59 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.



CVS commit: src

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 20:01:17 UTC 2020

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

Log Message:
make(1): add test for job command flags


To generate a diff of this commit:
cvs rdiff -u -r1.961 -r1.962 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.188 -r1.189 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/job-flags.exp \
src/usr.bin/make/unit-tests/job-flags.mk

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



CVS commit: src

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 20:01:17 UTC 2020

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

Log Message:
make(1): add test for job command flags


To generate a diff of this commit:
cvs rdiff -u -r1.961 -r1.962 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.188 -r1.189 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/job-flags.exp \
src/usr.bin/make/unit-tests/job-flags.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.961 src/distrib/sets/lists/tests/mi:1.962
--- src/distrib/sets/lists/tests/mi:1.961	Wed Nov  4 04:24:57 2020
+++ src/distrib/sets/lists/tests/mi	Sat Nov  7 20:01:17 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.961 2020/11/04 04:24:57 rillig Exp $
+# $NetBSD: mi,v 1.962 2020/11/07 20:01:17 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5097,6 +5097,8 @@
 ./usr/tests/usr.bin/make/unit-tests/include-main.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/include-sub.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/include-subsub.mktests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/job-flags.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/job-flags.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/job-output-long-lines.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/job-output-long-lines.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/lint.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.188 src/usr.bin/make/unit-tests/Makefile:1.189
--- src/usr.bin/make/unit-tests/Makefile:1.188	Wed Nov  4 04:24:57 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sat Nov  7 20:01:17 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.188 2020/11/04 04:24:57 rillig Exp $
+# $NetBSD: Makefile,v 1.189 2020/11/07 20:01:17 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -175,6 +175,7 @@ TESTS+=		forsubst
 TESTS+=		hanoi-include
 TESTS+=		impsrc
 TESTS+=		include-main
+TESTS+=		job-flags
 TESTS+=		job-output-long-lines
 TESTS+=		lint
 TESTS+=		make-exported

Added files:

Index: src/usr.bin/make/unit-tests/job-flags.exp
diff -u /dev/null src/usr.bin/make/unit-tests/job-flags.exp:1.1
--- /dev/null	Sat Nov  7 20:01:17 2020
+++ src/usr.bin/make/unit-tests/job-flags.exp	Sat Nov  7 20:01:17 2020
@@ -0,0 +1,8 @@
+.BEGIN
+silent
+ignore
+true in ignore
+false in ignore
+*** [ignore] Error code 1 (ignored)
+.END
+exit status 0
Index: src/usr.bin/make/unit-tests/job-flags.mk
diff -u /dev/null src/usr.bin/make/unit-tests/job-flags.mk:1.1
--- /dev/null	Sat Nov  7 20:01:17 2020
+++ src/usr.bin/make/unit-tests/job-flags.mk	Sat Nov  7 20:01:17 2020
@@ -0,0 +1,23 @@
+# $NetBSD: job-flags.mk,v 1.1 2020/11/07 20:01:17 rillig Exp $
+#
+# Tests for Job.flags, which are controlled by special source dependencies
+# like .SILENT or .IGNORE, as well as the command line options -s or -i.
+
+.MAKEFLAGS: -j1
+
+all: silent .WAIT ignore
+
+.BEGIN:
+	@echo $@
+
+silent: .SILENT
+	echo $@
+
+ignore: .IGNORE
+	@echo $@
+	true in $@
+	false in $@
+	@echo 'Still there in $@'
+
+.END:
+	@echo $@



CVS commit: src/external/mit/xorg/lib/libepoxy

2020-11-07 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Nov  7 18:12:16 UTC 2020

Modified Files:
src/external/mit/xorg/lib/libepoxy: Makefile

Log Message:
libepoxy: Only require egl on ports with egl support.

Reported by martin.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/mit/xorg/lib/libepoxy/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/libepoxy/Makefile
diff -u src/external/mit/xorg/lib/libepoxy/Makefile:1.8 src/external/mit/xorg/lib/libepoxy/Makefile:1.9
--- src/external/mit/xorg/lib/libepoxy/Makefile:1.8	Mon Nov  2 06:25:24 2020
+++ src/external/mit/xorg/lib/libepoxy/Makefile	Sat Nov  7 18:12:16 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2020/11/02 06:25:24 mrg Exp $
+#	$NetBSD: Makefile,v 1.9 2020/11/07 18:12:16 nia Exp $
 
 .include 
 
@@ -40,8 +40,15 @@ PKGCONFIG_SED_FLAGS= \
 	-e "s,@DLOPEN_LIBS@,," \
 	-e "s,@epoxy_has_glx@,1," \
 	-e "s,@epoxy_has_egl@,${EGL}," \
-	-e "s,@epoxy_has_wgl@,0," \
+	-e "s,@epoxy_has_wgl@,0,"
+
+.if ${HAVE_XORG_GLAMOR} != "no"
+PKGCONFIG_SED_FLAGS+= \
 	-e "s,@GL_REQS@, gl egl,"
+.else
+PKGCONFIG_SED_FLAGS+= \
+	-e "s,@GL_REQS@, gl,"
+.endif
 
 .include 
 .include 



CVS commit: src/external/mit/xorg/lib/libepoxy

2020-11-07 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Nov  7 18:12:16 UTC 2020

Modified Files:
src/external/mit/xorg/lib/libepoxy: Makefile

Log Message:
libepoxy: Only require egl on ports with egl support.

Reported by martin.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/mit/xorg/lib/libepoxy/Makefile

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



CVS commit: src/usr.sbin/syslogd

2020-11-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  7 17:46:57 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
make the buffer fit any 32 bit number.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/usr.sbin/syslogd/syslogd.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/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.134 src/usr.sbin/syslogd/syslogd.c:1.135
--- src/usr.sbin/syslogd/syslogd.c:1.134	Sat Nov  7 11:16:33 2020
+++ src/usr.sbin/syslogd/syslogd.c	Sat Nov  7 12:46:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.134 2020/11/07 16:16:33 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.135 2020/11/07 17:46:56 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.134 2020/11/07 16:16:33 christos Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.135 2020/11/07 17:46:56 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -207,7 +207,7 @@ bool	BSDOutputFormat = true;	/* if true 
  */
 char	appname[]   = "syslogd";/* the APPNAME for own messages */
 char   *include_pid;		/* include PID in own messages */
-char	include_pid_buf[6];
+char	include_pid_buf[11];
 
 
 /* init and setup */



CVS commit: src/usr.sbin/syslogd

2020-11-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  7 17:46:57 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
make the buffer fit any 32 bit number.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/usr.sbin/syslogd/syslogd.c

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



CVS commit: src/usr.sbin/syslogd

2020-11-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  7 16:16:33 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
PR/55794: Jan Schaumann: Eliminate unchecked malloc


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/usr.sbin/syslogd/syslogd.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/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.133 src/usr.sbin/syslogd/syslogd.c:1.134
--- src/usr.sbin/syslogd/syslogd.c:1.133	Tue Sep 29 10:08:43 2020
+++ src/usr.sbin/syslogd/syslogd.c	Sat Nov  7 11:16:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.133 2020/09/29 14:08:43 gson Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.134 2020/11/07 16:16:33 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.133 2020/09/29 14:08:43 gson Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.134 2020/11/07 16:16:33 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -206,7 +206,8 @@ bool	BSDOutputFormat = true;	/* if true 
  * configurations (e.g. with SG="0").
  */
 char	appname[]   = "syslogd";/* the APPNAME for own messages */
-char   *include_pid = NULL;	/* include PID in own messages */
+char   *include_pid;		/* include PID in own messages */
+char	include_pid_buf[6];
 
 
 /* init and setup */
@@ -573,9 +574,8 @@ getgroup:
 #endif /* __NetBSD_Version__ */
 	}
 
-#define MAX_PID_LEN 5
-	include_pid = malloc(MAX_PID_LEN+1);
-	snprintf(include_pid, MAX_PID_LEN+1, "%d", getpid());
+	include_pid = include_pid_buf;
+	snprintf(include_pid_buf, sizeof(include_pid_buf), "%d", getpid());
 
 	/*
 	 * Create the global kernel event descriptor.



CVS commit: src/usr.sbin/syslogd

2020-11-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  7 16:16:33 UTC 2020

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
PR/55794: Jan Schaumann: Eliminate unchecked malloc


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/usr.sbin/syslogd/syslogd.c

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



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

2020-11-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov  7 14:48:46 UTC 2020

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

Log Message:
Use lower case for hex constants


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

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

Modified files:

Index: src/sys/arch/riscv/include/vmparam.h
diff -u src/sys/arch/riscv/include/vmparam.h:1.6 src/sys/arch/riscv/include/vmparam.h:1.7
--- src/sys/arch/riscv/include/vmparam.h:1.6	Tue Oct  6 13:42:03 2020
+++ src/sys/arch/riscv/include/vmparam.h	Sat Nov  7 14:48:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.6 2020/10/06 13:42:03 christos Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.7 2020/11/07 14:48:45 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -106,12 +106,12 @@
 #define VM_MIN_ADDRESS		((vaddr_t)0x)
 #ifdef _LP64	/* Sv39 */
 #define VM_MAXUSER_ADDRESS	((vaddr_t)0x0040 - 16 * PAGE_SIZE)
-#define VM_MIN_KERNEL_ADDRESS	((vaddr_t)0xFFC0)
-#define VM_MAX_KERNEL_ADDRESS	((vaddr_t)0xFFD0) /* MIN + 64GB */
+#define VM_MIN_KERNEL_ADDRESS	((vaddr_t)0xffc0)
+#define VM_MAX_KERNEL_ADDRESS	((vaddr_t)0xffd0) /* MIN + 64GB */
 #else		/* Sv32 */
-#define VM_MAXUSER_ADDRESS	((vaddr_t)-0x7fff-1)/* 0x8000 */
-#define VM_MIN_KERNEL_ADDRESS	((vaddr_t)-0x7fff-1)/* 0x8000 */
-#define VM_MAX_KERNEL_ADDRESS	((vaddr_t)-0x4000)	/* 0xC000 */
+#define VM_MAXUSER_ADDRESS	((vaddr_t)-0x7fff-1)/* 0x8000 */
+#define VM_MIN_KERNEL_ADDRESS	((vaddr_t)-0x7fff-1)/* 0x8000 */
+#define VM_MAX_KERNEL_ADDRESS	((vaddr_t)-0x4000)	/* 0xc000 */
 #endif
 #define VM_MAX_ADDRESS		VM_MAXUSER_ADDRESS
 #define VM_MAXUSER_ADDRESS32	((vaddr_t)(1UL << 31))/* 0x8000 */



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

2020-11-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov  7 14:48:46 UTC 2020

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

Log Message:
Use lower case for hex constants


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

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 14:40:51 UTC 2020

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

Log Message:
make(1): add test for parse error in function defined()


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/usr.bin/make/cond.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-func-defined.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-func-defined.mk

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

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.180 src/usr.bin/make/cond.c:1.181
--- src/usr.bin/make/cond.c:1.180	Sat Nov  7 14:37:30 2020
+++ src/usr.bin/make/cond.c	Sat Nov  7 14:40:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.180 2020/11/07 14:37:30 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.181 2020/11/07 14:40:51 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.180 2020/11/07 14:37:30 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.181 2020/11/07 14:40:51 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -200,7 +200,7 @@ CondParser_SkipWhitespace(CondParser *pa
  *	func says whether the argument belongs to an actual function, or
  *	whether the parsed argument is passed to the default function.
  *
- * Return the length of the argument. */
+ * Return the length of the argument, or 0 on error. */
 static size_t
 ParseFuncArg(const char **pp, Boolean doEval, const char *func,
 	 char **out_arg) {

Index: src/usr.bin/make/unit-tests/cond-func-defined.exp
diff -u src/usr.bin/make/unit-tests/cond-func-defined.exp:1.3 src/usr.bin/make/unit-tests/cond-func-defined.exp:1.4
--- src/usr.bin/make/unit-tests/cond-func-defined.exp:1.3	Thu Aug 20 17:45:47 2020
+++ src/usr.bin/make/unit-tests/cond-func-defined.exp	Sat Nov  7 14:40:51 2020
@@ -1,5 +1,7 @@
 make: "cond-func-defined.mk" line 23: warning: Missing closing parenthesis for defined()
 make: "cond-func-defined.mk" line 23: Malformed conditional (!defined(A B))
+make: "cond-func-defined.mk" line 33: warning: Missing closing parenthesis for defined()
+make: "cond-func-defined.mk" line 33: Malformed conditional (defined(DEF)
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/cond-func-defined.mk
diff -u src/usr.bin/make/unit-tests/cond-func-defined.mk:1.5 src/usr.bin/make/unit-tests/cond-func-defined.mk:1.6
--- src/usr.bin/make/unit-tests/cond-func-defined.mk:1.5	Sat Oct 24 08:46:08 2020
+++ src/usr.bin/make/unit-tests/cond-func-defined.mk	Sat Nov  7 14:40:51 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func-defined.mk,v 1.5 2020/10/24 08:46:08 rillig Exp $
+# $NetBSD: cond-func-defined.mk,v 1.6 2020/11/07 14:40:51 rillig Exp $
 #
 # Tests for the defined() function in .if conditions.
 
@@ -29,5 +29,12 @@ ${:UA B}=	variable name with spaces
 .  error
 .endif
 
+# Parse error: missing closing parenthesis; see ParseFuncArg.
+.if defined(DEF
+.  error
+.else
+.  error
+.endif
+
 all:
 	@:;



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 14:40:51 UTC 2020

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

Log Message:
make(1): add test for parse error in function defined()


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/usr.bin/make/cond.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-func-defined.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-func-defined.mk

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 14:37:31 UTC 2020

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

Log Message:
make(1): add test for parse error in condition using empty()


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/usr.bin/make/cond.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond-func-empty.exp
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cond-func-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/cond.c
diff -u src/usr.bin/make/cond.c:1.179 src/usr.bin/make/cond.c:1.180
--- src/usr.bin/make/cond.c:1.179	Sat Nov  7 14:11:58 2020
+++ src/usr.bin/make/cond.c	Sat Nov  7 14:37:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.179 2020/11/07 14:11:58 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.180 2020/11/07 14:37:30 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.179 2020/11/07 14:11:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.180 2020/11/07 14:37:30 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -162,7 +162,7 @@ static unsigned int cond_min_depth = 0;	
  *
  * TRUE when CondEvalExpression is called from Cond_EvalLine (.if etc)
  * FALSE when CondEvalExpression is called from ApplyModifier_IfElse
- * since lhs is already expanded and we cannot tell if
+ * since lhs is already expanded, and at that point we cannot tell if
  * it was a variable reference or not.
  */
 static Boolean lhsStrict;

Index: src/usr.bin/make/unit-tests/cond-func-empty.exp
diff -u src/usr.bin/make/unit-tests/cond-func-empty.exp:1.1 src/usr.bin/make/unit-tests/cond-func-empty.exp:1.2
--- src/usr.bin/make/unit-tests/cond-func-empty.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/cond-func-empty.exp	Sat Nov  7 14:37:31 2020
@@ -1 +1,5 @@
-exit status 0
+make: "cond-func-empty.mk" line 150: Unclosed variable "WORD"
+make: "cond-func-empty.mk" line 150: Malformed conditional (empty(WORD)
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1

Index: src/usr.bin/make/unit-tests/cond-func-empty.mk
diff -u src/usr.bin/make/unit-tests/cond-func-empty.mk:1.8 src/usr.bin/make/unit-tests/cond-func-empty.mk:1.9
--- src/usr.bin/make/unit-tests/cond-func-empty.mk:1.8	Wed Sep 23 08:11:28 2020
+++ src/usr.bin/make/unit-tests/cond-func-empty.mk	Sat Nov  7 14:37:31 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func-empty.mk,v 1.8 2020/09/23 08:11:28 rillig Exp $
+# $NetBSD: cond-func-empty.mk,v 1.9 2020/11/07 14:37:31 rillig Exp $
 #
 # Tests for the empty() function in .if conditions, which tests a variable
 # expression for emptiness.
@@ -146,5 +146,12 @@ ${:U WORD }=	variable name with spaces
 .  error
 .endif
 
+# Parse error: missing closing parenthesis.
+.if empty(WORD
+.  error
+.else
+.  error
+.endif
+
 all:
 	@:;



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 14:37:31 UTC 2020

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

Log Message:
make(1): add test for parse error in condition using empty()


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/usr.bin/make/cond.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond-func-empty.exp
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cond-func-empty.mk

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 14:32:13 UTC 2020

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

Log Message:
make(1): clean up Compat_Make


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

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



CVS commit: src/usr.bin/make

2020-11-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Nov  7 14:32:13 UTC 2020

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

Log Message:
make(1): clean up Compat_Make


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 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.178 src/usr.bin/make/compat.c:1.179
--- src/usr.bin/make/compat.c:1.178	Sat Nov  7 14:27:16 2020
+++ src/usr.bin/make/compat.c	Sat Nov  7 14:32:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.178 2020/11/07 14:27:16 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.179 2020/11/07 14:32:12 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.178 2020/11/07 14:27:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.179 2020/11/07 14:32:12 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -467,16 +467,17 @@ MakeNodes(GNodeList *gnodes, GNode *pgn)
 void
 Compat_Make(GNode *gn, GNode *pgn)
 {
-if (!shellName)		/* we came here from jobs */
+if (shellName == NULL)	/* we came here from jobs */
 	Shell_Init();
+
 if (gn->made == UNMADE && (gn == pgn || !(pgn->type & OP_MADE))) {
 	/*
 	 * First mark ourselves to be made, then apply whatever transformations
 	 * the suffix module thinks are necessary. Once that's done, we can
 	 * descend and make all our children. If any of them has an error
-	 * but the -k flag was given, our 'make' field will be set FALSE again.
-	 * This is our signal to not attempt to do anything but abort our
-	 * parent as well.
+	 * but the -k flag was given, our 'make' field will be set to FALSE
+	 * again. This is our signal to not attempt to do anything but abort
+	 * our parent as well.
 	 */
 	gn->flags |= REMAKE;
 	gn->made = BEINGMADE;



  1   2   >