CVS commit: src/sys/arch/aarch64/aarch64

2020-10-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Oct  3 05:56:26 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: aarch64_machdep.c

Log Message:
G/C


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/aarch64/aarch64/aarch64_machdep.c

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/aarch64_machdep.c
diff -u src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.49 src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.50
--- src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.49	Wed Sep 30 16:47:55 2020
+++ src/sys/arch/aarch64/aarch64/aarch64_machdep.c	Sat Oct  3 05:56:26 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: aarch64_machdep.c,v 1.49 2020/09/30 16:47:55 skrll Exp $ */
+/* $NetBSD: aarch64_machdep.c,v 1.50 2020/10/03 05:56:26 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.49 2020/09/30 16:47:55 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.50 2020/10/03 05:56:26 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_cpuoptions.h"
@@ -366,7 +366,7 @@ initarm_common(vaddr_t kvm_base, vsize_t
 		 * order.
 		 */
 		paddr_t segend = end;
-		for (size_t j = 0; j < nbp; j++ /*, start = segend, segend = end */) {
+		for (size_t j = 0; j < nbp; j++) {
 			paddr_t bp_start = bp[j].bp_start;
 			paddr_t bp_end = bp_start + bp[j].bp_pages;
 



CVS commit: src/usr.bin/make

2020-10-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct  2 22:20:25 UTC 2020

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

Log Message:
make(1): use hash table for looking up open directories by name

As long as there are less than 20 open directories, it's perfectly fine
to use a doubly-linked list for name lookup.  A singly linked list or
even an array list would have been better, but anyway.

When the number of directories rises above 1000, which happens with
dirdeps.mk, linear list lookup becomes too expensive, especially since
each list entry is compared using a strcmp call, in a callback function
that is not inlined.

Using a hash table is much more efficient than linear lookup.  While
here, abstract all operations regarding the openDirectories list into a
new data type that provides a simple and straight-forward API.  This
strongly typed API is especially important since the current
implementation of the list and hash table is weakly typed, using void *
for the actual data, and StringList and CachedDirList refer to the
exactly same type, they just have different names to help the human
readers but don't provide any type safety.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 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.154 src/usr.bin/make/dir.c:1.155
--- src/usr.bin/make/dir.c:1.154	Thu Oct  1 22:42:00 2020
+++ src/usr.bin/make/dir.c	Fri Oct  2 22:20:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.154 2020/10/01 22:42:00 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.155 2020/10/02 22:20:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -136,7 +136,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.154 2020/10/01 22:42:00 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.155 2020/10/02 22:20:25 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -219,7 +219,58 @@ typedef ListNode SearchPathNode;
 
 SearchPath *dirSearchPath;		/* main search path */
 
-static CachedDirList *openDirectories;	/* the list of all open directories */
+/* A list of cached directories, with fast lookup by directory name. */
+typedef struct OpenDirs {
+CachedDirList *list;
+Hash_Table /* of CachedDirListNode */ table;
+} OpenDirs;
+
+static void
+OpenDirs_Init(OpenDirs *odirs)
+{
+odirs->list = Lst_Init();
+Hash_InitTable(>table);
+}
+
+static void MAKE_ATTR_UNUSED
+OpenDirs_Done(OpenDirs *odirs)
+{
+Dir_ClearPath(odirs->list);
+Lst_Free(odirs->list);
+Hash_DeleteTable(>table);
+}
+
+static CachedDir *
+OpenDirs_Find(OpenDirs *odirs, const char *name)
+{
+CachedDirListNode *ln = Hash_FindValue(>table, name);
+return ln != NULL ? ln->datum : NULL;
+}
+
+static void
+OpenDirs_Add(OpenDirs *odirs, CachedDir *cdir)
+{
+Hash_Entry *he = Hash_FindEntry(>table, cdir->name);
+if (he != NULL)
+	return;
+he = Hash_CreateEntry(>table, cdir->name, NULL);
+Lst_Append(odirs->list, cdir);
+Hash_SetValue(he, odirs->list->last);
+}
+
+static void
+OpenDirs_Remove(OpenDirs *odirs, const char *name)
+{
+Hash_Entry *he = Hash_FindEntry(>table, name);
+CachedDirListNode *ln;
+if (he == NULL)
+	return;
+ln = Hash_GetValue(he);
+Hash_DeleteEntry(>table, he);
+Lst_Remove(odirs->list, ln);
+}
+
+static OpenDirs openDirs;	/* the list of all open directories */
 
 /*
  * Variables for gathering statistics on the efficiency of the hashing
@@ -337,7 +388,7 @@ void
 Dir_Init(void)
 {
 dirSearchPath = Lst_Init();
-openDirectories = Lst_Init();
+OpenDirs_Init();
 Hash_InitTable();
 Hash_InitTable();
 }
@@ -387,11 +438,8 @@ void
 Dir_InitDot(void)
 {
 if (dot != NULL) {
-	CachedDirListNode *ln;
-
-	/* Remove old entry from openDirectories, but do not destroy. */
-	ln = Lst_FindDatum(openDirectories, dot);
-	Lst_Remove(openDirectories, ln);
+	/* Remove old entry from openDirs, but do not destroy. */
+	OpenDirs_Remove(, dot->name);
 }
 
 dot = Dir_AddDir(NULL, ".");
@@ -424,8 +472,7 @@ Dir_End(void)
 Dir_Destroy(dot);
 Dir_ClearPath(dirSearchPath);
 Lst_Free(dirSearchPath);
-Dir_ClearPath(openDirectories);
-Lst_Free(openDirectories);
+OpenDirs_Done();
 Hash_DeleteTable();
 #endif
 }
@@ -1482,13 +1529,12 @@ Dir_MTime(GNode *gn, Boolean recheck)
 CachedDir *
 Dir_AddDir(SearchPath *path, const char *name)
 {
-SearchPathNode *ln = NULL;
 CachedDir *dir = NULL;	/* the added directory */
 DIR *d;
 struct dirent *dp;
 
 if (path != NULL && strcmp(name, ".DOTLAST") == 0) {
-	ln = Lst_Find(path, DirFindName, name);
+	SearchPathNode *ln = Lst_Find(path, DirFindName, name);
 	if (ln != NULL)
 	return LstNode_Datum(ln);
 
@@ -1497,9 +1543,8 @@ 

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

2020-10-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct  2 20:48:37 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varmod-l-name-to-value.mk

Log Message:
make(1): add test for repeating the :L variable modifier


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/usr.bin/make/unit-tests/varmod-l-name-to-value.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/varmod-l-name-to-value.mk
diff -u src/usr.bin/make/unit-tests/varmod-l-name-to-value.mk:1.5 src/usr.bin/make/unit-tests/varmod-l-name-to-value.mk:1.6
--- src/usr.bin/make/unit-tests/varmod-l-name-to-value.mk:1.5	Wed Sep 30 06:15:43 2020
+++ src/usr.bin/make/unit-tests/varmod-l-name-to-value.mk	Fri Oct  2 20:48:37 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-l-name-to-value.mk,v 1.5 2020/09/30 06:15:43 rillig Exp $
+# $NetBSD: varmod-l-name-to-value.mk,v 1.6 2020/10/02 20:48:37 rillig Exp $
 #
 # Tests for the :L modifier, which returns the variable name as the new value.
 
@@ -34,5 +34,11 @@
 .if ${value:${:UL}} == ""
 .endif
 
+# As of 2020-10-02, the :L modifier does not ensure that it is followed by
+# a delimiter, that is, a ':' or endc.  Neither does the :P modifier.
+.if ${value:LLPL} != "value"
+.  error
+.endif
+
 all:
 	@:;



CVS commit: src

2020-10-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct  2 20:34:59 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile varmod-ifelse.mk
Added Files:
src/usr.bin/make/unit-tests: directive-export-gmake.exp
directive-export-gmake.mk varparse-mod.exp varparse-mod.mk

Log Message:
make(1): add tests for parsing and exporting variables

Once again, there are a few surprises deeply hidden inside the edge
cases.


To generate a diff of this commit:
cvs rdiff -u -r1.934 -r1.935 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.155 -r1.156 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/directive-export-gmake.exp \
src/usr.bin/make/unit-tests/directive-export-gmake.mk \
src/usr.bin/make/unit-tests/varparse-mod.exp \
src/usr.bin/make/unit-tests/varparse-mod.mk
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-ifelse.mk

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.934 src/distrib/sets/lists/tests/mi:1.935
--- src/distrib/sets/lists/tests/mi:1.934	Thu Oct  1 02:00:04 2020
+++ src/distrib/sets/lists/tests/mi	Fri Oct  2 20:34:59 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.934 2020/10/01 02:00:04 pgoyette Exp $
+# $NetBSD: mi,v 1.935 2020/10/02 20:34:59 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4747,6 +4747,8 @@
 ./usr/tests/usr.bin/make/unit-tests/directive-error.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/directive-export-env.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/directive-export-env.mk			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/directive-export-gmake.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/directive-export-gmake.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/directive-export-literal.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/directive-export-literal.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/directive-export.exp			tests-usr.bin-tests	compattestfile,atf
@@ -5185,6 +5187,8 @@
 ./usr/tests/usr.bin/make/unit-tests/varname.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varparse-dynamic.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varparse-dynamic.mktests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varparse-mod.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varparse-mod.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varparse-undef-partial.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varparse-undef-partial.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/varquote.exptests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.155 src/usr.bin/make/unit-tests/Makefile:1.156
--- src/usr.bin/make/unit-tests/Makefile:1.155	Tue Sep 29 18:16:24 2020
+++ src/usr.bin/make/unit-tests/Makefile	Fri Oct  2 20:34:59 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.155 2020/09/29 18:16:24 rillig Exp $
+# $NetBSD: Makefile,v 1.156 2020/10/02 20:34:59 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -137,6 +137,7 @@ TESTS+=		directive-endif
 TESTS+=		directive-error
 TESTS+=		directive-export
 TESTS+=		directive-export-env
+TESTS+=		directive-export-gmake
 TESTS+=		directive-export-literal
 TESTS+=		directive-for
 TESTS+=		directive-for-generating-endif
@@ -350,6 +351,7 @@ TESTS+=		varname-makeflags
 TESTS+=		varname-pwd
 TESTS+=		varname-vpath
 TESTS+=		varparse-dynamic
+TESTS+=		varparse-mod
 TESTS+=		varparse-undef-partial
 TESTS+=		varquote
 TESTS+=		varshell

Index: src/usr.bin/make/unit-tests/varmod-ifelse.mk
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.2 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varmod-ifelse.mk	Fri Oct  2 20:34:59 2020
@@ -1,9 +1,12 @@
-# $NetBSD: varmod-ifelse.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-ifelse.mk,v 1.3 2020/10/02 20:34:59 rillig Exp $
 #
 # Tests for the ${cond:?then:else} variable modifier, which evaluates either
 # the then-expression or the else-expression, depending on the condition.
 
 # TODO: Implementation
 
+# TODO: Test another modifier after ifelse; does not work, it becomes part
+# of the else branch.
+
 all:
 	@:;

Added files:

Index: src/usr.bin/make/unit-tests/directive-export-gmake.exp
diff -u /dev/null 

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

2020-10-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct  2 18:46:54 UTC 2020

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

Log Message:
make(1): add test for the special .PATH target and variable


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

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

Modified files:

Index: src/usr.bin/make/unit-tests/varname-dot-path.mk
diff -u src/usr.bin/make/unit-tests/varname-dot-path.mk:1.2 src/usr.bin/make/unit-tests/varname-dot-path.mk:1.3
--- src/usr.bin/make/unit-tests/varname-dot-path.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varname-dot-path.mk	Fri Oct  2 18:46:54 2020
@@ -1,8 +1,56 @@
-# $NetBSD: varname-dot-path.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varname-dot-path.mk,v 1.3 2020/10/02 18:46:54 rillig Exp $
 #
-# Tests for the special .PATH variable.
+# Tests for the special .PATH variable, which TODO: describe the purpose.
 
-# TODO: Implementation
+_!=	mkdir -p varname-dot-path.d
+
+# By default, .PATH consists of "." and .CURDIR.
+# XXX: Why both? Shouldn't they have the same effect?
+.if ${.PATH} != ". ${.CURDIR}"
+.  error ${.PATH}
+.endif
+
+# The special target .PATH adds a directory to the path.
+.PATH: /
+.if ${.PATH} != ". ${.CURDIR} /"
+.  error ${.PATH}
+.endif
+
+# Only existing directories are added to the path, the others are ignored.
+.PATH: /nonexistent
+.if ${.PATH} != ". ${.CURDIR} /"
+.  error ${.PATH}
+.endif
+
+# Only directories are added to the path, not regular files.
+.PATH: ${.PARSEDIR}/${.PARSEFILE}
+.if ${.PATH} != ". ${.CURDIR} /"
+.  error ${.PATH}
+.endif
+
+# Relative directories can be added as well.
+# Each directory is only added once to the path.
+.PATH: varname-dot-path.d /
+.if ${.PATH} != ". ${.CURDIR} / varname-dot-path.d"
+.  error ${.PATH}
+.endif
+
+# The pathnames are not normalized before being added to the path.
+.PATH: ./.
+.if ${.PATH} != ". ${.CURDIR} / varname-dot-path.d ./."
+.  error ${.PATH}
+.endif
+
+# The two default entries can be placed at the back of the path,
+# by adding the special entry ".DOTLAST" somewhere in the path.
+# The entry .DOTLAST, if any, is listed in the path, always at the
+# very beginning, to make this magic less surprising.
+.PATH: .DOTLAST
+.if ${.PATH} != ".DOTLAST / varname-dot-path.d ./. . ${.CURDIR}"
+.  error ${.PATH}
+.endif
+
+_!=	rmdir varname-dot-path.d
 
 all:
 	@:;



CVS commit: src/usr.bin/make

2020-10-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Oct  2 17:42:33 UTC 2020

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

Log Message:
make(1): in ApplyModifier_To, update pp in each branch

Before, the parsing position was updated once at the beginning, which
didn't make sense.  Updating it in each branch allows to decide for its
appropriate value in each branch individually.


To generate a diff of this commit:
cvs rdiff -u -r1.555 -r1.556 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.555 src/usr.bin/make/var.c:1.556
--- src/usr.bin/make/var.c:1.555	Wed Sep 30 06:46:43 2020
+++ src/usr.bin/make/var.c	Fri Oct  2 17:42:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.555 2020/09/30 06:46:43 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.556 2020/10/02 17:42:33 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include"metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.555 2020/09/30 06:46:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.556 2020/10/02 17:42:33 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -2448,9 +2448,7 @@ ModifyWord_Copy(const char *word, SepBuf
 static ApplyModifierResult
 ApplyModifier_ToSep(const char **pp, ApplyModifiersState *st)
 {
-/* XXX: pp points to the 's', for historic reasons only.
- * Changing this will influence the error messages. */
-const char *sep = *pp + 1;
+const char *sep = *pp + 2;
 
 /* ":ts" or ":ts:" */
 if (sep[0] != st->endc && (sep[1] == st->endc || sep[1] == ':')) {
@@ -2467,8 +2465,10 @@ ApplyModifier_ToSep(const char **pp, App
 }
 
 /* ":ts". */
-if (sep[0] != '\\')
+if (sep[0] != '\\') {
+	(*pp)++;		/* just for backwards compatibility */
 	return AMR_BAD;
+}
 
 /* ":ts\n" */
 if (sep[1] == 'n') {
@@ -2493,12 +2493,16 @@ ApplyModifier_ToSep(const char **pp, App
 	if (sep[1] == 'x') {
 	base = 16;
 	numStart++;
-	} else if (!ch_isdigit(sep[1]))
+	} else if (!ch_isdigit(sep[1])) {
+	(*pp)++;		/* just for backwards compatibility */
 	return AMR_BAD;	/* ":ts". */
+	}
 
 	st->sep = (char)strtoul(numStart, , base);
-	if (*end != ':' && *end != st->endc)
+	if (*end != ':' && *end != st->endc) {
+	(*pp)++;		/* just for backwards compatibility */
 	return AMR_BAD;
+	}
 	*pp = end;
 }
 
@@ -2515,15 +2519,18 @@ ApplyModifier_To(const char **pp, ApplyM
 const char *mod = *pp;
 assert(mod[0] == 't');
 
-*pp = mod + 1;		/* make sure it is set */
-if (mod[1] == st->endc || mod[1] == ':' || mod[1] == '\0')
+if (mod[1] == st->endc || mod[1] == ':' || mod[1] == '\0') {
+	*pp = mod + 1;
 	return AMR_BAD;		/* Found ":t" or ":t:". */
+}
 
 if (mod[1] == 's')
 	return ApplyModifier_ToSep(pp, st);
 
-if (mod[2] != st->endc && mod[2] != ':')
+if (mod[2] != st->endc && mod[2] != ':') {
+	*pp = mod + 1;
 	return AMR_BAD;		/* Found ":t". */
+}
 
 /* Check for two-character options: ":tu", ":tl" */
 if (mod[1] == 'A') {	/* absolute path */
@@ -2533,7 +2540,7 @@ ApplyModifier_To(const char **pp, ApplyM
 	return AMR_OK;
 }
 
-if (mod[1] == 'u') {
+if (mod[1] == 'u') {	/* :tu */
 	size_t i;
 	size_t len = strlen(st->val);
 	st->newVal = bmake_malloc(len + 1);
@@ -2543,7 +2550,7 @@ ApplyModifier_To(const char **pp, ApplyM
 	return AMR_OK;
 }
 
-if (mod[1] == 'l') {
+if (mod[1] == 'l') {	/* :tl */
 	size_t i;
 	size_t len = strlen(st->val);
 	st->newVal = bmake_malloc(len + 1);
@@ -2553,7 +2560,7 @@ ApplyModifier_To(const char **pp, ApplyM
 	return AMR_OK;
 }
 
-if (mod[1] == 'W' || mod[1] == 'w') {
+if (mod[1] == 'W' || mod[1] == 'w') { /* :tW, :tw */
 	st->oneBigWord = mod[1] == 'W';
 	st->newVal = st->val;
 	*pp = mod + 2;
@@ -2561,6 +2568,7 @@ ApplyModifier_To(const char **pp, ApplyM
 }
 
 /* Found ":t:" or ":t". */
+*pp = mod + 1;
 return AMR_BAD;
 }
 



CVS commit: src/bin/csh

2020-10-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  2 17:33:14 UTC 2020

Modified Files:
src/bin/csh: lex.c

Log Message:
undo previous for 'r' and 'e' modifiers; they should no go further than
the last '/'.


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

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

Modified files:

Index: src/bin/csh/lex.c
diff -u src/bin/csh/lex.c:1.37 src/bin/csh/lex.c:1.38
--- src/bin/csh/lex.c:1.37	Wed Sep 30 13:51:10 2020
+++ src/bin/csh/lex.c	Fri Oct  2 13:33:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.37 2020/09/30 17:51:10 christos Exp $ */
+/* $NetBSD: lex.c,v 1.38 2020/10/02 17:33:13 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)lex.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: lex.c,v 1.37 2020/09/30 17:51:10 christos Exp $");
+__RCSID("$NetBSD: lex.c,v 1.38 2020/10/02 17:33:13 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -996,6 +996,7 @@ domod(Char *cp, int type)
 	if ((c != ' ' && c != '\t') || type == 'q')
 		*xp |= QUOTE;
 	return (wp);
+
 case 'h':
 case 't':
 	wp = Strrchr(cp, '/');
@@ -1009,14 +1010,16 @@ domod(Char *cp, int type)
 
 case 'e':
 case 'r':
-	wp = Strrchr(cp, '.');
-	if (wp == NULL)
-	return Strsave(type == 'r' ? cp : STRNULL);
-	if (type == 'e')
-	xp = Strsave(wp + 1);
-	else
-	xp = Strsave(cp), xp[wp - cp] = 0;
-	return (xp);
+	wp = Strend(cp);
+	for (wp--; wp >= cp && *wp != '/'; wp--)
+	if (*wp == '.') {
+		if (type == 'e')
+		xp = Strsave(wp + 1);
+		else
+		xp = Strsave(cp), xp[wp - cp] = 0;
+		return (xp);
+	}
+	return (Strsave(type == 'e' ? STRNULL : cp));
 
 default:
 	break;



CVS commit: src/etc/etc.evbarm

2020-10-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Oct  2 17:27:12 UTC 2020

Modified Files:
src/etc/etc.evbarm: Makefile.inc

Log Message:
Build arm64.img for aarch64eb with a LE FFS, and include GENERIC64 in
release builds.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/etc/etc.evbarm/Makefile.inc

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

Modified files:

Index: src/etc/etc.evbarm/Makefile.inc
diff -u src/etc/etc.evbarm/Makefile.inc:1.120 src/etc/etc.evbarm/Makefile.inc:1.121
--- src/etc/etc.evbarm/Makefile.inc:1.120	Thu May 28 10:22:49 2020
+++ src/etc/etc.evbarm/Makefile.inc	Fri Oct  2 17:27:12 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.120 2020/05/28 10:22:49 jmcneill Exp $
+#	$NetBSD: Makefile.inc,v 1.121 2020/10/02 17:27:12 jmcneill Exp $
 #
 #	etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
 #
@@ -12,7 +12,12 @@ EVBARM_BOARDS=
 EVBARM_BOARDS.${i}=
 .endfor
 
-.if !empty(MACHINE_ARCH:M*eb)
+.if ${MACHINE_ARCH} == "aarch64eb"
+# For AArch64 BE images, we need a LE image for efiboot to be able to
+# read the target file-system (no libsa FFS EI support).
+IMAGEENDIAN=	le
+KERNEL_SETS.arm64+=		GENERIC64
+.elif !empty(MACHINE_ARCH:M*eb)
 IMAGEENDIAN=	be
 # big endian boards
 KERNEL_SETS.armv4+=		IXM1200
@@ -114,6 +119,7 @@ ARCHES.earmv7hf=	armv7hf
 ARCHES.earmv7eb=	armv7
 ARCHES.earmv7hfeb=	armv7hf
 ARCHES.aarch64=		arm64
+ARCHES.aarch64eb=	arm64
 .for arch in ${ARCHES.${MACHINE_ARCH}}
 .for board in ${EVBARM_BOARDS.${arch}}
 KERNEL_SETS+=		${board}
@@ -122,7 +128,7 @@ BUILD_KERNELS+=		${board}_INSTALL
 KERNEL_SETS+=		${KERNEL_SETS.${arch}}
 .endfor
 
-.if !empty(MACHINE_ARCH:Maarch64)
+.if !empty(MACHINE_ARCH:Maarch64*)
 smp_efibootaa64:
 	cd ${KERNSRCDIR}/stand/efiboot/bootaa64 && ${MAKE} release
 SNAP_MD_POST_DEPS+=	smp_efibootaa64
@@ -142,7 +148,7 @@ MKI_OPTS.smp_armv7=	-K ${IMAGE.kern}
 SNAP_MD_POST_DEPS+=	smp_armv7
 .endif
 
-.if !empty(MACHINE_ARCH:Maarch64) && empty(ALL_KERNELS)
+.if !empty(MACHINE_ARCH:Maarch64*) && empty(ALL_KERNELS)
 smp_arm64: __mkimage
 MKI_OPTS.smp_arm64=	-K ${IMAGE.kern}
 SNAP_MD_POST_DEPS+=	smp_arm64



CVS commit: src/sys/dev/fdt

2020-10-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Oct  2 14:59:56 UTC 2020

Modified Files:
src/sys/dev/fdt: dw_apb_uart.c

Log Message:
Revert rev 1.5:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/fdt/dw_apb_uart.c#rev1.5

The device is capable to recognize break signal actually.
Reset cnmagic from + to default.

Pointed out by jakllsch. Thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/fdt/dw_apb_uart.c

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

Modified files:

Index: src/sys/dev/fdt/dw_apb_uart.c
diff -u src/sys/dev/fdt/dw_apb_uart.c:1.7 src/sys/dev/fdt/dw_apb_uart.c:1.8
--- src/sys/dev/fdt/dw_apb_uart.c:1.7	Mon Sep 28 11:34:47 2020
+++ src/sys/dev/fdt/dw_apb_uart.c	Fri Oct  2 14:59:56 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dw_apb_uart.c,v 1.7 2020/09/28 11:34:47 jmcneill Exp $ */
+/* $NetBSD: dw_apb_uart.c,v 1.8 2020/10/02 14:59:56 rin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dw_apb_uart.c,v 1.7 2020/09/28 11:34:47 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dw_apb_uart.c,v 1.8 2020/10/02 14:59:56 rin Exp $");
 
 #include 
 #include 
@@ -183,8 +183,6 @@ dw_apb_uart_console_consinit(struct fdt_
 
 	if (comcnattach1(, speed, uart_freq, COM_TYPE_DW_APB, flags))
 		panic("Cannot initialize dw-apb-uart console");
-
-	cn_set_magic("+");
 }
 
 static const struct fdt_console dw_apb_uart_console = {



CVS commit: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common

2020-10-02 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Oct  2 14:36:54 UTC 2020

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_linux_libcdep.cc

Log Message:
Do not assume that _lwp_getprivate() returns unbiased private pointer

Cherry-pick and adapt:

>From 2a9ce60de98e53198047daaeeec3cf09ece4e693 Mon Sep 17 00:00:00 2001
From: Kamil Rytarowski 
Date: Fri, 2 Oct 2020 16:13:09 +0200
Subject: [PATCH] [compiler-rt] [netbsd] Improve the portability of
 ThreadSelfTlsTcb

Use __lwp_gettcb_fast() and __lwp_getprivate_fast(), as _lwp_getprivate()
can be a biased pointer and invalid for use in this function on all CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc

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

Modified files:

Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:1.16 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:1.17
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:1.16	Thu Sep 10 12:53:05 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc	Fri Oct  2 14:36:54 2020
@@ -25,6 +25,10 @@
 #include "sanitizer_placement_new.h"
 #include "sanitizer_procmaps.h"
 
+#if SANITIZER_NETBSD
+#define _RTLD_SOURCE  // for __lwp_gettcb_fast() / __lwp_getprivate_fast()
+#endif
+
 #include   // for dlsym()
 #include 
 #include 
@@ -418,7 +422,13 @@ uptr ThreadSelf() {
 
 #if SANITIZER_NETBSD
 static struct tls_tcb * ThreadSelfTlsTcb() {
-  return (struct tls_tcb *)_lwp_getprivate();
+  struct tls_tcb *tcb = nullptr;
+#ifdef __HAVE___LWP_GETTCB_FAST
+  tcb = (struct tls_tcb *)__lwp_gettcb_fast();
+#elif defined(__HAVE___LWP_GETPRIVATE_FAST)
+  tcb = (struct tls_tcb *)__lwp_getprivate_fast();
+#endif
+  return tcb;
 }
 
 uptr ThreadSelf() {



CVS commit: xsrc/external/mit

2020-10-02 Thread Nia Alarie
Module Name:xsrc
Committed By:   nia
Date:   Fri Oct  2 13:45:07 UTC 2020

Modified Files:
xsrc/external/mit/xdm/dist/config: Xsession.in
xsrc/external/mit/xinit/dist: xinitrc.cpp

Log Message:
Slightly nicer default colors for various X11 apps


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xdm/dist/config/Xsession.in
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/xinit/dist/xinitrc.cpp

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

Modified files:

Index: xsrc/external/mit/xdm/dist/config/Xsession.in
diff -u xsrc/external/mit/xdm/dist/config/Xsession.in:1.4 xsrc/external/mit/xdm/dist/config/Xsession.in:1.5
--- xsrc/external/mit/xdm/dist/config/Xsession.in:1.4	Fri Oct  2 07:33:47 2020
+++ xsrc/external/mit/xdm/dist/config/Xsession.in	Fri Oct  2 13:45:07 2020
@@ -61,6 +61,14 @@ if [ -s "$startup" ]; then
 else
 	if [ -r "$resources" ]; then
 		BINDIR/xrdb -load "$resources"
+	else
+		BINDIR/xrdb -load - <

CVS commit: src/external/mit/xorg/bin/xterm

2020-10-02 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri Oct  2 13:08:07 UTC 2020

Modified Files:
src/external/mit/xorg/bin/xterm: Makefile

Log Message:
xterm: Enable SIXEL graphics support.

could also enable REGIS, it will require -lm and i suppose isn't
a default upstream yet(?)

test with "-ti vt340".


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/external/mit/xorg/bin/xterm/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/bin/xterm/Makefile
diff -u src/external/mit/xorg/bin/xterm/Makefile:1.17 src/external/mit/xorg/bin/xterm/Makefile:1.18
--- src/external/mit/xorg/bin/xterm/Makefile:1.17	Wed May  9 08:39:55 2018
+++ src/external/mit/xorg/bin/xterm/Makefile	Fri Oct  2 13:08:07 2020
@@ -1,16 +1,14 @@
-#	$NetBSD: Makefile,v 1.17 2018/05/09 08:39:55 mrg Exp $
+#	$NetBSD: Makefile,v 1.18 2020/10/02 13:08:07 nia Exp $
 
 .include 
 
 PROG=	xterm
 SRCS=	button.c charproc.c charsets.c cursor.c data.c doublechr.c \
-	fontutils.c input.c linedata.c menu.c misc.c print.c ptydata.c \
-	screen.c scrollback.c scrollbar.c tabs.c util.c xstrings.c \
-	TekPrsTbl.c Tekproc.c VTPrsTbl.c main.c charclass.c precompose.c \
-	wcwidth.c xutf8.c cachedGCs.c xtermcap.c version.c
-
-# graphics_regis.c graphics_sixel.c
-# xterm.appdata.xml
+	graphics.c graphics_sixel.c fontutils.c input.c linedata.c menu.c \
+	misc.c print.c ptydata.c screen.c scrollback.c scrollbar.c tabs.c \
+	util.c xstrings.c TekPrsTbl.c Tekproc.c VTPrsTbl.c main.c \
+	charclass.c precompose.c wcwidth.c xutf8.c cachedGCs.c xtermcap.c \
+	version.c
 
 CPPFLAGS+=	-I. \
 		-I${X11SRCDIR.${PROG}} \
@@ -19,6 +17,8 @@ CPPFLAGS+=	-I. \
 		-I${DESTDIR}${X11INCDIR}/freetype2/freetype \
 		-DPROJECTROOT=${X11ROOTDIR} \
 		-DHAVE_CONFIG_H \
+		-DOPT_GRAPHICS \
+		-DOPT_SIXEL_GRAPHICS \
 		-D_REENTRANT \
 		${X11FLAGS.VERSION}
 



CVS commit: xsrc/external/mit/xdm/dist/config

2020-10-02 Thread Nia Alarie
Module Name:xsrc
Committed By:   nia
Date:   Fri Oct  2 07:33:47 UTC 2020

Modified Files:
xsrc/external/mit/xdm/dist/config: Xsession.in

Log Message:
remove redundant $


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/xdm/dist/config/Xsession.in

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

Modified files:

Index: xsrc/external/mit/xdm/dist/config/Xsession.in
diff -u xsrc/external/mit/xdm/dist/config/Xsession.in:1.3 xsrc/external/mit/xdm/dist/config/Xsession.in:1.4
--- xsrc/external/mit/xdm/dist/config/Xsession.in:1.3	Tue Sep 22 14:32:03 2020
+++ xsrc/external/mit/xdm/dist/config/Xsession.in	Fri Oct  2 07:33:47 2020
@@ -62,6 +62,6 @@ else
 	if [ -r "$resources" ]; then
 		BINDIR/xrdb -load "$resources"
 	fi
-	$BINDIR/uxterm &
+	BINDIR/uxterm &
 	exec BINDIR/ctwm -W
 fi