CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 13 05:56:32 UTC 2020

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

Log Message:
make(1): consense documentation for Fatal


To generate a diff of this commit:
cvs rdiff -u -r1.333 -r1.334 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.333 src/usr.bin/make/main.c:1.334
--- src/usr.bin/make/main.c:1.333	Sat Sep 12 15:15:51 2020
+++ src/usr.bin/make/main.c	Sun Sep 13 05:56:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.333 2020/09/12 15:15:51 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.334 2020/09/13 05:56:32 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.333 2020/09/12 15:15:51 rillig Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.334 2020/09/13 05:56:32 rillig Exp $";
 #else
 #include 
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.333 2020/09/12 15:15:51 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.334 2020/09/13 05:56:32 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1727,17 +1727,9 @@ Error(const char *fmt, ...)
 	}
 }
 
-/*-
- * Fatal --
- *	Produce a Fatal error message. If jobs are running, waits for them
- *	to finish.
- *
- * Results:
- *	None
+/* Produce a Fatal error message, then exit immediately.
  *
- * Side Effects:
- *	The program exits
- */
+ * If jobs are running, waits for them to finish. */
 /* VARARGS */
 void
 Fatal(const char *fmt, ...)



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 13 05:55:39 UTC 2020

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

Log Message:
make(1): improve implementation comment in Var_Parse


To generate a diff of this commit:
cvs rdiff -u -r1.505 -r1.506 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.505 src/usr.bin/make/var.c:1.506
--- src/usr.bin/make/var.c:1.505	Sat Sep 12 22:12:17 2020
+++ src/usr.bin/make/var.c	Sun Sep 13 05:55:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.505 2020/09/12 22:12:17 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.506 2020/09/13 05:55:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.505 2020/09/12 22:12:17 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.506 2020/09/13 05:55:39 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.505 2020/09/12 22:12:17 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.506 2020/09/13 05:55:39 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3537,16 +3537,16 @@ Var_Parse(const char **pp, GNode *ctxt, 
 	}
 
 	/* The variable expression is based on an undefined variable.
+	 * Nevertheless it needs a Var, for modifiers that access the
+	 * variable name, such as :L or :?, and for modifiers that access
+	 * the variable flags (VAR_JUNK, VAR_KEEP).
+	 *
 	 * Most modifiers leave this expression in the "undefined" state
-	 * (VAR_JUNK), only some modifiers like :D, :U, :L, :P turn this
-	 * undefined expression into a defined expression.
+	 * (VAR_JUNK), only a few modifiers like :D, :U, :L, :P turn this
+	 * undefined expression into a defined expression (VAR_KEEP).
 	 *
-	 * At the end, after applying all modifiers, if the expression is
-	 * still undefined after applying all the modifiers, var_Error is
-	 * returned.  Until then, the expression needs a variable struct,
-	 * for all the modifiers that need access to the variable name,
-	 * such as :L or :?.
-	 */
+	 * At the end, after applying all modifiers, if the expression
+	 * is still !VAR_KEEP, Var_Parse will return var_Error. */
 	v = bmake_malloc(sizeof(Var));
 	v->name = varname;
 	Buf_Init(>val, 1);



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

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep 13 05:36:26 UTC 2020

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

Log Message:
make(1): fix comments in test for the :M variable modifier

One mistake per sentence is pretty much, I must have been quite
unconcentrated.

The other commits from around that time are fine though.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-match.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-match.mk
diff -u src/usr.bin/make/unit-tests/varmod-match.mk:1.4 src/usr.bin/make/unit-tests/varmod-match.mk:1.5
--- src/usr.bin/make/unit-tests/varmod-match.mk:1.4	Sat Sep 12 22:35:43 2020
+++ src/usr.bin/make/unit-tests/varmod-match.mk	Sun Sep 13 05:36:26 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-match.mk,v 1.4 2020/09/12 22:35:43 rillig Exp $
+# $NetBSD: varmod-match.mk,v 1.5 2020/09/13 05:36:26 rillig Exp $
 #
 # Tests for the :M variable modifier, which filters words that match the
 # given pattern.
@@ -9,18 +9,21 @@
 
 NUMBERS=	One Two Three Four five six seven
 
-# Only keep numbers that start with an uppercase letter.
+# Only keep words that start with an uppercase letter.
 .if ${NUMBERS:M[A-Z]*} != "One Two Three Four"
 .  error
 .endif
 
-# Only keep numbers that don't start with an uppercase letter.
+# Only keep words that start with a character other than an uppercase letter.
 .if ${NUMBERS:M[^A-Z]*} != "five six seven"
 .  error
 .endif
 
-# Only keep numbers that don't start with s and at the same time
-# ends with either of [ex].
+# Only keep words that don't start with s and at the same time end with
+# either of [ex].
+#
+# This test case ensures that the negation from the first character class
+# does not propagate to the second character class.
 .if ${NUMBERS:M[^s]*[ex]} != "One Three five"
 .  error
 .endif
@@ -31,14 +34,18 @@ NUMBERS=	One Two Three Four five six sev
 .endif
 
 # To match a dollar sign in a word, double it.
+#
 # This is different from the :S and :C variable modifiers, where a '$'
-# has to be escaped as '$$'.
+# has to be escaped as '\$'.
 .if ${:Ua \$ sign:M*$$*} != "\$"
 .  error
 .endif
 
-# In the :M modifier, it does not work to escape a dollar using a backslash.
-# This is different from the :S, :C and a few other variable modifiers.
+# In the :M modifier, '\$' does not escape a dollar.  Instead it is
+# interpreted as a backslash followed by whatever expression the
+# '$' starts.
+#
+# This differs from the :S, :C and several other variable modifiers.
 ${:U*}=		asterisk
 .if ${:Ua \$ sign any-asterisk:M*\$*} != "any-asterisk"
 .  error



CVS commit: src

2020-09-12 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Sep 13 04:14:49 UTC 2020

Modified Files:
src/sys/dev/audio: audio_if.h audiodef.h
src/usr.bin/fstat: misc.c

Log Message:
Support audio descriptor for fstat(1).
sys/dev/audio/*.h: export only what we need for fstat.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/audio/audio_if.h
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/audio/audiodef.h
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/fstat/misc.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/audio/audio_if.h
diff -u src/sys/dev/audio/audio_if.h:1.2 src/sys/dev/audio/audio_if.h:1.3
--- src/sys/dev/audio/audio_if.h:1.2	Wed May  8 13:40:17 2019
+++ src/sys/dev/audio/audio_if.h	Sun Sep 13 04:14:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio_if.h,v 1.2 2019/05/08 13:40:17 isaki Exp $	*/
+/*	$NetBSD: audio_if.h,v 1.3 2020/09/13 04:14:48 isaki Exp $	*/
 
 /*
  * Copyright (c) 1994 Havard Eidnes.
@@ -57,6 +57,8 @@
 
 struct audio_softc;
 
+#if defined(_KERNEL)
+
 /**
  * audio stream format
  */
@@ -154,6 +156,8 @@ extern int audio_indexof_format(const st
 	const audio_params_t *);
 extern const char *audio_encoding_name(int);
 
+#endif /* _KERNEL */
+
 /* Device identity flags */
 #define SOUND_DEVICE		0
 #define AUDIO_DEVICE		0x80

Index: src/sys/dev/audio/audiodef.h
diff -u src/sys/dev/audio/audiodef.h:1.14 src/sys/dev/audio/audiodef.h:1.15
--- src/sys/dev/audio/audiodef.h:1.14	Wed Apr 29 03:58:27 2020
+++ src/sys/dev/audio/audiodef.h	Sun Sep 13 04:14:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiodef.h,v 1.14 2020/04/29 03:58:27 isaki Exp $	*/
+/*	$NetBSD: audiodef.h,v 1.15 2020/09/13 04:14:48 isaki Exp $	*/
 
 /*
  * Copyright (C) 2017 Tetsuya Isaki. All rights reserved.
@@ -78,6 +78,8 @@
 #define AUDIO_SCALEDOWN(value, bits)	((value) / (1 << (bits)))
 #endif
 
+#if defined(_KERNEL)
+
 /* conversion stage */
 typedef struct {
 	audio_ring_t srcbuf;
@@ -92,7 +94,7 @@ typedef enum {
 	AUDIO_STATE_DRAINING,	/* now draining */
 } audio_state_t;
 
-typedef struct audio_track {
+struct audio_track {
 	/*
 	 * AUMODE_PLAY for playback track, or
 	 * AUMODE_RECORD for recoding track.
@@ -167,7 +169,10 @@ typedef struct audio_track {
 	volatile uint	lock;
 
 	int		id;		/* track id for debug */
-} audio_track_t;
+};
+#endif /* _KERNEL */
+
+typedef struct audio_track audio_track_t;
 
 struct audio_file {
 	struct audio_softc *sc;
@@ -197,6 +202,8 @@ struct audio_file {
 	SLIST_ENTRY(audio_file) entry;
 };
 
+#if defined(_KERNEL)
+
 struct audio_trackmixer {
 	struct audio_softc *sc;
 
@@ -439,4 +446,6 @@ auring_get_contig_free(const audio_ring_
 	}
 }
 
+#endif /* _KERNEL */
+
 #endif /* !_SYS_DEV_AUDIO_AUDIODEF_H_ */

Index: src/usr.bin/fstat/misc.c
diff -u src/usr.bin/fstat/misc.c:1.23 src/usr.bin/fstat/misc.c:1.24
--- src/usr.bin/fstat/misc.c:1.23	Sat May  2 18:42:30 2020
+++ src/usr.bin/fstat/misc.c	Sun Sep 13 04:14:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.23 2020/05/02 18:42:30 christos Exp $	*/
+/*	$NetBSD: misc.c,v 1.24 2020/09/13 04:14:48 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: misc.c,v 1.23 2020/05/02 18:42:30 christos Exp $");
+__RCSID("$NetBSD: misc.c,v 1.24 2020/09/13 04:14:48 isaki Exp $");
 
 #include 
 #include 
@@ -60,6 +60,9 @@ __RCSID("$NetBSD: misc.c,v 1.23 2020/05/
 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -220,6 +223,46 @@ p_kqueue(struct file *f)
 	return 0;
 }
 
+static int
+p_audio(struct file *f)
+{
+	struct audio_file af;
+	const char *devname;
+	const char *modename;
+
+	if (!KVM_READ(f->f_data, , sizeof(af))) {
+		dprintf("can't read audio_file at %p for pid %d",
+		f->f_data, Pid);
+		return 0;
+	}
+
+	if (ISDEVAUDIO(af.dev)) {
+		devname = "audio";
+	} else if (ISDEVSOUND(af.dev)) {
+		devname = "sound";
+	} else if (ISDEVAUDIOCTL(af.dev)) {
+		devname = "audioctl";
+	} else if (ISDEVMIXER(af.dev)) {
+		devname = "mixer";
+	} else {
+		devname = "???";
+	}
+
+	if (af.ptrack && af.rtrack) {
+		modename = "playback, record";
+	} else if (af.ptrack) {
+		modename = "playback";
+	} else if (af.rtrack) {
+		modename = "record";
+	} else {
+		modename = "-";
+	}
+
+	(void)printf("* audio@%s%d %s", devname, AUDIOUNIT(af.dev), modename);
+	oprint(f, "\n");
+	return 0;
+}
+
 int
 pmisc(struct file *f, const char *name)
 {
@@ -263,8 +306,7 @@ pmisc(struct file *f, const char *name)
 		printf("* crypto %p", f->f_data);
 		break;
 	case NL_AUDIO:
-		printf("* audio %p", f->f_data);
-		break;
+		return p_audio(f);
 	case NL_PAD:
 		printf("* pad %p", f->f_data);
 		break;



CVS commit: src/distrib/sets/lists

2020-09-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Sep 13 03:43:16 UTC 2020

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/comp: mi shl.mi
src/distrib/sets/lists/debug: mi

Log Message:
Currently restrict GCC TSan files to gcc=9


To generate a diff of this commit:
cvs rdiff -u -r1.902 -r1.903 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.2352 -r1.2353 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.340 -r1.341 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.334 -r1.335 src/distrib/sets/lists/debug/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/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.902 src/distrib/sets/lists/base/shl.mi:1.903
--- src/distrib/sets/lists/base/shl.mi:1.902	Sun Sep 13 02:37:31 2020
+++ src/distrib/sets/lists/base/shl.mi	Sun Sep 13 03:43:16 2020
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.902 2020/09/13 02:37:31 kamil Exp $
+# $NetBSD: shl.mi,v 1.903 2020/09/13 03:43:16 kamil Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -896,7 +896,7 @@
 ./usr/lib/libtre.sobase-sys-shlib		compatfile
 ./usr/lib/libtre.so.0base-sys-shlib		compatfile
 ./usr/lib/libtre.so.0.8base-sys-shlib		compatfile
-./usr/lib/libtsan.sobase-sys-shlib		arch64,cxx,gcc
+./usr/lib/libtsan.sobase-sys-shlib		arch64,cxx,gcc=9
 ./usr/lib/libtsan.so.1base-sys-shlib		arch64,cxx,gcc=9
 ./usr/lib/libtsan.so.1.0			base-sys-shlib		arch64,cxx,gcc=9
 ./usr/lib/libtspi.sobase-sys-shlib		compatfile,tpm

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2352 src/distrib/sets/lists/comp/mi:1.2353
--- src/distrib/sets/lists/comp/mi:1.2352	Sun Sep 13 02:37:31 2020
+++ src/distrib/sets/lists/comp/mi	Sun Sep 13 03:43:16 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2352 2020/09/13 02:37:31 kamil Exp $
+#	$NetBSD: mi,v 1.2353 2020/09/13 03:43:16 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -3947,8 +3947,8 @@
 ./usr/lib/libtpm_unseal_p.a			comp-c-proflib		compatfile,tpm,profile
 ./usr/lib/libtre.acomp-c-lib		compatfile
 ./usr/lib/libtre_p.acomp-c-proflib		compatfile,profile
-./usr/lib/libtsan.acomp-c-lib		arch64,cxx,gcc
-./usr/lib/libtsan_p.acomp-c-proflib		arch64,profile,cxx,gcc
+./usr/lib/libtsan.acomp-c-lib		arch64,cxx,gcc=9
+./usr/lib/libtsan_p.acomp-c-proflib		arch64,profile,cxx,gcc=9
 ./usr/lib/libtspi.acomp-c-lib		compatfile,tpm
 ./usr/lib/libtspi_p.acomp-c-proflib		compatfile,tpm,profile
 ./usr/lib/libubsan.acomp-c-lib		compatfile,cxx,gcc

Index: src/distrib/sets/lists/comp/shl.mi
diff -u src/distrib/sets/lists/comp/shl.mi:1.340 src/distrib/sets/lists/comp/shl.mi:1.341
--- src/distrib/sets/lists/comp/shl.mi:1.340	Sun Sep 13 02:37:31 2020
+++ src/distrib/sets/lists/comp/shl.mi	Sun Sep 13 03:43:16 2020
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.340 2020/09/13 02:37:31 kamil Exp $
+# $NetBSD: shl.mi,v 1.341 2020/09/13 03:43:16 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -274,7 +274,7 @@
 ./usr/lib/libtermlib_pic.a			comp-c-piclib		compatfile,picinstall
 ./usr/lib/libtpm_unseal_pic.a			comp-tpm-lib		compatfile,picinstall,tpm
 ./usr/lib/libtre_pic.acomp-c-piclib		compatfile,picinstall
-./usr/lib/libtsan_pic.acomp-c-piclib		arch64,picinstall,cxx,gcc
+./usr/lib/libtsan_pic.acomp-c-piclib		arch64,picinstall,cxx,gcc=9
 ./usr/lib/libtspi_pic.acomp-c-piclib		compatfile,picinstall,tpm
 ./usr/lib/libubsan_pic.a			comp-c-piclib		compatfile,picinstall,cxx,gcc
 ./usr/lib/libukfs_pic.acomp-c-piclib		compatfile,picinstall,rump

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.334 src/distrib/sets/lists/debug/mi:1.335
--- src/distrib/sets/lists/debug/mi:1.334	Sun Sep 13 02:37:31 2020
+++ src/distrib/sets/lists/debug/mi	Sun Sep 13 03:43:16 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.334 2020/09/13 02:37:31 kamil Exp $
+# $NetBSD: mi,v 1.335 2020/09/13 03:43:16 kamil Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -261,7 +261,7 @@
 ./usr/lib/libterminfo_g.a			comp-c-debuglib		debuglib,compatfile
 ./usr/lib/libtpm_unseal_g.a			comp-c-debuglib		debuglib,compatfile,tpm
 ./usr/lib/libtre_g.acomp-c-debuglib		debuglib,compatfile
-./usr/lib/libtsan_g.acomp-c-debuglib		debuglib,arch64,cxx,gcc
+./usr/lib/libtsan_g.acomp-c-debuglib		debuglib,arch64,cxx,gcc=9
 ./usr/lib/libtspi_g.acomp-c-debuglib		debuglib,compatfile,tpm
 ./usr/lib/libubsan_g.acomp-c-debuglib		debuglib,compatfile,cxx,gcc
 ./usr/lib/libukfs_g.acomp-c-debuglib		debuglib,compatfile,rump



CVS commit: src/doc

2020-09-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Sep 13 03:03:57 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
gcc(1): Install TSan for 64bit CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.2737 -r1.2738 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2737 src/doc/CHANGES:1.2738
--- src/doc/CHANGES:1.2737	Sat Sep 12 08:39:31 2020
+++ src/doc/CHANGES	Sun Sep 13 03:03:57 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2737 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2738 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -280,3 +280,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	dhcpcd: Update to version 9.2.0. [roy 20200906]
 	iavf(4): Add driver for Intel Ethernet Adaptive Virtual Function
 		[yamaguchi 20200908]
+	gcc(1): Install TSan for 64bit CPUs. [kamil 20200913]



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

2020-09-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Sep 13 03:00:12 UTC 2020

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/include/sanitizer:
netbsd_syscall_hooks.h
src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
sanitizer_syscalls_netbsd.inc

Log Message:
Sync netbsd_syscall_hooks.h with LLVM r. 74760bb00fb9b78a

Update the syscall definitionss from a snapshot 2.5 years old to the
current one.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/external/gpl3/gcc/dist/libsanitizer/include/sanitizer/netbsd_syscall_hooks.h
cvs rdiff -u -r1.1.1.1 -r1.2 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_syscalls_netbsd.inc

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/include/sanitizer/netbsd_syscall_hooks.h
diff -u src/external/gpl3/gcc/dist/libsanitizer/include/sanitizer/netbsd_syscall_hooks.h:1.1.1.1 src/external/gpl3/gcc/dist/libsanitizer/include/sanitizer/netbsd_syscall_hooks.h:1.2
--- src/external/gpl3/gcc/dist/libsanitizer/include/sanitizer/netbsd_syscall_hooks.h:1.1.1.1	Sat Sep  5 07:52:57 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/include/sanitizer/netbsd_syscall_hooks.h	Sun Sep 13 03:00:12 2020
@@ -1,7 +1,8 @@
 //===-- netbsd_syscall_hooks.h ===//
 //
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===--===//
 //
@@ -19,8 +20,8 @@
 // DO NOT EDIT! THIS FILE HAS BEEN GENERATED!
 //
 // Generated with: generate_netbsd_syscalls.awk
-// Generated date: 2018-03-03
-// Generated from: syscalls.master,v 1.291 2018/01/06 16:41:23 kamil Exp
+// Generated date: 2020-09-10
+// Generated from: syscalls.master,v 1.306 2020/08/14 00:53:16 riastradh Exp
 //
 //===--===//
 #ifndef SANITIZER_NETBSD_SYSCALL_HOOKS_H
@@ -473,7 +474,12 @@
   __sanitizer_syscall_pre_impl_dup2((long long)(from), (long long)(to))
 #define __sanitizer_syscall_post_dup2(res, from, to)   \
   __sanitizer_syscall_post_impl_dup2(res, (long long)(from), (long long)(to))
-/* syscall 91 has been skipped */
+#define __sanitizer_syscall_pre_getrandom(buf, buflen, flags)  \
+  __sanitizer_syscall_pre_impl_getrandom(  \
+  (long long)(buf), (long long)(buflen), (long long)(flags))
+#define __sanitizer_syscall_post_getrandom(res, buf, buflen, flags)\
+  __sanitizer_syscall_post_impl_getrandom( \
+  res, (long long)(buf), (long long)(buflen), (long long)(flags))
 #define __sanitizer_syscall_pre_fcntl(fd, cmd, arg)\
   __sanitizer_syscall_pre_impl_fcntl((long long)(fd), (long long)(cmd),\
  (long long)(arg))
@@ -848,9 +854,31 @@
 #define __sanitizer_syscall_post_sysarch(res, op, parms)   \
   __sanitizer_syscall_post_impl_sysarch(res, (long long)(op),  \
 (long long)(parms))
-/* syscall 166 has been skipped */
-/* syscall 167 has been skipped */
-/* syscall 168 has been skipped */
+#define __sanitizer_syscall_pre___futex(uaddr, op, val, timeout, uaddr2, val2, \
+val3)  \
+  __sanitizer_syscall_pre_impl___futex((long long)(uaddr), (long long)(op),\
+   (long long)(val), (long long)(timeout), \
+   (long long)(uaddr2), (long long)(val2), \
+   (long long)(val3))
+#define __sanitizer_syscall_post___futex(res, uaddr, op, val, timeout, uaddr2, \
+ val2, val3)   \
+  __sanitizer_syscall_post_impl___futex(   \
+  res, (long long)(uaddr), (long long)(op), (long long)(val),  \
+  (long long)(timeout), (long long)(uaddr2), (long long)(val2),\
+  (long long)(val3))
+#define __sanitizer_syscall_pre___futex_set_robust_list(head, len) \
+  __sanitizer_syscall_pre_impl___futex_set_robust_list((long long)(head),  \
+   (long long)(len))
+#define __sanitizer_syscall_post___futex_set_robust_list(res, head, len)   \
+  __sanitizer_syscall_post_impl___futex_set_robust_list(   \
+  res, 

CVS commit: src

2020-09-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Sep 13 02:37:32 UTC 2020

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/comp: mi shl.mi
src/distrib/sets/lists/debug: mi shl.mi
src/external/gpl3/gcc/lib: Makefile
src/external/gpl3/gcc/lib/libtsan: Makefile
src/external/gpl3/gcc/usr.bin/include/sanitizer: Makefile
src/share/mk: bsd.own.mk

Log Message:
Build and install GCC TSan for 64-bit CPUs


To generate a diff of this commit:
cvs rdiff -u -r1.901 -r1.902 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.2351 -r1.2352 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.339 -r1.340 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.333 -r1.334 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.261 -r1.262 src/distrib/sets/lists/debug/shl.mi
cvs rdiff -u -r1.18 -r1.19 src/external/gpl3/gcc/lib/Makefile
cvs rdiff -u -r1.12 -r1.13 src/external/gpl3/gcc/lib/libtsan/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/external/gpl3/gcc/usr.bin/include/sanitizer/Makefile
cvs rdiff -u -r1.1210 -r1.1211 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.901 src/distrib/sets/lists/base/shl.mi:1.902
--- src/distrib/sets/lists/base/shl.mi:1.901	Tue Sep  8 13:01:47 2020
+++ src/distrib/sets/lists/base/shl.mi	Sun Sep 13 02:37:31 2020
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.901 2020/09/08 13:01:47 adam Exp $
+# $NetBSD: shl.mi,v 1.902 2020/09/13 02:37:31 kamil Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -896,6 +896,9 @@
 ./usr/lib/libtre.sobase-sys-shlib		compatfile
 ./usr/lib/libtre.so.0base-sys-shlib		compatfile
 ./usr/lib/libtre.so.0.8base-sys-shlib		compatfile
+./usr/lib/libtsan.sobase-sys-shlib		arch64,cxx,gcc
+./usr/lib/libtsan.so.1base-sys-shlib		arch64,cxx,gcc=9
+./usr/lib/libtsan.so.1.0			base-sys-shlib		arch64,cxx,gcc=9
 ./usr/lib/libtspi.sobase-sys-shlib		compatfile,tpm
 ./usr/lib/libtspi.so.3base-sys-shlib		compatfile,tpm
 ./usr/lib/libtspi.so.3.0			base-sys-shlib		compatfile,tpm

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2351 src/distrib/sets/lists/comp/mi:1.2352
--- src/distrib/sets/lists/comp/mi:1.2351	Sat Sep 12 12:11:19 2020
+++ src/distrib/sets/lists/comp/mi	Sun Sep 13 02:37:31 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2351 2020/09/12 12:11:19 roy Exp $
+#	$NetBSD: mi,v 1.2352 2020/09/13 02:37:31 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -2174,6 +2174,8 @@
 ./usr/include/gcc-9/sanitizer/asan_interface.h		comp-gcc-include	gcc=9
 ./usr/include/gcc-9/sanitizer/common_interface_defs.h	comp-gcc-include	gcc=9
 ./usr/include/gcc-9/sanitizer/lsan_interface.h		comp-gcc-include	gcc=9
+./usr/include/gcc-9/sanitizer/netbsd_syscall_hooks.h	comp-gcc-include	gcc=9
+./usr/include/gcc-9/sanitizer/tsan_interface.h		comp-gcc-include	gcc=9
 ./usr/include/gcc-9/sanitizer/tsan_interface_atomic.h	comp-gcc-include	gcc=9
 ./usr/include/gcc-9/stdatomic.hcomp-gcc-include	gcc=9
 ./usr/include/gelf.hcomp-c-include
@@ -3945,6 +3947,8 @@
 ./usr/lib/libtpm_unseal_p.a			comp-c-proflib		compatfile,tpm,profile
 ./usr/lib/libtre.acomp-c-lib		compatfile
 ./usr/lib/libtre_p.acomp-c-proflib		compatfile,profile
+./usr/lib/libtsan.acomp-c-lib		arch64,cxx,gcc
+./usr/lib/libtsan_p.acomp-c-proflib		arch64,profile,cxx,gcc
 ./usr/lib/libtspi.acomp-c-lib		compatfile,tpm
 ./usr/lib/libtspi_p.acomp-c-proflib		compatfile,tpm,profile
 ./usr/lib/libubsan.acomp-c-lib		compatfile,cxx,gcc

Index: src/distrib/sets/lists/comp/shl.mi
diff -u src/distrib/sets/lists/comp/shl.mi:1.339 src/distrib/sets/lists/comp/shl.mi:1.340
--- src/distrib/sets/lists/comp/shl.mi:1.339	Thu Aug 27 15:32:00 2020
+++ src/distrib/sets/lists/comp/shl.mi	Sun Sep 13 02:37:31 2020
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.339 2020/08/27 15:32:00 riastradh Exp $
+# $NetBSD: shl.mi,v 1.340 2020/09/13 02:37:31 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -274,6 +274,7 @@
 ./usr/lib/libtermlib_pic.a			comp-c-piclib		compatfile,picinstall
 ./usr/lib/libtpm_unseal_pic.a			comp-tpm-lib		compatfile,picinstall,tpm
 ./usr/lib/libtre_pic.acomp-c-piclib		compatfile,picinstall
+./usr/lib/libtsan_pic.acomp-c-piclib		arch64,picinstall,cxx,gcc
 ./usr/lib/libtspi_pic.acomp-c-piclib		compatfile,picinstall,tpm
 ./usr/lib/libubsan_pic.a			comp-c-piclib		compatfile,picinstall,cxx,gcc
 ./usr/lib/libukfs_pic.acomp-c-piclib		compatfile,picinstall,rump

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.333 src/distrib/sets/lists/debug/mi:1.334
--- src/distrib/sets/lists/debug/mi:1.333	

CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 23:12:44 UTC 2020

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

Log Message:
make(1): fix assertion failure in Dir_Destroy in -DCLEANUP mode

When the openDirectories path list is cleaned up, each path from it is
first dequeued and then freed via Dir_Destroy.  At this point, the path
is no longer in openDirectories, which triggered an assertion in
Lst_Remove, called by Dir_Destroy.


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 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.140 src/usr.bin/make/dir.c:1.141
--- src/usr.bin/make/dir.c:1.140	Sat Sep 12 12:24:21 2020
+++ src/usr.bin/make/dir.c	Sat Sep 12 23:12:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.140 2020/09/12 12:24:21 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.141 2020/09/12 23:12:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.140 2020/09/12 12:24:21 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.141 2020/09/12 23:12:44 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.140 2020/09/12 12:24:21 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.141 2020/09/12 23:12:44 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1656,10 +1656,11 @@ Dir_Destroy(void *pp)
 p->refCount -= 1;
 
 if (p->refCount == 0) {
-	LstNode ln;
+	LstNode node;
 
-	ln = Lst_FindDatum(openDirectories, p);
-	Lst_Remove(openDirectories, ln);
+	node = Lst_FindDatum(openDirectories, p);
+	if (node != NULL)
+	Lst_Remove(openDirectories, node);
 
 	Hash_DeleteTable(>files);
 	free(p->name);



CVS commit: src/external/gpl3/gcc/lib/libtsan

2020-09-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Sep 12 23:04:44 UTC 2020

Modified Files:
src/external/gpl3/gcc/lib/libtsan: Makefile

Log Message:
Always link TSan runtime with librt and libm

With these changes, TSan/amd64 works.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/gcc/lib/libtsan/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/gpl3/gcc/lib/libtsan/Makefile
diff -u src/external/gpl3/gcc/lib/libtsan/Makefile:1.11 src/external/gpl3/gcc/lib/libtsan/Makefile:1.12
--- src/external/gpl3/gcc/lib/libtsan/Makefile:1.11	Sat Sep 12 22:24:22 2020
+++ src/external/gpl3/gcc/lib/libtsan/Makefile	Sat Sep 12 23:04:44 2020
@@ -1,4 +1,7 @@
-# $NetBSD: Makefile,v 1.11 2020/09/12 22:24:22 kamil Exp $
+# $NetBSD: Makefile,v 1.12 2020/09/12 23:04:44 kamil Exp $
+
+UNSUPPORTED_COMPILER.clang= # defined
+NOSANITIZER=# defined
 
 .include 
 
@@ -53,6 +56,8 @@ TSAN_SRCS+= tsan_rtl_unimpl.cc
 
 LIB=	tsan
 SRCS+=	${TSAN_SRCS}
+LIBDPLIBS+= rt ${NETBSDSRCDIR}/lib/librt
+LIBDPLIBS+= m  ${NETBSDSRCDIR}/lib/libm
 CPPFLAGS+=-DCAN_SANITIZE_UB=0
 COPTS.tsan_interceptors.cc += -Wno-unused-function
 



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

2020-09-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Sep 12 22:52:24 UTC 2020

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

Log Message:
Disable GetNamedMappingFd for NetBSD

Analogous logic is in LLVM rev. 74760bb00fb9b78a2fe122.

Removes undefined symbol linkage to shm_unlink and shm_open.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.7 -r1.2 \

src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix_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_posix_libcdep.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc:1.1.1.7 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc:1.2
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc:1.1.1.7	Sat Sep  5 07:52:57 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc	Sat Sep 12 22:52:24 2020
@@ -304,7 +304,7 @@ void PlatformPrepareForSandboxing(__sani
   MemoryMappingLayout::CacheMemoryMappings();
 }
 
-#if SANITIZER_ANDROID || SANITIZER_GO
+#if SANITIZER_ANDROID || SANITIZER_GO || SANITIZER_NETBSD
 int GetNamedMappingFd(const char *name, uptr size) {
   return -1;
 }



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

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 22:35:43 UTC 2020

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

Log Message:
make(1): add test for escaping dollars in the :M variable modifier


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-match.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-match.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-match.exp
diff -u src/usr.bin/make/unit-tests/varmod-match.exp:1.2 src/usr.bin/make/unit-tests/varmod-match.exp:1.3
--- src/usr.bin/make/unit-tests/varmod-match.exp:1.2	Sun Aug 16 20:03:53 2020
+++ src/usr.bin/make/unit-tests/varmod-match.exp	Sat Sep 12 22:35:43 2020
@@ -1,5 +1,12 @@
-match-char-class:
-  uppercase numbers: One Two Three Four
-  all the others: five six seven
-  starts with non-s, ends with [ex]: One Three five
+CondParser_Eval: ${NUMBERS:M[A-Z]*} != "One Two Three Four"
+lhs = "One Two Three Four", rhs = "One Two Three Four", op = !=
+CondParser_Eval: ${NUMBERS:M[^A-Z]*} != "five six seven"
+lhs = "five six seven", rhs = "five six seven", op = !=
+CondParser_Eval: ${NUMBERS:M[^s]*[ex]} != "One Three five"
+lhs = "One Three five", rhs = "One Three five", op = !=
+CondParser_Eval: ${:U:Mb}
+CondParser_Eval: ${:Ua \$ sign:M*$$*} != "\$"
+lhs = "$", rhs = "$", op = !=
+CondParser_Eval: ${:Ua \$ sign any-asterisk:M*\$*} != "any-asterisk"
+lhs = "any-asterisk", rhs = "any-asterisk", op = !=
 exit status 0

Index: src/usr.bin/make/unit-tests/varmod-match.mk
diff -u src/usr.bin/make/unit-tests/varmod-match.mk:1.3 src/usr.bin/make/unit-tests/varmod-match.mk:1.4
--- src/usr.bin/make/unit-tests/varmod-match.mk:1.3	Sun Aug 16 20:03:53 2020
+++ src/usr.bin/make/unit-tests/varmod-match.mk	Sat Sep 12 22:35:43 2020
@@ -1,22 +1,48 @@
-# $NetBSD: varmod-match.mk,v 1.3 2020/08/16 20:03:53 rillig Exp $
+# $NetBSD: varmod-match.mk,v 1.4 2020/09/12 22:35:43 rillig Exp $
 #
 # Tests for the :M variable modifier, which filters words that match the
 # given pattern.
+#
+# See ApplyModifier_Match and ModifyWord_Match for the implementation.
 
-all: match-char-class
-all: slow
-
+.MAKEFLAGS: -dc
 
 NUMBERS=	One Two Three Four five six seven
 
-match-char-class:
-	@echo '$@:'
-	@echo '  uppercase numbers: ${NUMBERS:M[A-Z]*}'
-	@echo '  all the others: ${NUMBERS:M[^A-Z]*}'
-	@echo '  starts with non-s, ends with [ex]: ${NUMBERS:M[^s]*[ex]}'
-
+# Only keep numbers that start with an uppercase letter.
+.if ${NUMBERS:M[A-Z]*} != "One Two Three Four"
+.  error
+.endif
+
+# Only keep numbers that don't start with an uppercase letter.
+.if ${NUMBERS:M[^A-Z]*} != "five six seven"
+.  error
+.endif
+
+# Only keep numbers that don't start with s and at the same time
+# ends with either of [ex].
+.if ${NUMBERS:M[^s]*[ex]} != "One Three five"
+.  error
+.endif
 
 # Before 2020-06-13, this expression took quite a long time in Str_Match,
 # calling itself 601080390 times for 16 asterisks.
-slow:
-	@: ${:U:Mb}
+.if ${:U:Mb}
+.endif
+
+# To match a dollar sign in a word, double it.
+# This is different from the :S and :C variable modifiers, where a '$'
+# has to be escaped as '$$'.
+.if ${:Ua \$ sign:M*$$*} != "\$"
+.  error
+.endif
+
+# In the :M modifier, it does not work to escape a dollar using a backslash.
+# This is different from the :S, :C and a few other variable modifiers.
+${:U*}=		asterisk
+.if ${:Ua \$ sign any-asterisk:M*\$*} != "any-asterisk"
+.  error
+.endif
+
+all:
+	@:;



CVS commit: src/external/gpl3/gcc/lib/libtsan

2020-09-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Sep 12 22:24:22 UTC 2020

Modified Files:
src/external/gpl3/gcc/lib/libtsan: Makefile

Log Message:
Ignore unused functions in tsan_interceptors.cc


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/gcc/lib/libtsan/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/gpl3/gcc/lib/libtsan/Makefile
diff -u src/external/gpl3/gcc/lib/libtsan/Makefile:1.10 src/external/gpl3/gcc/lib/libtsan/Makefile:1.11
--- src/external/gpl3/gcc/lib/libtsan/Makefile:1.10	Wed Oct  2 02:54:35 2019
+++ src/external/gpl3/gcc/lib/libtsan/Makefile	Sat Sep 12 22:24:22 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.10 2019/10/02 02:54:35 mrg Exp $
+# $NetBSD: Makefile,v 1.11 2020/09/12 22:24:22 kamil Exp $
 
 .include 
 
@@ -54,5 +54,6 @@ TSAN_SRCS+= tsan_rtl_unimpl.cc
 LIB=	tsan
 SRCS+=	${TSAN_SRCS}
 CPPFLAGS+=-DCAN_SANITIZE_UB=0
+COPTS.tsan_interceptors.cc += -Wno-unused-function
 
 .include 



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

2020-09-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Sep 12 22:23:57 UTC 2020

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/tsan: tsan_interceptors.cc

Log Message:
Sync chunks of tsan_interceptors.cc with LLVM rev. 74760bb00fb9b78a2fe122

Sync tsan_interceptors.cc with upstream file tsan_interceptors_posix.cpp.

Changes:
 - define fileno_unlocked() for NetBSD
 - use defined __sanitizer_FILE for NetBSD
 - handle symbol indirection for vfork and nanosleep
 - delete sem_* API, currently moved to common code with sanitizers
 - undef SANITIZER_INTERCEPT_PTHREAD_SIGMASK to fix build
 - remove locally introduced SANITIZER_NETBSD

With these changes, TSan for GCC builds.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/external/gpl3/gcc/dist/libsanitizer/tsan/tsan_interceptors.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/tsan/tsan_interceptors.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/tsan/tsan_interceptors.cc:1.10 src/external/gpl3/gcc/dist/libsanitizer/tsan/tsan_interceptors.cc:1.11
--- src/external/gpl3/gcc/dist/libsanitizer/tsan/tsan_interceptors.cc:1.10	Sat Sep 12 21:30:36 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/tsan/tsan_interceptors.cc	Sat Sep 12 22:23:57 2020
@@ -40,17 +40,16 @@ using namespace __tsan;  // NOLINT
 
 #if SANITIZER_NETBSD
 #define dirfd(dirp) (*(int *)(dirp))
-#define fileno_unlocked fileno
+#define fileno_unlocked(fp)  \
+  (((__sanitizer_FILE *)fp)->_file == -1 \
+   ? -1  \
+   : (int)(unsigned short)(((__sanitizer_FILE *)fp)->_file))
 
-#if _LP64
-#define __sF_size 152
-#else
-#define __sF_size 88
-#endif
-
-#define stdout ((char*)&__sF + (__sF_size * 1))
-#define stderr ((char*)&__sF + (__sF_size * 2))
+#define stdout ((__sanitizer_FILE*)&__sF[1])
+#define stderr ((__sanitizer_FILE*)&__sF[2])
 
+#define nanosleep __nanosleep50
+#define vfork __vfork14
 #endif
 
 #if SANITIZER_ANDROID
@@ -92,8 +91,8 @@ DECLARE_REAL_AND_INTERCEPTOR(void *, mal
 DECLARE_REAL_AND_INTERCEPTOR(void, free, void *ptr)
 extern "C" void *pthread_self();
 extern "C" void _exit(int status);
-extern "C" int fileno_unlocked(void *stream);
 #if !SANITIZER_NETBSD
+extern "C" int fileno_unlocked(void *stream);
 extern "C" int dirfd(void *dirp);
 #endif
 #if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_NETBSD
@@ -1417,61 +1416,6 @@ TSAN_INTERCEPTOR(int, pthread_once, void
   return 0;
 }
 
-TSAN_INTERCEPTOR(int, sem_init, void *s, int pshared, unsigned value) {
-  SCOPED_TSAN_INTERCEPTOR(sem_init, s, pshared, value);
-  int res = REAL(sem_init)(s, pshared, value);
-  return res;
-}
-
-TSAN_INTERCEPTOR(int, sem_destroy, void *s) {
-  SCOPED_TSAN_INTERCEPTOR(sem_destroy, s);
-  int res = REAL(sem_destroy)(s);
-  return res;
-}
-
-TSAN_INTERCEPTOR(int, sem_wait, void *s) {
-  SCOPED_TSAN_INTERCEPTOR(sem_wait, s);
-  int res = BLOCK_REAL(sem_wait)(s);
-  if (res == 0) {
-Acquire(thr, pc, (uptr)s);
-  }
-  return res;
-}
-
-TSAN_INTERCEPTOR(int, sem_trywait, void *s) {
-  SCOPED_TSAN_INTERCEPTOR(sem_trywait, s);
-  int res = BLOCK_REAL(sem_trywait)(s);
-  if (res == 0) {
-Acquire(thr, pc, (uptr)s);
-  }
-  return res;
-}
-
-TSAN_INTERCEPTOR(int, sem_timedwait, void *s, void *abstime) {
-  SCOPED_TSAN_INTERCEPTOR(sem_timedwait, s, abstime);
-  int res = BLOCK_REAL(sem_timedwait)(s, abstime);
-  if (res == 0) {
-Acquire(thr, pc, (uptr)s);
-  }
-  return res;
-}
-
-TSAN_INTERCEPTOR(int, sem_post, void *s) {
-  SCOPED_TSAN_INTERCEPTOR(sem_post, s);
-  Release(thr, pc, (uptr)s);
-  int res = REAL(sem_post)(s);
-  return res;
-}
-
-TSAN_INTERCEPTOR(int, sem_getvalue, void *s, int *sval) {
-  SCOPED_TSAN_INTERCEPTOR(sem_getvalue, s, sval);
-  int res = REAL(sem_getvalue)(s, sval);
-  if (res == 0) {
-Acquire(thr, pc, (uptr)s);
-  }
-  return res;
-}
-
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
 TSAN_INTERCEPTOR(int, __fxstat, int version, int fd, void *buf) {
   SCOPED_TSAN_INTERCEPTOR(__fxstat, version, fd, buf);
@@ -2236,6 +2180,7 @@ static void HandleRecvmsg(ThreadState *t
 #define NEED_TLS_GET_ADDR
 #endif
 #undef SANITIZER_INTERCEPT_TLS_GET_ADDR
+#undef SANITIZER_INTERCEPT_PTHREAD_SIGMASK
 
 #define COMMON_INTERCEPT_FUNCTION(name) INTERCEPT_FUNCTION(name)
 #define COMMON_INTERCEPT_FUNCTION_VER(name, ver)  \
@@ -2476,7 +2421,6 @@ static void syscall_fd_close(uptr pc, in
   TSAN_SYSCALL();
   FdClose(thr, pc, fd);
 }
-#endif
 
 static USED void syscall_fd_acquire(uptr pc, int fd) {
   TSAN_SYSCALL();
@@ -2490,7 +2434,6 @@ static USED void syscall_fd_release(uptr
   FdRelease(thr, pc, fd);
 }
 
-#if !SANITIZER_NETBSD
 static void syscall_pre_fork(uptr pc) {
   TSAN_SYSCALL();
   ForkBefore(thr, pc);



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 22:12:18 UTC 2020

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

Log Message:
make(1): fix return type of ApplyModifier_Localtime


To generate a diff of this commit:
cvs rdiff -u -r1.504 -r1.505 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.504 src/usr.bin/make/var.c:1.505
--- src/usr.bin/make/var.c:1.504	Sat Sep 12 20:03:37 2020
+++ src/usr.bin/make/var.c	Sat Sep 12 22:12:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.504 2020/09/12 20:03:37 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.505 2020/09/12 22:12:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.504 2020/09/12 20:03:37 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.505 2020/09/12 22:12:17 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.504 2020/09/12 20:03:37 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.505 2020/09/12 22:12:17 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2077,7 +2077,7 @@ ApplyModifier_Gmtime(const char **pp, Ap
 }
 
 /* :localtime */
-static Boolean
+static ApplyModifierResult
 ApplyModifier_Localtime(const char **pp, ApplyModifiersState *st)
 {
 time_t utc;



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

2020-09-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Sep 12 21:30:36 UTC 2020

Modified Files:
src/external/gpl3/gcc/dist/libsanitizer/tsan: tsan_interceptors.cc

Log Message:
Remove dead code block (from a local patch)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/external/gpl3/gcc/dist/libsanitizer/tsan/tsan_interceptors.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/tsan/tsan_interceptors.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/tsan/tsan_interceptors.cc:1.9 src/external/gpl3/gcc/dist/libsanitizer/tsan/tsan_interceptors.cc:1.10
--- src/external/gpl3/gcc/dist/libsanitizer/tsan/tsan_interceptors.cc:1.9	Sat Sep  5 09:12:32 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/tsan/tsan_interceptors.cc	Sat Sep 12 21:30:36 2020
@@ -57,21 +57,6 @@ using namespace __tsan;  // NOLINT
 #define mallopt(a, b)
 #endif
 
-#if 0 // XXXMRG
-#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD
-#define PTHREAD_CREATE_DETACHED 1
-#elif SANITIZER_MAC
-#define PTHREAD_CREATE_DETACHED 2
-#endif
-#if SANITIZER_NETBSD
-#define	__errno_location __errno
-#define	pthread_yield sched_yield
-#define	fileno_unlocked fileno
-#define	stdout __sF[1]
-#define	stderr __sF[2]
-#endif
-#endif
-
 #ifdef __mips__
 const int kSigCount = 129;
 #else



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 20:03:37 UTC 2020

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

Log Message:
make(1): move buffer from Var_Parse to ParseVarname

There's no reason to keep the buffer in memory after the variable name
has been parsed.


To generate a diff of this commit:
cvs rdiff -u -r1.503 -r1.504 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.503 src/usr.bin/make/var.c:1.504
--- src/usr.bin/make/var.c:1.503	Sat Sep 12 19:41:20 2020
+++ src/usr.bin/make/var.c	Sat Sep 12 20:03:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.503 2020/09/12 19:41:20 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.504 2020/09/12 20:03:37 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.503 2020/09/12 19:41:20 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.504 2020/09/12 20:03:37 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.503 2020/09/12 19:41:20 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.504 2020/09/12 20:03:37 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3329,14 +3329,19 @@ ShortVarValue(char varname, const GNode 
 return eflags & VARE_UNDEFERR ? var_Error : varNoError;
 }
 
-/* Skip to the end character or a colon, whichever comes first. */
-static void
+/* Parse a variable name, until the end character or a colon, whichever
+ * comes first. */
+static char *
 ParseVarname(const char **pp, char startc, char endc,
-	 GNode *ctxt, VarEvalFlags eflags, Buffer *namebuf)
+	 GNode *ctxt, VarEvalFlags eflags,
+	 size_t *out_varname_len)
 {
+Buffer buf;
 const char *p = *pp;
 int depth = 1;
 
+Buf_Init(, 0);
+
 while (*p != '\0') {
 	/* Track depth so we can spot parse errors. */
 	if (*p == startc)
@@ -3347,18 +3352,21 @@ ParseVarname(const char **pp, char start
 	}
 	if (*p == ':' && depth == 1)
 	break;
+
 	/* A variable inside a variable, expand. */
 	if (*p == '$') {
 	void *freeIt;
 	const char *rval = Var_Parse(, ctxt, eflags, );
-	Buf_AddStr(namebuf, rval);
+	Buf_AddStr(, rval);
 	free(freeIt);
 	} else {
-	Buf_AddByte(namebuf, *p);
+	Buf_AddByte(, *p);
 	p++;
 	}
 }
 *pp = p;
+*out_varname_len = Buf_Size();
+return Buf_Destroy(, FALSE);
 }
 
 /*-
@@ -3464,30 +3472,25 @@ Var_Parse(const char **pp, GNode *ctxt, 
 	p = start + 1;
 	}
 } else {
-	Buffer namebuf;		/* Holds the variable name */
 	size_t namelen;
 	char *varname;
 
 	endc = startc == PROPEN ? PRCLOSE : BRCLOSE;
 
-	Buf_Init(, 0);
-
 	p = start + 2;
-	ParseVarname(, startc, endc, ctxt, eflags, );
+	varname = ParseVarname(, startc, endc, ctxt, eflags, );
 
 	if (*p == ':') {
 	haveModifier = TRUE;
 	} else if (*p == endc) {
 	haveModifier = FALSE;
 	} else {
-	Parse_Error(PARSE_FATAL, "Unclosed variable \"%s\"",
-			Buf_GetAll(, NULL));
+	Parse_Error(PARSE_FATAL, "Unclosed variable \"%s\"", varname);
 	*pp = p;
-	Buf_Destroy(, TRUE);
+	free(varname);
 	return var_Error;
 	}
 
-	varname = Buf_GetAll(, );
 	v = VarFind(varname, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
 
 	/* At this point, p points just after the variable name,
@@ -3525,10 +3528,10 @@ Var_Parse(const char **pp, GNode *ctxt, 
 		if (dynamic) {
 		char *pstr = bmake_strsedup(start, p);
 		*freePtr = pstr;
-		Buf_Destroy(, TRUE);
+		free(varname);
 		return pstr;
 		} else {
-		Buf_Destroy(, TRUE);
+		free(varname);
 		return (eflags & VARE_UNDEFERR) ? var_Error : varNoError;
 		}
 	}
@@ -3548,9 +3551,8 @@ Var_Parse(const char **pp, GNode *ctxt, 
 	v->name = varname;
 	Buf_Init(>val, 1);
 	v->flags = VAR_JUNK;
-	Buf_Destroy(, FALSE);
 	} else
-	Buf_Destroy(, TRUE);
+	free(varname);
 }
 
 if (v->flags & VAR_IN_USE) {



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 19:41:20 UTC 2020

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

Log Message:
make(1): reword variable invocation to variable expression

Variables are a passive thing.  They cannot be invoked, they can only be
evaluated.


To generate a diff of this commit:
cvs rdiff -u -r1.294 -r1.295 src/usr.bin/make/parse.c
cvs rdiff -u -r1.152 -r1.153 src/usr.bin/make/suff.c
cvs rdiff -u -r1.502 -r1.503 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/parse.c
diff -u src/usr.bin/make/parse.c:1.294 src/usr.bin/make/parse.c:1.295
--- src/usr.bin/make/parse.c:1.294	Sat Sep 12 18:19:50 2020
+++ src/usr.bin/make/parse.c	Sat Sep 12 19:41:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.294 2020/09/12 18:19:50 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.295 2020/09/12 19:41:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.294 2020/09/12 18:19:50 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.295 2020/09/12 19:41:20 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.294 2020/09/12 18:19:50 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.295 2020/09/12 19:41:20 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1927,7 +1927,7 @@ Parse_DoVar(char *line, GNode *ctxt)
 } else if (type == VAR_SUBST) {
 	/*
 	 * Allow variables in the old value to be undefined, but leave their
-	 * invocation alone -- this is done by forcing oldVars to be false.
+	 * expressions alone -- this is done by forcing oldVars to be false.
 	 * XXX: This can cause recursive variables, but that's not hard to do,
 	 * and this allows someone to do something like
 	 *

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.152 src/usr.bin/make/suff.c:1.153
--- src/usr.bin/make/suff.c:1.152	Sat Sep 12 18:19:50 2020
+++ src/usr.bin/make/suff.c	Sat Sep 12 19:41:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.152 2020/09/12 18:19:50 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.153 2020/09/12 19:41:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.152 2020/09/12 18:19:50 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.153 2020/09/12 19:41:20 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c	8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.152 2020/09/12 18:19:50 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.153 2020/09/12 19:41:20 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1241,7 +1241,7 @@ SuffFindCmds(Src *targ, Lst slst)
 }
 
 /* Expand the names of any children of a given node that contain variable
- * invocations or file wildcards into actual targets.
+ * expressions or file wildcards into actual targets.
  *
  * The expanded node is removed from the parent's list of children, and the
  * parent's unmade counter is decremented, but other nodes may be added.

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.502 src/usr.bin/make/var.c:1.503
--- src/usr.bin/make/var.c:1.502	Sat Sep 12 19:33:02 2020
+++ src/usr.bin/make/var.c	Sat Sep 12 19:41:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.502 2020/09/12 19:33:02 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.503 2020/09/12 19:41:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.502 2020/09/12 19:33:02 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.503 2020/09/12 19:41:20 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.502 2020/09/12 19:33:02 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.503 2020/09/12 19:41:20 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3364,7 +3364,7 @@ ParseVarname(const char **pp, char start
 /*-
  *---
  * Var_Parse --
- *	Given the start of a variable invocation (such as $v, $(VAR),
+ *	Given the start of a variable expression (such as $v, $(VAR),
  *	${VAR:Mpattern}), extract the variable name, possibly some
  *	modifiers and find its value by applying the modifiers to the
  *	original value.
@@ -3416,7 +3416,7 @@ Var_Parse(const char **pp, GNode *ctxt, 
 Boolean	 dynamic;	/* TRUE if the variable is local and we're
  * expanding it in a non-local context. This
  * is done to support dynamic sources. The
- * result is just the invocation, unaltered */
+ * result is just the expression, unaltered */
 const char *extramodifiers;
 

CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 19:33:02 UTC 2020

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

Log Message:
make(1): extract ShortVarValue from Var_Parse


To generate a diff of this commit:
cvs rdiff -u -r1.501 -r1.502 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.501 src/usr.bin/make/var.c:1.502
--- src/usr.bin/make/var.c:1.501	Sat Sep 12 19:24:59 2020
+++ src/usr.bin/make/var.c	Sat Sep 12 19:33:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.501 2020/09/12 19:24:59 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.502 2020/09/12 19:33:02 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.501 2020/09/12 19:24:59 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.502 2020/09/12 19:33:02 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.501 2020/09/12 19:24:59 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.502 2020/09/12 19:33:02 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3302,6 +3302,33 @@ VarIsDynamic(GNode *ctxt, const char *va
 return FALSE;
 }
 
+static const char *
+ShortVarValue(char varname, const GNode *ctxt, VarEvalFlags eflags)
+{
+if (ctxt == VAR_CMD || ctxt == VAR_GLOBAL) {
+	/*
+	 * If substituting a local variable in a non-local context,
+	 * assume it's for dynamic source stuff. We have to handle
+	 * this specially and return the longhand for the variable
+	 * with the dollar sign escaped so it makes it back to the
+	 * caller. Only four of the local variables are treated
+	 * specially as they are the only four that will be set
+	 * when dynamic sources are expanded.
+	 */
+	switch (varname) {
+	case '@':
+	return "$(.TARGET)";
+	case '%':
+	return "$(.MEMBER)";
+	case '*':
+	return "$(.PREFIX)";
+	case '!':
+	return "$(.ARCHIVE)";
+	}
+}
+return eflags & VARE_UNDEFERR ? var_Error : varNoError;
+}
+
 /* Skip to the end character or a colon, whichever comes first. */
 static void
 ParseVarname(const char **pp, char startc, char endc,
@@ -3431,28 +3458,7 @@ Var_Parse(const char **pp, GNode *ctxt, 
 	if (v == NULL) {
 	*pp += 2;
 
-	if (ctxt == VAR_CMD || ctxt == VAR_GLOBAL) {
-		/*
-		 * If substituting a local variable in a non-local context,
-		 * assume it's for dynamic source stuff. We have to handle
-		 * this specially and return the longhand for the variable
-		 * with the dollar sign escaped so it makes it back to the
-		 * caller. Only four of the local variables are treated
-		 * specially as they are the only four that will be set
-		 * when dynamic sources are expanded.
-		 */
-		switch (start[1]) {
-		case '@':
-		return "$(.TARGET)";
-		case '%':
-		return "$(.MEMBER)";
-		case '*':
-		return "$(.PREFIX)";
-		case '!':
-		return "$(.ARCHIVE)";
-		}
-	}
-	return (eflags & VARE_UNDEFERR) ? var_Error : varNoError;
+	return ShortVarValue(start[1], ctxt, eflags);
 	} else {
 	haveModifier = FALSE;
 	p = start + 1;



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 19:24:59 UTC 2020

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

Log Message:
make(1): extract ParseVarname from Var_Parse

This was an easy part since it affects only a few variables.  250 lines
for a single function is still quite a lot, so further refactorings will
follow.


To generate a diff of this commit:
cvs rdiff -u -r1.500 -r1.501 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.500 src/usr.bin/make/var.c:1.501
--- src/usr.bin/make/var.c:1.500	Sat Sep 12 19:15:20 2020
+++ src/usr.bin/make/var.c	Sat Sep 12 19:24:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.500 2020/09/12 19:15:20 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.501 2020/09/12 19:24:59 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.500 2020/09/12 19:15:20 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.501 2020/09/12 19:24:59 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.500 2020/09/12 19:15:20 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.501 2020/09/12 19:24:59 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3302,6 +3302,38 @@ VarIsDynamic(GNode *ctxt, const char *va
 return FALSE;
 }
 
+/* Skip to the end character or a colon, whichever comes first. */
+static void
+ParseVarname(const char **pp, char startc, char endc,
+	 GNode *ctxt, VarEvalFlags eflags, Buffer *namebuf)
+{
+const char *p = *pp;
+int depth = 1;
+
+while (*p != '\0') {
+	/* Track depth so we can spot parse errors. */
+	if (*p == startc)
+	depth++;
+	if (*p == endc) {
+	if (--depth == 0)
+		break;
+	}
+	if (*p == ':' && depth == 1)
+	break;
+	/* A variable inside a variable, expand. */
+	if (*p == '$') {
+	void *freeIt;
+	const char *rval = Var_Parse(, ctxt, eflags, );
+	Buf_AddStr(namebuf, rval);
+	free(freeIt);
+	} else {
+	Buf_AddByte(namebuf, *p);
+	p++;
+	}
+}
+*pp = p;
+}
+
 /*-
  *---
  * Var_Parse --
@@ -3427,7 +3459,6 @@ Var_Parse(const char **pp, GNode *ctxt, 
 	}
 } else {
 	Buffer namebuf;		/* Holds the variable name */
-	int depth;
 	size_t namelen;
 	char *varname;
 
@@ -3435,31 +3466,9 @@ Var_Parse(const char **pp, GNode *ctxt, 
 
 	Buf_Init(, 0);
 
-	/*
-	 * Skip to the end character or a colon, whichever comes first.
-	 */
-	depth = 1;
-	for (p = start + 2; *p != '\0';) {
-	/* Track depth so we can spot parse errors. */
-	if (*p == startc)
-		depth++;
-	if (*p == endc) {
-		if (--depth == 0)
-		break;
-	}
-	if (*p == ':' && depth == 1)
-		break;
-	/* A variable inside a variable, expand. */
-	if (*p == '$') {
-		void *freeIt;
-		const char *rval = Var_Parse(, ctxt, eflags, );
-		Buf_AddStr(, rval);
-		free(freeIt);
-	} else {
-		Buf_AddByte(, *p);
-		p++;
-	}
-	}
+	p = start + 2;
+	ParseVarname(, startc, endc, ctxt, eflags, );
+
 	if (*p == ':') {
 	haveModifier = TRUE;
 	} else if (*p == endc) {



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 19:15:20 UTC 2020

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.499 -r1.500 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.499 src/usr.bin/make/var.c:1.500
--- src/usr.bin/make/var.c:1.499	Sat Sep 12 19:13:43 2020
+++ src/usr.bin/make/var.c	Sat Sep 12 19:15:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.499 2020/09/12 19:13:43 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.500 2020/09/12 19:15:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.499 2020/09/12 19:13:43 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.500 2020/09/12 19:15:20 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.499 2020/09/12 19:13:43 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.500 2020/09/12 19:15:20 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3643,7 +3643,7 @@ char *
 Var_Subst(const char *str, GNode *ctxt, VarEvalFlags eflags)
 {
 Buffer buf;			/* Buffer for forming things */
-Boolean trailingBslash;
+Boolean trailingBackslash;
 
 /* Set true if an error has already been reported,
  * to prevent a plethora of messages when recursing */
@@ -3651,10 +3651,10 @@ Var_Subst(const char *str, GNode *ctxt, 
 
 Buf_Init(, 0);
 errorReported = FALSE;
-trailingBslash = FALSE;	/* variable ends in \ */
+trailingBackslash = FALSE;	/* variable ends in \ */
 
 while (*str) {
-	if (*str == '\n' && trailingBslash)
+	if (*str == '\n' && trailingBackslash)
 	Buf_AddByte(, ' ');
 
 	if (*str == '$' && str[1] == '$') {
@@ -3714,7 +3714,7 @@ Var_Subst(const char *str, GNode *ctxt, 
 
 		val_len = strlen(val);
 		Buf_AddBytes(, val, val_len);
-		trailingBslash = val_len > 0 && val[val_len - 1] == '\\';
+		trailingBackslash = val_len > 0 && val[val_len - 1] == '\\';
 	}
 	free(freeIt);
 	freeIt = NULL;



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 19:13:43 UTC 2020

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

Log Message:
make(1): remove double negation in Var_Parse


To generate a diff of this commit:
cvs rdiff -u -r1.498 -r1.499 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.498 src/usr.bin/make/var.c:1.499
--- src/usr.bin/make/var.c:1.498	Sat Sep 12 18:45:24 2020
+++ src/usr.bin/make/var.c	Sat Sep 12 19:13:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.498 2020/09/12 18:45:24 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.499 2020/09/12 19:13:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.498 2020/09/12 18:45:24 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.499 2020/09/12 19:13:43 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.498 2020/09/12 18:45:24 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.499 2020/09/12 19:13:43 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3588,15 +3588,13 @@ Var_Parse(const char **pp, GNode *ctxt, 
 *pp = p + (*p ? 1 : 0);
 
 if (v->flags & VAR_FROM_ENV) {
-	Boolean destroy = nstr != Buf_GetAll(>val, NULL);
-	if (!destroy) {
-	/*
-	 * Returning the value unmodified, so tell the caller to free
-	 * the thing.
-	 */
+/* Free the environment variable now since we own it,
+ * but don't free the variable value if it will be returned. */
+	Boolean keepValue = nstr == Buf_GetAll(>val, NULL);
+	if (keepValue)
 	*freePtr = nstr;
-	}
-	(void)VarFreeEnv(v, destroy);
+	(void)VarFreeEnv(v, !keepValue);
+
 } else if (v->flags & VAR_JUNK) {
 	/*
 	 * Perform any freeing needed and set *freePtr to NULL so the caller



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 18:45:24 UTC 2020

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

Log Message:
make(1): clean up Var_Parse


To generate a diff of this commit:
cvs rdiff -u -r1.497 -r1.498 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.497 src/usr.bin/make/var.c:1.498
--- src/usr.bin/make/var.c:1.497	Sat Sep 12 18:39:37 2020
+++ src/usr.bin/make/var.c	Sat Sep 12 18:45:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.497 2020/09/12 18:39:37 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.498 2020/09/12 18:45:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.497 2020/09/12 18:39:37 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.498 2020/09/12 18:45:24 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.497 2020/09/12 18:39:37 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.498 2020/09/12 18:45:24 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3347,8 +3347,8 @@ VarIsDynamic(GNode *ctxt, const char *va
 const char *
 Var_Parse(const char **pp, GNode *ctxt, VarEvalFlags eflags, void **freePtr)
 {
-const char * const start = *pp;
-const char	*p;
+const char *const start = *pp;
+const char *p;
 Boolean 	 haveModifier;	/* TRUE if have modifiers for the variable */
 char	 startc;	/* Starting character if variable in parens
  * or braces */
@@ -3473,19 +3473,11 @@ Var_Parse(const char **pp, GNode *ctxt, 
 	}
 
 	varname = Buf_GetAll(, );
+	v = VarFind(varname, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
 
-	/*
-	 * At this point, varname points into newly allocated memory from
-	 * namebuf, containing only the name of the variable.
-	 *
-	 * start and tstr point into the string that was pointed
-	 * to by the original value of the str parameter.  start points
-	 * to the '$' at the beginning of the string, while tstr points
-	 * to the char just after the end of the variable name -- this
-	 * is '\0', ':', PRCLOSE, or BRCLOSE.
-	 */
+	/* At this point, p points just after the variable name,
+	 * either at ':' or at endc. */
 
-	v = VarFind(varname, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD);
 	/*
 	 * Check also for bogus D and F forms of local variables since we're
 	 * in a local context and the name is the right length.
@@ -3513,10 +3505,10 @@ Var_Parse(const char **pp, GNode *ctxt, 
 	dynamic = VarIsDynamic(ctxt, varname, namelen);
 
 	if (!haveModifier) {
-	size_t len = (size_t)(p + 1 - start);
-		*pp += len;
+	p++;		/* skip endc */
+		*pp = p;
 		if (dynamic) {
-		char *pstr = bmake_strldup(start, len);
+		char *pstr = bmake_strsedup(start, p);
 		*freePtr = pstr;
 		Buf_Destroy(, TRUE);
 		return pstr;



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 18:39:37 UTC 2020

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

Log Message:
make(1): rename local variables in Var_Parse

The main property of the former "str" is not being a string but pointing
at the start of the expression to be parsed.

The main property of the former "tstr" is not being a string but being
the moving pointer, the current parsing position.  No idea what the "t"
in "tstr" stood for.


To generate a diff of this commit:
cvs rdiff -u -r1.496 -r1.497 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.496 src/usr.bin/make/var.c:1.497
--- src/usr.bin/make/var.c:1.496	Sat Sep 12 18:19:50 2020
+++ src/usr.bin/make/var.c	Sat Sep 12 18:39:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.496 2020/09/12 18:19:50 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.497 2020/09/12 18:39:37 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.496 2020/09/12 18:19:50 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.497 2020/09/12 18:39:37 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.496 2020/09/12 18:19:50 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.497 2020/09/12 18:39:37 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3347,8 +3347,8 @@ VarIsDynamic(GNode *ctxt, const char *va
 const char *
 Var_Parse(const char **pp, GNode *ctxt, VarEvalFlags eflags, void **freePtr)
 {
-const char * const str = *pp;
-const char	*tstr;		/* Pointer into str */
+const char * const start = *pp;
+const char	*p;
 Boolean 	 haveModifier;	/* TRUE if have modifiers for the variable */
 char	 startc;	/* Starting character if variable in parens
  * or braces */
@@ -3363,7 +3363,7 @@ Var_Parse(const char **pp, GNode *ctxt, 
 char *nstr;
 char eflags_str[VarEvalFlags_ToStringSize];
 
-VAR_DEBUG("%s: %s with %s\n", __func__, str,
+VAR_DEBUG("%s: %s with %s\n", __func__, start,
 	  Enum_FlagsToString(eflags_str, sizeof eflags_str, eflags,
  VarEvalFlags_ToStringSpecs));
 
@@ -3377,7 +3377,7 @@ Var_Parse(const char **pp, GNode *ctxt, 
 endc = '\0';
 #endif
 
-startc = str[1];
+startc = start[1];
 if (startc != PROPEN && startc != BROPEN) {
 	char name[2];
 
@@ -3409,7 +3409,7 @@ Var_Parse(const char **pp, GNode *ctxt, 
 		 * specially as they are the only four that will be set
 		 * when dynamic sources are expanded.
 		 */
-		switch (str[1]) {
+		switch (start[1]) {
 		case '@':
 		return "$(.TARGET)";
 		case '%':
@@ -3423,7 +3423,7 @@ Var_Parse(const char **pp, GNode *ctxt, 
 	return (eflags & VARE_UNDEFERR) ? var_Error : varNoError;
 	} else {
 	haveModifier = FALSE;
-	tstr = str + 1;
+	p = start + 1;
 	}
 } else {
 	Buffer namebuf;		/* Holds the variable name */
@@ -3439,35 +3439,35 @@ Var_Parse(const char **pp, GNode *ctxt, 
 	 * Skip to the end character or a colon, whichever comes first.
 	 */
 	depth = 1;
-	for (tstr = str + 2; *tstr != '\0';) {
+	for (p = start + 2; *p != '\0';) {
 	/* Track depth so we can spot parse errors. */
-	if (*tstr == startc)
+	if (*p == startc)
 		depth++;
-	if (*tstr == endc) {
+	if (*p == endc) {
 		if (--depth == 0)
 		break;
 	}
-	if (*tstr == ':' && depth == 1)
+	if (*p == ':' && depth == 1)
 		break;
 	/* A variable inside a variable, expand. */
-	if (*tstr == '$') {
+	if (*p == '$') {
 		void *freeIt;
-		const char *rval = Var_Parse(, ctxt, eflags, );
+		const char *rval = Var_Parse(, ctxt, eflags, );
 		Buf_AddStr(, rval);
 		free(freeIt);
 	} else {
-		Buf_AddByte(, *tstr);
-		tstr++;
+		Buf_AddByte(, *p);
+		p++;
 	}
 	}
-	if (*tstr == ':') {
+	if (*p == ':') {
 	haveModifier = TRUE;
-	} else if (*tstr == endc) {
+	} else if (*p == endc) {
 	haveModifier = FALSE;
 	} else {
 	Parse_Error(PARSE_FATAL, "Unclosed variable \"%s\"",
 			Buf_GetAll(, NULL));
-	*pp = tstr;
+	*pp = p;
 	Buf_Destroy(, TRUE);
 	return var_Error;
 	}
@@ -3513,10 +3513,10 @@ Var_Parse(const char **pp, GNode *ctxt, 
 	dynamic = VarIsDynamic(ctxt, varname, namelen);
 
 	if (!haveModifier) {
-	size_t len = (size_t)(tstr + 1 - str);
+	size_t len = (size_t)(p + 1 - start);
 		*pp += len;
 		if (dynamic) {
-		char *pstr = bmake_strldup(str, len);
+		char *pstr = bmake_strldup(start, len);
 		*freePtr = pstr;
 		Buf_Destroy(, TRUE);
 		return pstr;
@@ -3582,9 +3582,9 @@ Var_Parse(const char **pp, GNode *ctxt, 
 
 	if (haveModifier) {
 	/* Skip initial colon. */
-	tstr++;
+	p++;
 
-	nstr = ApplyModifiers(, nstr, startc, endc,
+	nstr = 

CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 18:19:50 UTC 2020

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

Log Message:
make(1): rename Var_ParsePP back to Var_Parse

The migration to the "parsing position" pointer has been done.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/usr.bin/make/arch.c
cvs rdiff -u -r1.140 -r1.141 src/usr.bin/make/cond.c
cvs rdiff -u -r1.115 -r1.116 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.293 -r1.294 src/usr.bin/make/parse.c
cvs rdiff -u -r1.151 -r1.152 src/usr.bin/make/suff.c
cvs rdiff -u -r1.495 -r1.496 src/usr.bin/make/var.c

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

Modified files:

Index: src/usr.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.111 src/usr.bin/make/arch.c:1.112
--- src/usr.bin/make/arch.c:1.111	Fri Sep 11 17:32:36 2020
+++ src/usr.bin/make/arch.c	Sat Sep 12 18:19:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.111 2020/09/11 17:32:36 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.112 2020/09/12 18:19:50 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.111 2020/09/11 17:32:36 rillig Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.112 2020/09/12 18:19:50 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.111 2020/09/11 17:32:36 rillig Exp $");
+__RCSID("$NetBSD: arch.c,v 1.112 2020/09/12 18:19:50 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -238,7 +238,7 @@ Arch_ParseArchive(char **linePtr, Lst no
 	const char *result;
 	Boolean isError;
 
-	result = Var_ParsePP(_p, ctxt,
+	result = Var_Parse(_p, ctxt,
 			   VARE_UNDEFERR|VARE_WANTRES, _freeIt);
 	isError = result == var_Error;
 	free(result_freeIt);
@@ -280,8 +280,8 @@ Arch_ParseArchive(char **linePtr, Lst no
 		Boolean isError;
 		const char *nested_p = cp;
 
-		result = Var_ParsePP(_p, ctxt,
- VARE_UNDEFERR|VARE_WANTRES, );
+		result = Var_Parse(_p, ctxt,
+   VARE_UNDEFERR|VARE_WANTRES, );
 		isError = result == var_Error;
 		free(freeIt);
 

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.140 src/usr.bin/make/cond.c:1.141
--- src/usr.bin/make/cond.c:1.140	Sat Sep 12 18:04:45 2020
+++ src/usr.bin/make/cond.c	Sat Sep 12 18:19:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.140 2020/09/12 18:04:45 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.141 2020/09/12 18:19:50 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.140 2020/09/12 18:04:45 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.141 2020/09/12 18:19:50 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.140 2020/09/12 18:04:45 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.141 2020/09/12 18:19:50 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -258,7 +258,7 @@ ParseFuncArg(const char **linePtr, Boole
 	 */
 	void *freeIt;
 	VarEvalFlags eflags = VARE_UNDEFERR | (doEval ? VARE_WANTRES : 0);
-	const char *cp2 = Var_ParsePP(, VAR_CMD, eflags, );
+	const char *cp2 = Var_Parse(, VAR_CMD, eflags, );
 	Buf_AddStr(, cp2);
 	free(freeIt);
 	continue;
@@ -462,7 +462,7 @@ CondParser_String(CondParser *par, Boole
 		 (doEval ? VARE_WANTRES : 0);
 	nested_p = par->p;
 	atStart = nested_p == start;
-	str = Var_ParsePP(_p, VAR_CMD, eflags, freeIt);
+	str = Var_Parse(_p, VAR_CMD, eflags, freeIt);
 	if (str == var_Error) {
 		if (*freeIt) {
 		free(*freeIt);
@@ -703,7 +703,7 @@ ParseEmptyArg(const char **linePtr, Bool
 *argPtr = NULL;
 
 (*linePtr)--;		/* Make (*linePtr)[1] point to the '('. */
-val = Var_ParsePP(linePtr, VAR_CMD, doEval ? VARE_WANTRES : 0, _freeIt);
+val = Var_Parse(linePtr, VAR_CMD, doEval ? VARE_WANTRES : 0, _freeIt);
 /* If successful, *linePtr points beyond the closing ')' now. */
 
 if (val == var_Error) {

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.115 src/usr.bin/make/nonints.h:1.116
--- src/usr.bin/make/nonints.h:1.115	Sat Sep 12 18:04:45 2020
+++ src/usr.bin/make/nonints.h	Sat Sep 12 18:19:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.115 2020/09/12 18:04:45 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.116 2020/09/12 18:19:50 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -213,7 +213,7 @@ void Var_Set_with_flags(const char *, co
 void Var_Append(const char *, const char *, GNode *);
 Boolean Var_Exists(const char *, GNode *);
 const char *Var_Value(const char *, GNode *, char **);
-const char *Var_ParsePP(const char **, 

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

2020-09-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Sep 12 18:12:53 UTC 2020

Modified Files:
src/sys/arch/macppc/dev: lmu.c

Log Message:
respond to keyboard brightness control PMF events


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/macppc/dev/lmu.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/macppc/dev/lmu.c
diff -u src/sys/arch/macppc/dev/lmu.c:1.4 src/sys/arch/macppc/dev/lmu.c:1.5
--- src/sys/arch/macppc/dev/lmu.c:1.4	Thu Apr 23 12:56:40 2020
+++ src/sys/arch/macppc/dev/lmu.c	Sat Sep 12 18:12:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lmu.c,v 1.4 2020/04/23 12:56:40 macallan Exp $ */
+/* $NetBSD: lmu.c,v 1.5 2020/09/12 18:12:53 macallan Exp $ */
 
 /*-
  * Copyright (c) 2020 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.4 2020/04/23 12:56:40 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.5 2020/09/12 18:12:53 macallan Exp $");
 
 #include 
 #include 
@@ -123,6 +123,26 @@ lmu_video_off(device_t dev)
 	sc->sc_video_state = false;
 }
 
+static void
+lmu_kbd_brightness_up(device_t dev)
+{
+	struct lmu_softc * const sc = device_private(dev);
+
+	sc->sc_level = __MIN(16, sc->sc_level + 2);
+	sc->sc_target = sc->sc_level;
+	callout_schedule(>sc_adjust, LMU_FADE);
+}
+
+static void
+lmu_kbd_brightness_down(device_t dev)
+{
+	struct lmu_softc * const sc = device_private(dev);
+
+	sc->sc_level = __MAX(0, sc->sc_level - 2);
+	sc->sc_target = sc->sc_level;
+	callout_schedule(>sc_adjust, LMU_FADE);
+}
+
 static int
 lmu_match(device_t parent, cfdata_t match, void *aux)
 {
@@ -162,6 +182,10 @@ lmu_attach(device_t parent, device_t sel
 	lmu_video_on, true);
 	pmf_event_register(sc->sc_dev, PMFE_DISPLAY_OFF,
 	lmu_video_off, true);
+	pmf_event_register(sc->sc_dev, PMFE_KEYBOARD_BRIGHTNESS_UP,
+	lmu_kbd_brightness_up, true);
+	pmf_event_register(sc->sc_dev, PMFE_KEYBOARD_BRIGHTNESS_DOWN,
+	lmu_kbd_brightness_down, true);
 
 	sc->sc_sme = sysmon_envsys_create();
 	sc->sc_sme->sme_name = device_xname(self);



CVS commit: src/sys/dev/usb

2020-09-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Sep 12 18:10:38 UTC 2020

Modified Files:
src/sys/dev/usb: ukbd.c

Log Message:
send PMF events for keyboard brightness hotkeys on apple laptops


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/dev/usb/ukbd.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/usb/ukbd.c
diff -u src/sys/dev/usb/ukbd.c:1.146 src/sys/dev/usb/ukbd.c:1.147
--- src/sys/dev/usb/ukbd.c:1.146	Sun Mar 29 10:46:10 2020
+++ src/sys/dev/usb/ukbd.c	Sat Sep 12 18:10:37 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: ukbd.c,v 1.146 2020/03/29 10:46:10 tih Exp $*/
+/*  $NetBSD: ukbd.c,v 1.147 2020/09/12 18:10:37 macallan Exp $*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.146 2020/03/29 10:46:10 tih Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.147 2020/09/12 18:10:37 macallan Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -128,9 +128,9 @@ Static const struct ukbd_keycodetrans tr
 	{ 0x3e, IS_PMF | PMFE_AUDIO_VOLUME_UP },
 	{ 0x3f, 0xd6 },	/* num lock */
 	{ 0x40, 0xd7 },
-	{ 0x41, 0xd8 },
-	{ 0x42, 0xd9 },	/* kbd light down */
-	{ 0x43, 0xda },	/* kbd light up */
+	{ 0x41, IS_PMF | PMFE_KEYBOARD_BRIGHTNESS_TOGGLE },
+	{ 0x42, IS_PMF | PMFE_KEYBOARD_BRIGHTNESS_DOWN },
+	{ 0x43, IS_PMF | PMFE_KEYBOARD_BRIGHTNESS_UP },
 	{ 0x44, 0xdb },
 	{ 0x45, 0xdc },
 	{ 0x4f, 0x4d },	/* Right -> End */



CVS commit: src/sys/sys

2020-09-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Sep 12 18:08:38 UTC 2020

Modified Files:
src/sys/sys: pmf.h

Log Message:
add event types for keyboard brightness control


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/sys/pmf.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/sys/pmf.h
diff -u src/sys/sys/pmf.h:1.24 src/sys/sys/pmf.h:1.25
--- src/sys/sys/pmf.h:1.24	Thu Apr 19 21:19:07 2018
+++ src/sys/sys/pmf.h	Sat Sep 12 18:08:38 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pmf.h,v 1.24 2018/04/19 21:19:07 christos Exp $ */
+/* $NetBSD: pmf.h,v 1.25 2020/09/12 18:08:38 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -53,7 +53,10 @@ typedef enum {
 	PMFE_POWER_CHANGED,
 	PMFE_SPEED_CHANGED,
 	PMFE_THROTTLE_ENABLE,
-	PMFE_THROTTLE_DISABLE
+	PMFE_THROTTLE_DISABLE,
+	PMFE_KEYBOARD_BRIGHTNESS_UP,
+	PMFE_KEYBOARD_BRIGHTNESS_DOWN,
+	PMFE_KEYBOARD_BRIGHTNESS_TOGGLE
 } pmf_generic_event_t;
 
 struct pmf_qual {



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 18:04:45 UTC 2020

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

Log Message:
make(1): migrate CondParser_String to Var_ParsePP


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/usr.bin/make/cond.c
cvs rdiff -u -r1.114 -r1.115 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.494 -r1.495 src/usr.bin/make/var.c

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

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.139 src/usr.bin/make/cond.c:1.140
--- src/usr.bin/make/cond.c:1.139	Sat Sep 12 18:02:43 2020
+++ src/usr.bin/make/cond.c	Sat Sep 12 18:04:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.139 2020/09/12 18:02:43 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.140 2020/09/12 18:04:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.139 2020/09/12 18:02:43 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.140 2020/09/12 18:04:45 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.139 2020/09/12 18:02:43 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.140 2020/09/12 18:04:45 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -392,6 +392,12 @@ TryParseNumber(const char *str, double *
 return TRUE;
 }
 
+static Boolean
+is_separator(char ch)
+{
+return ch == '\0' || ch_isspace(ch) || strchr("!=><)", ch);
+}
+
 /*-
  * Parse a string from a variable reference or an optionally quoted
  * string.  This is called for the lhs and rhs of string comparisons.
@@ -408,7 +414,8 @@ CondParser_String(CondParser *par, Boole
 {
 Buffer buf;
 const char *str;
-int len;
+Boolean atStart;
+const char *nested_p;
 Boolean qt;
 const char *start;
 VarEvalFlags eflags;
@@ -450,10 +457,12 @@ CondParser_String(CondParser *par, Boole
 	par->p++;
 	continue;
 	case '$':
-	/* if we are in quotes, then an undefined variable is ok */
+	/* if we are in quotes, an undefined variable is ok */
 	eflags = ((!qt && doEval) ? VARE_UNDEFERR : 0) |
 		 (doEval ? VARE_WANTRES : 0);
-	str = Var_Parse(par->p, VAR_CMD, eflags, , freeIt);
+	nested_p = par->p;
+	atStart = nested_p == start;
+	str = Var_ParsePP(_p, VAR_CMD, eflags, freeIt);
 	if (str == var_Error) {
 		if (*freeIt) {
 		free(*freeIt);
@@ -466,18 +475,16 @@ CondParser_String(CondParser *par, Boole
 		str = NULL;
 		goto cleanup;
 	}
-	par->p += len;
+	par->p = nested_p;
+
 	/*
-	 * If the '$' was first char (no quotes), and we are
-	 * followed by space, the operator or end of expression,
-	 * we are done.
+	 * If the '$' started the string literal (which means no quotes),
+	 * and the variable expression is followed by a space, looks like
+	 * a comparison operator or is the end of the expression, we are
+	 * done.
 	 */
-	if ((par->p == start + len) &&
-		(par->p[0] == '\0' ||
-		 ch_isspace(par->p[0]) ||
-		 strchr("!=><)", par->p[0]))) {
+	if (atStart && is_separator(par->p[0]))
 		goto cleanup;
-	}
 
 	Buf_AddStr(, str);
 	if (*freeIt) {

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.114 src/usr.bin/make/nonints.h:1.115
--- src/usr.bin/make/nonints.h:1.114	Sat Sep 12 16:46:24 2020
+++ src/usr.bin/make/nonints.h	Sat Sep 12 18:04:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.114 2020/09/12 16:46:24 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.115 2020/09/12 18:04:45 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -213,7 +213,6 @@ void Var_Set_with_flags(const char *, co
 void Var_Append(const char *, const char *, GNode *);
 Boolean Var_Exists(const char *, GNode *);
 const char *Var_Value(const char *, GNode *, char **);
-const char *Var_Parse(const char *, GNode *, VarEvalFlags, int *, void **);
 const char *Var_ParsePP(const char **, GNode *, VarEvalFlags, void **);
 char *Var_Subst(const char *, GNode *, VarEvalFlags);
 void Var_Init(void);

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.494 src/usr.bin/make/var.c:1.495
--- src/usr.bin/make/var.c:1.494	Sat Sep 12 14:41:00 2020
+++ src/usr.bin/make/var.c	Sat Sep 12 18:04:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.494 2020/09/12 14:41:00 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.495 2020/09/12 18:04:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.494 2020/09/12 14:41:00 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.495 2020/09/12 18:04:45 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 

CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 18:02:43 UTC 2020

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

Log Message:
make(1): use correct character literals in TryParseNumber


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 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.138 src/usr.bin/make/cond.c:1.139
--- src/usr.bin/make/cond.c:1.138	Sat Sep 12 17:14:40 2020
+++ src/usr.bin/make/cond.c	Sat Sep 12 18:02:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.138 2020/09/12 17:14:40 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.139 2020/09/12 18:02:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.138 2020/09/12 17:14:40 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.139 2020/09/12 18:02:43 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.138 2020/09/12 17:14:40 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.139 2020/09/12 18:02:43 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -378,10 +378,10 @@ TryParseNumber(const char *str, double *
 }
 l_val = strtoul(str, , str[1] == 'x' ? 16 : 10);
 ech = *eptr;
-if (ech == 0 && errno != ERANGE) {
+if (ech == '\0' && errno != ERANGE) {
 	d_val = str[0] == '-' ? -(double)-l_val : (double)l_val;
 } else {
-	if (ech != 0 && ech != '.' && ech != 'e' && ech != 'E')
+	if (ech != '\0' && ech != '.' && ech != 'e' && ech != 'E')
 	return FALSE;
 	d_val = strtod(str, );
 	if (*eptr)



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

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 18:01:51 UTC 2020

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

Log Message:
make(1): add test for Infinity and NaN

Neither is recognized by the make parser, which is good since the main
task of make is dependency resolution and text processing, not
calculating.


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

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

Modified files:

Index: src/usr.bin/make/unit-tests/cond-cmp-numeric.exp
diff -u src/usr.bin/make/unit-tests/cond-cmp-numeric.exp:1.1 src/usr.bin/make/unit-tests/cond-cmp-numeric.exp:1.2
--- src/usr.bin/make/unit-tests/cond-cmp-numeric.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-numeric.exp	Sat Sep 12 18:01:51 2020
@@ -1 +1,11 @@
-exit status 0
+CondParser_Eval: !(${:UINF} > 1e100)
+make: "cond-cmp-numeric.mk" line 11: warning: String comparison operator must be either == or !=
+make: "cond-cmp-numeric.mk" line 11: Malformed conditional (!(${:UINF} > 1e100))
+CondParser_Eval: ${:UNaN} > NaN
+make: "cond-cmp-numeric.mk" line 16: warning: String comparison operator must be either == or !=
+make: "cond-cmp-numeric.mk" line 16: Malformed conditional (${:UNaN} > NaN)
+CondParser_Eval: !(${:UNaN} == NaN)
+lhs = "NaN", rhs = "NaN", op = ==
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1

Index: src/usr.bin/make/unit-tests/cond-cmp-numeric.mk
diff -u src/usr.bin/make/unit-tests/cond-cmp-numeric.mk:1.2 src/usr.bin/make/unit-tests/cond-cmp-numeric.mk:1.3
--- src/usr.bin/make/unit-tests/cond-cmp-numeric.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-numeric.mk	Sat Sep 12 18:01:51 2020
@@ -1,8 +1,29 @@
-# $NetBSD: cond-cmp-numeric.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: cond-cmp-numeric.mk,v 1.3 2020/09/12 18:01:51 rillig Exp $
 #
 # Tests for numeric comparisons in .if conditions.
 
-# TODO: Implementation
+.MAKEFLAGS: -dc
+
+# The ${:U...} on the left-hand side is necessary for the parser.
+
+# Even if strtod(3) parses "INF" as +Infinity, make does not accept this
+# since it is not really a number; see TryParseNumber.
+.if !(${:UINF} > 1e100)
+.  error
+.endif
+
+# Neither is NaN a number; see TryParseNumber.
+.if ${:UNaN} > NaN
+.  error
+.endif
+
+# Since NaN is not parsed as a number, both operands are interpreted
+# as strings and are therefore equal.  If they were parsed as numbers,
+# they would compare unequal, since NaN is unequal to any and everything,
+# including itself.
+.if !(${:UNaN} == NaN)
+.  error
+.endif
 
 all:
 	@:;



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

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 17:47:24 UTC 2020

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

Log Message:
make(1): add tests for comparison tokens without whitespace


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

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

Modified files:

Index: src/usr.bin/make/unit-tests/cond-token-plain.exp
diff -u src/usr.bin/make/unit-tests/cond-token-plain.exp:1.2 src/usr.bin/make/unit-tests/cond-token-plain.exp:1.3
--- src/usr.bin/make/unit-tests/cond-token-plain.exp:1.2	Fri Sep 11 06:47:42 2020
+++ src/usr.bin/make/unit-tests/cond-token-plain.exp	Sat Sep 12 17:47:24 2020
@@ -15,4 +15,15 @@ lhs = "no", rhs = "no", op = !=
 CondParser_Eval: ${1 # comment :?yes:no} != yes
 CondParser_Eval: 1 # comment 
 lhs = "yes", rhs = "yes", op = !=
+CondParser_Eval: ${UNDEF:Uundefined}!=undefined
+lhs = "undefined", rhs = "undefined", op = !=
+CondParser_Eval: ${UNDEF:U12345}>12345
+lhs = 12345.00, rhs = 12345.00, op = >1
+CondParser_Eval: ${UNDEF:U12345}<12345
+lhs = 12345.00, rhs = 12345.00, op = <1
+CondParser_Eval: (${UNDEF:U0})||0
+CondParser_Eval: ${:Uvar}& != "var&"
+lhs = "var&", rhs = "var&", op = !=
+CondParser_Eval: ${:Uvar}||name != "var||name"
+lhs = "var||name", rhs = "var||name", op = !=
 exit status 0

Index: src/usr.bin/make/unit-tests/cond-token-plain.mk
diff -u src/usr.bin/make/unit-tests/cond-token-plain.mk:1.3 src/usr.bin/make/unit-tests/cond-token-plain.mk:1.4
--- src/usr.bin/make/unit-tests/cond-token-plain.mk:1.3	Fri Sep 11 06:47:42 2020
+++ src/usr.bin/make/unit-tests/cond-token-plain.mk	Sat Sep 12 17:47:24 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-token-plain.mk,v 1.3 2020/09/11 06:47:42 rillig Exp $
+# $NetBSD: cond-token-plain.mk,v 1.4 2020/09/12 17:47:24 rillig Exp $
 #
 # Tests for plain tokens (that is, string literals without quotes)
 # in .if conditions.
@@ -63,5 +63,32 @@
 .  error
 .endif
 
+# Usually there is whitespace around the comparison operator, but this is
+# not required.
+.if ${UNDEF:Uundefined}!=undefined
+.  error
+.endif
+.if ${UNDEF:U12345}>12345
+.  error
+.endif
+.if ${UNDEF:U12345}<12345
+.  error
+.endif
+.if (${UNDEF:U0})||0
+.  error
+.endif
+
+# Only the comparison operator terminates the comparison operand, and it's
+# a coincidence that the '!' is both used in the '!=' comparison operator
+# as well as for negating a comparison result.
+#
+# The boolean operators '&' and '|' don't terminate a comparison operand.
+.if ${:Uvar}& != "var&"
+.  error
+.endif
+.if ${:Uvar}||name != "var||name"
+.  error
+.endif
+
 all:
 	@:;



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 17:14:40 UTC 2020

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

Log Message:
make(1): clean up code in CondParser_String

The two parts of the for loop were not related in any way, which made
the code more confusing than necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 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.137 src/usr.bin/make/cond.c:1.138
--- src/usr.bin/make/cond.c:1.137	Sat Sep 12 14:41:00 2020
+++ src/usr.bin/make/cond.c	Sat Sep 12 17:14:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.137 2020/09/12 14:41:00 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.138 2020/09/12 17:14:40 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.137 2020/09/12 14:41:00 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.138 2020/09/12 17:14:40 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.137 2020/09/12 14:41:00 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.138 2020/09/12 17:14:40 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -419,7 +419,8 @@ CondParser_String(CondParser *par, Boole
 *quoted = qt = par->p[0] == '"' ? 1 : 0;
 if (qt)
 	par->p++;
-for (start = par->p; par->p[0] && str == NULL;) {
+start = par->p;
+while (par->p[0] && str == NULL) {
 	switch (par->p[0]) {
 	case '\\':
 	par->p++;



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 16:46:24 UTC 2020

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

Log Message:
make(1): add typedef for signal handler

Without this typedef, both the declaration and the definition of
bmake_signal were as unreadable as the declaration in the signal(3)
manual page.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.58 -r1.59 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/nonints.h
diff -u src/usr.bin/make/nonints.h:1.113 src/usr.bin/make/nonints.h:1.114
--- src/usr.bin/make/nonints.h:1.113	Sat Sep 12 16:38:19 2020
+++ src/usr.bin/make/nonints.h	Sat Sep 12 16:46:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.113 2020/09/12 16:38:19 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.114 2020/09/12 16:46:24 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -225,4 +225,5 @@ void Var_Export(const char *, Boolean);
 void Var_UnExport(const char *);
 
 /* util.c */
-void (*bmake_signal(int, void (*)(int)))(int);
+typedef void (*SignalProc)(int);
+SignalProc bmake_signal(int, SignalProc);

Index: src/usr.bin/make/util.c
diff -u src/usr.bin/make/util.c:1.58 src/usr.bin/make/util.c:1.59
--- src/usr.bin/make/util.c:1.58	Sat Aug  1 14:47:49 2020
+++ src/usr.bin/make/util.c	Sat Sep 12 16:46:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.58 2020/08/01 14:47:49 rillig Exp $	*/
+/*	$NetBSD: util.c,v 1.59 2020/09/12 16:46:24 rillig Exp $	*/
 
 /*
  * Missing stuff from OS's
@@ -8,11 +8,11 @@
 #endif
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: util.c,v 1.58 2020/08/01 14:47:49 rillig Exp $";
+static char rcsid[] = "$NetBSD: util.c,v 1.59 2020/09/12 16:46:24 rillig Exp $";
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: util.c,v 1.58 2020/08/01 14:47:49 rillig Exp $");
+__RCSID("$NetBSD: util.c,v 1.59 2020/09/12 16:46:24 rillig Exp $");
 #endif
 #endif
 
@@ -339,8 +339,8 @@ getwd(char *pathname)
 #endif /* __hpux */
 
 /* force posix signals */
-void (*
-bmake_signal(int s, void (*a)(int)))(int)
+SignalProc
+bmake_signal(int s, SignalProc a)
 {
 struct sigaction sa, osa;
 



CVS commit: src/sys/dev/tc

2020-09-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Sep 12 16:44:41 UTC 2020

Modified Files:
src/sys/dev/tc: sticio.h

Log Message:
Restrict stic_xmap to the kernel namespace

Otherwise this header is not includable on ports without the definition
of NBPG. This fixes build of sanitizers. In practice only pmax might be
interested in using this device driver.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/tc/sticio.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/dev/tc/sticio.h
diff -u src/sys/dev/tc/sticio.h:1.5 src/sys/dev/tc/sticio.h:1.6
--- src/sys/dev/tc/sticio.h:1.5	Sun Sep  6 06:01:01 2015
+++ src/sys/dev/tc/sticio.h	Sat Sep 12 16:44:41 2020
@@ -1,4 +1,4 @@
-/* 	$NetBSD: sticio.h,v 1.5 2015/09/06 06:01:01 dholland Exp $	*/
+/* 	$NetBSD: sticio.h,v 1.6 2020/09/12 16:44:41 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -72,6 +72,7 @@ struct stic_xcomm {
 	u_int	sxc_done[16];		/* packet completion semaphores */
 };
 
+#ifdef _KERNEL
 /*
  * stic_xmap: a description of the area returned by mapping the board.
  * sxm_xcomm and sxm_buf are physically contigious and of variable size as a
@@ -82,6 +83,7 @@ struct stic_xmap {
 	u_int8_t	sxm_poll[0xc];		/* poll registers */
 	u_int8_t	sxm_xcomm[256 * 1024];		/* X comms area */
 };
+#endif
 
 /*
  * ioctl interface.



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 16:38:19 UTC 2020

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

Log Message:
make(1): fix API of Targ_PrintNode

There was no need to export Targ_PrintNode at all.  All the callers need
is a high-level API for printing a single node or a list of nodes.  The
implementation detail that Targ_PrintNode was used as a callback to
Lst_ForEach should have never leaked into the API.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/usr.bin/make/make.c
cvs rdiff -u -r1.112 -r1.113 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.86 -r1.87 src/usr.bin/make/targ.c

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

Modified files:

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.134 src/usr.bin/make/make.c:1.135
--- src/usr.bin/make/make.c:1.134	Mon Sep  7 06:20:07 2020
+++ src/usr.bin/make/make.c	Sat Sep 12 16:38:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.134 2020/09/07 06:20:07 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.135 2020/09/12 16:38:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: make.c,v 1.134 2020/09/07 06:20:07 rillig Exp $";
+static char rcsid[] = "$NetBSD: make.c,v 1.135 2020/09/12 16:38:19 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)make.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: make.c,v 1.134 2020/09/07 06:20:07 rillig Exp $");
+__RCSID("$NetBSD: make.c,v 1.135 2020/09/12 16:38:19 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -141,11 +141,9 @@ static int MakeBuildParent(void *, void 
 MAKE_ATTR_DEAD static void
 make_abort(GNode *gn, int line)
 {
-static int two = 2;
-
 fprintf(debug_file, "make_abort from line %d\n", line);
-Targ_PrintNode(gn, );
-Lst_ForEach(toBeMade, Targ_PrintNode, );
+Targ_PrintNode(gn, 2);
+Targ_PrintNodes(toBeMade, 2);
 Targ_PrintGraph(3);
 abort();
 }
@@ -821,11 +819,10 @@ Make_Update(GNode *cgn)
 	continue;
 	}
 	if (DEBUG(MAKE)) {
-	static int two = 2;
 	fprintf(debug_file, "- %s%s made, schedule %s%s (made %d)\n",
 		cgn->name, cgn->cohort_num,
 		pgn->name, pgn->cohort_num, pgn->made);
-	Targ_PrintNode(pgn, );
+	Targ_PrintNode(pgn, 2);
 	}
 	/* Ok, we can schedule the parent again */
 	pgn->made = REQUESTED;

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.112 src/usr.bin/make/nonints.h:1.113
--- src/usr.bin/make/nonints.h:1.112	Sat Sep 12 16:13:48 2020
+++ src/usr.bin/make/nonints.h	Sat Sep 12 16:38:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.112 2020/09/12 16:13:48 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.113 2020/09/12 16:38:19 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -182,7 +182,8 @@ Boolean Targ_Silent(GNode *);
 Boolean Targ_Precious(GNode *);
 void Targ_SetMain(GNode *);
 void Targ_PrintCmds(GNode *);
-int Targ_PrintNode(void *, void *);
+void Targ_PrintNode(GNode *, int);
+void Targ_PrintNodes(Lst, int);
 char *Targ_FmtTime(time_t);
 void Targ_PrintType(int);
 void Targ_PrintGraph(int);

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.86 src/usr.bin/make/targ.c:1.87
--- src/usr.bin/make/targ.c:1.86	Sat Sep 12 16:24:20 2020
+++ src/usr.bin/make/targ.c	Sat Sep 12 16:38:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.86 2020/09/12 16:24:20 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.87 2020/09/12 16:38:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: targ.c,v 1.86 2020/09/12 16:24:20 rillig Exp $";
+static char rcsid[] = "$NetBSD: targ.c,v 1.87 2020/09/12 16:38:19 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)targ.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: targ.c,v 1.86 2020/09/12 16:24:20 rillig Exp $");
+__RCSID("$NetBSD: targ.c,v 1.87 2020/09/12 16:38:19 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -467,12 +467,11 @@ made_name(GNodeMade made)
 }
 }
 
-/* Print the contents of a node. */
-int
-Targ_PrintNode(void *gnp, void *passp)
+static int
+PrintNode(void *gnp, void *passp)
 {
-GNode *gn = (GNode *)gnp;
-int		  pass = passp ? *(int *)passp : 0;
+GNode *gn = gnp;
+int pass = *(const int *)passp;
 
 fprintf(debug_file, "# %s%s", gn->name, gn->cohort_num);
 GNode_FprintDetails(debug_file, ", ", gn, "\n");
@@ -526,12 +525,25 @@ Targ_PrintNode(void *gnp, void *passp)
 	Targ_PrintCmds(gn);
 	fprintf(debug_file, "\n\n");
 	if (gn->type & OP_DOUBLEDEP) {
-	Lst_ForEach(gn->cohorts, Targ_PrintNode, );
+	Lst_ForEach(gn->cohorts, PrintNode, passp);
 	}
 }
 return 0;
 }
 
+/* Print the contents of a node. */
+void
+Targ_PrintNode(GNode *gn, int pass)
+{
+PrintNode(gn, );
+}
+
+void

CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 16:24:20 UTC 2020

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

Log Message:
make(1): remove unintended noinline from previous commit


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

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

Modified files:

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.85 src/usr.bin/make/targ.c:1.86
--- src/usr.bin/make/targ.c:1.85	Sat Sep 12 16:22:32 2020
+++ src/usr.bin/make/targ.c	Sat Sep 12 16:24:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.85 2020/09/12 16:22:32 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.86 2020/09/12 16:24:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: targ.c,v 1.85 2020/09/12 16:22:32 rillig Exp $";
+static char rcsid[] = "$NetBSD: targ.c,v 1.86 2020/09/12 16:24:20 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)targ.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: targ.c,v 1.85 2020/09/12 16:22:32 rillig Exp $");
+__RCSID("$NetBSD: targ.c,v 1.86 2020/09/12 16:24:20 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -368,7 +368,7 @@ Targ_SetMain(GNode *gn)
 mainTarg = gn;
 }
 
-static void __attribute__((noinline))
+static void
 PrintNodeNames(Lst gnodes)
 {
 LstNode node;



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 16:22:32 UTC 2020

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

Log Message:
make(1): fix trailing space in output of related node names (-dg2)


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

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

Modified files:

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.84 src/usr.bin/make/targ.c:1.85
--- src/usr.bin/make/targ.c:1.84	Sat Sep 12 16:13:48 2020
+++ src/usr.bin/make/targ.c	Sat Sep 12 16:22:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.84 2020/09/12 16:13:48 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.85 2020/09/12 16:22:32 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: targ.c,v 1.84 2020/09/12 16:13:48 rillig Exp $";
+static char rcsid[] = "$NetBSD: targ.c,v 1.85 2020/09/12 16:22:32 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)targ.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: targ.c,v 1.84 2020/09/12 16:13:48 rillig Exp $");
+__RCSID("$NetBSD: targ.c,v 1.85 2020/09/12 16:22:32 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -141,7 +141,6 @@ static Lst	  allGNs;	/* List of all the 
 static Hash_Table targets;	/* a hash table of same */
 
 static int TargPrintOnlySrc(void *, void *);
-static int TargPrintName(void *, void *);
 #ifdef CLEANUP
 static void TargFreeGN(void *);
 #endif
@@ -369,14 +368,25 @@ Targ_SetMain(GNode *gn)
 mainTarg = gn;
 }
 
-static int
-TargPrintName(void *gnp, void *pflags MAKE_ATTR_UNUSED)
+static void __attribute__((noinline))
+PrintNodeNames(Lst gnodes)
 {
-GNode *gn = (GNode *)gnp;
+LstNode node;
 
-fprintf(debug_file, "%s%s ", gn->name, gn->cohort_num);
+for (node = Lst_First(gnodes); node != NULL; node = LstNode_Next(node)) {
+	GNode *gn = LstNode_Datum(node);
+	fprintf(debug_file, " %s%s", gn->name, gn->cohort_num);
+}
+}
 
-return 0;
+static void
+PrintNodeNamesLine(const char *label, Lst gnodes)
+{
+if (Lst_IsEmpty(gnodes))
+	return;
+fprintf(debug_file, "# %s:", label);
+PrintNodeNames(gnodes);
+fprintf(debug_file, "\n");
 }
 
 static int
@@ -492,30 +502,14 @@ Targ_PrintNode(void *gnp, void *passp)
 		fprintf(debug_file, "# unmade\n");
 		}
 	}
-	if (!Lst_IsEmpty(gn->implicitParents)) {
-		fprintf(debug_file, "# implicit parents: ");
-		Lst_ForEach(gn->implicitParents, TargPrintName, NULL);
-		fprintf(debug_file, "\n");
-	}
+	PrintNodeNamesLine("implicit parents", gn->implicitParents);
 	} else {
 	if (gn->unmade)
 		fprintf(debug_file, "# %d unmade children\n", gn->unmade);
 	}
-	if (!Lst_IsEmpty(gn->parents)) {
-	fprintf(debug_file, "# parents: ");
-	Lst_ForEach(gn->parents, TargPrintName, NULL);
-	fprintf(debug_file, "\n");
-	}
-	if (!Lst_IsEmpty(gn->order_pred)) {
-	fprintf(debug_file, "# order_pred: ");
-	Lst_ForEach(gn->order_pred, TargPrintName, NULL);
-	fprintf(debug_file, "\n");
-	}
-	if (!Lst_IsEmpty(gn->order_succ)) {
-	fprintf(debug_file, "# order_succ: ");
-	Lst_ForEach(gn->order_succ, TargPrintName, NULL);
-	fprintf(debug_file, "\n");
-	}
+	PrintNodeNamesLine("parents", gn->parents);
+	PrintNodeNamesLine("order_pred", gn->order_pred);
+	PrintNodeNamesLine("order_succ", gn->order_succ);
 
 	fprintf(debug_file, "%-16s", gn->name);
 	switch (gn->type & OP_OPMASK) {
@@ -527,7 +521,7 @@ Targ_PrintNode(void *gnp, void *passp)
 		fprintf(debug_file, "::"); break;
 	}
 	Targ_PrintType(gn->type);
-	Lst_ForEach(gn->children, TargPrintName, NULL);
+	PrintNodeNames(gn->children);
 	fprintf(debug_file, "\n");
 	Targ_PrintCmds(gn);
 	fprintf(debug_file, "\n\n");



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 16:13:48 UTC 2020

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

Log Message:
make(1): fix API for Targ_PrintCmd

The previous API was too low-level and not strictly typed.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.150 -r1.151 src/usr.bin/make/suff.c
cvs rdiff -u -r1.83 -r1.84 src/usr.bin/make/targ.c

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

Modified files:

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.111 src/usr.bin/make/nonints.h:1.112
--- src/usr.bin/make/nonints.h:1.111	Sat Sep 12 15:21:25 2020
+++ src/usr.bin/make/nonints.h	Sat Sep 12 16:13:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.111 2020/09/12 15:21:25 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.112 2020/09/12 16:13:48 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -181,7 +181,7 @@ Boolean Targ_Ignore(GNode *);
 Boolean Targ_Silent(GNode *);
 Boolean Targ_Precious(GNode *);
 void Targ_SetMain(GNode *);
-int Targ_PrintCmd(void *, void *);
+void Targ_PrintCmds(GNode *);
 int Targ_PrintNode(void *, void *);
 char *Targ_FmtTime(time_t);
 void Targ_PrintType(int);

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.150 src/usr.bin/make/suff.c:1.151
--- src/usr.bin/make/suff.c:1.150	Sat Sep 12 15:21:25 2020
+++ src/usr.bin/make/suff.c	Sat Sep 12 16:13:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.150 2020/09/12 15:21:25 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.151 2020/09/12 16:13:48 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.150 2020/09/12 15:21:25 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.151 2020/09/12 16:13:48 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c	8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.150 2020/09/12 15:21:25 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.151 2020/09/12 16:13:48 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2247,7 +2247,7 @@ SuffPrintTrans(void *tp, void *dummy MAK
 fprintf(debug_file, "%-16s:", t->name);
 Targ_PrintType(t->type);
 fputc('\n', debug_file);
-Lst_ForEach(t->commands, Targ_PrintCmd, NULL);
+Targ_PrintCmds(t);
 fputc('\n', debug_file);
 return 0;
 }

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.83 src/usr.bin/make/targ.c:1.84
--- src/usr.bin/make/targ.c:1.83	Sat Sep  5 13:55:08 2020
+++ src/usr.bin/make/targ.c	Sat Sep 12 16:13:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.83 2020/09/05 13:55:08 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.84 2020/09/12 16:13:48 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: targ.c,v 1.83 2020/09/05 13:55:08 rillig Exp $";
+static char rcsid[] = "$NetBSD: targ.c,v 1.84 2020/09/12 16:13:48 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)targ.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: targ.c,v 1.83 2020/09/05 13:55:08 rillig Exp $");
+__RCSID("$NetBSD: targ.c,v 1.84 2020/09/12 16:13:48 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -379,14 +379,19 @@ TargPrintName(void *gnp, void *pflags MA
 return 0;
 }
 
-
-int
-Targ_PrintCmd(void *cmd, void *dummy MAKE_ATTR_UNUSED)
+static int
+TargPrintCmd(void *cmd, void *dummy MAKE_ATTR_UNUSED)
 {
 fprintf(debug_file, "\t%s\n", (char *)cmd);
 return 0;
 }
 
+void
+Targ_PrintCmds(GNode *gn)
+{
+Lst_ForEach(gn->commands, TargPrintCmd, NULL);
+}
+
 /* Format a modification time in some reasonable way and return it.
  * The time is placed in a static area, so it is overwritten with each call. */
 char *
@@ -524,7 +529,7 @@ Targ_PrintNode(void *gnp, void *passp)
 	Targ_PrintType(gn->type);
 	Lst_ForEach(gn->children, TargPrintName, NULL);
 	fprintf(debug_file, "\n");
-	Lst_ForEach(gn->commands, Targ_PrintCmd, NULL);
+	Targ_PrintCmds(gn);
 	fprintf(debug_file, "\n\n");
 	if (gn->type & OP_DOUBLEDEP) {
 	Lst_ForEach(gn->cohorts, Targ_PrintNode, );



CVS commit: src

2020-09-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep 12 15:25:42 UTC 2020

Modified Files:
src/distrib/sets: mkvars.mk sets.subr
src/distrib/sets/lists/base: ad.aarch64 ad.arm md.amd64 md.i386 mi
src/distrib/sets/lists/debug: ad.aarch64 md.amd64 md.i386 mi
src/external/bsd/acpica/bin/iasl: Makefile
src/share/mk: bsd.own.mk
src/sys/arch/evbarm/stand: Makefile
src/usr.sbin/acpitools/acpidump: Makefile
src/usr.sbin/acpitools/amldb: Makefile

Log Message:
Add HAVE_ACPI and HAVE_UEFI flags to bsd.own.mk and use them to
conditionally include ACPI and UEFI bits instead of relying on adhoc
MACHINE_ARCH tests.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/distrib/sets/mkvars.mk
cvs rdiff -u -r1.191 -r1.192 src/distrib/sets/sets.subr
cvs rdiff -u -r1.34 -r1.35 src/distrib/sets/lists/base/ad.aarch64
cvs rdiff -u -r1.84 -r1.85 src/distrib/sets/lists/base/ad.arm
cvs rdiff -u -r1.281 -r1.282 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.154 -r1.155 src/distrib/sets/lists/base/md.i386
cvs rdiff -u -r1.1262 -r1.1263 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.31 -r1.32 src/distrib/sets/lists/debug/ad.aarch64
cvs rdiff -u -r1.110 -r1.111 src/distrib/sets/lists/debug/md.amd64
cvs rdiff -u -r1.18 -r1.19 src/distrib/sets/lists/debug/md.i386
cvs rdiff -u -r1.332 -r1.333 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.26 -r1.27 src/external/bsd/acpica/bin/iasl/Makefile
cvs rdiff -u -r1.1209 -r1.1210 src/share/mk/bsd.own.mk
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbarm/stand/Makefile
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/acpitools/acpidump/Makefile
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/acpitools/amldb/Makefile

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

Modified files:

Index: src/distrib/sets/mkvars.mk
diff -u src/distrib/sets/mkvars.mk:1.38 src/distrib/sets/mkvars.mk:1.39
--- src/distrib/sets/mkvars.mk:1.38	Sat Apr  4 19:50:53 2020
+++ src/distrib/sets/mkvars.mk	Sat Sep 12 15:25:41 2020
@@ -1,9 +1,10 @@
-# $NetBSD: mkvars.mk,v 1.38 2020/04/04 19:50:53 christos Exp $
+# $NetBSD: mkvars.mk,v 1.39 2020/09/12 15:25:41 jmcneill Exp $
 
 MKEXTRAVARS= \
 	MACHINE \
 	MACHINE_ARCH \
 	MACHINE_CPU \
+	HAVE_ACPI \
 	HAVE_GCC \
 	HAVE_GDB \
 	HAVE_XORG_SERVER_VER \
@@ -13,6 +14,7 @@ MKEXTRAVARS= \
 	HAVE_LIBGCC_EH \
 	HAVE_OPENSSL \
 	HAVE_SSP \
+	HAVE_UEFI \
 	OBJECT_FMT \
 	TOOLCHAIN_MISSING \
 	EXTSRCS \

Index: src/distrib/sets/sets.subr
diff -u src/distrib/sets/sets.subr:1.191 src/distrib/sets/sets.subr:1.192
--- src/distrib/sets/sets.subr:1.191	Mon May 18 21:19:34 2020
+++ src/distrib/sets/sets.subr	Sat Sep 12 15:25:41 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: sets.subr,v 1.191 2020/05/18 21:19:34 jmcneill Exp $
+#	$NetBSD: sets.subr,v 1.192 2020/09/12 15:25:41 jmcneill Exp $
 #
 
 #
@@ -16,11 +16,13 @@
 #	MACHINE	
 #	MACHINE_ARCH
 #	MACHINE_CPU
+#	HAVE_ACPI
 #	HAVE_BINUTILS
 #	HAVE_GCC
 #	HAVE_GDB
 #	HAVE_SSP
 #	HAVE_OPENSSL
+#	HAVE_UEFI
 #	TOOLCHAIN_MISSING
 #	OBJECT_FMT
 # as well as:
@@ -189,7 +191,7 @@ SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g
 # In each file, a record consists of a path and a System Package name,
 # separated by whitespace. E.g.,
 #
-# 	# $NetBSD: sets.subr,v 1.191 2020/05/18 21:19:34 jmcneill Exp $
+# 	# $NetBSD: sets.subr,v 1.192 2020/09/12 15:25:41 jmcneill Exp $
 # 	.			base-sys-root	[keyword[,...]]
 # 	./altroot		base-sys-root
 # 	./bin			base-sys-root
@@ -219,13 +221,15 @@ SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g
 #1. The HAVE_:
 #	ssp			${HAVE_SSP} != no
 #	libgcc_eh		${HAVE_LIBGCC_EH} != no
+#	acpi			${HAVE_ACPI} != no
 #	binutils=		 = value of ${HAVE_BINUTILS}
 #	gcc=			 = value of ${HAVE_GCC}
 #	gdb=			 = value of ${HAVE_GDB}
+#	mesa_ver=		 = value of ${HAVE_MESA_VER}
 #	openssl=		 = value of ${HAVE_OPENSSL}
+#	uefi			${HAVE_UEFI} != no
 #	xorg_server_ver=	 = value of ${HAVE_XORG_SERVER_VER}
 #	xorg_glamor		${HAVE_XORG_GLAMOR} != no
-#	mesa_ver=		 = value of ${HAVE_MESA_VER}
 #
 #2. The USE_:
 #	use_inet6		${USE_INET6} != no
@@ -330,14 +334,20 @@ list_set_files()
 if ("gdb" in wanted)
 	wanted["gdb=" "'"${HAVE_GDB}"'"] = 1
 			}
+			if ("acpi" in wanted) {
+wanted["acpi=" "'"${HAVE_ACPI}"'"] = 1
+			}
+			if ("mesa_ver" in wanted) {
+wanted["mesa_ver=" "'"${HAVE_MESA_VER}"'"] = 1
+			}
 			if ("openssl" in wanted) {
 wanted["openssl=" "'"${HAVE_OPENSSL}"'"] = 1
 			}
 			if ("xorg_server_ver" in wanted) {
 wanted["xorg_server_ver=" "'"${HAVE_XORG_SERVER_VER}"'"] = 1
 			}
-			if ("mesa_ver" in wanted) {
-wanted["mesa_ver=" "'"${HAVE_MESA_VER}"'"] = 1
+			if ("uefi" in wanted) {
+wanted["uefi=" "'"${HAVE_UEFI}"'"] = 1
 			}
 			if (("man" in wanted) && ("catpages" in wanted))
 wanted[".cat"] = 1

Index: src/distrib/sets/lists/base/ad.aarch64
diff -u src/distrib/sets/lists/base/ad.aarch64:1.34 src/distrib/sets/lists/base/ad.aarch64:1.35
--- src/distrib/sets/lists/base/ad.aarch64:1.34	

CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 15:21:25 UTC 2020

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

Log Message:
make(1): fix prototype of Suff_EndTransform


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.292 -r1.293 src/usr.bin/make/parse.c
cvs rdiff -u -r1.149 -r1.150 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/nonints.h
diff -u src/usr.bin/make/nonints.h:1.110 src/usr.bin/make/nonints.h:1.111
--- src/usr.bin/make/nonints.h:1.110	Sat Sep 12 15:15:51 2020
+++ src/usr.bin/make/nonints.h	Sat Sep 12 15:21:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.110 2020/09/12 15:15:51 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.111 2020/09/12 15:21:25 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -156,7 +156,7 @@ Boolean Str_Match(const char *, const ch
 void Suff_ClearSuffixes(void);
 Boolean Suff_IsTransform(char *);
 GNode *Suff_AddTransform(char *);
-int Suff_EndTransform(void *, void *);
+void Suff_EndTransform(GNode *);
 void Suff_AddSuffix(const char *, GNode **);
 Lst Suff_GetPath(char *);
 void Suff_DoPaths(void);

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.292 src/usr.bin/make/parse.c:1.293
--- src/usr.bin/make/parse.c:1.292	Sat Sep 12 14:41:00 2020
+++ src/usr.bin/make/parse.c	Sat Sep 12 15:21:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.292 2020/09/12 14:41:00 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.293 2020/09/12 15:21:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.292 2020/09/12 14:41:00 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.293 2020/09/12 15:21:25 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.292 2020/09/12 14:41:00 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.293 2020/09/12 15:21:25 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2842,6 +2842,13 @@ ParseReadLine(void)
 }
 }
 
+static int
+SuffEndTransform(void *target, void *unused MAKE_ATTR_UNUSED)
+{
+Suff_EndTransform(target);
+return 0;
+}
+
 /*-
  *---
  * ParseFinishLine --
@@ -2860,7 +2867,7 @@ ParseFinishLine(void)
 {
 if (inLine) {
 	if (targets != NULL) {
-	Lst_ForEach(targets, Suff_EndTransform, NULL);
+	Lst_ForEach(targets, SuffEndTransform, NULL);
 	Lst_Destroy(targets, ParseHasCommands);
 	}
 	targets = NULL;

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.149 src/usr.bin/make/suff.c:1.150
--- src/usr.bin/make/suff.c:1.149	Sat Sep 12 15:15:51 2020
+++ src/usr.bin/make/suff.c	Sat Sep 12 15:21:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.149 2020/09/12 15:15:51 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.150 2020/09/12 15:21:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.149 2020/09/12 15:15:51 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.150 2020/09/12 15:21:25 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c	8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.149 2020/09/12 15:15:51 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.150 2020/09/12 15:21:25 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -616,16 +616,11 @@ Suff_AddTransform(char *line)
  * of the affected suffixes are altered.
  *
  * Input:
- *	gnp		Node for transformation
- *
- * Results:
- *	0, so that Lst_ForEach continues
+ *	gn		Node for transformation
  */
-int
-Suff_EndTransform(void *gnp, void *dummy MAKE_ATTR_UNUSED)
+void
+Suff_EndTransform(GNode *gn)
 {
-GNode *gn = (GNode *)gnp;
-
 if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty(gn->cohorts))
 	gn = LstNode_Datum(Lst_Last(gn->cohorts));
 if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) &&
@@ -666,8 +661,6 @@ Suff_EndTransform(void *gnp, void *dummy
 } else if (gn->type & OP_TRANSFORM) {
 	SUFF_DEBUG1("transformation %s complete\n", gn->name);
 }
-
-return 0;
 }
 
 /* Called from Suff_AddSuffix via Lst_ForEach to search through the list of



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 15:15:51 UTC 2020

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

Log Message:
make(1): move PrintAddr to where it belongs


To generate a diff of this commit:
cvs rdiff -u -r1.332 -r1.333 src/usr.bin/make/main.c
cvs rdiff -u -r1.109 -r1.110 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.148 -r1.149 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/main.c
diff -u src/usr.bin/make/main.c:1.332 src/usr.bin/make/main.c:1.333
--- src/usr.bin/make/main.c:1.332	Fri Sep 11 17:32:36 2020
+++ src/usr.bin/make/main.c	Sat Sep 12 15:15:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.332 2020/09/11 17:32:36 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.333 2020/09/12 15:15:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.332 2020/09/11 17:32:36 rillig Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.333 2020/09/12 15:15:51 rillig Exp $";
 #else
 #include 
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.332 2020/09/11 17:32:36 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.333 2020/09/12 15:15:51 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1968,13 +1968,6 @@ cached_realpath(const char *pathname, ch
 return rp ? resolved : NULL;
 }
 
-int
-PrintAddr(void *a, void *b)
-{
-printf("%lx ", (unsigned long) a);
-return b ? 0 : 0;
-}
-
 
 static int
 addErrorCMD(void *cmdp, void *gnp)

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.109 src/usr.bin/make/nonints.h:1.110
--- src/usr.bin/make/nonints.h:1.109	Sat Sep 12 15:10:55 2020
+++ src/usr.bin/make/nonints.h	Sat Sep 12 15:15:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.109 2020/09/12 15:10:55 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.110 2020/09/12 15:15:51 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -113,7 +113,6 @@ void Error(const char *, ...) MAKE_ATTR_
 void Fatal(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD;
 void Punt(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD;
 void DieHorribly(void) MAKE_ATTR_DEAD;
-int PrintAddr(void *, void *);
 void Finish(int) MAKE_ATTR_DEAD;
 int eunlink(const char *);
 void execError(const char *, const char *);

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.148 src/usr.bin/make/suff.c:1.149
--- src/usr.bin/make/suff.c:1.148	Sat Sep 12 14:41:00 2020
+++ src/usr.bin/make/suff.c	Sat Sep 12 15:15:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.148 2020/09/12 14:41:00 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.149 2020/09/12 15:15:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.148 2020/09/12 14:41:00 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.149 2020/09/12 15:15:51 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c	8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.148 2020/09/12 14:41:00 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.149 2020/09/12 15:15:51 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -948,6 +948,15 @@ Suff_AddLib(const char *sname)
 
 	  /** Implicit Source Search Functions */
 
+#ifdef DEBUG_SRC
+static int
+PrintAddr(void *a, void *b MAKE_ATTR_UNUSED)
+{
+printf("%lx ", (unsigned long) a);
+return 0;
+}
+#endif
+
 /* Add a suffix as a Src structure to the given list with its parent
  * being the given Src structure. If the suffix is the null suffix,
  * the prefix is used unaltered as the file name in the Src structure.



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 15:10:55 UTC 2020

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

Log Message:
make(1): fix prototype of Compat_Make


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/usr.bin/make/compat.c
cvs rdiff -u -r1.108 -r1.109 src/usr.bin/make/nonints.h

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

Modified files:

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.142 src/usr.bin/make/compat.c:1.143
--- src/usr.bin/make/compat.c:1.142	Sat Sep 12 15:03:39 2020
+++ src/usr.bin/make/compat.c	Sat Sep 12 15:10:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.142 2020/09/12 15:03:39 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.143 2020/09/12 15:10:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.142 2020/09/12 15:03:39 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.143 2020/09/12 15:10:55 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.142 2020/09/12 15:03:39 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.143 2020/09/12 15:10:55 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -485,6 +485,12 @@ CompatRunCommand(void *cmd, void *gn)
 return Compat_RunCommand(cmd, gn);
 }
 
+static int
+CompatMake(void *gn, void *pgn)
+{
+return Compat_Make(gn, pgn);
+}
+
 /*-
  *---
  * Compat_Make --
@@ -503,11 +509,8 @@ CompatRunCommand(void *cmd, void *gn)
  *---
  */
 int
-Compat_Make(void *gnp, void *pgnp)
+Compat_Make(GNode *gn, GNode *pgn)
 {
-GNode *gn = (GNode *)gnp;
-GNode *pgn = (GNode *)pgnp;
-
 if (!shellName)		/* we came here from jobs */
 	Shell_Init();
 if (gn->made == UNMADE && (gn == pgn || (pgn->type & OP_MADE) == 0)) {
@@ -523,7 +526,7 @@ Compat_Make(void *gnp, void *pgnp)
 	gn->made = BEINGMADE;
 	if ((gn->type & OP_MADE) == 0)
 	Suff_FindDeps(gn);
-	Lst_ForEach(gn->children, Compat_Make, gn);
+	Lst_ForEach(gn->children, CompatMake, gn);
 	if ((gn->flags & REMAKE) == 0) {
 	gn->made = ABORTED;
 	pgn->flags &= ~(unsigned)REMAKE;
@@ -663,7 +666,7 @@ Compat_Make(void *gnp, void *pgnp)
 }
 
 cohorts:
-Lst_ForEach(gn->cohorts, Compat_Make, pgnp);
+Lst_ForEach(gn->cohorts, CompatMake, pgn);
 return 0;
 }
 

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.108 src/usr.bin/make/nonints.h:1.109
--- src/usr.bin/make/nonints.h:1.108	Sat Sep 12 15:03:40 2020
+++ src/usr.bin/make/nonints.h	Sat Sep 12 15:10:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.108 2020/09/12 15:03:40 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.109 2020/09/12 15:10:55 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -87,7 +87,7 @@ Boolean Arch_IsLib(GNode *);
 /* compat.c */
 int Compat_RunCommand(char *, GNode *);
 void Compat_Run(Lst);
-int Compat_Make(void *, void *);
+int Compat_Make(GNode *, GNode *);
 
 /* cond.c */
 struct If;



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 15:03:40 UTC 2020

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

Log Message:
make(1): fix name and prototype of Compat_RunCommand

By convention, exported identifiers are written with underscore.

The prototype of an exported function must not use void * just because
it is used in Lst_ForEach.  This is an implementation detail and must
remain so.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/usr.bin/make/compat.c
cvs rdiff -u -r1.230 -r1.231 src/usr.bin/make/job.c
cvs rdiff -u -r1.107 -r1.108 src/usr.bin/make/nonints.h

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

Modified files:

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.141 src/usr.bin/make/compat.c:1.142
--- src/usr.bin/make/compat.c:1.141	Sat Sep 12 14:41:00 2020
+++ src/usr.bin/make/compat.c	Sat Sep 12 15:03:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.141 2020/09/12 14:41:00 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.142 2020/09/12 15:03:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.141 2020/09/12 14:41:00 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.142 2020/09/12 15:03:39 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.141 2020/09/12 14:41:00 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.142 2020/09/12 15:03:39 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -197,7 +197,7 @@ CompatInterrupt(int signo)
  *---
  */
 int
-CompatRunCommand(void *cmdp, void *gnp)
+Compat_RunCommand(char *cmdp, struct GNode *gn)
 {
 char	  *cmdStart;	/* Start of expanded command */
 char 	  *cp, *bp;
@@ -214,7 +214,6 @@ CompatRunCommand(void *cmdp, void *gnp)
 Boolean 	  useShell;	/* TRUE if command should be executed
  * using a shell */
 char	  * volatile cmd = (char *)cmdp;
-GNode	  *gn = (GNode *)gnp;
 
 silent = (gn->type & OP_SILENT) != 0;
 errCheck = !(gn->type & OP_IGNORE);
@@ -480,6 +479,12 @@ CompatRunCommand(void *cmdp, void *gnp)
 return status;
 }
 
+static int
+CompatRunCommand(void *cmd, void *gn)
+{
+return Compat_RunCommand(cmd, gn);
+}
+
 /*-
  *---
  * Compat_Make --

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.230 src/usr.bin/make/job.c:1.231
--- src/usr.bin/make/job.c:1.230	Fri Sep 11 17:32:36 2020
+++ src/usr.bin/make/job.c	Sat Sep 12 15:03:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.230 2020/09/11 17:32:36 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.231 2020/09/12 15:03:40 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.230 2020/09/11 17:32:36 rillig Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.231 2020/09/12 15:03:40 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.230 2020/09/11 17:32:36 rillig Exp $");
+__RCSID("$NetBSD: job.c,v 1.231 2020/09/12 15:03:40 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -742,7 +742,7 @@ JobPrintCommand(void *cmdp, void *jobp)
 		 * We're not actually executing anything...
 		 * but this one needs to be - use compat mode just for it.
 		 */
-		CompatRunCommand(cmdp, job->node);
+		Compat_RunCommand(cmdp, job->node);
 		free(cmdStart);
 		return 0;
 	}

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.107 src/usr.bin/make/nonints.h:1.108
--- src/usr.bin/make/nonints.h:1.107	Sat Sep 12 10:14:16 2020
+++ src/usr.bin/make/nonints.h	Sat Sep 12 15:03:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.107 2020/09/12 10:14:16 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.108 2020/09/12 15:03:40 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -85,7 +85,7 @@ void Arch_End(void);
 Boolean Arch_IsLib(GNode *);
 
 /* compat.c */
-int CompatRunCommand(void *, void *);
+int Compat_RunCommand(char *, GNode *);
 void Compat_Run(Lst);
 int Compat_Make(void *, void *);
 



CVS commit: src/libexec/httpd

2020-09-12 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Sat Sep 12 14:44:25 UTC 2020

Modified Files:
src/libexec/httpd: content-bozo.c

Log Message:
bozohttpd: correct .m4a to audio/mp4.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/libexec/httpd/content-bozo.c

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

Modified files:

Index: src/libexec/httpd/content-bozo.c
diff -u src/libexec/httpd/content-bozo.c:1.17 src/libexec/httpd/content-bozo.c:1.18
--- src/libexec/httpd/content-bozo.c:1.17	Sat Sep 12 12:39:28 2020
+++ src/libexec/httpd/content-bozo.c	Sat Sep 12 14:44:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: content-bozo.c,v 1.17 2020/09/12 12:39:28 rhialto Exp $	*/
+/*	$NetBSD: content-bozo.c,v 1.18 2020/09/12 14:44:25 rhialto Exp $	*/
 
 /*	$eterna: content-bozo.c,v 1.17 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -135,7 +135,7 @@ static bozo_content_map_t static_content
 	{ ".snd",	"audio/basic",			"",		"", NULL },
 	{ ".mpga",	"audio/mpeg",			"",		"", NULL },
 	{ ".mp2",	"audio/mpeg",			"",		"", NULL },
-	{ ".m4a",	"audio/mpeg",			"",		"", NULL },
+	{ ".m4a",	"audio/mp4",			"",		"", NULL },
 	{ ".aif",	"audio/x-aiff",			"",		"", NULL },
 	{ ".aiff",	"audio/x-aiff",			"",		"", NULL },
 	{ ".aifc",	"audio/x-aiff",			"",		"", NULL },



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 14:41:00 UTC 2020

Modified Files:
src/usr.bin/make: compat.c cond.c enum.c enum.h for.c lst.c meta.c
parse.c suff.c var.c

Log Message:
make(1): fix inconsistent code indentation


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/usr.bin/make/compat.c
cvs rdiff -u -r1.136 -r1.137 src/usr.bin/make/cond.c
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/enum.c
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/enum.h
cvs rdiff -u -r1.81 -r1.82 src/usr.bin/make/for.c
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/make/lst.c
cvs rdiff -u -r1.113 -r1.114 src/usr.bin/make/meta.c
cvs rdiff -u -r1.291 -r1.292 src/usr.bin/make/parse.c
cvs rdiff -u -r1.147 -r1.148 src/usr.bin/make/suff.c
cvs rdiff -u -r1.493 -r1.494 src/usr.bin/make/var.c

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

Modified files:

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.140 src/usr.bin/make/compat.c:1.141
--- src/usr.bin/make/compat.c:1.140	Fri Sep 11 17:32:36 2020
+++ src/usr.bin/make/compat.c	Sat Sep 12 14:41:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.140 2020/09/11 17:32:36 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.141 2020/09/12 14:41:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.140 2020/09/11 17:32:36 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.141 2020/09/12 14:41:00 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.140 2020/09/11 17:32:36 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.141 2020/09/12 14:41:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -238,7 +238,7 @@ CompatRunCommand(void *cmdp, void *gnp)
 LstNode_Set(cmdNode, cmdStart);
 
 if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) {
-assert(ENDNode != NULL);
+	assert(ENDNode != NULL);
 	Lst_Append(ENDNode->commands, cmdStart);
 	return 0;
 }

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.136 src/usr.bin/make/cond.c:1.137
--- src/usr.bin/make/cond.c:1.136	Sat Sep 12 10:41:43 2020
+++ src/usr.bin/make/cond.c	Sat Sep 12 14:41:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.136 2020/09/12 10:41:43 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.137 2020/09/12 14:41:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.136 2020/09/12 10:41:43 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.137 2020/09/12 14:41:00 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.136 2020/09/12 10:41:43 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.137 2020/09/12 14:41:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -654,7 +654,7 @@ CondParser_Comparison(CondParser *par, B
 	}
 	break;
 default:
-t = doEval ? EvalNotEmpty(par, lhs, lhsQuoted) : TOK_FALSE;
+	t = doEval ? EvalNotEmpty(par, lhs, lhsQuoted) : TOK_FALSE;
 	goto done;
 }
 
@@ -991,10 +991,10 @@ CondParser_Eval(CondParser *par, Boolean
 
 res = CondParser_Expr(par, TRUE);
 if (res != TOK_FALSE && res != TOK_TRUE)
-return COND_INVALID;
+	return COND_INVALID;
 
 if (CondParser_Token(par, TRUE /* XXX: Why TRUE? */) != TOK_EOF)
-return COND_INVALID;
+	return COND_INVALID;
 
 *value = res == TOK_TRUE;
 return COND_PARSE;

Index: src/usr.bin/make/enum.c
diff -u src/usr.bin/make/enum.c:1.6 src/usr.bin/make/enum.c:1.7
--- src/usr.bin/make/enum.c:1.6	Tue Sep  1 20:34:51 2020
+++ src/usr.bin/make/enum.c	Sat Sep 12 14:41:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: enum.c,v 1.6 2020/09/01 20:34:51 rillig Exp $	*/
+/*	$NetBSD: enum.c,v 1.7 2020/09/12 14:41:00 rillig Exp $	*/
 
 /*
  Copyright (c) 2020 Roland Illig 
@@ -28,11 +28,11 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: enum.c,v 1.6 2020/09/01 20:34:51 rillig Exp $";
+static char rcsid[] = "$NetBSD: enum.c,v 1.7 2020/09/12 14:41:00 rillig Exp $";
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: enum.c,v 1.6 2020/09/01 20:34:51 rillig Exp $");
+__RCSID("$NetBSD: enum.c,v 1.7 2020/09/12 14:41:00 rillig Exp $");
 #endif
 #endif
 
@@ -94,7 +94,7 @@ Enum_ValueToString(int value, const Enum
 {
 	for (; spec->es_name[0] != '\0'; spec++) {
 	if (value == spec->es_value)
-	return spec->es_name;
+		return spec->es_name;
 	}
 	abort(/* unknown enum value */);
 }

Index: src/usr.bin/make/enum.h
diff -u src/usr.bin/make/enum.h:1.9 src/usr.bin/make/enum.h:1.10
--- src/usr.bin/make/enum.h:1.9	Tue Sep  1 20:34:51 2020
+++ src/usr.bin/make/enum.h	Sat Sep 12 14:41:00 2020

CVS commit: src/libexec/httpd

2020-09-12 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Sat Sep 12 12:39:28 UTC 2020

Modified Files:
src/libexec/httpd: CHANGES content-bozo.c

Log Message:
bozohttpd: add .m4a and .m4v file extensions.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/libexec/httpd/CHANGES
cvs rdiff -u -r1.16 -r1.17 src/libexec/httpd/content-bozo.c

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

Modified files:

Index: src/libexec/httpd/CHANGES
diff -u src/libexec/httpd/CHANGES:1.41 src/libexec/httpd/CHANGES:1.42
--- src/libexec/httpd/CHANGES:1.41	Thu Aug 20 07:55:10 2020
+++ src/libexec/httpd/CHANGES	Sat Sep 12 12:39:28 2020
@@ -1,4 +1,7 @@
-$NetBSD: CHANGES,v 1.41 2020/08/20 07:55:10 mrg Exp $
+$NetBSD: CHANGES,v 1.42 2020/09/12 12:39:28 rhialto Exp $
+
+changes in bozohttpd 20200912:
+	o  add .m4a and .m4v file extensions.
 
 changes in bozohttpd 20200820:
 	o  make this work on sun2 by reducing mmap window there.

Index: src/libexec/httpd/content-bozo.c
diff -u src/libexec/httpd/content-bozo.c:1.16 src/libexec/httpd/content-bozo.c:1.17
--- src/libexec/httpd/content-bozo.c:1.16	Fri Nov 23 08:11:20 2018
+++ src/libexec/httpd/content-bozo.c	Sat Sep 12 12:39:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: content-bozo.c,v 1.16 2018/11/23 08:11:20 mrg Exp $	*/
+/*	$NetBSD: content-bozo.c,v 1.17 2020/09/12 12:39:28 rhialto Exp $	*/
 
 /*	$eterna: content-bozo.c,v 1.17 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -135,6 +135,7 @@ static bozo_content_map_t static_content
 	{ ".snd",	"audio/basic",			"",		"", NULL },
 	{ ".mpga",	"audio/mpeg",			"",		"", NULL },
 	{ ".mp2",	"audio/mpeg",			"",		"", NULL },
+	{ ".m4a",	"audio/mpeg",			"",		"", NULL },
 	{ ".aif",	"audio/x-aiff",			"",		"", NULL },
 	{ ".aiff",	"audio/x-aiff",			"",		"", NULL },
 	{ ".aifc",	"audio/x-aiff",			"",		"", NULL },
@@ -167,6 +168,7 @@ static bozo_content_map_t static_content
 	{ ".ts",	"video/mpeg",			"",		"", NULL },
 	{ ".vob",	"video/mpeg",			"",		"", NULL },
 	{ ".mp4",	"video/mp4",			"",		"", NULL },
+	{ ".m4v",	"video/mp4",			"",		"", NULL },
 	{ ".qt",	"video/quicktime",		"",		"", NULL },
 	{ ".mov",	"video/quicktime",		"",		"", NULL },
 	{ ".avi",	"video/x-msvideo",		"",		"", NULL },



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 12:24:21 UTC 2020

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

Log Message:
make(1): fix indentation in dir.c


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 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.139 src/usr.bin/make/dir.c:1.140
--- src/usr.bin/make/dir.c:1.139	Sat Sep 12 12:15:22 2020
+++ src/usr.bin/make/dir.c	Sat Sep 12 12:24:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.139 2020/09/12 12:15:22 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.140 2020/09/12 12:24:21 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.139 2020/09/12 12:15:22 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.140 2020/09/12 12:24:21 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.139 2020/09/12 12:15:22 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.140 2020/09/12 12:24:21 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -596,8 +596,8 @@ DirMatchFiles(const char *pattern, Path 
 	 (pattern[0] == '.')))
 	{
 	Lst_Append(expansions,
-			(isDot ? bmake_strdup(entry->name) :
-			 str_concat3(p->name, "/", entry->name)));
+		   (isDot ? bmake_strdup(entry->name) :
+			str_concat3(p->name, "/", entry->name)));
 	}
 }
 }
@@ -1082,10 +1082,10 @@ Dir_FindFile(const char *name, Lst path)
 base = strrchr(name, '/');
 if (base) {
 	hasSlash = TRUE;
-	base += 1;
+	base += 1;
 } else {
 	hasSlash = FALSE;
-	base = name;
+	base = name;
 }
 
 DIR_DEBUG1("Searching for %s ...", name);



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 12:15:22 UTC 2020

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

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

The name "cp" is not appropriate for a variable containing the basename
of a path.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 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.138 src/usr.bin/make/dir.c:1.139
--- src/usr.bin/make/dir.c:1.138	Fri Sep 11 04:32:39 2020
+++ src/usr.bin/make/dir.c	Sat Sep 12 12:15:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.138 2020/09/11 04:32:39 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.139 2020/09/12 12:15:22 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.138 2020/09/11 04:32:39 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.139 2020/09/12 12:15:22 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.138 2020/09/11 04:32:39 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.139 2020/09/12 12:15:22 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1069,7 +1069,7 @@ Dir_FindFile(const char *name, Lst path)
 LstNode ln;			/* a list element */
 char *file;			/* the current filename to check */
 Path *p;			/* current path member */
-const char *cp;		/* Terminal name of file */
+const char *base;		/* Terminal name of file */
 Boolean hasLastDot = FALSE;	/* true we should search dot last */
 Boolean hasSlash;		/* true if 'name' contains a / */
 struct make_stat mst;	/* Buffer for stat, if necessary */
@@ -1079,13 +1079,13 @@ Dir_FindFile(const char *name, Lst path)
  * Find the final component of the name and note whether it has a
  * slash in it (the name, I mean)
  */
-cp = strrchr(name, '/');
-if (cp) {
+base = strrchr(name, '/');
+if (base) {
 	hasSlash = TRUE;
-	cp += 1;
+	base += 1;
 } else {
 	hasSlash = FALSE;
-	cp = name;
+	base = name;
 }
 
 DIR_DEBUG1("Searching for %s ...", name);
@@ -,7 +,7 @@ Dir_FindFile(const char *name, Lst path)
  * directory component is exactly `./', consult the cached contents
  * of each of the directories on the search path.
  */
-if (!hasSlash || (cp - name == 2 && *name == '.')) {
+if (!hasSlash || (base - name == 2 && *name == '.')) {
 	/*
 	 * We look through all the directories on the path seeking one which
 	 * contains the final component of the given name.  If such a beast
@@ -1126,7 +1126,7 @@ Dir_FindFile(const char *name, Lst path)
 	 * This is so there are no conflicts between what the user
 	 * specifies (fish.c) and what pmake finds (./fish.c).
 	 */
-	if (!hasLastDot && (file = DirFindDot(hasSlash, name, cp)) != NULL) {
+	if (!hasLastDot && (file = DirFindDot(hasSlash, name, base)) != NULL) {
 	Lst_Close(path);
 	return file;
 	}
@@ -1135,13 +1135,13 @@ Dir_FindFile(const char *name, Lst path)
 	p = LstNode_Datum(ln);
 	if (p == dotLast)
 		continue;
-	if ((file = DirLookup(p, name, cp, hasSlash)) != NULL) {
+	if ((file = DirLookup(p, name, base, hasSlash)) != NULL) {
 		Lst_Close(path);
 		return file;
 	}
 	}
 
-	if (hasLastDot && (file = DirFindDot(hasSlash, name, cp)) != NULL) {
+	if (hasLastDot && (file = DirFindDot(hasSlash, name, base)) != NULL) {
 	Lst_Close(path);
 	return file;
 	}
@@ -1168,9 +1168,9 @@ Dir_FindFile(const char *name, Lst path)
 	return NULL;
 }
 
-if (*cp == '\0') {
+if (*base == '\0') {
 	/* we were given a trailing "/" */
-	cp = trailing_dot;
+	base = trailing_dot;
 }
 
 if (name[0] != '/') {
@@ -1238,7 +1238,7 @@ Dir_FindFile(const char *name, Lst path)
 	DIR_DEBUG0("   Trying exact path matches...\n");
 
 	if (!hasLastDot && cur &&
-	((file = DirLookupAbs(cur, name, cp)) != NULL)) {
+	((file = DirLookupAbs(cur, name, base)) != NULL)) {
 	if (file[0] == '\0') {
 		free(file);
 		return NULL;
@@ -1251,7 +1251,7 @@ Dir_FindFile(const char *name, Lst path)
 	p = LstNode_Datum(ln);
 	if (p == dotLast)
 		continue;
-	if ((file = DirLookupAbs(p, name, cp)) != NULL) {
+	if ((file = DirLookupAbs(p, name, base)) != NULL) {
 		Lst_Close(path);
 		if (file[0] == '\0') {
 		free(file);
@@ -1263,7 +1263,7 @@ Dir_FindFile(const char *name, Lst path)
 	Lst_Close(path);
 
 	if (hasLastDot && cur &&
-	((file = DirLookupAbs(cur, name, cp)) != NULL)) {
+	((file = DirLookupAbs(cur, name, base)) != NULL)) {
 	if (file[0] == '\0') {
 		free(file);
 		return NULL;
@@ -1290,13 +1290,13 @@ Dir_FindFile(const char *name, Lst path)
  * b/c we added it here. This is not good...
  

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

2020-09-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Sep 12 12:11:19 UTC 2020

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

Log Message:
Include nd.h in sets


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

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2350 src/distrib/sets/lists/comp/mi:1.2351
--- src/distrib/sets/lists/comp/mi:1.2350	Thu Sep 10 01:53:22 2020
+++ src/distrib/sets/lists/comp/mi	Sat Sep 12 12:11:19 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2350 2020/09/10 01:53:22 rin Exp $
+#	$NetBSD: mi,v 1.2351 2020/09/12 12:11:19 roy Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -2424,6 +2424,7 @@
 ./usr/include/net/if_types.h			comp-c-include
 ./usr/include/net/if_vlanvar.h			comp-c-include
 ./usr/include/net/if_wg.h			comp-c-include
+./usr/include/net/nd.hcomp-c-include
 ./usr/include/net/net_stats.h			comp-c-include
 ./usr/include/net/netisr.h			comp-c-include
 ./usr/include/net/npf.hcomp-c-include



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

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 11:55:28 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: varname-dot-parsedir.exp
varname-dot-parsedir.mk varname-dot-parsefile.exp
varname-dot-parsefile.mk

Log Message:
make(1): add test for .PARSEFILE


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varname-dot-parsedir.exp \
src/usr.bin/make/unit-tests/varname-dot-parsefile.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varname-dot-parsedir.mk
cvs rdiff -u -r1.1 -r1.2 \
src/usr.bin/make/unit-tests/varname-dot-parsefile.exp

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

Modified files:

Index: src/usr.bin/make/unit-tests/varname-dot-parsedir.exp
diff -u src/usr.bin/make/unit-tests/varname-dot-parsedir.exp:1.2 src/usr.bin/make/unit-tests/varname-dot-parsedir.exp:1.3
--- src/usr.bin/make/unit-tests/varname-dot-parsedir.exp:1.2	Sat Sep 12 11:45:47 2020
+++ src/usr.bin/make/unit-tests/varname-dot-parsedir.exp	Sat Sep 12 11:55:28 2020
@@ -1,4 +1,5 @@
-make: "varname-dot-parsedir.mk" line 19: At this point, .PARSEDIR is undefined.
-make: "/fake-absolute-path/varname-dot-parsedir.mk" line 24: The location can be faked.
-make: "varname-dot-parsedir.mk" line 28: The location is no longer fake.
+make: "varname-dot-parsedir.mk" line 28: At this point, .PARSEDIR is undefined.
+make: "/fake-absolute-path/varname-dot-parsedir.mk" line 33: The location can be faked.
+make: "varname-dot-parsedir.mk" line 37: The location is no longer fake.
+At run time, .PARSEDIR is undefined.
 exit status 0
Index: src/usr.bin/make/unit-tests/varname-dot-parsefile.mk
diff -u src/usr.bin/make/unit-tests/varname-dot-parsefile.mk:1.2 src/usr.bin/make/unit-tests/varname-dot-parsefile.mk:1.3
--- src/usr.bin/make/unit-tests/varname-dot-parsefile.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varname-dot-parsefile.mk	Sat Sep 12 11:55:28 2020
@@ -1,8 +1,35 @@
-# $NetBSD: varname-dot-parsefile.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varname-dot-parsefile.mk,v 1.3 2020/09/12 11:55:28 rillig Exp $
 #
-# Tests for the special .PARSEFILE variable.
+# Tests for the special .PARSEFILE variable, which contains the basename part
+# of the file that is currently parsed.
 
-# TODO: Implementation
+.if ${.PARSEFILE} != "varname-dot-parsefile.mk"
+.  error
+.endif
+
+# During parsing, it is possible to undefine .PARSEFILE.
+# Not that anyone would ever want to do this, but there's code in parse.c,
+# function PrintLocation, that explicitly handles this situation.
+.if !defined(.PARSEFILE)
+.  error
+.endif
+.undef .PARSEFILE
+.if defined(.PARSEFILE)
+.  error
+.endif
+
+# The variable .PARSEFILE is indirectly used by the .info directive,
+# via PrintLocation.
+.info At this point, .PARSEFILE is undefined.
+
+# There is absolutely no point in faking the location of the file that is
+# being parsed.  Technically, it's possible though.
+.PARSEFILE = fake-parsefile
+.info The location can be faked.
+
+# After including another file, .PARSEFILE is reset.
+.include "/dev/null"
+.info The location is no longer fake.
 
 all:
-	@:;
+	@echo At run time, .PARSEFILE is ${.PARSEFILE:Uundefined}.

Index: src/usr.bin/make/unit-tests/varname-dot-parsedir.mk
diff -u src/usr.bin/make/unit-tests/varname-dot-parsedir.mk:1.3 src/usr.bin/make/unit-tests/varname-dot-parsedir.mk:1.4
--- src/usr.bin/make/unit-tests/varname-dot-parsedir.mk:1.3	Sat Sep 12 11:45:47 2020
+++ src/usr.bin/make/unit-tests/varname-dot-parsedir.mk	Sat Sep 12 11:55:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varname-dot-parsedir.mk,v 1.3 2020/09/12 11:45:47 rillig Exp $
+# $NetBSD: varname-dot-parsedir.mk,v 1.4 2020/09/12 11:55:28 rillig Exp $
 #
 # Tests for the special .PARSEDIR variable, which contains the directory part
 # of the file that is currently parsed.
@@ -12,8 +12,17 @@
 # During parsing, it is possible to undefine .PARSEDIR.
 # Not that anyone would ever want to do this, but there's code in parse.c,
 # function PrintLocation, that explicitly handles this situation.
+.if !defined(.PARSEDIR)
+.  error
+.endif
 .undef .PARSEDIR
+.if defined(.PARSEDIR)
+.  error
+.endif
 
+# The variable .PARSEDIR is indirectly used by the .info directive,
+# via PrintLocation.
+#
 # The .rawout file contains the full path to the current directory.
 # In the .out file, it is filtered out.
 .info At this point, .PARSEDIR is undefined.
@@ -28,4 +37,4 @@
 .info The location is no longer fake.
 
 all:
-	@:;
+	@echo At run time, .PARSEDIR is ${.PARSEDIR:Uundefined}.

Index: src/usr.bin/make/unit-tests/varname-dot-parsefile.exp
diff -u src/usr.bin/make/unit-tests/varname-dot-parsefile.exp:1.1 src/usr.bin/make/unit-tests/varname-dot-parsefile.exp:1.2
--- src/usr.bin/make/unit-tests/varname-dot-parsefile.exp:1.1	Sun Aug 16 12:07:52 2020
+++ src/usr.bin/make/unit-tests/varname-dot-parsefile.exp	Sat Sep 12 11:55:28 2020

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

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 11:45:48 UTC 2020

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

Log Message:
make(1): add test for .PARSEDIR


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varname-dot-parsedir.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varname-dot-parsedir.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-parsedir.exp
diff -u src/usr.bin/make/unit-tests/varname-dot-parsedir.exp:1.1 src/usr.bin/make/unit-tests/varname-dot-parsedir.exp:1.2
--- src/usr.bin/make/unit-tests/varname-dot-parsedir.exp:1.1	Sun Aug 16 12:07:52 2020
+++ src/usr.bin/make/unit-tests/varname-dot-parsedir.exp	Sat Sep 12 11:45:47 2020
@@ -1 +1,4 @@
+make: "varname-dot-parsedir.mk" line 19: At this point, .PARSEDIR is undefined.
+make: "/fake-absolute-path/varname-dot-parsedir.mk" line 24: The location can be faked.
+make: "varname-dot-parsedir.mk" line 28: The location is no longer fake.
 exit status 0

Index: src/usr.bin/make/unit-tests/varname-dot-parsedir.mk
diff -u src/usr.bin/make/unit-tests/varname-dot-parsedir.mk:1.2 src/usr.bin/make/unit-tests/varname-dot-parsedir.mk:1.3
--- src/usr.bin/make/unit-tests/varname-dot-parsedir.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varname-dot-parsedir.mk	Sat Sep 12 11:45:47 2020
@@ -1,8 +1,31 @@
-# $NetBSD: varname-dot-parsedir.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varname-dot-parsedir.mk,v 1.3 2020/09/12 11:45:47 rillig Exp $
 #
-# Tests for the special .PARSEDIR variable.
+# Tests for the special .PARSEDIR variable, which contains the directory part
+# of the file that is currently parsed.
 
-# TODO: Implementation
+# The .PARSEDIR may be absolute or relative, therefore there is not much that
+# can be tested here.
+.if !${.PARSEDIR:tA:M*/unit-tests}
+.  error
+.endif
+
+# During parsing, it is possible to undefine .PARSEDIR.
+# Not that anyone would ever want to do this, but there's code in parse.c,
+# function PrintLocation, that explicitly handles this situation.
+.undef .PARSEDIR
+
+# The .rawout file contains the full path to the current directory.
+# In the .out file, it is filtered out.
+.info At this point, .PARSEDIR is undefined.
+
+# There is absolutely no point in faking the location of the file that is
+# being parsed.  Technically, it's possible though.
+.PARSEDIR = /fake-absolute-path
+.info The location can be faked.
+
+# After including another file, .PARSEDIR is reset.
+.include "/dev/null"
+.info The location is no longer fake.
 
 all:
 	@:;



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 11:21:16 UTC 2020

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

Log Message:
make(1): split ParseVErrorInternal into 2 functions


To generate a diff of this commit:
cvs rdiff -u -r1.290 -r1.291 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.290 src/usr.bin/make/parse.c:1.291
--- src/usr.bin/make/parse.c:1.290	Fri Sep 11 17:32:36 2020
+++ src/usr.bin/make/parse.c	Sat Sep 12 11:21:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.290 2020/09/11 17:32:36 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.291 2020/09/12 11:21:15 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.290 2020/09/11 17:32:36 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.291 2020/09/12 11:21:15 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.290 2020/09/11 17:32:36 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.291 2020/09/12 11:21:15 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -610,6 +610,43 @@ ParseFindKeyword(const char *str)
 return -1;
 }
 
+static void
+PrintLocation(FILE *f, const char *cfname, size_t clineno)
+{
+	char dirbuf[MAXPATHLEN+1];
+
+	(void)fprintf(f, "\"");
+	if (*cfname != '/' && strcmp(cfname, "(stdin)") != 0) {
+		char *cp, *cp2;
+		const char *dir, *fname;
+
+		/*
+		 * Nothing is more annoying than not knowing
+		 * which Makefile is the culprit; we try ${.PARSEDIR}
+		 * and apply realpath(3) if not absolute.
+		 */
+		dir = Var_Value(".PARSEDIR", VAR_GLOBAL, );
+		if (dir == NULL)
+			dir = ".";
+		if (*dir != '/') {
+			dir = realpath(dir, dirbuf);
+		}
+		fname = Var_Value(".PARSEFILE", VAR_GLOBAL, );
+		if (fname == NULL) {
+			if ((fname = strrchr(cfname, '/')))
+fname++;
+			else
+fname = cfname;
+		}
+		(void)fprintf(f, "%s/%s", dir, fname);
+		bmake_free(cp2);
+		bmake_free(cp);
+	} else
+		(void)fprintf(f, "%s", cfname);
+
+	(void)fprintf(f, "\" line %d: ", (int)clineno);
+}
+
 /*-
  * ParseVErrorInternal  --
  *	Error message abort function for parsing. Prints out the context
@@ -628,42 +665,11 @@ ParseVErrorInternal(FILE *f, const char 
 const char *fmt, va_list ap)
 {
 	static Boolean fatal_warning_error_printed = FALSE;
-	char dirbuf[MAXPATHLEN+1];
 
 	(void)fprintf(f, "%s: ", progname);
 
-	if (cfname != NULL) {
-		(void)fprintf(f, "\"");
-		if (*cfname != '/' && strcmp(cfname, "(stdin)") != 0) {
-			char *cp, *cp2;
-			const char *dir, *fname;
-
-			/*
-			 * Nothing is more annoying than not knowing
-			 * which Makefile is the culprit; we try ${.PARSEDIR}
-			 * and apply realpath(3) if not absolute.
-			 */
-			dir = Var_Value(".PARSEDIR", VAR_GLOBAL, );
-			if (dir == NULL)
-dir = ".";
-			if (*dir != '/') {
-dir = realpath(dir, dirbuf);
-			}
-			fname = Var_Value(".PARSEFILE", VAR_GLOBAL, );
-			if (fname == NULL) {
-if ((fname = strrchr(cfname, '/')))
-	fname++;
-else
-	fname = cfname;
-			}
-			(void)fprintf(f, "%s/%s", dir, fname);
-			bmake_free(cp2);
-			bmake_free(cp);
-		} else
-			(void)fprintf(f, "%s", cfname);
-
-		(void)fprintf(f, "\" line %d: ", (int)clineno);
-	}
+	if (cfname != NULL)
+		PrintLocation(f, cfname, clineno);
 	if (type == PARSE_WARNING)
 		(void)fprintf(f, "warning: ");
 	(void)vfprintf(f, fmt, ap);



CVS commit: src/sys/rump/net/lib/libnet

2020-09-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Sep 12 10:44:32 UTC 2020

Modified Files:
src/sys/rump/net/lib/libnet: Makefile

Log Message:
rump: Add nd.c to libnet


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/rump/net/lib/libnet/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/rump/net/lib/libnet/Makefile
diff -u src/sys/rump/net/lib/libnet/Makefile:1.33 src/sys/rump/net/lib/libnet/Makefile:1.34
--- src/sys/rump/net/lib/libnet/Makefile:1.33	Wed Jan 29 06:13:02 2020
+++ src/sys/rump/net/lib/libnet/Makefile	Sat Sep 12 10:44:32 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.33 2020/01/29 06:13:02 thorpej Exp $
+#	$NetBSD: Makefile,v 1.34 2020/09/12 10:44:32 roy Exp $
 #
 
 
@@ -13,7 +13,7 @@ SRCS=	if.c if_loop.c if_stats.c route.c 
 	raw_cb.c if_media.c link_proto.c net_stats.c if_ethersubr.c	\
 	if_spppsubr.c
 SRCS+=	if_43.c
-SRCS+=	if_llatbl.c
+SRCS+=	if_llatbl.c nd.c
 SRCS+=	net_component.c
 SRCS+=	ether_sw_offload.c
 



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 10:41:43 UTC 2020

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

Log Message:
make(1): inline local variable in Cond_Eval


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 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.135 src/usr.bin/make/cond.c:1.136
--- src/usr.bin/make/cond.c:1.135	Sat Sep 12 10:38:52 2020
+++ src/usr.bin/make/cond.c	Sat Sep 12 10:41:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.135 2020/09/12 10:38:52 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.136 2020/09/12 10:41:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.135 2020/09/12 10:38:52 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.136 2020/09/12 10:41:43 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.135 2020/09/12 10:38:52 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.136 2020/09/12 10:41:43 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1084,10 +1084,8 @@ Cond_Eval(const char *line)
 const struct If *ifp;
 Boolean isElif;
 Boolean value;
-int level;			/* Level at which to report errors. */
 enum if_states state;
 
-level = PARSE_FATAL;
 if (!cond_state) {
 	cond_state = bmake_malloc(max_if_depth * sizeof(*cond_state));
 	cond_state[0] = IF_ACTIVE;
@@ -1103,7 +1101,7 @@ Cond_Eval(const char *line)
 		return COND_INVALID;
 	/* End of conditional section */
 	if (cond_depth == cond_min_depth) {
-		Parse_Error(level, "if-less endif");
+		Parse_Error(PARSE_FATAL, "if-less endif");
 		return COND_PARSE;
 	}
 	/* Return state for previous conditional */
@@ -1117,7 +1115,7 @@ Cond_Eval(const char *line)
 	if (is_token(line, "se", 2)) {
 	/* It is else... */
 	if (cond_depth == cond_min_depth) {
-		Parse_Error(level, "if-less else");
+		Parse_Error(PARSE_FATAL, "if-less else");
 		return COND_PARSE;
 	}
 
@@ -1166,7 +1164,7 @@ Cond_Eval(const char *line)
 
 if (isElif) {
 	if (cond_depth == cond_min_depth) {
-	Parse_Error(level, "if-less elif");
+	Parse_Error(PARSE_FATAL, "if-less elif");
 	return COND_PARSE;
 	}
 	state = cond_state[cond_depth];



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

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 10:39:34 UTC 2020

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

Log Message:
make(1): fix wording of parse error in conditionals

The word "should" is not appropriate for situations that eventually lead
to a parse error.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-cmp-string.exp
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond1.exp

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

Modified files:

Index: src/usr.bin/make/unit-tests/cond-cmp-string.exp
diff -u src/usr.bin/make/unit-tests/cond-cmp-string.exp:1.3 src/usr.bin/make/unit-tests/cond-cmp-string.exp:1.4
--- src/usr.bin/make/unit-tests/cond-cmp-string.exp:1.3	Fri Sep 11 15:33:28 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-string.exp	Sat Sep 12 10:39:34 2020
@@ -1,6 +1,6 @@
 make: "cond-cmp-string.mk" line 18: Malformed conditional (str != str)
 make: "cond-cmp-string.mk" line 37: Malformed conditional ("string" != "str""ing")
-make: "cond-cmp-string.mk" line 42: warning: String comparison operator should be either == or !=
+make: "cond-cmp-string.mk" line 42: warning: String comparison operator must be either == or !=
 make: "cond-cmp-string.mk" line 42: Malformed conditional (!("value" = "value"))
 make: "cond-cmp-string.mk" line 49: Malformed conditional (!("value" === "value"))
 make: Fatal errors encountered -- cannot continue

Index: src/usr.bin/make/unit-tests/cond1.exp
diff -u src/usr.bin/make/unit-tests/cond1.exp:1.1 src/usr.bin/make/unit-tests/cond1.exp:1.2
--- src/usr.bin/make/unit-tests/cond1.exp:1.1	Thu Aug 21 13:44:51 2014
+++ src/usr.bin/make/unit-tests/cond1.exp	Sat Sep 12 10:39:34 2020
@@ -16,7 +16,7 @@ Passed:
 4 is not prime
 5 is  prime
 
-make: warning: String comparison operator should be either == or !=
+make: warning: String comparison operator must be either == or !=
 make: Bad conditional expression `"0" > 0' in "0" > 0?OK:No
 
 OK



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 10:38:52 UTC 2020

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

Log Message:
make(1): fix wording of parse error in conditionals

The word "should" is not appropriate for situations that eventually lead
to a parse error.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 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.134 src/usr.bin/make/cond.c:1.135
--- src/usr.bin/make/cond.c:1.134	Fri Sep 11 17:32:36 2020
+++ src/usr.bin/make/cond.c	Sat Sep 12 10:38:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.134 2020/09/11 17:32:36 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.135 2020/09/12 10:38:52 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.134 2020/09/11 17:32:36 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.135 2020/09/12 10:38:52 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.134 2020/09/11 17:32:36 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.135 2020/09/12 10:38:52 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -281,6 +281,7 @@ ParseFuncArg(const char **linePtr, Boole
 if (func != NULL && *cp++ != ')') {
 	Parse_Error(PARSE_WARNING, "Missing closing parenthesis for %s()",
 		func);
+	/* The PARSE_FATAL is done as a follow-up by Cond_EvalExpression. */
 	return 0;
 }
 
@@ -550,18 +551,20 @@ static Token
 EvalCompareNum(double lhs, const char *op, double rhs)
 {
 if (DEBUG(COND))
-	fprintf(debug_file, "lhs = %f, right = %f, op = %.2s\n", lhs, rhs, op);
+	fprintf(debug_file, "lhs = %f, rhs = %f, op = %.2s\n", lhs, rhs, op);
 
 switch (op[0]) {
 case '!':
 	if (op[1] != '=') {
 	Parse_Error(PARSE_WARNING, "Unknown operator");
+	/* The PARSE_FATAL is done as a follow-up by Cond_EvalExpression. */
 	return TOK_ERROR;
 	}
 	return lhs != rhs;
 case '=':
 	if (op[1] != '=') {
 	Parse_Error(PARSE_WARNING, "Unknown operator");
+	/* The PARSE_FATAL is done as a follow-up by Cond_EvalExpression. */
 	return TOK_ERROR;
 	}
 	return lhs == rhs;
@@ -576,9 +579,10 @@ EvalCompareNum(double lhs, const char *o
 static Token
 EvalCompareStr(const char *lhs, const char *op, const char *rhs)
 {
-if ((*op != '!' && *op != '=') || op[1] != '=') {
+if (!((op[0] == '!' || op[0] == '=') && op[1] == '=')) {
 	Parse_Error(PARSE_WARNING,
-		"String comparison operator should be either == or !=");
+		"String comparison operator must be either == or !=");
+	/* The PARSE_FATAL is done as a follow-up by Cond_EvalExpression. */
 	return TOK_ERROR;
 }
 
@@ -658,6 +662,7 @@ 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 Cond_EvalExpression. */
 	goto done;
 }
 



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 10:14:16 UTC 2020

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

Log Message:
make(1): use proper return type for For_Accum


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/usr.bin/make/for.c
cvs rdiff -u -r1.106 -r1.107 src/usr.bin/make/nonints.h

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

Modified files:

Index: src/usr.bin/make/for.c
diff -u src/usr.bin/make/for.c:1.80 src/usr.bin/make/for.c:1.81
--- src/usr.bin/make/for.c:1.80	Sat Sep 12 10:12:09 2020
+++ src/usr.bin/make/for.c	Sat Sep 12 10:14:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.80 2020/09/12 10:12:09 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.81 2020/09/12 10:14:16 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -30,14 +30,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: for.c,v 1.80 2020/09/12 10:12:09 rillig Exp $";
+static char rcsid[] = "$NetBSD: for.c,v 1.81 2020/09/12 10:14:16 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)for.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: for.c,v 1.80 2020/09/12 10:12:09 rillig Exp $");
+__RCSID("$NetBSD: for.c,v 1.81 2020/09/12 10:14:16 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -266,9 +266,9 @@ For_Eval(const char *line)
 
 /*
  * Add another line to a .for loop.
- * Returns 0 when the matching .endfor is reached.
+ * Returns FALSE when the matching .endfor is reached.
  */
-int
+Boolean
 For_Accum(const char *line)
 {
 const char *ptr = line;
@@ -282,7 +282,7 @@ For_Accum(const char *line)
 	if (DEBUG(FOR))
 		(void)fprintf(debug_file, "For: end for %d\n", forLevel);
 	if (--forLevel <= 0)
-		return 0;
+		return FALSE;
 	} else if (strncmp(ptr, "for", 3) == 0 && ch_isspace(ptr[3])) {
 	forLevel++;
 	if (DEBUG(FOR))
@@ -292,7 +292,7 @@ For_Accum(const char *line)
 
 Buf_AddStr(>buf, line);
 Buf_AddByte(>buf, '\n');
-return 1;
+return TRUE;
 }
 
 

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.106 src/usr.bin/make/nonints.h:1.107
--- src/usr.bin/make/nonints.h:1.106	Sun Sep  6 19:34:36 2020
+++ src/usr.bin/make/nonints.h	Sat Sep 12 10:14:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.106 2020/09/06 19:34:36 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.107 2020/09/12 10:14:16 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -99,7 +99,7 @@ unsigned int Cond_save_depth(void);
 
 /* for.c */
 int For_Eval(const char *);
-int For_Accum(const char *);
+Boolean For_Accum(const char *);
 void For_Run(int);
 
 /* job.c */



CVS commit: src/usr.bin/make

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 10:12:09 UTC 2020

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

Log Message:
make(1): update the comment about .for loops to match the code


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 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.79 src/usr.bin/make/for.c:1.80
--- src/usr.bin/make/for.c:1.79	Fri Sep 11 17:32:36 2020
+++ src/usr.bin/make/for.c	Sat Sep 12 10:12:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.79 2020/09/11 17:32:36 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.80 2020/09/12 10:12:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -30,26 +30,43 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: for.c,v 1.79 2020/09/11 17:32:36 rillig Exp $";
+static char rcsid[] = "$NetBSD: for.c,v 1.80 2020/09/12 10:12:09 rillig Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)for.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: for.c,v 1.79 2020/09/11 17:32:36 rillig Exp $");
+__RCSID("$NetBSD: for.c,v 1.80 2020/09/12 10:12:09 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
 
 /*-
- * for.c --
- *	Functions to handle loops in a makefile.
+ * Handling of .for/.endfor loops in a makefile.
+ *
+ * For loops are of the form:
+ *
+ * .for  in 
+ * ...
+ * .endfor
+ *
+ * When a .for line is parsed, all following lines are accumulated into a
+ * buffer, up to but excluding the corresponding .endfor line.  To find the
+ * corresponding .endfor, the number of nested .for and .endfor directives
+ * are counted.
+ *
+ * During parsing, any nested .for loops are just passed through; they get
+ * handled recursively in For_Eval when the enclosing .for loop is evaluated
+ * in For_Run.
+ *
+ * When the .for loop has been parsed completely, the variable expressions
+ * for the iteration variables are replaced with expressions of the form
+ * ${:Uvalue}, and then this modified body is "included" as a special file.
  *
  * Interface:
  *	For_Eval 	Evaluate the loop in the passed line.
  *	For_Run		Run accumulated loop
- *
  */
 
 #include"make.h"
@@ -61,24 +78,6 @@ typedef enum {
 FOR_SUB_ESCAPE_PAREN = 0x0004
 } ForEscapes;
 
-/*
- * For statements are of the form:
- *
- * .for  in 
- * ...
- * .endfor
- *
- * The trick is to look for the matching end inside for for loop
- * To do that, we count the current nesting level of the for loops.
- * and the .endfor statements, accumulating all the statements between
- * the initial .for loop and the matching .endfor;
- * then we evaluate the for loop for each variable in the varlist.
- *
- * Note that any nested fors are just passed through; they get handled
- * recursively in For_Eval when we're expanding the enclosing for in
- * For_Run.
- */
-
 static int forLevel = 0;	/* Nesting level */
 
 /*
@@ -269,7 +268,6 @@ For_Eval(const char *line)
  * Add another line to a .for loop.
  * Returns 0 when the matching .endfor is reached.
  */
-
 int
 For_Accum(const char *line)
 {



CVS commit: src/crypto/external/bsd/openssl/dist/crypto/engine

2020-09-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep 12 09:37:01 UTC 2020

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/engine: eng_devcrypto.c

Log Message:
Restore a local change for PR/54740 lost during openssl 1.1.1e merge.

syslogd(8) complains "Could not open /dev/crypto: Device not configured"
again when pseudo-device crypto(4) is not configured in a kernel.
 
http://cvsweb.netbsd.org/bsdweb.cgi/src/crypto/external/bsd/openssl/dist/crypto/engine/eng_devcrypto.c#rev1.5
 
http://cvsweb.netbsd.org/bsdweb.cgi/src/crypto/external/bsd/openssl/dist/crypto/engine/eng_devcrypto.c#rev1.7

Should be pullued up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/crypto/external/bsd/openssl/dist/crypto/engine/eng_devcrypto.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/engine/eng_devcrypto.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/engine/eng_devcrypto.c:1.7 src/crypto/external/bsd/openssl/dist/crypto/engine/eng_devcrypto.c:1.8
--- src/crypto/external/bsd/openssl/dist/crypto/engine/eng_devcrypto.c:1.7	Sun Mar 22 00:53:05 2020
+++ src/crypto/external/bsd/openssl/dist/crypto/engine/eng_devcrypto.c	Sat Sep 12 09:37:01 2020
@@ -761,7 +761,7 @@ void engine_load_devcrypto_int()
 
 if ((cfd = open("/dev/crypto", O_RDWR, 0)) < 0) {
 #ifndef ENGINE_DEVCRYPTO_DEBUG
-if (errno != ENOENT)
+if (errno != ENOENT && errno != ENXIO)
 #endif
 fprintf(stderr, "Could not open /dev/crypto: %s\n", strerror(errno));
 return;



CVS commit: src/doc

2020-09-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Sep 12 08:39:31 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
Fix typo in gcc version.


To generate a diff of this commit:
cvs rdiff -u -r1.2736 -r1.2737 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2736 src/doc/CHANGES:1.2737
--- src/doc/CHANGES:1.2736	Sat Sep 12 08:31:39 2020
+++ src/doc/CHANGES	Sat Sep 12 08:39:31 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2736 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2737 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -276,7 +276,7 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	kernel: Disable COMPAT_LINUX by default [jdolecek 20200816]
 	mips: Port crash(8) to mips.  [mrg 20200816]
 	wg(4): Add implementation of WireGuard protocol. [ozaki-r 20200820]
-	gcc(1): Import GCC 8.4. [mrg 20200904]
+	gcc(1): Import GCC 9.3. [mrg 20200904]
 	dhcpcd: Update to version 9.2.0. [roy 20200906]
 	iavf(4): Add driver for Intel Ethernet Adaptive Virtual Function
 		[yamaguchi 20200908]



CVS commit: src/doc

2020-09-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Sep 12 08:39:37 UTC 2020

Modified Files:
src/doc: 3RDPARTY

Log Message:
Update gcc entry.


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

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1744 src/doc/3RDPARTY:1.1745
--- src/doc/3RDPARTY:1.1744	Sun Sep  6 14:58:53 2020
+++ src/doc/3RDPARTY	Sat Sep 12 08:39:36 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1744 2020/09/06 14:58:53 roy Exp $
+#	$NetBSD: 3RDPARTY,v 1.1745 2020/09/12 08:39:36 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -449,8 +449,8 @@ Notes:
 There is a flex2netbsd script to help newer imports.
 
 Package:	gcc
-Version:	7.4.0/8.4.0
-Current Vers:	7.5.0/8.4.0/9.3.0/10.1
+Version:	8.4.0/9.3.0
+Current Vers:	8.4.0/9.3.0/10.1
 Maintainer:	FSF
 Archive Site:	ftp://ftp.gnu.org/gnu/gcc/
 Home Page:	http://www.gnu.org/software/gcc/



CVS commit: src

2020-09-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Sep 12 08:31:39 UTC 2020

Modified Files:
src: UPDATING
src/doc: CHANGES
src/share/mk: bsd.own.mk

Log Message:
switch to GCC 9 on arm and x86.

note GCC 8.3, 8.4 and 9.3 import dates.  add an UPDATING entry.


To generate a diff of this commit:
cvs rdiff -u -r1.313 -r1.314 src/UPDATING
cvs rdiff -u -r1.2735 -r1.2736 src/doc/CHANGES
cvs rdiff -u -r1.1208 -r1.1209 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/UPDATING
diff -u src/UPDATING:1.313 src/UPDATING:1.314
--- src/UPDATING:1.313	Mon Sep  7 10:19:02 2020
+++ src/UPDATING	Sat Sep 12 08:31:39 2020
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.313 2020/09/07 10:19:02 mrg Exp $
+$NetBSD: UPDATING,v 1.314 2020/09/12 08:31:39 mrg Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -19,6 +19,10 @@ See also: BUILDING, build.sh, Makefile.
 Recent changes:
 ^^^
 
+20200912:
+	GCC 9 has arrived for Arm and x86 platforms, and will be coming
+	for several more, as will binutils 2.34.  Clean as required.
+
 20200907:
 	GCC 9 is coming, and binutils has been updated for MIPS.  This
 	probably requires cleaning the tools/binutils.

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2735 src/doc/CHANGES:1.2736
--- src/doc/CHANGES:1.2735	Wed Sep  9 05:16:01 2020
+++ src/doc/CHANGES	Sat Sep 12 08:31:39 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2735 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2736 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -40,6 +40,7 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 		packets from userland. [maxv 20190914]
 	mos(4): Ported driver for MosChip MCS7730/7830/7832 USB ethernet.
 		[mrg 20190920]
+	gcc(1): Import GCC 8.3. [mrg 20191001]
 	libpcap: Import 1.9.1. [christos 20191001]
 	tcpdump(8): Import 4.9.3. [christos 20191001]
 	rescue(8): Moved into a separate, rescue-only set. [maya 20191001]
@@ -153,6 +154,7 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	libcbor: Import for libfido2 support [christos 20200302]
 	libfido2: Import for pam-u2f support [christos 20200302]
 	pam-u2f: Import token authenticator [christos 20200302]
+	gcc(1): Import GCC 8.4. [mrg 20200311]
 	terminfo: Support numeric parameters as int [roy 20200313]
 	postfix(1): Import version 3.5.0. [christos 20200318]
 	OpenSSL: Imported 1.1.1e. [christos 20200321]
@@ -274,6 +276,7 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	kernel: Disable COMPAT_LINUX by default [jdolecek 20200816]
 	mips: Port crash(8) to mips.  [mrg 20200816]
 	wg(4): Add implementation of WireGuard protocol. [ozaki-r 20200820]
+	gcc(1): Import GCC 8.4. [mrg 20200904]
 	dhcpcd: Update to version 9.2.0. [roy 20200906]
 	iavf(4): Add driver for Intel Ethernet Adaptive Virtual Function
 		[yamaguchi 20200908]

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1208 src/share/mk/bsd.own.mk:1.1209
--- src/share/mk/bsd.own.mk:1.1208	Thu Sep 10 06:02:30 2020
+++ src/share/mk/bsd.own.mk	Sat Sep 12 08:31:39 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1208 2020/09/10 06:02:30 mrg Exp $
+#	$NetBSD: bsd.own.mk,v 1.1209 2020/09/12 08:31:39 mrg Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -63,7 +63,12 @@ TOOLCHAIN_MISSING?=	no
 #
 # What GCC is used?
 #
+.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" || \
+${MACHINE_CPU} == "aarch64" || ${MACHINE_CPU} == "arm"
+HAVE_GCC?=	9
+.else
 HAVE_GCC?=	8
+.endif
 
 #
 # Platforms that can't run a modern GCC natively



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

2020-09-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Sep 12 07:04:51 UTC 2020

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

Log Message:
make(1): add tests for combining the :D and :U variable modifiers


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

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

Modified files:

Index: src/usr.bin/make/unit-tests/varmod-defined.mk
diff -u src/usr.bin/make/unit-tests/varmod-defined.mk:1.4 src/usr.bin/make/unit-tests/varmod-defined.mk:1.5
--- src/usr.bin/make/unit-tests/varmod-defined.mk:1.4	Thu Sep  3 18:52:36 2020
+++ src/usr.bin/make/unit-tests/varmod-defined.mk	Sat Sep 12 07:04:51 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-defined.mk,v 1.4 2020/09/03 18:52:36 rillig Exp $
+# $NetBSD: varmod-defined.mk,v 1.5 2020/09/12 07:04:51 rillig Exp $
 #
 # Tests for the :D variable modifier, which returns the given string
 # if the variable is defined.  It is closely related to the :U modifier.
@@ -60,6 +60,21 @@ DEF=	defined
 .  error
 .endif
 
+# The :D modifier is often used in combination with the :U modifier.
+# It does not matter in which order the :D and :U modifiers appear.
+.if ${UNDEF:Dyes:Uno} != no
+.  error
+.endif
+.if ${UNDEF:Uno:Dyes} != no
+.  error
+.endif
+.if ${DEF:Dyes:Uno} != yes
+.  error
+.endif
+.if ${DEF:Uno:Dyes} != yes
+.  error
+.endif
+
 # TODO: Add more tests for parsing the plain text part, to cover each branch
 # of ApplyModifier_Defined.
 
Index: src/usr.bin/make/unit-tests/varmod-undefined.mk
diff -u src/usr.bin/make/unit-tests/varmod-undefined.mk:1.4 src/usr.bin/make/unit-tests/varmod-undefined.mk:1.5
--- src/usr.bin/make/unit-tests/varmod-undefined.mk:1.4	Thu Sep  3 18:52:36 2020
+++ src/usr.bin/make/unit-tests/varmod-undefined.mk	Sat Sep 12 07:04:51 2020
@@ -1,20 +1,22 @@
-# $NetBSD: varmod-undefined.mk,v 1.4 2020/09/03 18:52:36 rillig Exp $
+# $NetBSD: varmod-undefined.mk,v 1.5 2020/09/12 07:04:51 rillig Exp $
 #
 # Tests for the :U variable modifier, which returns the given string
 # if the variable is undefined.
 #
-# The pattern ${:Uword} is heavily used when expanding .for loops.
+# See also:
+#	varmod-defined.mk
 
+# The pattern ${:Uword} is heavily used when expanding .for loops.
+#
 # This is how an expanded .for loop looks like.
 # .for word in one
 # .  if ${word} != one
-# .error ${word}
-# .  endif
-# .endfor
-
 .if ${:Uone} != one
+# .error ${word}
 .  error ${:Uone}
+# .  endif
 .endif
+# .endfor
 
 # The variable expressions in the text of the :U modifier may be arbitrarily
 # nested.



CVS commit: src/sys/dev/audio

2020-09-12 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Sep 12 06:09:17 UTC 2020

Modified Files:
src/sys/dev/audio: mulaw.c

Log Message:
Improve slinear16-to-mulaw conversion calculation.
It's about 2~3 times faster on my amd64 and x68k(68030).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/audio/mulaw.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/audio/mulaw.c
diff -u src/sys/dev/audio/mulaw.c:1.3 src/sys/dev/audio/mulaw.c:1.4
--- src/sys/dev/audio/mulaw.c:1.3	Sat Jan 11 04:06:13 2020
+++ src/sys/dev/audio/mulaw.c	Sat Sep 12 06:09:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mulaw.c,v 1.3 2020/01/11 04:06:13 isaki Exp $	*/
+/*	$NetBSD: mulaw.c,v 1.4 2020/09/12 06:09:16 isaki Exp $	*/
 
 /*
  * Copyright (C) 2017 Tetsuya Isaki. All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mulaw.c,v 1.3 2020/01/11 04:06:13 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mulaw.c,v 1.4 2020/09/12 06:09:16 isaki Exp $");
 
 #include 
 #include 
@@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: mulaw.c,v 1.
  *
  * 2. Calculation (default)
  *  It calculates mu-law with full spec and its precision is 14bit.
- *  It's about 10 times slower but the size is less than a half (on m68k,
+ *  It's about 3 times slower but the size is less than a half (on m68k,
  *  for example).
  *
  * mu-law is no longer a popular format.  I think size-optimized is better.
@@ -247,33 +247,40 @@ audio_internal_to_mulaw32(audio_filter_a
 		m = slinear8_to_mulaw[val];
 #else
 		/* 14bit (fullspec, slow but small) encoder */
-		int16_t val;
+		uint16_t val;
 		int c;
 
-		val = (int16_t)(*s++ >> (AUDIO_INTERNAL_BITS - 16));
-		if (val < 0) {
+		val = *s++ >> (AUDIO_INTERNAL_BITS - 16);
+		if ((int16_t)val < 0) {
 			m = 0;
 		} else {
 			val = ~val;
 			m = 0x80;
 		}
 		/* limit */
-		if (val < -8158 * 4)
+		if ((int16_t)val < -8158 * 4)
 			val = -8158 * 4;
 		val -= 33 * 4;	/* bias */
 
-		val <<= 1;
-		for (c = 0; c < 7; c++) {
-			if (val >= 0) {
-break;
-			}
+		// Before(1) Before(2) Before(3)
+		// S0xx_ 0xxx_xxx0 c=0,v=0xxx_xxx0
+		// S10x_ 10xx_xxx0 c=1,v=0xxx_xx00
+		// S110_ 110x_xxx0 c=2,v=0xxx_x000
+		// : : :
+		// S110_ 110M_MMM0 c=6,v=0xxx_x000
 
-			m += (1 << 4);	/* exponent */
-			val <<= 1;
-		}
+		// (1) Push out sign bit
 		val <<= 1;
 
-		m += (val >> 12) & 0x0f; /* mantissa */
+		// (2) Find first zero (and align val to left)
+		c = 0;
+		if (val >= 0xf000) c += 4, val <<= 4;
+		if (val >= 0xc000) c += 2, val <<= 2;
+		if (val >= 0x8000) c += 1, val <<= 1;
+
+		// (3)
+		m += (c << 4);
+		m += (val >> 11) & 0x0f;
 #endif
 
 #if defined(MULAW32)