CVS commit: src/usr.bin/make

2021-02-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Feb  3 06:58:22 UTC 2021

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

Log Message:
make: fix compiler warning about signedness in comparison


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

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

Modified files:

Index: src/usr.bin/make/util.c
diff -u src/usr.bin/make/util.c:1.74 src/usr.bin/make/util.c:1.75
--- src/usr.bin/make/util.c:1.74	Mon Feb  1 19:46:58 2021
+++ src/usr.bin/make/util.c	Wed Feb  3 06:58:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.74 2021/02/01 19:46:58 rillig Exp $	*/
+/*	$NetBSD: util.c,v 1.75 2021/02/03 06:58:22 rillig Exp $	*/
 
 /*
  * Missing stuff from OS's
@@ -15,7 +15,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: util.c,v 1.74 2021/02/01 19:46:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: util.c,v 1.75 2021/02/03 06:58:22 rillig Exp $");
 
 #if !defined(MAKE_NATIVE) && !defined(HAVE_STRERROR)
 extern int errno, sys_nerr;
@@ -45,7 +45,7 @@ findenv(const char *name, int *offset)
 	len = strlen(name);
 	for (i = 0; (q = environ[i]); i++) {
 		p = strchr(q, '=');
-		if (p == NULL || p - q != len)
+		if (p == NULL || (size_t)(p - q) != len)
 			continue;
 		if (strncmp(name, q, len) == 0) {
 			*offset = i;



CVS commit: src/usr.bin/tftp

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 06:51:26 UTC 2021

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

Log Message:
tftp: no longer need packed member warning


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/tftp/Makefile

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

Modified files:

Index: src/usr.bin/tftp/Makefile
diff -u src/usr.bin/tftp/Makefile:1.14 src/usr.bin/tftp/Makefile:1.15
--- src/usr.bin/tftp/Makefile:1.14	Mon Sep  7 00:26:24 2020
+++ src/usr.bin/tftp/Makefile	Wed Feb  3 06:51:26 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.14 2020/09/07 00:26:24 mrg Exp $
+#	$NetBSD: Makefile,v 1.15 2021/02/03 06:51:26 roy Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 WARNS?=2
@@ -8,8 +8,7 @@ USE_FORT?= yes	# network client
 PROG=	tftp
 SRCS=	main.c tftp.c tftpsubs.c
 
-CWARNFLAGS.gcc+=	${GCC_NO_ADDR_OF_PACKED_MEMBER} \
-			${GCC_NO_STRINGOP_OVERFLOW} \
+CWARNFLAGS.gcc+=	${GCC_NO_STRINGOP_OVERFLOW} \
 			${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8:? -Wno-array-bounds :}
 
 .include 



CVS commit: src/usr.sbin/rtadvd

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 06:50:08 UTC 2021

Modified Files:
src/usr.sbin/rtadvd: Makefile

Log Message:
rtadvd: no longer need packed member warning


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/rtadvd/Makefile

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

Modified files:

Index: src/usr.sbin/rtadvd/Makefile
diff -u src/usr.sbin/rtadvd/Makefile:1.25 src/usr.sbin/rtadvd/Makefile:1.26
--- src/usr.sbin/rtadvd/Makefile:1.25	Sun Sep  6 07:20:32 2020
+++ src/usr.sbin/rtadvd/Makefile	Wed Feb  3 06:50:07 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.25 2020/09/06 07:20:32 mrg Exp $
+# $NetBSD: Makefile,v 1.26 2021/02/03 06:50:07 roy Exp $
 
 WARNS?=	4
 
@@ -31,9 +31,6 @@ LDADD.rump+=	-lrumpres
 DPADD.rump+=	${LIBRUMPRES}
 .endif
 
-CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
-CWARNFLAGS.gcc+=	${GCC_NO_ADDR_OF_PACKED_MEMBER}
-
 COPTS.if.c+=		${GCC_NO_STRINGOP_TRUNCATION}
 COPTS.config.c+=	${GCC_NO_STRINGOP_TRUNCATION}
 



CVS commit: src/usr.sbin/traceroute

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 06:49:18 UTC 2021

Modified Files:
src/usr.sbin/traceroute: Makefile

Log Message:
traceroute: no longer need gcc packed member warning


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/traceroute/Makefile

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

Modified files:

Index: src/usr.sbin/traceroute/Makefile
diff -u src/usr.sbin/traceroute/Makefile:1.21 src/usr.sbin/traceroute/Makefile:1.22
--- src/usr.sbin/traceroute/Makefile:1.21	Sun Sep  6 07:20:33 2020
+++ src/usr.sbin/traceroute/Makefile	Wed Feb  3 06:49:18 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.21 2020/09/06 07:20:33 mrg Exp $	
+#	$NetBSD: Makefile,v 1.22 2021/02/03 06:49:18 roy Exp $	
 
 USE_FORT?= yes	# network client
 
@@ -30,6 +30,4 @@ SANITIZER_RENAME_SYMBOL.rump+=	getifaddr
 
 AWKS=	median.awk mean.awk 
 
-CWARNFLAGS.gcc+=${GCC_NO_ADDR_OF_PACKED_MEMBER}
-
 .include 



CVS commit: src/usr.sbin/ldpd

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 06:46:27 UTC 2021

Modified Files:
src/usr.sbin/ldpd: Makefile

Log Message:
ldpd: Discard warning about accessing packed member

I don't see a good way of fixing this right now.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/ldpd/Makefile

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

Modified files:

Index: src/usr.sbin/ldpd/Makefile
diff -u src/usr.sbin/ldpd/Makefile:1.5 src/usr.sbin/ldpd/Makefile:1.6
--- src/usr.sbin/ldpd/Makefile:1.5	Fri Oct 18 10:49:19 2013
+++ src/usr.sbin/ldpd/Makefile	Wed Feb  3 06:46:27 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2013/10/18 10:49:19 kefren Exp $
+# $NetBSD: Makefile,v 1.6 2021/02/03 06:46:27 roy Exp $
 
 .include 
 
@@ -26,4 +26,6 @@ LDADD+=	-lcrypt
 CPPFLAGS+=-DINET6
 .endif
 
+CWARNFLAGS.gcc+=${GCC_NO_ADDR_OF_PACKED_MEMBER}
+
 .include 



CVS commit: src/usr.sbin/traceroute6

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 06:42:50 UTC 2021

Modified Files:
src/usr.sbin/traceroute6: Makefile traceroute6.c

Log Message:
traceroute6: Remove __packed


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/traceroute6/Makefile
cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/traceroute6/traceroute6.c

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

Modified files:

Index: src/usr.sbin/traceroute6/Makefile
diff -u src/usr.sbin/traceroute6/Makefile:1.11 src/usr.sbin/traceroute6/Makefile:1.12
--- src/usr.sbin/traceroute6/Makefile:1.11	Sun Sep  6 07:20:33 2020
+++ src/usr.sbin/traceroute6/Makefile	Wed Feb  3 06:42:50 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.11 2020/09/06 07:20:33 mrg Exp $
+# $NetBSD: Makefile,v 1.12 2021/02/03 06:42:50 roy Exp $
 
 USE_FORT?= yes	# network client
 
@@ -20,6 +20,4 @@ CPPFLAGS+=-I${TRACEROUTE}
 
 .PATH: ${TRACEROUTE}
 
-CWARNFLAGS.gcc+=${GCC_NO_ADDR_OF_PACKED_MEMBER}
-
 .include 

Index: src/usr.sbin/traceroute6/traceroute6.c
diff -u src/usr.sbin/traceroute6/traceroute6.c:1.51 src/usr.sbin/traceroute6/traceroute6.c:1.52
--- src/usr.sbin/traceroute6/traceroute6.c:1.51	Mon Apr 23 18:59:03 2018
+++ src/usr.sbin/traceroute6/traceroute6.c	Wed Feb  3 06:42:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: traceroute6.c,v 1.51 2018/04/23 18:59:03 maxv Exp $	*/
+/*	$NetBSD: traceroute6.c,v 1.52 2021/02/03 06:42:50 roy Exp $	*/
 /*	$KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $	*/
 
 /*
@@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: traceroute6.c,v 1.51 2018/04/23 18:59:03 maxv Exp $");
+__RCSID("$NetBSD: traceroute6.c,v 1.52 2021/02/03 06:42:50 roy Exp $");
 #endif
 #endif
 
@@ -306,7 +306,7 @@ struct opacket {
 	u_char hops;		/* hop limit of the packet */
 	u_char pad[2];
 	struct tv32 tv;		/* time packet left */
-} __packed;
+};
 
 static u_char	packet[512];		/* last inbound (icmp) packet */
 static struct opacket	*outpacket;	/* last output (udp) packet */



CVS commit: src/sys

2021-02-02 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Feb  3 05:51:40 UTC 2021

Modified Files:
src/sys/net: if_arp.h if_ether.h if_gre.h
src/sys/netinet: if_ether.h igmp.h in.h ip.h ip6.h ip_carp.h ip_icmp.h
ip_mroute.h ip_var.h tcp.h tcp_debug.h tcp_var.h udp.h udp_var.h

Log Message:
Remove __packed from various network structures

They are already network aligned and adding the __packed attribute
just causes needless compiler warnings about accssing members of packed
objects.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/net/if_arp.h
cvs rdiff -u -r1.81 -r1.82 src/sys/net/if_ether.h
cvs rdiff -u -r1.44 -r1.45 src/sys/net/if_gre.h
cvs rdiff -u -r1.34 -r1.35 src/sys/netinet/if_ether.h src/sys/netinet/tcp.h
cvs rdiff -u -r1.12 -r1.13 src/sys/netinet/igmp.h src/sys/netinet/ip_carp.h
cvs rdiff -u -r1.111 -r1.112 src/sys/netinet/in.h
cvs rdiff -u -r1.35 -r1.36 src/sys/netinet/ip.h
cvs rdiff -u -r1.26 -r1.27 src/sys/netinet/ip6.h
cvs rdiff -u -r1.40 -r1.41 src/sys/netinet/ip_icmp.h
cvs rdiff -u -r1.32 -r1.33 src/sys/netinet/ip_mroute.h
cvs rdiff -u -r1.130 -r1.131 src/sys/netinet/ip_var.h
cvs rdiff -u -r1.18 -r1.19 src/sys/netinet/tcp_debug.h
cvs rdiff -u -r1.192 -r1.193 src/sys/netinet/tcp_var.h
cvs rdiff -u -r1.16 -r1.17 src/sys/netinet/udp.h
cvs rdiff -u -r1.46 -r1.47 src/sys/netinet/udp_var.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/net/if_arp.h
diff -u src/sys/net/if_arp.h:1.33 src/sys/net/if_arp.h:1.34
--- src/sys/net/if_arp.h:1.33	Sat Jun 30 15:08:04 2018
+++ src/sys/net/if_arp.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.h,v 1.33 2018/06/30 15:08:04 christos Exp $	*/
+/*	$NetBSD: if_arp.h,v 1.34 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1986, 1993
@@ -71,7 +71,7 @@ struct	arphdr {
 	uint8_t  ar_tha[];	/* target hardware address (!IEEE1394) */
 	uint8_t  ar_tpa[];	/* target protocol address */
 #endif
-} __packed;
+};
 
 static __inline uint8_t *
 ar_data(struct arphdr *ap)

Index: src/sys/net/if_ether.h
diff -u src/sys/net/if_ether.h:1.81 src/sys/net/if_ether.h:1.82
--- src/sys/net/if_ether.h:1.81	Wed Jul 17 03:26:24 2019
+++ src/sys/net/if_ether.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.81 2019/07/17 03:26:24 msaitoh Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.82 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -79,7 +79,7 @@
  */
 struct ether_addr {
 	uint8_t ether_addr_octet[ETHER_ADDR_LEN];
-} __packed;
+};
 
 /*
  * Structure of a 10Mb/s Ethernet header.
@@ -88,7 +88,7 @@ struct ether_header {
 	uint8_t  ether_dhost[ETHER_ADDR_LEN];
 	uint8_t  ether_shost[ETHER_ADDR_LEN];
 	uint16_t ether_type;
-} __packed;
+};
 
 #include 
 

Index: src/sys/net/if_gre.h
diff -u src/sys/net/if_gre.h:1.44 src/sys/net/if_gre.h:1.45
--- src/sys/net/if_gre.h:1.44	Tue Feb 26 09:43:37 2019
+++ src/sys/net/if_gre.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.h,v 1.44 2019/02/26 09:43:37 msaitoh Exp $ */
+/*	$NetBSD: if_gre.h,v 1.45 2021/02/03 05:51:40 roy Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@ struct gre_h {
 	struct gre_sre[] routing Routing fileds (see below)
 Present if (rt_pres == 1)
  */
-} __packed;
+};
 
 #define GRE_CP		0x8000  /* Checksum Present */
 #define GRE_RP		0x4000  /* Routing Present */

Index: src/sys/netinet/if_ether.h
diff -u src/sys/netinet/if_ether.h:1.34 src/sys/netinet/if_ether.h:1.35
--- src/sys/netinet/if_ether.h:1.34	Tue Dec 25 18:33:46 2007
+++ src/sys/netinet/if_ether.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.34 2007/12/25 18:33:46 perry Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.35 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -75,7 +75,7 @@ struct	ether_arp {
 	u_int8_t arp_spa[4];			/* sender protocol address */
 	u_int8_t arp_tha[ETHER_ADDR_LEN];	/* target hardware address */
 	u_int8_t arp_tpa[4];			/* target protocol address */
-} __packed;
+};
 #define	arp_hrd	ea_hdr.ar_hrd
 #define	arp_pro	ea_hdr.ar_pro
 #define	arp_hln	ea_hdr.ar_hln
Index: src/sys/netinet/tcp.h
diff -u src/sys/netinet/tcp.h:1.34 src/sys/netinet/tcp.h:1.35
--- src/sys/netinet/tcp.h:1.34	Fri Nov  1 13:54:59 2019
+++ src/sys/netinet/tcp.h	Wed Feb  3 05:51:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp.h,v 1.34 2019/11/01 13:54:59 christos Exp $	*/
+/*	$NetBSD: tcp.h,v 1.35 2021/02/03 05:51:40 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -72,7 +72,7 @@ struct tcphdr {
 	uint16_t th_win;			/* window */
 	uint16_t th_sum;			/* checksum */
 	uint16_t th_urp;			/* urgent pointer */
-} __packed;
+};
 
 #define	TCPOPT_EOL		0
 #define	   TCPOLEN_EOL			1

Index: src/sys/netinet/igmp.h
diff -u src/sys/netinet/igmp.h:1.12 src/sys/netinet/igmp.h:1.13
--- src/sys/netinet/igmp.h:1.12	Thu May 29 23:02:48 2014
+++ src/sys/netinet/igmp.h	Wed Feb  3 05:51:40 

CVS commit: src/external/gpl3/binutils/dist/include/elf

2021-02-02 Thread Frederic Cambus
Module Name:src
Committed By:   fcambus
Date:   Tue Feb  2 21:45:39 UTC 2021

Modified Files:
src/external/gpl3/binutils/dist/include/elf: common.h

Log Message:
Fix typo in the comments of local binutils patches: s/Servguard/Segvguard.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/gpl3/binutils/dist/include/elf/common.h

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/binutils/dist/include/elf/common.h
diff -u src/external/gpl3/binutils/dist/include/elf/common.h:1.12 src/external/gpl3/binutils/dist/include/elf/common.h:1.13
--- src/external/gpl3/binutils/dist/include/elf/common.h:1.12	Fri Apr  3 23:48:48 2020
+++ src/external/gpl3/binutils/dist/include/elf/common.h	Tue Feb  2 21:45:39 2021
@@ -868,7 +868,7 @@
 #define NT_NETBSD_PAX_MPROTECT		0x01	/* Force enable Mprotect */
 #define NT_NETBSD_PAX_NOMPROTECT	0x02	/* Force disable Mprotect */
 #define NT_NETBSD_PAX_GUARD		0x04	/* Force enable Segvguard */
-#define NT_NETBSD_PAX_NOGUARD		0x08/* Force disable Servguard */
+#define NT_NETBSD_PAX_NOGUARD		0x08/* Force disable Segvguard */
 #define NT_NETBSD_PAX_ASLR		0x10	/* Force enable ASLR */
 #define NT_NETBSD_PAX_NOASLR		0x20	/* Force disable ASLR */
 



CVS commit: src/usr.sbin/fstyp

2021-02-02 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Feb  2 21:31:11 UTC 2021

Modified Files:
src/usr.sbin/fstyp: Makefile

Log Message:
Ignore address of packed-member for clang too


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/fstyp/Makefile

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

Modified files:

Index: src/usr.sbin/fstyp/Makefile
diff -u src/usr.sbin/fstyp/Makefile:1.10 src/usr.sbin/fstyp/Makefile:1.11
--- src/usr.sbin/fstyp/Makefile:1.10	Sun Sep  6 07:20:31 2020
+++ src/usr.sbin/fstyp/Makefile	Tue Feb  2 21:31:11 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2020/09/06 07:20:31 mrg Exp $
+#	$NetBSD: Makefile,v 1.11 2021/02/02 21:31:11 joerg Exp $
 
 .include 
 
@@ -29,7 +29,7 @@ COPTS.zfs.c+=	-I${NETBSDSRCDIR}/external
 LDADD+=	-lnvpair -lzfs
 .endif
 
-CWARNFLAGS.clang+=	-Wno-unknown-pragmas
+CWARNFLAGS.clang+=	-Wno-unknown-pragmas -Wno-error=address-of-packed-member
 CWARNFLAGS.gcc+=${GCC_NO_ADDR_OF_PACKED_MEMBER}
 
 .include 



CVS commit: src/usr.bin/make

2021-02-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Feb  2 21:26:51 UTC 2021

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

Log Message:
make: remove unused INTERNAL flag

It had been used for cached_realpaths, until this variable had its type
changed from GNode to HashTable in main.c 1.469 from 2020-11-14.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/enum.h
cvs rdiff -u -r1.239 -r1.240 src/usr.bin/make/make.c
cvs rdiff -u -r1.250 -r1.251 src/usr.bin/make/make.h
cvs rdiff -u -r1.789 -r1.790 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/enum.h
diff -u src/usr.bin/make/enum.h:1.17 src/usr.bin/make/enum.h:1.18
--- src/usr.bin/make/enum.h:1.17	Tue Feb  2 17:56:31 2021
+++ src/usr.bin/make/enum.h	Tue Feb  2 21:26:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: enum.h,v 1.17 2021/02/02 17:56:31 rillig Exp $	*/
+/*	$NetBSD: enum.h,v 1.18 2021/02/02 21:26:51 rillig Exp $	*/
 
 /*
  Copyright (c) 2020 Roland Illig 
@@ -179,16 +179,16 @@ const char *Enum_FlagsToString(char *, s
 
 /*
  * Declare the necessary data structures for calling Enum_FlagsToString
- * for an enum with 10 flags.
+ * for an enum with 9 flags.
  */
-#define ENUM_FLAGS_RTTI_10(typnam, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) \
+#define ENUM_FLAGS_RTTI_9(typnam, v1, v2, v3, v4, v5, v6, v7, v8, v9) \
 	ENUM__FLAGS_RTTI(typnam, \
 	ENUM__SPECS_2( \
 		ENUM__SPEC_8(v1, v2, v3, v4, v5, v6, v7, v8), \
-		ENUM__SPEC_2(v9, v10)), \
+		ENUM__SPEC_1(v9)), \
 	ENUM__JOIN_2( \
 		ENUM__JOIN_STR_8(v1, v2, v3, v4, v5, v6, v7, v8), \
-		ENUM__JOIN_STR_2(v9, v10)))
+		ENUM__JOIN_STR_1(v9)))
 
 /*
  * Declare the necessary data structures for calling Enum_FlagsToString

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.239 src/usr.bin/make/make.c:1.240
--- src/usr.bin/make/make.c:1.239	Tue Feb  2 17:56:31 2021
+++ src/usr.bin/make/make.c	Tue Feb  2 21:26:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.239 2021/02/02 17:56:31 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.240 2021/02/02 21:26:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -103,7 +103,7 @@
 #include "job.h"
 
 /*	"@(#)make.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: make.c,v 1.239 2021/02/02 17:56:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.240 2021/02/02 21:26:51 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked_seqno = 1;
@@ -148,10 +148,10 @@ ENUM_FLAGS_RTTI_31(GNodeType,
 OP_TRANSFORM, OP_MEMBER, OP_LIB, OP_ARCHV,
 OP_HAS_COMMANDS, OP_SAVE_CMDS, OP_DEPS_FOUND, OP_MARK);
 
-ENUM_FLAGS_RTTI_10(GNodeFlags,
+ENUM_FLAGS_RTTI_9(GNodeFlags,
 REMAKE, CHILDMADE, FORCE, DONE_WAIT,
 DONE_ORDER, FROM_DEPEND, DONE_ALLSRC, CYCLE,
-DONECYCLE, INTERNAL);
+DONECYCLE);
 
 void
 GNode_FprintDetails(FILE *f, const char *prefix, const GNode *gn,

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.250 src/usr.bin/make/make.h:1.251
--- src/usr.bin/make/make.h:1.250	Mon Feb  1 21:32:54 2021
+++ src/usr.bin/make/make.h	Tue Feb  2 21:26:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.250 2021/02/01 21:32:54 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.251 2021/02/02 21:26:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -350,9 +350,7 @@ typedef enum GNodeFlags {
 	/* Used by MakePrintStatus */
 	CYCLE		= 1 << 12,
 	/* Used by MakePrintStatus */
-	DONECYCLE	= 1 << 13,
-	/* Internal use only */
-	INTERNAL	= 1 << 14
+	DONECYCLE	= 1 << 13
 } GNodeFlags;
 
 typedef struct List StringList;

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.789 src/usr.bin/make/var.c:1.790
--- src/usr.bin/make/var.c:1.789	Tue Feb  2 16:18:16 2021
+++ src/usr.bin/make/var.c	Tue Feb  2 21:26:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.789 2021/02/02 16:18:16 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.790 2021/02/02 21:26:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.789 2021/02/02 16:18:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.790 2021/02/02 21:26:51 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -475,8 +475,7 @@ VarAdd(const char *name, const char *val
 	Var *v = VarNew(FStr_InitRefer(/* aliased to */ he->key), val,
 	flags & VAR_SET_READONLY ? VAR_READONLY : VAR_NONE);
 	HashEntry_Set(he, v);
-	if (!(ctxt->flags & INTERNAL))
-		DEBUG3(VAR, "%s:%s = %s\n", ctxt->name, name, val);
+	DEBUG3(VAR, "%s:%s = %s\n", ctxt->name, name, val);
 }
 
 /*



CVS commit: src/usr.bin/make

2021-02-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Feb  2 17:56:31 UTC 2021

Modified Files:
src/usr.bin/make: enum.c enum.h make.c nonints.h targ.c
src/usr.bin/make/unit-tests: gnode-submake.exp opt-debug-graph1.exp
opt-debug-graph2.exp opt-debug-graph3.exp suff-incomplete.exp
suff-main-several.exp suff-transform-debug.exp

Log Message:
make: remove overengineered Enum_ValueToString

For printing the status of a GNode, there was already made_name (now
renamed to GNodeMade_Name), which prints user-friendly text instead of
the bare enum constant names.

To do this change confidently, I first had to demonstrate that the
output really affects something other than just the word "UNMADE". There
had not been a test for that case before, and the test immediately
discovered a bug in the -dg2 and -dg3 options.  This bug is one of the
oldest in make, dating back to at least 1993.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/enum.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/enum.h
cvs rdiff -u -r1.238 -r1.239 src/usr.bin/make/make.c
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.160 -r1.161 src/usr.bin/make/targ.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/gnode-submake.exp
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/opt-debug-graph1.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/opt-debug-graph2.exp \
src/usr.bin/make/unit-tests/opt-debug-graph3.exp \
src/usr.bin/make/unit-tests/suff-incomplete.exp \
src/usr.bin/make/unit-tests/suff-transform-debug.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/suff-main-several.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/enum.c
diff -u src/usr.bin/make/enum.c:1.14 src/usr.bin/make/enum.c:1.15
--- src/usr.bin/make/enum.c:1.14	Sat Jan  9 16:06:09 2021
+++ src/usr.bin/make/enum.c	Tue Feb  2 17:56:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: enum.c,v 1.14 2021/01/09 16:06:09 rillig Exp $	*/
+/*	$NetBSD: enum.c,v 1.15 2021/02/02 17:56:31 rillig Exp $	*/
 
 /*
  Copyright (c) 2020 Roland Illig 
@@ -29,7 +29,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: enum.c,v 1.14 2021/01/09 16:06:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: enum.c,v 1.15 2021/02/02 17:56:31 rillig Exp $");
 
 /*
  * Convert a bitset into a string representation, showing the names of the
@@ -78,15 +78,3 @@ Enum_FlagsToString(char *buf, size_t buf
 	buf[0] = '\0';
 	return buf_start;
 }
-
-/* Convert a fixed-value enum into a string representation. */
-const char *
-Enum_ValueToString(int value, const EnumToStringSpec *spec)
-{
-	for (; spec->es_name[0] != '\0'; spec++) {
-		if (value == spec->es_value)
-			return spec->es_name;
-	}
-	abort(/* unknown enum value */);
-	/*NOTREACHED*/
-}

Index: src/usr.bin/make/enum.h
diff -u src/usr.bin/make/enum.h:1.16 src/usr.bin/make/enum.h:1.17
--- src/usr.bin/make/enum.h:1.16	Sat Jan 30 15:53:55 2021
+++ src/usr.bin/make/enum.h	Tue Feb  2 17:56:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: enum.h,v 1.16 2021/01/30 15:53:55 rillig Exp $	*/
+/*	$NetBSD: enum.h,v 1.17 2021/02/02 17:56:31 rillig Exp $	*/
 
 /*
  Copyright (c) 2020 Roland Illig 
@@ -39,8 +39,9 @@ typedef struct EnumToStringSpec {
 	const char *es_name;
 } EnumToStringSpec;
 
+
 const char *Enum_FlagsToString(char *, size_t, int, const EnumToStringSpec *);
-const char *Enum_ValueToString(int, const EnumToStringSpec *);
+
 
 /* For Enum_FlagsToString, the separator between flags. */
 #define ENUM__SEP "|"
@@ -100,13 +101,6 @@ const char *Enum_ValueToString(int, cons
 #define ENUM__SPECS_5(part1, part2, part3, part4, part5) \
 	{ part1, part2, part3, part4, part5, { 0, "" } }
 
-/* Declare the necessary data structures for calling Enum_ValueToString. */
-#define ENUM__VALUE_RTTI(typnam, specs) \
-	static const EnumToStringSpec typnam ## _ ## ToStringSpecs[] = specs; \
-	MAKE_INLINE const char *typnam ## _ToString(typnam value) \
-	{ return Enum_ValueToString(value, typnam ## _ ## ToStringSpecs); } \
-	extern void enum_value_rtti_dummy(void)
-
 
 /* Declare the necessary data structures for calling Enum_FlagsToString. */
 #define ENUM__FLAGS_RTTI(typnam, specs, joined) \
@@ -184,16 +178,6 @@ const char *Enum_ValueToString(int, cons
 		ENUM__JOIN_STR_4(v5, v6, v7, v8)))
 
 /*
- * Declare the necessary data structures for calling Enum_ValueToString
- * for an enum with 8 constants.
- */
-#define ENUM_VALUE_RTTI_8(typnam, v1, v2, v3, v4, v5, v6, v7, v8) \
-	ENUM__VALUE_RTTI(typnam, \
-	ENUM__SPECS_2( \
-		ENUM__SPEC_4(v1, v2, v3, v4), \
-		ENUM__SPEC_4(v5, v6, v7, v8)))
-
-/*
  * Declare the necessary data structures for calling Enum_FlagsToString
  * for an enum with 10 flags.
  */

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.238 src/usr.bin/make/make.c:1.239
--- src/usr.bin/make/make.c:1.238	Mon Feb  1 20:42:13 2021
+++ 

CVS commit: src/usr.bin/make

2021-02-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Feb  2 17:47:56 UTC 2021

Modified Files:
src/usr.bin/make: compat.c
src/usr.bin/make/unit-tests: opt-debug-graph2.exp opt-debug-graph2.mk
opt-debug-graph3.exp opt-debug-graph3.mk

Log Message:
make: when exiting due to an error, print graph information

The code now does what the manual page has been promising since at least
1993.


To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 src/usr.bin/make/compat.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-debug-graph2.exp \
src/usr.bin/make/unit-tests/opt-debug-graph2.mk \
src/usr.bin/make/unit-tests/opt-debug-graph3.exp \
src/usr.bin/make/unit-tests/opt-debug-graph3.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/compat.c
diff -u src/usr.bin/make/compat.c:1.221 src/usr.bin/make/compat.c:1.222
--- src/usr.bin/make/compat.c:1.221	Mon Feb  1 21:04:10 2021
+++ src/usr.bin/make/compat.c	Tue Feb  2 17:47:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.221 2021/02/01 21:04:10 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.222 2021/02/02 17:47:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*	"@(#)compat.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: compat.c,v 1.221 2021/02/01 21:04:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.222 2021/02/02 17:47:56 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -749,6 +749,10 @@ Compat_Run(GNodeList *targs)
 	}
 
 	if (errorNode != NULL) {
+		if (DEBUG(GRAPH2))
+			Targ_PrintGraph(2);
+		else if (DEBUG(GRAPH3))
+			Targ_PrintGraph(3);
 		PrintOnError(errorNode, "\nStop.");
 		exit(1);
 	}

Index: src/usr.bin/make/unit-tests/opt-debug-graph2.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-graph2.exp:1.2 src/usr.bin/make/unit-tests/opt-debug-graph2.exp:1.3
--- src/usr.bin/make/unit-tests/opt-debug-graph2.exp:1.2	Tue Feb  2 17:27:35 2021
+++ src/usr.bin/make/unit-tests/opt-debug-graph2.exp	Tue Feb  2 17:47:56 2021
@@ -4,6 +4,89 @@ false
 false
 *** Error code 1 (continuing)
 `all' not remade because of errors.
+#*** Input graph:
+# made-target, made MADE, type OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS|OP_DEPS_FOUND|OP_MARK, flags REMAKE|DONE_ALLSRC
+#
+# *** MAIN TARGET ***
+# No unmade children
+# last modified : made
+# parents: all
+made-target :
+	(null)
+
+
+# error-target, made ERROR, type OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS|OP_DEPS_FOUND|OP_MARK, flags REMAKE|DONE_ALLSRC
+#
+# No unmade children
+# nonexistent (maybe): error when made
+# parents: all
+error-target:
+	(null)
+
+
+# aborted-target, made ABORTED, type OP_DEPENDS|OP_PHONY|OP_DEPS_FOUND|OP_MARK, flags none
+# aborted-target-dependency, made ERROR, type OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS|OP_DEPS_FOUND|OP_MARK, flags REMAKE|DONE_ALLSRC
+#
+# No unmade children
+# nonexistent (maybe): error when made
+# parents: aborted-target
+aborted-target-dependency:
+	(null)
+
+
+# all, made ABORTED, type OP_DEPENDS|OP_DEPS_FOUND, flags CHILDMADE|FORCE
+#
+# 3 unmade children
+# nonexistent (maybe): aborted
+all : made-target error-target aborted-target
+
+
+# .END, made UNMADE, type OP_SPECIAL, flags none
+
+
+#
+#   Files that are only sources:
+#	.END [.END]
+#*** Global Variables:
+.ALLTARGETS  =  made-target error-target aborted-target aborted-target-dependency all .END
+.CURDIR  = 
+.INCLUDES= 
+.LIBS= 
+.MAKE= 
+.MAKE.DEPENDFILE = 
+.MAKE.GID= 
+.MAKE.LEVEL  = 
+.MAKE.MAKEFILES  = 
+.MAKE.MAKEFILE_PREFERENCE = 
+.MAKE.OS = 
+.MAKE.PATH_FILEMON = 
+.MAKE.PID= 
+.MAKE.PPID   = 
+.MAKE.UID= 
+.MAKEFLAGS   =  -r -k -d g2
+.MAKEOVERRIDES   = 
+.OBJDIR  = 
+.PATH= . 
+.TARGETS =  all
+.newline = 
+
+MACHINE  = 
+MACHINE_ARCH = 
+MAKE = 
+MFLAGS   =   -r -k -d g2
+#*** Command-line Variables:
+.MAKE.LEVEL.ENV  = MAKELEVEL
+.SHELL   = 
+
+#*** Directory Cache:
+# Stats: 0 hits 4 misses 0 near misses 0 losers (0%)
+#  refs  hits  directory
+# 1 0  
+# 1 0  .
+# 1 0  
+
+#*** Suffixes:
+#*** Transformations:
 
 Stop.
 make: stopped in unit-tests
Index: src/usr.bin/make/unit-tests/opt-debug-graph2.mk
diff -u src/usr.bin/make/unit-tests/opt-debug-graph2.mk:1.2 src/usr.bin/make/unit-tests/opt-debug-graph2.mk:1.3
--- src/usr.bin/make/unit-tests/opt-debug-graph2.mk:1.2	Tue Feb  2 17:27:35 2021
+++ src/usr.bin/make/unit-tests/opt-debug-graph2.mk	Tue Feb  2 17:47:56 2021
@@ -1,9 +1,9 @@
-# $NetBSD: opt-debug-graph2.mk,v 1.2 2021/02/02 17:27:35 rillig Exp $
+# $NetBSD: opt-debug-graph2.mk,v 1.3 2021/02/02 17:47:56 rillig Exp $
 #
 # Tests for the -dg2 command line option, which prints the input
 # graph after 

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

2021-02-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Feb  2 17:27:35 UTC 2021

Modified Files:
src/usr.bin/make/unit-tests: Makefile opt-debug-graph2.exp
opt-debug-graph2.mk opt-debug-graph3.exp opt-debug-graph3.mk

Log Message:
make: demonstrate that neither -dg2 nor -dg3 produces debug output


To generate a diff of this commit:
cvs rdiff -u -r1.265 -r1.266 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/opt-debug-graph2.exp \
src/usr.bin/make/unit-tests/opt-debug-graph2.mk \
src/usr.bin/make/unit-tests/opt-debug-graph3.exp \
src/usr.bin/make/unit-tests/opt-debug-graph3.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.265 src/usr.bin/make/unit-tests/Makefile:1.266
--- src/usr.bin/make/unit-tests/Makefile:1.265	Mon Feb  1 20:31:41 2021
+++ src/usr.bin/make/unit-tests/Makefile	Tue Feb  2 17:27:35 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.265 2021/02/01 20:31:41 rillig Exp $
+# $NetBSD: Makefile,v 1.266 2021/02/02 17:27:35 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -488,6 +488,8 @@ SED_CMDS.job-output-long-lines= \
 	-e '/^bb*--- job-a ---$$/d'
 SED_CMDS.objdir-writable=	-e 's,${RO_OBJDIR},OBJDIR/roobj,g'
 SED_CMDS.opt-debug-graph1=	${STD_SED_CMDS.dg1}
+SED_CMDS.opt-debug-graph2=	${STD_SED_CMDS.dg2}
+SED_CMDS.opt-debug-graph3=	${STD_SED_CMDS.dg3}
 SED_CMDS.opt-debug-jobs=	-e 's,([0-9][0-9]*),(),'
 SED_CMDS.opt-debug-jobs+=	-e 's,pid [0-9][0-9]*,pid ,'
 SED_CMDS.opt-debug-jobs+=	-e 's,Process [0-9][0-9]*,Process ,'
@@ -539,6 +541,11 @@ STD_SED_CMDS.dg1+=	-e 's,^\(\.MAKE *=\) 
 STD_SED_CMDS.dg1+=	-e 's,^\(\.MAKE\.[A-Z_]* *=\) .*,\1 ,'
 STD_SED_CMDS.dg1+=	-e 's,^\(MACHINE[_ARCH]* *=\) .*,\1 ,'
 STD_SED_CMDS.dg1+=	-e 's,^\(MAKE *=\) .*,\1 ,'
+STD_SED_CMDS.dg1+=	-e 's,^\(\.SHELL *=\) .*,\1 ,'
+
+STD_SED_CMDS.dg2=	${STD_SED_CMDS.dg1}
+STD_SED_CMDS.dg2+=	-e 's,\(last modified\) ..:..:.. ... ..\, ,\1 ,'
+STD_SED_CMDS.dg3=	${STD_SED_CMDS.dg2}
 
 # Omit details such as process IDs from the output of the -dj option.
 STD_SED_CMDS.dj= \

Index: src/usr.bin/make/unit-tests/opt-debug-graph2.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-graph2.exp:1.1 src/usr.bin/make/unit-tests/opt-debug-graph2.exp:1.2
--- src/usr.bin/make/unit-tests/opt-debug-graph2.exp:1.1	Sat Sep  5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-graph2.exp	Tue Feb  2 17:27:35 2021
@@ -1 +1,10 @@
-exit status 0
+: 'Making made-target.'
+false
+*** Error code 1 (continuing)
+false
+*** Error code 1 (continuing)
+`all' not remade because of errors.
+
+Stop.
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/opt-debug-graph2.mk
diff -u src/usr.bin/make/unit-tests/opt-debug-graph2.mk:1.1 src/usr.bin/make/unit-tests/opt-debug-graph2.mk:1.2
--- src/usr.bin/make/unit-tests/opt-debug-graph2.mk:1.1	Sat Sep  5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-graph2.mk	Tue Feb  2 17:27:35 2021
@@ -1,9 +1,23 @@
-# $NetBSD: opt-debug-graph2.mk,v 1.1 2020/09/05 06:20:51 rillig Exp $
+# $NetBSD: opt-debug-graph2.mk,v 1.2 2021/02/02 17:27:35 rillig Exp $
 #
 # Tests for the -dg2 command line option, which prints the input
 # graph after making everything, or before exiting on error.
+#
+# FIXME: The documentation is wrong.  There is no debug output despite
+# the error.
+
+.MAKEFLAGS: -dg2
+
+.MAIN: all
+
+made-target: .PHONY
+	: 'Making $@.'
+
+error-target: .PHONY
+	false
 
-# TODO: Implementation
+aborted-target: .PHONY aborted-target-dependency
+aborted-target-dependency: .PHONY
+	false
 
-all:
-	@:;
+all: made-target error-target aborted-target
Index: src/usr.bin/make/unit-tests/opt-debug-graph3.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-graph3.exp:1.1 src/usr.bin/make/unit-tests/opt-debug-graph3.exp:1.2
--- src/usr.bin/make/unit-tests/opt-debug-graph3.exp:1.1	Sat Sep  5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-graph3.exp	Tue Feb  2 17:27:35 2021
@@ -1 +1,10 @@
-exit status 0
+: 'Making made-target.'
+false
+*** Error code 1 (continuing)
+false
+*** Error code 1 (continuing)
+`all' not remade because of errors.
+
+Stop.
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/opt-debug-graph3.mk
diff -u src/usr.bin/make/unit-tests/opt-debug-graph3.mk:1.1 src/usr.bin/make/unit-tests/opt-debug-graph3.mk:1.2
--- src/usr.bin/make/unit-tests/opt-debug-graph3.mk:1.1	Sat Sep  5 06:20:51 2020
+++ src/usr.bin/make/unit-tests/opt-debug-graph3.mk	Tue Feb  2 17:27:35 2021
@@ -1,9 +1,23 @@
-# $NetBSD: opt-debug-graph3.mk,v 1.1 2020/09/05 06:20:51 rillig Exp $
+# $NetBSD: opt-debug-graph3.mk,v 1.2 2021/02/02 17:27:35 rillig Exp $
 #
 # Tests for the -dg3 command line option, which prints the input
 # graph before exiting on error.
+#
+# FIXME: The documentation is wrong.  There is no debug output despite
+# the error.

CVS commit: src/usr.bin/make

2021-02-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Feb  2 16:18:16 UTC 2021

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: directive-export-impl.exp
var-op-append.exp vardebug.exp varmod-indirect.exp
varmod-match-escape.exp varname.exp

Log Message:
make: replace VarExprFlags with VarExprStatus

The combination of !VEF_UNDEF && VEF_DEF was not possible, which made it
rather strange to model this state as a bit set.

The only functional change is the renamed constants in the debug output.

Using ENUM_VALUE_RTTI_2 felt like overengineering since it's harder to
understand than a simple array of names.


To generate a diff of this commit:
cvs rdiff -u -r1.788 -r1.789 src/usr.bin/make/var.c
cvs rdiff -u -r1.1 -r1.2 \
src/usr.bin/make/unit-tests/directive-export-impl.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/var-op-append.exp
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/vardebug.exp
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-indirect.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-match-escape.exp
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varname.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/var.c
diff -u src/usr.bin/make/var.c:1.788 src/usr.bin/make/var.c:1.789
--- src/usr.bin/make/var.c:1.788	Tue Feb  2 15:41:14 2021
+++ src/usr.bin/make/var.c	Tue Feb  2 16:18:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.788 2021/02/02 15:41:14 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.789 2021/02/02 16:18:16 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.788 2021/02/02 15:41:14 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.789 2021/02/02 16:18:16 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -1971,21 +1971,24 @@ VarStrftime(const char *fmt, Boolean zul
  * Some modifiers need to free some memory.
  */
 
-typedef enum VarExprFlags {
-	VEF_NONE	= 0,
+typedef enum VarExprStatus {
+	/* The variable expression is based in a regular, defined variable. */
+	VES_NONE,
 	/* The variable expression is based on an undefined variable. */
-	VEF_UNDEF = 0x01,
+	VES_UNDEF,
 	/*
 	 * The variable expression started as an undefined expression, but one
 	 * of the modifiers (such as :D or :U) has turned the expression from
 	 * undefined to defined.
 	 */
-	VEF_DEF = 0x02
-} VarExprFlags;
-
-ENUM_FLAGS_RTTI_2(VarExprFlags,
-		  VEF_UNDEF, VEF_DEF);
+	VES_DEF
+} VarExprStatus;
 
+static const char * const VarExprStatus_Name[] = {
+	"none",
+	"VES_UNDEF",
+	"VES_DEF"
+};
 
 typedef struct ApplyModifiersState {
 	/* '\0' or '{' or '(' */
@@ -2008,14 +2011,14 @@ typedef struct ApplyModifiersState {
 	 * big word, possibly containing spaces.
 	 */
 	Boolean oneBigWord;
-	VarExprFlags exprFlags;
+	VarExprStatus exprStatus;
 } ApplyModifiersState;
 
 static void
 ApplyModifiersState_Define(ApplyModifiersState *st)
 {
-	if (st->exprFlags & VEF_UNDEF)
-		st->exprFlags |= VEF_DEF;
+	if (st->exprStatus == VES_UNDEF)
+		st->exprStatus = VES_DEF;
 }
 
 typedef enum ApplyModifierResult {
@@ -2325,7 +2328,7 @@ ApplyModifier_Defined(const char **pp, c
 
 	VarEvalFlags eflags = VARE_NONE;
 	if (st->eflags & VARE_WANTRES)
-		if ((**pp == 'D') == !(st->exprFlags & VEF_UNDEF))
+		if ((**pp == 'D') == (st->exprStatus == VES_NONE))
 			eflags = st->eflags;
 
 	Buf_Init();
@@ -3203,7 +3206,7 @@ ok:
 	}
 
 	ctxt = st->ctxt;	/* context where v belongs */
-	if (!(st->exprFlags & VEF_UNDEF) && st->ctxt != VAR_GLOBAL) {
+	if (st->exprStatus == VES_NONE && st->ctxt != VAR_GLOBAL) {
 		Var *gv = VarFind(st->var->name.str, st->ctxt, FALSE);
 		if (gv == NULL)
 			ctxt = VAR_GLOBAL;
@@ -3245,7 +3248,7 @@ ok:
 			break;
 		}
 		case '?':
-			if (!(st->exprFlags & VEF_UNDEF))
+			if (st->exprStatus == VES_NONE)
 break;
 			/* FALLTHROUGH */
 		default:
@@ -3396,7 +3399,6 @@ LogBeforeApply(const ApplyModifiersState
 {
 	char eflags_str[VarEvalFlags_ToStringSize];
 	char vflags_str[VarFlags_ToStringSize];
-	char exprflags_str[VarExprFlags_ToStringSize];
 	Boolean is_single_char = mod[0] != '\0' &&
  (mod[1] == endc || mod[1] == ':');
 
@@ -3406,7 +3408,7 @@ LogBeforeApply(const ApplyModifiersState
 	st->var->name.str, mod[0], is_single_char ? "" : "...", val,
 	VarEvalFlags_ToString(eflags_str, st->eflags),
 	VarFlags_ToString(vflags_str, st->var->flags),
-	VarExprFlags_ToString(exprflags_str, st->exprFlags));
+	VarExprStatus_Name[st->exprStatus]);
 }
 
 static void
@@ -3414,7 +3416,6 @@ LogAfterApply(ApplyModifiersState *st, c
 {
 	char eflags_str[VarEvalFlags_ToStringSize];
 	char vflags_str[VarFlags_ToStringSize];
-	char exprflags_str[VarExprFlags_ToStringSize];
 	const char *quot = st->newVal.str == var_Error ? "" : "\"";
 	

CVS commit: src/sys/dev/pci

2021-02-02 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Feb  2 16:11:43 UTC 2021

Modified Files:
src/sys/dev/pci: pucdata.c

Log Message:
Also match Oxford Semiconductor Exsys EX-41098 PCI UARTs


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/dev/pci/pucdata.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/pci/pucdata.c
diff -u src/sys/dev/pci/pucdata.c:1.108 src/sys/dev/pci/pucdata.c:1.109
--- src/sys/dev/pci/pucdata.c:1.108	Sat Jun 13 12:42:58 2020
+++ src/sys/dev/pci/pucdata.c	Tue Feb  2 16:11:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.108 2020/06/13 12:42:58 ryo Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.109 2021/02/02 16:11:43 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 Christopher G. Demetriou.  All rights reserved.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.108 2020/06/13 12:42:58 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.109 2021/02/02 16:11:43 bouyer Exp $");
 
 #include 
 #include 
@@ -1322,6 +1322,19 @@ const struct puc_device_description puc_
 	},
 	},
 
+	/* Oxford Semiconductor Exsys EX-41098 PCI UARTs */
+	{   "Oxford Semiconductor Exsys EX-41098 UARTs",
+	{	PCI_VENDOR_OXFORDSEMI,	PCI_PRODUCT_OXFORDSEMI_EXSYS_EX41098,
+		PCI_VENDOR_OXFORDSEMI,	0 },
+	{	0x,	0x,	0x,	0	},
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ * 8},
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x08, COM_FREQ * 8},
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x10, COM_FREQ * 8},
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x18, COM_FREQ * 8},
+	},
+	},
+
 	/* I-O DATA RSA-PCI2 eight(5-8) UARTs base on OX16PCI954 */
 	{   "I-O DATA RSA-PCI2/P8 (5-8) UARTs",
 	{	PCI_VENDOR_OXFORDSEMI,	PCI_PRODUCT_OXFORDSEMI_EXSYS_EX41098,



CVS commit: src/usr.bin/make

2021-02-02 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Feb  2 15:41:14 UTC 2021

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

Log Message:
make: replace enum bit-set with bit-field

No functional change.

The generated code from GCC 5.5 is very similar.  On x86_64, memory
access is no longer in 32-bit units but in 8-bit units since only the
first few bits are actually used.  The bit patterns are the same as
before, so if there is any difference in performance, GCC should have
chosen the more efficient variant all along.

In a previous experiment, the code size increased a lot, surprisingly.


To generate a diff of this commit:
cvs rdiff -u -r1.787 -r1.788 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.787 src/usr.bin/make/var.c:1.788
--- src/usr.bin/make/var.c:1.787	Mon Feb  1 19:46:58 2021
+++ src/usr.bin/make/var.c	Tue Feb  2 15:41:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.787 2021/02/01 19:46:58 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.788 2021/02/02 15:41:14 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.787 2021/02/01 19:46:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.788 2021/02/02 15:41:14 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -223,16 +223,16 @@ typedef enum UnexportWhat {
 } UnexportWhat;
 
 /* Flags for pattern matching in the :S and :C modifiers */
-typedef enum VarPatternFlags {
-	VARP_NONE		= 0,
+typedef struct VarPatternFlags {
+
 	/* Replace as often as possible ('g') */
-	VARP_SUB_GLOBAL		= 1 << 0,
+	Boolean subGlobal: 1;
 	/* Replace only once ('1') */
-	VARP_SUB_ONE		= 1 << 1,
+	Boolean subOnce: 1;
 	/* Match at start of word ('^') */
-	VARP_ANCHOR_START	= 1 << 2,
+	Boolean anchorStart: 1;
 	/* Match at end of word ('$') */
-	VARP_ANCHOR_END		= 1 << 3
+	Boolean anchorEnd: 1;
 } VarPatternFlags;
 
 /* SepBuf is a string being built from words, interleaved with separators. */
@@ -1440,15 +1440,15 @@ ModifyWord_Subst(const char *word, SepBu
 	struct ModifyWord_SubstArgs *args = data;
 	const char *match;
 
-	if ((args->pflags & VARP_SUB_ONE) && args->matched)
+	if (args->pflags.subOnce && args->matched)
 		goto nosub;
 
-	if (args->pflags & VARP_ANCHOR_START) {
+	if (args->pflags.anchorStart) {
 		if (wordLen < args->lhsLen ||
 		memcmp(word, args->lhs, args->lhsLen) != 0)
 			goto nosub;
 
-		if ((args->pflags & VARP_ANCHOR_END) && wordLen != args->lhsLen)
+		if ((args->pflags.anchorEnd) && wordLen != args->lhsLen)
 			goto nosub;
 
 		/* :S,^prefix,replacement, or :S,^whole$,replacement, */
@@ -1459,7 +1459,7 @@ ModifyWord_Subst(const char *word, SepBu
 		return;
 	}
 
-	if (args->pflags & VARP_ANCHOR_END) {
+	if (args->pflags.anchorEnd) {
 		const char *start;
 
 		if (wordLen < args->lhsLen)
@@ -1486,7 +1486,7 @@ ModifyWord_Subst(const char *word, SepBu
 		args->matched = TRUE;
 		wordLen -= (size_t)(match - word) + args->lhsLen;
 		word += (size_t)(match - word) + args->lhsLen;
-		if (wordLen == 0 || !(args->pflags & VARP_SUB_GLOBAL))
+		if (wordLen == 0 || !args->pflags.subGlobal)
 			break;
 	}
 nosub:
@@ -1527,7 +1527,7 @@ ModifyWord_SubstRegex(const char *word, 
 	int flags = 0;
 	regmatch_t m[10];
 
-	if ((args->pflags & VARP_SUB_ONE) && args->matched)
+	if (args->pflags.subOnce && args->matched)
 		goto nosub;
 
 tryagain:
@@ -1575,7 +1575,7 @@ tryagain:
 		}
 
 		wp += m[0].rm_eo;
-		if (args->pflags & VARP_SUB_GLOBAL) {
+		if (args->pflags.subGlobal) {
 			flags |= REG_NOTBOL;
 			if (m[0].rm_so == 0 && m[0].rm_eo == 0) {
 SepBuf_AddBytes(buf, wp, 1);
@@ -2093,7 +2093,7 @@ ParseModifierPartSubst(
 
 		if (p[1] == delim) {	/* Unescaped $ at end of pattern */
 			if (out_pflags != NULL)
-*out_pflags |= VARP_ANCHOR_END;
+out_pflags->anchorEnd = TRUE;
 			else
 Buf_AddByte(, *p);
 			p++;
@@ -2666,7 +2666,7 @@ ApplyModifier_Subst(const char **pp, con
 
 	*pp += 2;
 
-	args.pflags = VARP_NONE;
+	args.pflags = (VarPatternFlags){ FALSE, FALSE, FALSE, FALSE };
 	args.matched = FALSE;
 
 	/*
@@ -2674,7 +2674,7 @@ ApplyModifier_Subst(const char **pp, con
 	 * start of the word -- skip over it and flag pattern.
 	 */
 	if (**pp == '^') {
-		args.pflags |= VARP_ANCHOR_START;
+		args.pflags.anchorStart = TRUE;
 		(*pp)++;
 	}
 
@@ -2694,10 +2694,10 @@ ApplyModifier_Subst(const char **pp, con
 	for (;; (*pp)++) {
 		switch (**pp) {
 		case 'g':
-			args.pflags |= VARP_SUB_GLOBAL;
+			args.pflags.subGlobal = TRUE;
 			continue;
 		case '1':
-			args.pflags |= VARP_SUB_ONE;
+			args.pflags.subOnce = TRUE;
 			continue;
 		case 'W':
 			oneBigWord = TRUE;
@@ -2745,16 +2745,16 @@ ApplyModifier_Regex(const char **pp, con
 		return AMR_CLEANUP;
 	}
 
-	args.pflags = VARP_NONE;
+	args.pflags = (VarPatternFlags){ FALSE, FALSE, FALSE, 

CVS commit: src/sys/netinet

2021-02-02 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Tue Feb  2 10:48:33 UTC 2021

Modified Files:
src/sys/netinet: if_arp.c

Log Message:
arp: Plug an mbuf leak


To generate a diff of this commit:
cvs rdiff -u -r1.297 -r1.298 src/sys/netinet/if_arp.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/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.297 src/sys/netinet/if_arp.c:1.298
--- src/sys/netinet/if_arp.c:1.297	Tue Sep 15 10:05:36 2020
+++ src/sys/netinet/if_arp.c	Tue Feb  2 10:48:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.297 2020/09/15 10:05:36 roy Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.298 2021/02/02 10:48:33 yamt Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.297 2020/09/15 10:05:36 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.298 2021/02/02 10:48:33 yamt Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1389,7 +1389,7 @@ arp_llinfo_missed(struct ifnet *ifp, con
 			mdaddr = ip->ip_src;
 
 		/* ip_input() will send ICMP_UNREACH_HOST, not us. */
-		m_free(m);
+		m_freem(m);
 	}
 
 	if (mdaddr.s_addr != INADDR_ANY) {



CVS commit: src/sys/dev/usb

2021-02-02 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Tue Feb  2 10:46:18 UTC 2021

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

Log Message:
if_urtwn.c: Plug a few leaks

Can be a cause of PR/55968


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/usb/if_urtwn.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/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.92 src/sys/dev/usb/if_urtwn.c:1.93
--- src/sys/dev/usb/if_urtwn.c:1.92	Tue Feb  2 00:27:38 2021
+++ src/sys/dev/usb/if_urtwn.c	Tue Feb  2 10:46:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.92 2021/02/02 00:27:38 yamt Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.93 2021/02/02 10:46:17 yamt Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.92 2021/02/02 00:27:38 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.93 2021/02/02 10:46:17 yamt Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2587,6 +2587,17 @@ urtwn_rxeof(struct usbd_xfer *xfer, void
 }
 
 static void
+urtwn_put_tx_data(struct urtwn_softc *sc, struct urtwn_tx_data *data)
+{
+	size_t pidx = data->pidx;
+
+	mutex_enter(>sc_tx_mtx);
+	/* Put this Tx buffer back to our free list. */
+	TAILQ_INSERT_TAIL(>tx_free_list[pidx], data, next);
+	mutex_exit(>sc_tx_mtx);
+}
+
+static void
 urtwn_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status)
 {
 	struct urtwn_tx_data *data = priv;
@@ -2598,10 +2609,7 @@ urtwn_txeof(struct usbd_xfer *xfer, void
 	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 	DPRINTFN(DBG_TX, "status=%jd", status, 0, 0, 0);
 
-	mutex_enter(>sc_tx_mtx);
-	/* Put this Tx buffer back to our free list. */
-	TAILQ_INSERT_TAIL(>tx_free_list[pidx], data, next);
-	mutex_exit(>sc_tx_mtx);
+	urtwn_put_tx_data(sc, data);
 
 	s = splnet();
 	sc->tx_timer = 0;
@@ -2650,8 +2658,10 @@ urtwn_tx(struct urtwn_softc *sc, struct 
 
 	if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
 		k = ieee80211_crypto_encap(ic, ni, m);
-		if (k == NULL)
+		if (k == NULL) {
+			urtwn_put_tx_data(sc, data);
 			return ENOBUFS;
+		}
 
 		/* packet header may have moved, reset our local pointer */
 		wh = mtod(m, struct ieee80211_frame *);
@@ -2908,6 +2918,7 @@ urtwn_start(struct ifnet *ifp)
 		(m = m_pullup(m, sizeof(*eh))) == NULL) {
 			printf("ERROR6\n");
 			if_statinc(ifp, if_oerrors);
+			urtwn_put_tx_data(sc, data);
 			continue;
 		}
 		eh = mtod(m, struct ether_header *);
@@ -2916,6 +2927,7 @@ urtwn_start(struct ifnet *ifp)
 			m_freem(m);
 			printf("ERROR5\n");
 			if_statinc(ifp, if_oerrors);
+			urtwn_put_tx_data(sc, data);
 			continue;
 		}
 
@@ -2925,6 +2937,7 @@ urtwn_start(struct ifnet *ifp)
 			ieee80211_free_node(ni);
 			printf("ERROR4\n");
 			if_statinc(ifp, if_oerrors);
+			urtwn_put_tx_data(sc, data);
 			continue;
 		}
  sendit:



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

2021-02-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb  2 08:18:42 UTC 2021

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

Log Message:
Worakround for traps on invalid VAs:
uvm_fault() can not (currently) deal properly with invalid VAs (inside the
VA hole), so do not pass faults for such addresses to it, but instead
either panic (if fault is in kernel) or send a SIGSEGV to userland.


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 src/sys/arch/sparc64/sparc64/trap.c

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

Modified files:

Index: src/sys/arch/sparc64/sparc64/trap.c
diff -u src/sys/arch/sparc64/sparc64/trap.c:1.192 src/sys/arch/sparc64/sparc64/trap.c:1.193
--- src/sys/arch/sparc64/sparc64/trap.c:1.192	Thu Nov 21 19:24:01 2019
+++ src/sys/arch/sparc64/sparc64/trap.c	Tue Feb  2 08:18:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.192 2019/11/21 19:24:01 ad Exp $ */
+/*	$NetBSD: trap.c,v 1.193 2021/02/02 08:18:42 martin Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.192 2019/11/21 19:24:01 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.193 2021/02/02 08:18:42 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1092,6 +1092,25 @@ data_access_fault(struct trapframe64 *tf
 	sticks = p->p_sticks;
 	tstate = tf->tf_tstate;
 
+#ifdef _LP64
+	/* deal with invalid VAs early */
+	if (__predict_false(addr >= (1UL<