Re: CVS commit: src/sys/kern

2021-06-30 Thread David Holland
On Thu, Jul 01, 2021 at 12:25:51AM -0400, Christos Zoulas wrote:
 > Modified Files:
 >  src/sys/kern: vfs_vnops.c
 > 
 > Log Message:
 > don't clear the error before we use it to determine if we are moving or 
 > duping.

oh ffs...

*goes to soak head*

-- 
David A. Holland
dholl...@netbsd.org


CVS commit: src/sys/kern

2021-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul  1 04:25:51 UTC 2021

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
don't clear the error before we use it to determine if we are moving or duping.


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.219 src/sys/kern/vfs_vnops.c

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



CVS commit: src/sys/kern

2021-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul  1 04:25:51 UTC 2021

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
don't clear the error before we use it to determine if we are moving or duping.


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.219 src/sys/kern/vfs_vnops.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/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.218 src/sys/kern/vfs_vnops.c:1.219
--- src/sys/kern/vfs_vnops.c:1.218	Wed Jun 30 13:51:49 2021
+++ src/sys/kern/vfs_vnops.c	Thu Jul  1 00:25:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnops.c,v 1.218 2021/06/30 17:51:49 dholland Exp $	*/
+/*	$NetBSD: vfs_vnops.c,v 1.219 2021/07/01 04:25:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.218 2021/06/30 17:51:49 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.219 2021/07/01 04:25:51 christos Exp $");
 
 #include "veriexec.h"
 
@@ -339,10 +339,10 @@ out:
 			error = EOPNOTSUPP;
 			break;
 		}
-		error = 0;
 		*ret_vp = NULL;
 		*ret_domove = error == EMOVEFD;
 		*ret_fd = l->l_dupfd;
+		error = 0;
 		break;
 	case 0:
 		*ret_vp = vp;



CVS commit: src/sys/dev/pckbport

2021-06-30 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Wed Jun 30 22:13:27 UTC 2021

Modified Files:
src/sys/dev/pckbport: synapticsvar.h

Log Message:
Fix hardcoded size for total_patckets array in synaptics_softc, it
needs to be SYN_MAX_FINGERS because the driver expects it to be.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pckbport/synapticsvar.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/pckbport/synapticsvar.h
diff -u src/sys/dev/pckbport/synapticsvar.h:1.10 src/sys/dev/pckbport/synapticsvar.h:1.11
--- src/sys/dev/pckbport/synapticsvar.h:1.10	Mon Apr 27 22:31:47 2020
+++ src/sys/dev/pckbport/synapticsvar.h	Wed Jun 30 22:13:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: synapticsvar.h,v 1.10 2020/04/27 22:31:47 jmcneill Exp $	*/
+/*	$NetBSD: synapticsvar.h,v 1.11 2021/06/30 22:13:27 blymn Exp $	*/
 
 /*
  * Copyright (c) 2005, Steve C. Woodford
@@ -38,6 +38,8 @@
 #ifndef _DEV_PCKBCPORT_SYNAPTICSVAR_H_
 #define _DEV_PCKBCPORT_SYNAPTICSVAR_H_
 
+#define SYN_MAX_FINGERS 2
+
 struct synaptics_softc {
 	int	caps;
 
@@ -56,7 +58,9 @@ struct synaptics_softc {
 #define	SYN_FLAG_HAS_EXTENDED_WMODE		(1 << 11)
 #define	SYN_FLAG_HAS_ADV_GESTURE_MODE		(1 << 12)
 
-	u_int	total_packets[2];	/* Total number of packets received */
+	/* Total number of packets received */
+	u_int	total_packets[SYN_MAX_FINGERS];
+
 #define	SYN_TIME(sc,c,n)	(((sc)->total_packets[(n)] >= (c)) ?	\
 ((sc)->total_packets[(n)] - (c)) :	\
 ((c) - (sc)->total_packets[(n)]))
@@ -79,7 +83,6 @@ struct synaptics_softc {
 #define	SYN_IS_DRAG(t)		((t) & SYN_GESTURE_DRAG)
 
 #define	SYN_HIST_SIZE	4
-#define SYN_MAX_FINGERS 2
 	char	button_history;
 	int	dz_hold;
 	int	rem_x[SYN_MAX_FINGERS];



CVS commit: src/sys/dev/pckbport

2021-06-30 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Wed Jun 30 22:13:27 UTC 2021

Modified Files:
src/sys/dev/pckbport: synapticsvar.h

Log Message:
Fix hardcoded size for total_patckets array in synaptics_softc, it
needs to be SYN_MAX_FINGERS because the driver expects it to be.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pckbport/synapticsvar.h

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



CVS commit: src/sys/kern

2021-06-30 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Wed Jun 30 21:52:16 UTC 2021

Modified Files:
src/sys/kern: kern_pmf.c

Log Message:
Prevent kernel panic on sleep if network interface driver does not
have if_stop defined.  This is a common problem with usb adaptors.
This is a temporary fix, the printf needs to be converted to an
assert once the drivers are cleaned up.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/kern/kern_pmf.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/kern/kern_pmf.c
diff -u src/sys/kern/kern_pmf.c:1.45 src/sys/kern/kern_pmf.c:1.46
--- src/sys/kern/kern_pmf.c:1.45	Thu Jun 11 02:30:21 2020
+++ src/sys/kern/kern_pmf.c	Wed Jun 30 21:52:16 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_pmf.c,v 1.45 2020/06/11 02:30:21 thorpej Exp $ */
+/* $NetBSD: kern_pmf.c,v 1.46 2021/06/30 21:52:16 blymn Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_pmf.c,v 1.45 2020/06/11 02:30:21 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pmf.c,v 1.46 2021/06/30 21:52:16 blymn Exp $");
 
 #include 
 #include 
@@ -892,11 +892,18 @@ pmf_class_network_suspend(device_t dev, 
 	struct ifnet *ifp = device_pmf_class_private(dev);
 	int s;
 
-	s = splnet();
-	IFNET_LOCK(ifp);
-	(*ifp->if_stop)(ifp, 0);
-	IFNET_UNLOCK(ifp);
-	splx(s);
+	if (ifp == NULL)
+		return true;
+
+	if ((*ifp->if_stop) == NULL)
+		printf("device %s has no if_stop\n", ifp->if_xname);
+	else {
+		s = splnet();
+		IFNET_LOCK(ifp);
+		(*ifp->if_stop)(ifp, 0);
+		IFNET_UNLOCK(ifp);
+		splx(s);
+	}
 
 	return true;
 }



CVS commit: src/sys/kern

2021-06-30 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Wed Jun 30 21:52:16 UTC 2021

Modified Files:
src/sys/kern: kern_pmf.c

Log Message:
Prevent kernel panic on sleep if network interface driver does not
have if_stop defined.  This is a common problem with usb adaptors.
This is a temporary fix, the printf needs to be converted to an
assert once the drivers are cleaned up.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/kern/kern_pmf.c

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



CVS commit: src/lib/libc/arch/arm

2021-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 30 21:20:30 UTC 2021

Modified Files:
src/lib/libc/arch/arm/gen: swapcontext.S
src/lib/libc/arch/arm/sys: __clone.S

Log Message:
Do previous differtly by pushing two registers in the same way as the
_INVOKE_CERROR macro


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/arch/arm/gen/swapcontext.S
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/arch/arm/sys/__clone.S

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

Modified files:

Index: src/lib/libc/arch/arm/gen/swapcontext.S
diff -u src/lib/libc/arch/arm/gen/swapcontext.S:1.17 src/lib/libc/arch/arm/gen/swapcontext.S:1.18
--- src/lib/libc/arch/arm/gen/swapcontext.S:1.17	Wed Jun 30 00:00:49 2021
+++ src/lib/libc/arch/arm/gen/swapcontext.S	Wed Jun 30 21:20:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: swapcontext.S,v 1.17 2021/06/30 00:00:49 rin Exp $	*/
+/*	$NetBSD: swapcontext.S,v 1.18 2021/06/30 21:20:29 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "assym.h"
 
 #if defined(LIBC_SCCS) && !defined(lint)
-RCSID("$NetBSD: swapcontext.S,v 1.17 2021/06/30 00:00:49 rin Exp $")
+RCSID("$NetBSD: swapcontext.S,v 1.18 2021/06/30 21:20:29 skrll Exp $")
 #endif /* LIBC_SCCS && !lint */
 
 ENTRY(swapcontext)
@@ -84,15 +84,9 @@ ENTRY(swapcontext)
 #if !defined(__thumb__) || defined(_ARM_ARCH_T2)
 	b	PLT_SYM(_C_LABEL(setcontext))
 #else
-	push	{lr}
-	mov	r1, sp
-	subs	r1, #4
-	mov	sp, r1
+	push	{r3, lr}
 	bl	PLT_SYM(_C_LABEL(setcontext))
-	mov	r1, sp
-	adds	r1, #4
-	mov	sp, r1
-	pop	{pc}
+	pop	{r3, pc}
 #endif
 #if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__)
 	.cfi_endproc

Index: src/lib/libc/arch/arm/sys/__clone.S
diff -u src/lib/libc/arch/arm/sys/__clone.S:1.13 src/lib/libc/arch/arm/sys/__clone.S:1.14
--- src/lib/libc/arch/arm/sys/__clone.S:1.13	Wed Jun 30 07:36:05 2021
+++ src/lib/libc/arch/arm/sys/__clone.S	Wed Jun 30 21:20:30 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: __clone.S,v 1.13 2021/06/30 07:36:05 skrll Exp $ */
+/* $NetBSD: __clone.S,v 1.14 2021/06/30 21:20:30 skrll Exp $ */
 
 /*
  * Copyright (c) 2001 Christopher Gilbert
@@ -117,14 +117,8 @@ ENTRY(__clone)
 	b	CERROR
 #else
 .Lcerror:
-	push	{lr}
-	mov	r1, sp
-	subs	r1, #4
-	mov	sp, r1
+	push	{r3, lr}
 	bl	CERROR
-	mov	r1, sp
-	adds	r1, #4
-	mov	sp, r1
-	pop	{pc}
+	pop	{r3, pc}
 #endif
 END(__clone)



CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm

2021-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 30 21:18:00 UTC 2021

Modified Files:
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm: aeabi_cfcmp.S
divmodsi4.S divsi3.S modsi3.S

Log Message:
Do previous differently by pushing even number of registers and remove
strange r7 usage.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S

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



CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm

2021-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 30 21:18:00 UTC 2021

Modified Files:
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm: aeabi_cfcmp.S
divmodsi4.S divsi3.S modsi3.S

Log Message:
Do previous differently by pushing even number of registers and remove
strange r7 usage.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S \
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S

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

Modified files:

Index: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S:1.2 src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S:1.3
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S:1.2	Tue Jun 29 23:26:00 2021
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S	Wed Jun 30 21:18:00 2021
@@ -27,12 +27,11 @@
 .syntax unified
 .p2align 2
 DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmpeq)
-push {r0-r3, lr}
-sub sp, #4
+// Save ip to ensure stack alignment (could be any register)
+push {r0-r3, ip, lr}
 bl __aeabi_cfcmpeq_check_nan
 cmp r0, #1
-add sp, #4
-pop {r0-r3, lr}
+pop {r0-r3, ip, lr}
 
 // NaN has been ruled out, so __aeabi_cfcmple can't trap
 bne __aeabi_cfcmple
@@ -57,17 +56,15 @@ END_COMPILERRT_FUNCTION(__aeabi_cfcmpeq)
 DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmple)
 // Per the RTABI, this function must preserve r0-r11.
 // Save lr in the same instruction for compactness
-push {r0-r3, lr}
-sub sp, #4
+// Save ip to ensure stack alignment (could be any register)
+push {r0-r3, ip, lr}
 
 bl __aeabi_fcmplt
 cmp r0, #1
 moveq ip, #0
 beq 1f
 
-add sp, #4
 ldm sp, {r0-r3}
-sub sp, #4
 bl __aeabi_fcmpeq
 cmp r0, #1
 moveq ip, #(APSR_C | APSR_Z)
@@ -75,8 +72,7 @@ DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmp
 
 1:
 msr CPSR_f, ip
-add sp, #4
-pop {r0-r3}
+pop {r0-r3, ip}
 POP_PC()
 END_COMPILERRT_FUNCTION(__aeabi_cfcmple)
 
Index: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S:1.2 src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S:1.3
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S:1.2	Tue Jun 29 23:26:00 2021
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S	Wed Jun 30 21:18:00 2021
@@ -16,12 +16,9 @@
 #include "../assembly.h"
 
 #define ESTABLISH_FRAME\
-push   {r4-r7, lr}   ;\
-add r7, sp, #12   ;\
-sub sp, #4
+push   {r4-r6, lr}
 #define CLEAR_FRAME_AND_RETURN \
-add sp, #4   ;\
-pop{r4-r7, pc}
+pop{r4-r6, pc}
 
 	.syntax unified
 	.text
Index: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S:1.2 src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S:1.3
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S:1.2	Tue Jun 29 23:26:00 2021
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S	Wed Jun 30 21:18:00 2021
@@ -15,12 +15,9 @@
 #include "../assembly.h"
 
 #define ESTABLISH_FRAME \
-push   {r4, r7, lr};\
-add r7, sp, #4   ;\
-sub sp, #4
+push   {r4, lr}
 #define CLEAR_FRAME_AND_RETURN \
-add sp, #4   ;\
-pop{r4, r7, pc}
+pop{r4, pc}
 
 	.syntax unified
 	.text
Index: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S
diff -u src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S:1.2 src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S:1.3
--- src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S:1.2	Tue Jun 29 23:26:00 2021
+++ src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S	Wed Jun 30 21:18:00 2021
@@ -15,12 +15,9 @@
 #include "../assembly.h"
 
 #define ESTABLISH_FRAME \
-push   {r4, r7, lr};\
-add r7, sp, #4   ;\
-sub sp, #4
+push   {r4, lr}
 #define CLEAR_FRAME_AND_RETURN \
-add sp, #4   ;\
-pop{r4, r7, pc}
+pop{r4, pc}
 
 	.syntax unified
 	.text



CVS commit: src/lib/libc/arch/arm

2021-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 30 21:20:30 UTC 2021

Modified Files:
src/lib/libc/arch/arm/gen: swapcontext.S
src/lib/libc/arch/arm/sys: __clone.S

Log Message:
Do previous differtly by pushing two registers in the same way as the
_INVOKE_CERROR macro


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/arch/arm/gen/swapcontext.S
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/arch/arm/sys/__clone.S

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



CVS commit: src/sys/dev/ic

2021-06-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jun 30 20:00:18 UTC 2021

Modified Files:
src/sys/dev/ic: ax88190.c dl10019.c dp8390.c dp8390var.h

Log Message:
Fix a couple of problems with MII-equipped NE2000 derivatives reported by
Björn Johannesson on current-users@:

- Re-factor dp8390_stop() into dp8390_halt() (that does the stuff to
  halt the hardware) and dp8390_stop() (which alls dp8390_halt() before
  calling mii_down() via sc->sc_stop_card()).  This prevents us from
  calling mii_down() before all of the interface data structures have
  been set up, which these days can trip a KASSERT().

- Add a 1-second timer to call mii_tick(), and enable it in the
  sc->sc_init_card() callback, and cancel it in the sc->sc_stop_card()
  and sc->sc_media_fini() callbacks.  This is actually a long-standing
  bug that previously didn't have much practical effect, but causes
  problems with dhcpcd's link live-ness detection logic.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/ax88190.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/dl10019.c
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/ic/dp8390.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/ic/dp8390var.h

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



CVS commit: src/sys/dev/ic

2021-06-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jun 30 20:00:18 UTC 2021

Modified Files:
src/sys/dev/ic: ax88190.c dl10019.c dp8390.c dp8390var.h

Log Message:
Fix a couple of problems with MII-equipped NE2000 derivatives reported by
Björn Johannesson on current-users@:

- Re-factor dp8390_stop() into dp8390_halt() (that does the stuff to
  halt the hardware) and dp8390_stop() (which alls dp8390_halt() before
  calling mii_down() via sc->sc_stop_card()).  This prevents us from
  calling mii_down() before all of the interface data structures have
  been set up, which these days can trip a KASSERT().

- Add a 1-second timer to call mii_tick(), and enable it in the
  sc->sc_init_card() callback, and cancel it in the sc->sc_stop_card()
  and sc->sc_media_fini() callbacks.  This is actually a long-standing
  bug that previously didn't have much practical effect, but causes
  problems with dhcpcd's link live-ness detection logic.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/ax88190.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/dl10019.c
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/ic/dp8390.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/ic/dp8390var.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/ic/ax88190.c
diff -u src/sys/dev/ic/ax88190.c:1.16 src/sys/dev/ic/ax88190.c:1.17
--- src/sys/dev/ic/ax88190.c:1.16	Tue Feb  4 05:25:39 2020
+++ src/sys/dev/ic/ax88190.c	Wed Jun 30 20:00:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ax88190.c,v 1.16 2020/02/04 05:25:39 thorpej Exp $	*/
+/*	$NetBSD: ax88190.c,v 1.17 2021/06/30 20:00:18 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ax88190.c,v 1.16 2020/02/04 05:25:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ax88190.c,v 1.17 2021/06/30 20:00:18 thorpej Exp $");
 
 #include 
 #include 
@@ -80,12 +80,27 @@ static const struct mii_bitbang_ops ax88
 	}
 };
 
+static void
+ax88190_tick(void *arg)
+{
+	struct dp8390_softc *sc = arg;
+	int s;
+
+	s = splnet();
+	mii_tick(>sc_mii);
+	splx(s);
+
+	callout_schedule(>sc_tick_ch, hz);
+}
+
 void
 ax88190_media_init(struct dp8390_softc *sc)
 {
 	struct ifnet *ifp = >sc_ec.ec_if;
 	struct mii_data *mii = >sc_mii;
 
+	callout_setfunc(>sc_tick_ch, ax88190_tick, sc);
+
 	mii->mii_ifp = ifp;
 	mii->mii_readreg = ax88190_mii_readreg;
 	mii->mii_writereg = ax88190_mii_writereg;
@@ -107,8 +122,9 @@ void
 ax88190_media_fini(struct dp8390_softc *sc)
 {
 
+	callout_stop(>sc_tick_ch);
 	mii_detach(>sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
-	ifmedia_fini(>sc_mii.mii_media);
+	/* dp8390_detach() will call ifmedia_fini(). */
 }
 
 int
@@ -135,12 +151,14 @@ ax88190_init_card(struct dp8390_softc *s
 {
 
 	mii_mediachg(>sc_mii);
+	callout_schedule(>sc_tick_ch, hz);
 }
 
 void
 ax88190_stop_card(struct dp8390_softc *sc)
 {
 
+	callout_stop(>sc_tick_ch);
 	mii_down(>sc_mii);
 }
 

Index: src/sys/dev/ic/dl10019.c
diff -u src/sys/dev/ic/dl10019.c:1.15 src/sys/dev/ic/dl10019.c:1.16
--- src/sys/dev/ic/dl10019.c:1.15	Tue Feb  4 05:25:39 2020
+++ src/sys/dev/ic/dl10019.c	Wed Jun 30 20:00:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dl10019.c,v 1.15 2020/02/04 05:25:39 thorpej Exp $	*/
+/*	$NetBSD: dl10019.c,v 1.16 2021/06/30 20:00:18 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dl10019.c,v 1.15 2020/02/04 05:25:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dl10019.c,v 1.16 2021/06/30 20:00:18 thorpej Exp $");
 
 #include 
 #include 
@@ -113,12 +113,27 @@ dl10019_mii_reset(struct dp8390_softc *s
 	bus_space_write_1(sc->sc_regt, sc->sc_regh, NEDL_DL0_GPIO, 0x00);
 }
 
+static void
+dl10019_tick(void *arg)
+{
+	struct dp8390_softc *sc = arg;
+	int s;
+
+	s = splnet();
+	mii_tick(>sc_mii);
+	splx(s);
+
+	callout_schedule(>sc_tick_ch, hz);
+}
+
 void
 dl10019_media_init(struct dp8390_softc *sc)
 {
 	struct ifnet *ifp = >sc_ec.ec_if;
 	struct mii_data *mii = >sc_mii;
 
+	callout_setfunc(>sc_tick_ch, dl10019_tick, sc);
+
 	mii->mii_ifp = ifp;
 	mii->mii_readreg = dl10019_mii_readreg;
 	mii->mii_writereg = dl10019_mii_writereg;
@@ -142,8 +157,9 @@ void
 dl10019_media_fini(struct dp8390_softc *sc)
 {
 
+	callout_stop(>sc_tick_ch);
 	mii_detach(>sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
-	ifmedia_fini(>sc_mii.mii_media);
+	/* dp8390_detach() will call ifmedia_fini(). */
 }
 
 int
@@ -171,12 +187,14 @@ dl10019_init_card(struct dp8390_softc *s
 
 	dl10019_mii_reset(sc);
 	mii_mediachg(>sc_mii);
+	callout_schedule(>sc_tick_ch, hz);
 }
 
 void
 dl10019_stop_card(struct dp8390_softc *sc)
 {
 
+	callout_stop(>sc_tick_ch);
 	mii_down(>sc_mii);
 }
 

Index: src/sys/dev/ic/dp8390.c
diff -u src/sys/dev/ic/dp8390.c:1.97 src/sys/dev/ic/dp8390.c:1.98
--- src/sys/dev/ic/dp8390.c:1.97	Tue Feb  4 05:25:39 2020
+++ src/sys/dev/ic/dp8390.c	Wed Jun 30 20:00:18 2021
@@ -1,4 

Re: CVS commit: src

2021-06-30 Thread David Holland
On Wed, Jun 30, 2021 at 06:42:21PM +0900, Rin Okuyama wrote:
 > /home/source/ab/HEAD/src/sys/kern/vfs_vnops.c:357:11: error: 'vp' may be 
 > used uninitialized in this function [-Werror=maybe-uninitialized]
 >   357 |   *ret_vp = vp;
 >   |   ^~~~
 > cc1: all warnings being treated as errors

If this still occurs (may depend on gcc version as usual), the fix is:

Index: sys/kern/vfs_vnops.c
===
RCS file: /cvsroot/src/sys/kern/vfs_vnops.c,v
retrieving revision 1.218
diff -u -p -r1.218 vfs_vnops.c
--- sys/kern/vfs_vnops.c30 Jun 2021 17:51:49 -  1.218
+++ sys/kern/vfs_vnops.c30 Jun 2021 17:53:56 -
@@ -214,8 +214,10 @@ vn_open(struct vnode *at_dvp, struct pat
l->l_dupfd = 0;
 
error = namei();
-   if (error)
+   if (error) {
+   vp = NULL;
goto out;
+   }
 
vp = nd.ni_vp;
 

This is the only remaining path I see that the compiler might
reasonably get confused about.

-- 
David A. Holland
dholl...@netbsd.org


CVS commit: src/sys/kern

2021-06-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Jun 30 17:51:49 UTC 2021

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
Improve Christos's vn_open fix.

- assert about api misuse up front (suggested by riastradh)
- restore the behavior of returning EOPNOTSUPP if ret_fd is NULL and we
  get a fd back (otherwise things like ktruss -o /dev/stderr panic)
- clear error to 0 for the EDUPFD and EMOVEFD cases so opening a
  cloner succeeds


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 src/sys/kern/vfs_vnops.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/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.217 src/sys/kern/vfs_vnops.c:1.218
--- src/sys/kern/vfs_vnops.c:1.217	Wed Jun 30 11:20:32 2021
+++ src/sys/kern/vfs_vnops.c	Wed Jun 30 17:51:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnops.c,v 1.217 2021/06/30 11:20:32 christos Exp $	*/
+/*	$NetBSD: vfs_vnops.c,v 1.218 2021/06/30 17:51:49 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.217 2021/06/30 11:20:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.218 2021/06/30 17:51:49 dholland Exp $");
 
 #include "veriexec.h"
 
@@ -173,6 +173,9 @@ vn_open(struct vnode *at_dvp, struct pat
 
 	KASSERT((nmode & (TRYEMULROOT | NOCHROOT)) == nmode);
 
+	KASSERT(ret_vp != NULL);
+	KASSERT((ret_domove == NULL) == (ret_fd == NULL));
+
 	if ((fmode & (O_CREAT | O_DIRECTORY)) == (O_CREAT | O_DIRECTORY))
 		return EINVAL;
 
@@ -332,9 +335,11 @@ out:
 	case EDUPFD:
 	case EMOVEFD:
 		/* if the caller isn't prepared to handle fds, fail for them */
-		KASSERTMSG(ret_domove && ret_fd,
-		"caller did not supply ret_domove and ret_fd for %d",
-		error);
+		if (ret_fd == NULL) {
+			error = EOPNOTSUPP;
+			break;
+		}
+		error = 0;
 		*ret_vp = NULL;
 		*ret_domove = error == EMOVEFD;
 		*ret_fd = l->l_dupfd;



CVS commit: src/sys/kern

2021-06-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Jun 30 17:51:49 UTC 2021

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
Improve Christos's vn_open fix.

- assert about api misuse up front (suggested by riastradh)
- restore the behavior of returning EOPNOTSUPP if ret_fd is NULL and we
  get a fd back (otherwise things like ktruss -o /dev/stderr panic)
- clear error to 0 for the EDUPFD and EMOVEFD cases so opening a
  cloner succeeds


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 src/sys/kern/vfs_vnops.c

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



CVS commit: src/sys/dev

2021-06-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jun 30 17:34:03 UTC 2021

Modified Files:
src/sys/dev: devlist2h.awk

Log Message:
devlist2h.awk: Nix trailing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/devlist2h.awk

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/devlist2h.awk
diff -u src/sys/dev/devlist2h.awk:1.4 src/sys/dev/devlist2h.awk:1.5
--- src/sys/dev/devlist2h.awk:1.4	Tue Jun 29 21:03:36 2021
+++ src/sys/dev/devlist2h.awk	Wed Jun 30 17:34:03 2021
@@ -1,5 +1,5 @@
 #! /usr/bin/awk -f
-#	$NetBSD: devlist2h.awk,v 1.4 2021/06/29 21:03:36 pgoyette Exp $
+#	$NetBSD: devlist2h.awk,v 1.5 2021/06/30 17:34:03 riastradh Exp $
 #
 # Copyright (c) 1995, 1996 Christopher G. Demetriou
 # All rights reserved.
@@ -31,7 +31,7 @@
 #
 
 function collectline(f) {
-	oparen = 0 
+	oparen = 0
 	line = ""
 	while (f <= NF) {
 		if ($f == "#") {
@@ -40,7 +40,7 @@ function collectline(f) {
 			f++
 			continue
 		}
-		if (oparen) {  
+		if (oparen) {
 			line = line $f
 			if (f < NF)
 			line = line " "



CVS commit: src/sys/dev

2021-06-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jun 30 17:34:03 UTC 2021

Modified Files:
src/sys/dev: devlist2h.awk

Log Message:
devlist2h.awk: Nix trailing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/devlist2h.awk

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



Re: CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm

2021-06-30 Thread Nick Hudson

On 30/06/2021 15:13, Joerg Sonnenberger wrote:

On Tue, Jun 29, 2021 at 11:26:00PM +, Rin Okuyama wrote:

Module Name:src
Committed By:   rin
Date:   Tue Jun 29 23:26:00 UTC 2021

Modified Files:
src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm: aeabi_cfcmp.S
divmodsi4.S divsi3.S modsi3.S

Log Message:
Align sp to 8-byte boundary as required by EABI.


Why not just push/pop another register? That's how it is normally done
for generated code.


https://mail-index.netbsd.org/port-arm/2021/06/30/msg007341.html

Nick


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

2021-06-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Jun 30 14:54:03 UTC 2021

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
No need to bother to use aprint_debug(9) inside #ifdef DEBUG block.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/hp300/dev/rd.c

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



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

2021-06-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Jun 30 14:54:03 UTC 2021

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
No need to bother to use aprint_debug(9) inside #ifdef DEBUG block.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/hp300/dev/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.103 src/sys/arch/hp300/dev/rd.c:1.104
--- src/sys/arch/hp300/dev/rd.c:1.103	Sun Jan 10 00:58:56 2021
+++ src/sys/arch/hp300/dev/rd.c	Wed Jun 30 14:54:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.103 2021/01/10 00:58:56 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.104 2021/06/30 14:54:03 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.103 2021/01/10 00:58:56 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.104 2021/06/30 14:54:03 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -429,20 +429,20 @@ rdident(device_t parent, struct rd_softc
 
 #ifdef DEBUG
 	if (rddebug & RDB_IDENT) {
-		aprint_debug("\n");
-		aprint_debug_dev(sc->sc_dev, "name: %x ('%s')\n",
-		desc->d_name, name);
-		aprint_debug("  iuw %x, maxxfr %d, ctype %d\n",
+		aprint_normal("\n");
+		aprint_normal_dev(sc->sc_dev, "id: 0x%04x, name: %x ('%s')\n",
+		ha->ha_id, desc->d_name, name);
+		aprint_normal("  iuw %x, maxxfr %d, ctype %d\n",
 		desc->d_iuw, desc->d_cmaxxfr, desc->d_ctype);
-		aprint_debug("  utype %d, bps %d, blkbuf %d, burst %d,"
+		aprint_normal("  utype %d, bps %d, blkbuf %d, burst %d,"
 		" blktime %d\n",
 		desc->d_utype, desc->d_sectsize,
 		desc->d_blkbuf, desc->d_burstsize, desc->d_blocktime);
-		aprint_debug("  avxfr %d, ort %d, atp %d, maxint %d, fv %x"
+		aprint_normal("  avxfr %d, ort %d, atp %d, maxint %d, fv %x"
 		", rv %x\n",
 		desc->d_uavexfr, desc->d_retry, desc->d_access,
 		desc->d_maxint, desc->d_fvbyte, desc->d_rvbyte);
-		aprint_debug("  maxcyl/head/sect %d/%d/%d, maxvsect %d,"
+		aprint_normal("  maxcyl/head/sect %d/%d/%d, maxvsect %d,"
 		" inter %d\n",
 		desc->d_maxcyl, desc->d_maxhead, desc->d_maxsect,
 		desc->d_maxvsectl, desc->d_interleave);



CVS commit: src

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 14:42:13 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_215.c
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: do not warn about use of implicitly declared GCC builtins


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_215.c
cvs rdiff -u -r1.302 -r1.303 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_215.c
diff -u src/tests/usr.bin/xlint/lint1/msg_215.c:1.8 src/tests/usr.bin/xlint/lint1/msg_215.c:1.9
--- src/tests/usr.bin/xlint/lint1/msg_215.c:1.8	Wed Jun 30 14:32:41 2021
+++ src/tests/usr.bin/xlint/lint1/msg_215.c	Wed Jun 30 14:42:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_215.c,v 1.8 2021/06/30 14:32:41 rillig Exp $	*/
+/*	$NetBSD: msg_215.c,v 1.9 2021/06/30 14:42:13 rillig Exp $	*/
 # 3 "msg_215.c"
 
 // Test for message: function '%s' implicitly declared to return int [215]
@@ -27,4 +27,8 @@ test(struct str str)
 	/* expect+2: error: type 'struct str' does not have member 'member' [101] */
 	/* expect+1: error: illegal function (type int) [149] */
 	str.member();
+
+	/* https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html */
+	__builtin_whatever(123, "string");
+	__atomic_whatever(123, "string");
 }

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.302 src/usr.bin/xlint/lint1/tree.c:1.303
--- src/usr.bin/xlint/lint1/tree.c:1.302	Wed Jun 30 14:32:41 2021
+++ src/usr.bin/xlint/lint1/tree.c	Wed Jun 30 14:42:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.302 2021/06/30 14:32:41 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.303 2021/06/30 14:42:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.302 2021/06/30 14:32:41 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.303 2021/06/30 14:42:13 rillig Exp $");
 #endif
 
 #include 
@@ -232,6 +232,14 @@ fallback_symbol(sym_t *sym)
 	error(99, sym->s_name);
 }
 
+/* https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html */
+static bool
+is_gcc_builtin(const char *name)
+{
+	return strncmp(name, "__atomic_", 9) == 0 ||
+	   strncmp(name, "__builtin_", 10) == 0;
+}
+
 /*
  * Create a node for a name (symbol table entry).
  * follow_token is the token which follows the name.
@@ -245,7 +253,13 @@ new_name_node(sym_t *sym, int follow_tok
 		sym->s_scl = EXTERN;
 		sym->s_def = DECL;
 		if (follow_token == T_LPAREN) {
-			if (Sflag) {
+			if (gflag && is_gcc_builtin(sym->s_name)) {
+/*
+ * Do not warn about these, just assume that
+ * they are regular functions compatible with
+ * non-prototype calling conventions.
+ */
+			} else if (Sflag) {
 /* function '%s' implicitly declared to ... */
 warning(215, sym->s_name);
 			} else if (sflag) {



CVS commit: src

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 14:42:13 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_215.c
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: do not warn about use of implicitly declared GCC builtins


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_215.c
cvs rdiff -u -r1.302 -r1.303 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 14:23:51 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_155.c msg_155.exp msg_215.c
msg_215.exp
src/usr.bin/xlint/lint1: err.c tree.c

Log Message:
lint: mention the name of an implicitly declared function

In the regular NetBSD builds, this happened in swab.c:65.  That line
contains __predict_false, which may or may not be a macro.  In other
cases, there may be more than one function call in a single line.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_155.c \
src/tests/usr.bin/xlint/lint1/msg_155.exp
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_215.c \
src/tests/usr.bin/xlint/lint1/msg_215.exp
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.300 -r1.301 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_155.c
diff -u src/tests/usr.bin/xlint/lint1/msg_155.c:1.8 src/tests/usr.bin/xlint/lint1/msg_155.c:1.9
--- src/tests/usr.bin/xlint/lint1/msg_155.c:1.8	Wed Jun 30 12:26:35 2021
+++ src/tests/usr.bin/xlint/lint1/msg_155.c	Wed Jun 30 14:23:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_155.c,v 1.8 2021/06/30 12:26:35 rillig Exp $	*/
+/*	$NetBSD: msg_155.c,v 1.9 2021/06/30 14:23:50 rillig Exp $	*/
 # 3 "msg_155.c"
 
 // Test for message: passing '%s' to incompatible '%s', arg #%d [155]
@@ -38,7 +38,8 @@ provoke_error_messages(struct incompatib
 	c99_6_7_6_example_e(arg);
 
 	/* TODO: C99 says 'function with no parameter specification returning a pointer to int' */
-	c99_6_7_6_example_f(arg);	/* expect: function implicitly declared */
+	/* expect+1: function 'c99_6_7_6_example_f' implicitly declared */
+	c99_6_7_6_example_f(arg);
 
 	/* expect+1: 'pointer to function(void) returning int' */
 	c99_6_7_6_example_g(arg);
Index: src/tests/usr.bin/xlint/lint1/msg_155.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_155.exp:1.8 src/tests/usr.bin/xlint/lint1/msg_155.exp:1.9
--- src/tests/usr.bin/xlint/lint1/msg_155.exp:1.8	Wed Jun 30 12:26:35 2021
+++ src/tests/usr.bin/xlint/lint1/msg_155.exp	Wed Jun 30 14:23:50 2021
@@ -3,10 +3,10 @@ msg_155.c(28): warning: passing 'struct 
 msg_155.c(32): warning: passing 'struct incompatible' to incompatible 'pointer to pointer to int', arg #1 [155]
 msg_155.c(35): warning: passing 'struct incompatible' to incompatible 'pointer to array[3] of int', arg #1 [155]
 msg_155.c(38): warning: passing 'struct incompatible' to incompatible 'pointer to array[unknown_size] of int', arg #1 [155]
-msg_155.c(41): error: function implicitly declared to return int [215]
-msg_155.c(44): warning: passing 'struct incompatible' to incompatible 'pointer to function(void) returning int', arg #1 [155]
-msg_155.c(47): warning: passing 'struct incompatible' to incompatible 'pointer to const pointer to function(unsigned int, ...) returning int', arg #1 [155]
-msg_155.c(68): warning: passing 'enum Day' to incompatible 'struct incompatible', arg #1 [155]
-msg_155.c(71): warning: passing 'enum Day' to incompatible 'struct incompatible', arg #1 [155]
-msg_155.c(74): warning: passing 'int' to incompatible 'struct incompatible', arg #1 [155]
-msg_155.c(77): warning: passing 'int' to incompatible 'struct incompatible', arg #1 [155]
+msg_155.c(42): error: function 'c99_6_7_6_example_f' implicitly declared to return int [215]
+msg_155.c(45): warning: passing 'struct incompatible' to incompatible 'pointer to function(void) returning int', arg #1 [155]
+msg_155.c(48): warning: passing 'struct incompatible' to incompatible 'pointer to const pointer to function(unsigned int, ...) returning int', arg #1 [155]
+msg_155.c(69): warning: passing 'enum Day' to incompatible 'struct incompatible', arg #1 [155]
+msg_155.c(72): warning: passing 'enum Day' to incompatible 'struct incompatible', arg #1 [155]
+msg_155.c(75): warning: passing 'int' to incompatible 'struct incompatible', arg #1 [155]
+msg_155.c(78): warning: passing 'int' to incompatible 'struct incompatible', arg #1 [155]

Index: src/tests/usr.bin/xlint/lint1/msg_215.c
diff -u src/tests/usr.bin/xlint/lint1/msg_215.c:1.6 src/tests/usr.bin/xlint/lint1/msg_215.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_215.c:1.6	Wed Jun 30 14:15:39 2021
+++ src/tests/usr.bin/xlint/lint1/msg_215.c	Wed Jun 30 14:23:50 2021
@@ -1,7 +1,7 @@
-/*	$NetBSD: msg_215.c,v 1.6 2021/06/30 14:15:39 rillig Exp $	*/
+/*	$NetBSD: msg_215.c,v 1.7 2021/06/30 14:23:50 rillig Exp $	*/
 # 3 "msg_215.c"
 
-// Test for message: function implicitly declared to return int [215]
+// Test for message: function '%s' implicitly declared to return int [215]
 
 /*
  * In traditional C and C90, it was possible to implicitly declare a function
@@ -17,7 +17,7 @@ struct str {
 void
 test(struct str str)
 {
-	/* expect+1: error: function implicitly declared to return int 

CVS commit: src

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 14:23:51 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_155.c msg_155.exp msg_215.c
msg_215.exp
src/usr.bin/xlint/lint1: err.c tree.c

Log Message:
lint: mention the name of an implicitly declared function

In the regular NetBSD builds, this happened in swab.c:65.  That line
contains __predict_false, which may or may not be a macro.  In other
cases, there may be more than one function call in a single line.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_155.c \
src/tests/usr.bin/xlint/lint1/msg_155.exp
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_215.c \
src/tests/usr.bin/xlint/lint1/msg_215.exp
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.300 -r1.301 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 14:32:41 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_155.exp msg_215.c msg_215.exp
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: in C99 mode, only warn about implicit function declarations

Since tree.c 1.294 from 2021-06-28 (two days ago), lint errored out on
an implicit function declaration.  In principle it is correct to do so
since C99 requires it, but in practice there are a several functions
that are not declared in the translation unit itself since they are
provided by the compiler.  Typical examples for GCC and Clang are the
various functions named '__builtin_*' and '__atomic_*'.

For now, only warn about these but don't error out.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/msg_155.exp
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_215.c \
src/tests/usr.bin/xlint/lint1/msg_215.exp
cvs rdiff -u -r1.301 -r1.302 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_155.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_155.exp:1.9 src/tests/usr.bin/xlint/lint1/msg_155.exp:1.10
--- src/tests/usr.bin/xlint/lint1/msg_155.exp:1.9	Wed Jun 30 14:23:50 2021
+++ src/tests/usr.bin/xlint/lint1/msg_155.exp	Wed Jun 30 14:32:41 2021
@@ -3,7 +3,7 @@ msg_155.c(28): warning: passing 'struct 
 msg_155.c(32): warning: passing 'struct incompatible' to incompatible 'pointer to pointer to int', arg #1 [155]
 msg_155.c(35): warning: passing 'struct incompatible' to incompatible 'pointer to array[3] of int', arg #1 [155]
 msg_155.c(38): warning: passing 'struct incompatible' to incompatible 'pointer to array[unknown_size] of int', arg #1 [155]
-msg_155.c(42): error: function 'c99_6_7_6_example_f' implicitly declared to return int [215]
+msg_155.c(42): warning: function 'c99_6_7_6_example_f' implicitly declared to return int [215]
 msg_155.c(45): warning: passing 'struct incompatible' to incompatible 'pointer to function(void) returning int', arg #1 [155]
 msg_155.c(48): warning: passing 'struct incompatible' to incompatible 'pointer to const pointer to function(unsigned int, ...) returning int', arg #1 [155]
 msg_155.c(69): warning: passing 'enum Day' to incompatible 'struct incompatible', arg #1 [155]

Index: src/tests/usr.bin/xlint/lint1/msg_215.c
diff -u src/tests/usr.bin/xlint/lint1/msg_215.c:1.7 src/tests/usr.bin/xlint/lint1/msg_215.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_215.c:1.7	Wed Jun 30 14:23:50 2021
+++ src/tests/usr.bin/xlint/lint1/msg_215.c	Wed Jun 30 14:32:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_215.c,v 1.7 2021/06/30 14:23:50 rillig Exp $	*/
+/*	$NetBSD: msg_215.c,v 1.8 2021/06/30 14:32:41 rillig Exp $	*/
 # 3 "msg_215.c"
 
 // Test for message: function '%s' implicitly declared to return int [215]
@@ -17,7 +17,7 @@ struct str {
 void
 test(struct str str)
 {
-	/* expect+1: error: function 'name' implicitly declared to return int [215] */
+	/* expect+1: warning: function 'name' implicitly declared to return int [215] */
 	name();
 
 	/* expect+2: error: 'parenthesized' undefined [99] */
Index: src/tests/usr.bin/xlint/lint1/msg_215.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_215.exp:1.7 src/tests/usr.bin/xlint/lint1/msg_215.exp:1.8
--- src/tests/usr.bin/xlint/lint1/msg_215.exp:1.7	Wed Jun 30 14:23:50 2021
+++ src/tests/usr.bin/xlint/lint1/msg_215.exp	Wed Jun 30 14:32:41 2021
@@ -1,4 +1,4 @@
-msg_215.c(21): error: function 'name' implicitly declared to return int [215]
+msg_215.c(21): warning: function 'name' implicitly declared to return int [215]
 msg_215.c(25): error: 'parenthesized' undefined [99]
 msg_215.c(25): error: illegal function (type int) [149]
 msg_215.c(29): error: type 'struct str' does not have member 'member' [101]

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.301 src/usr.bin/xlint/lint1/tree.c:1.302
--- src/usr.bin/xlint/lint1/tree.c:1.301	Wed Jun 30 14:23:50 2021
+++ src/usr.bin/xlint/lint1/tree.c	Wed Jun 30 14:32:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.301 2021/06/30 14:23:50 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.302 2021/06/30 14:32:41 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.301 2021/06/30 14:23:50 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.302 2021/06/30 14:32:41 rillig Exp $");
 #endif
 
 #include 
@@ -247,7 +247,7 @@ new_name_node(sym_t *sym, int follow_tok
 		if (follow_token == T_LPAREN) {
 			if (Sflag) {
 /* function '%s' implicitly declared to ... */
-error(215, sym->s_name);
+warning(215, sym->s_name);
 			} else if (sflag) {
 /* function '%s' implicitly declared to ... */
 warning(215, sym->s_name);



CVS commit: src

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 14:32:41 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_155.exp msg_215.c msg_215.exp
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: in C99 mode, only warn about implicit function declarations

Since tree.c 1.294 from 2021-06-28 (two days ago), lint errored out on
an implicit function declaration.  In principle it is correct to do so
since C99 requires it, but in practice there are a several functions
that are not declared in the translation unit itself since they are
provided by the compiler.  Typical examples for GCC and Clang are the
various functions named '__builtin_*' and '__atomic_*'.

For now, only warn about these but don't error out.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/msg_155.exp
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_215.c \
src/tests/usr.bin/xlint/lint1/msg_215.exp
cvs rdiff -u -r1.301 -r1.302 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src/tests/usr.bin/xlint/lint1

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 14:15:39 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_215.c msg_215.exp

Log Message:
tests/lint: extend test for message 215 about implicit function


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_215.c \
src/tests/usr.bin/xlint/lint1/msg_215.exp

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



Re: CVS commit: src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm

2021-06-30 Thread Joerg Sonnenberger
On Tue, Jun 29, 2021 at 11:26:00PM +, Rin Okuyama wrote:
> Module Name:  src
> Committed By: rin
> Date: Tue Jun 29 23:26:00 UTC 2021
> 
> Modified Files:
>   src/sys/external/bsd/compiler_rt/dist/lib/builtins/arm: aeabi_cfcmp.S
>   divmodsi4.S divsi3.S modsi3.S
> 
> Log Message:
> Align sp to 8-byte boundary as required by EABI.

Why not just push/pop another register? That's how it is normally done
for generated code.

Joerg


CVS commit: src/tests/usr.bin/xlint/lint1

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 14:15:39 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_215.c msg_215.exp

Log Message:
tests/lint: extend test for message 215 about implicit function


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_215.c \
src/tests/usr.bin/xlint/lint1/msg_215.exp

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_215.c
diff -u src/tests/usr.bin/xlint/lint1/msg_215.c:1.5 src/tests/usr.bin/xlint/lint1/msg_215.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_215.c:1.5	Wed Jun 30 14:11:08 2021
+++ src/tests/usr.bin/xlint/lint1/msg_215.c	Wed Jun 30 14:15:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_215.c,v 1.5 2021/06/30 14:11:08 rillig Exp $	*/
+/*	$NetBSD: msg_215.c,v 1.6 2021/06/30 14:15:39 rillig Exp $	*/
 # 3 "msg_215.c"
 
 // Test for message: function implicitly declared to return int [215]
@@ -20,6 +20,10 @@ test(struct str str)
 	/* expect+1: error: function implicitly declared to return int [215] */
 	name();
 
+	/* expect+2: error: 'parenthesized' undefined [99] */
+	/* expect+1: error: illegal function (type int) [149] */
+	(parenthesized)();
+
 	/* expect+2: error: type 'struct str' does not have member 'member' [101] */
 	/* expect+1: error: illegal function (type int) [149] */
 	str.member();
Index: src/tests/usr.bin/xlint/lint1/msg_215.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_215.exp:1.5 src/tests/usr.bin/xlint/lint1/msg_215.exp:1.6
--- src/tests/usr.bin/xlint/lint1/msg_215.exp:1.5	Wed Jun 30 14:11:08 2021
+++ src/tests/usr.bin/xlint/lint1/msg_215.exp	Wed Jun 30 14:15:39 2021
@@ -1,3 +1,5 @@
 msg_215.c(21): error: function implicitly declared to return int [215]
-msg_215.c(25): error: type 'struct str' does not have member 'member' [101]
+msg_215.c(25): error: 'parenthesized' undefined [99]
 msg_215.c(25): error: illegal function (type int) [149]
+msg_215.c(29): error: type 'struct str' does not have member 'member' [101]
+msg_215.c(29): error: illegal function (type int) [149]



CVS commit: src

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 14:11:08 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_101.c msg_101.exp msg_215.c
msg_215.exp
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: fix type name in message 101 for wrong member name


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_101.c \
src/tests/usr.bin/xlint/lint1/msg_101.exp
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_215.c \
src/tests/usr.bin/xlint/lint1/msg_215.exp
cvs rdiff -u -r1.299 -r1.300 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_101.c
diff -u src/tests/usr.bin/xlint/lint1/msg_101.c:1.5 src/tests/usr.bin/xlint/lint1/msg_101.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_101.c:1.5	Wed Jun 30 14:02:11 2021
+++ src/tests/usr.bin/xlint/lint1/msg_101.c	Wed Jun 30 14:11:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_101.c,v 1.5 2021/06/30 14:02:11 rillig Exp $	*/
+/*	$NetBSD: msg_101.c,v 1.6 2021/06/30 14:11:08 rillig Exp $	*/
 # 3 "msg_101.c"
 
 // Test for message: type '%s' does not have member '%s' [101]
@@ -17,11 +17,9 @@ test(const struct point *ptr, const stru
 	sink(pt.x);
 
 	/* accessing a nonexistent member */
-	/* FIXME: "type 'int'" is wrong. */
-	/* expect+1: error: type 'int' does not have member 'z' [101] */
+	/* expect+1: error: type 'pointer to const struct point' does not have member 'z' [101] */
 	sink(ptr->z);
-	/* FIXME: "type 'int'" is wrong. */
-	/* expect+1: error: type 'int' does not have member 'z' [101] */
+	/* expect+1: error: type 'const struct point' does not have member 'z' [101] */
 	sink(pt.z);
 
 	/* mixed up '.' and '->' */
@@ -33,10 +31,9 @@ test(const struct point *ptr, const stru
 	sink(pt->x);
 
 	/* accessing a nonexistent member via the wrong operator */
-	/* FIXME: "type 'int'" is wrong. */
-	/* expect+1: error: type 'int' does not have member 'z' [101] */
+	/* expect+1: error: type 'pointer to const struct point' does not have member 'z' [101] */
 	sink(ptr.z);
-	/* FIXME: "type 'int'" is wrong. */
-	/* expect+1: error: type 'int' does not have member 'z' [101] */
+	/* XXX: Why is the 'const' missing here, but not above? */
+	/* expect+1: error: type 'struct point' does not have member 'z' [101] */
 	sink(pt->z);
 }
Index: src/tests/usr.bin/xlint/lint1/msg_101.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_101.exp:1.5 src/tests/usr.bin/xlint/lint1/msg_101.exp:1.6
--- src/tests/usr.bin/xlint/lint1/msg_101.exp:1.5	Wed Jun 30 14:02:11 2021
+++ src/tests/usr.bin/xlint/lint1/msg_101.exp	Wed Jun 30 14:11:08 2021
@@ -1,6 +1,6 @@
-msg_101.c(22): error: type 'int' does not have member 'z' [101]
-msg_101.c(25): error: type 'int' does not have member 'z' [101]
-msg_101.c(30): error: left operand of '.' must be struct/union object [103]
-msg_101.c(33): error: left operand of '->' must be pointer to struct/union not struct point [104]
-msg_101.c(38): error: type 'int' does not have member 'z' [101]
-msg_101.c(41): error: type 'int' does not have member 'z' [101]
+msg_101.c(21): error: type 'pointer to const struct point' does not have member 'z' [101]
+msg_101.c(23): error: type 'const struct point' does not have member 'z' [101]
+msg_101.c(28): error: left operand of '.' must be struct/union object [103]
+msg_101.c(31): error: left operand of '->' must be pointer to struct/union not struct point [104]
+msg_101.c(35): error: type 'pointer to const struct point' does not have member 'z' [101]
+msg_101.c(38): error: type 'struct point' does not have member 'z' [101]

Index: src/tests/usr.bin/xlint/lint1/msg_215.c
diff -u src/tests/usr.bin/xlint/lint1/msg_215.c:1.4 src/tests/usr.bin/xlint/lint1/msg_215.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_215.c:1.4	Wed Jun 30 13:50:15 2021
+++ src/tests/usr.bin/xlint/lint1/msg_215.c	Wed Jun 30 14:11:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_215.c,v 1.4 2021/06/30 13:50:15 rillig Exp $	*/
+/*	$NetBSD: msg_215.c,v 1.5 2021/06/30 14:11:08 rillig Exp $	*/
 # 3 "msg_215.c"
 
 // Test for message: function implicitly declared to return int [215]
@@ -20,8 +20,7 @@ test(struct str str)
 	/* expect+1: error: function implicitly declared to return int [215] */
 	name();
 
-	/* FIXME: "type 'int'" sounds wrong. */
-	/* expect+2: error: type 'int' does not have member 'member' [101] */
+	/* expect+2: error: type 'struct str' does not have member 'member' [101] */
 	/* expect+1: error: illegal function (type int) [149] */
 	str.member();
 }
Index: src/tests/usr.bin/xlint/lint1/msg_215.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_215.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_215.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_215.exp:1.4	Wed Jun 30 13:50:15 2021
+++ src/tests/usr.bin/xlint/lint1/msg_215.exp	Wed Jun 30 14:11:08 2021
@@ -1,3 +1,3 @@
 msg_215.c(21): error: function implicitly declared to 

CVS commit: src

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 14:11:08 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_101.c msg_101.exp msg_215.c
msg_215.exp
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: fix type name in message 101 for wrong member name


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_101.c \
src/tests/usr.bin/xlint/lint1/msg_101.exp
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_215.c \
src/tests/usr.bin/xlint/lint1/msg_215.exp
cvs rdiff -u -r1.299 -r1.300 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src/tests/usr.bin/xlint/lint1

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 14:02:11 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_101.c msg_101.exp

Log Message:
tests/lint: extend tests for message 101

This demonstrates the wrong type name in the message.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_101.c \
src/tests/usr.bin/xlint/lint1/msg_101.exp

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



CVS commit: src/tests/usr.bin/xlint/lint1

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 14:02:11 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_101.c msg_101.exp

Log Message:
tests/lint: extend tests for message 101

This demonstrates the wrong type name in the message.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_101.c \
src/tests/usr.bin/xlint/lint1/msg_101.exp

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_101.c
diff -u src/tests/usr.bin/xlint/lint1/msg_101.c:1.4 src/tests/usr.bin/xlint/lint1/msg_101.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_101.c:1.4	Tue Mar 30 15:18:19 2021
+++ src/tests/usr.bin/xlint/lint1/msg_101.c	Wed Jun 30 14:02:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_101.c,v 1.4 2021/03/30 15:18:19 rillig Exp $	*/
+/*	$NetBSD: msg_101.c,v 1.5 2021/06/30 14:02:11 rillig Exp $	*/
 # 3 "msg_101.c"
 
 // Test for message: type '%s' does not have member '%s' [101]
@@ -7,8 +7,36 @@ struct point {
 	int x, y;
 };
 
-int
-get_z(const struct point *p)
+void sink(int);
+
+void
+test(const struct point *ptr, const struct point pt)
 {
-	return p.z;		/* expect: 101 */
+	/* accessing an existing member */
+	sink(ptr->x);
+	sink(pt.x);
+
+	/* accessing a nonexistent member */
+	/* FIXME: "type 'int'" is wrong. */
+	/* expect+1: error: type 'int' does not have member 'z' [101] */
+	sink(ptr->z);
+	/* FIXME: "type 'int'" is wrong. */
+	/* expect+1: error: type 'int' does not have member 'z' [101] */
+	sink(pt.z);
+
+	/* mixed up '.' and '->' */
+	/* TODO: mention actual type in the diagnostic */
+	/* expect+1: error: left operand of '.' must be struct/union object [103] */
+	sink(ptr.x);
+	/* TODO: put actual type in 'quotes' */
+	/* expect+1: error: left operand of '->' must be pointer to struct/union not struct point [104] */
+	sink(pt->x);
+
+	/* accessing a nonexistent member via the wrong operator */
+	/* FIXME: "type 'int'" is wrong. */
+	/* expect+1: error: type 'int' does not have member 'z' [101] */
+	sink(ptr.z);
+	/* FIXME: "type 'int'" is wrong. */
+	/* expect+1: error: type 'int' does not have member 'z' [101] */
+	sink(pt->z);
 }
Index: src/tests/usr.bin/xlint/lint1/msg_101.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_101.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_101.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_101.exp:1.4	Tue Mar 30 15:18:19 2021
+++ src/tests/usr.bin/xlint/lint1/msg_101.exp	Wed Jun 30 14:02:11 2021
@@ -1 +1,6 @@
-msg_101.c(13): error: type 'int' does not have member 'z' [101]
+msg_101.c(22): error: type 'int' does not have member 'z' [101]
+msg_101.c(25): error: type 'int' does not have member 'z' [101]
+msg_101.c(30): error: left operand of '.' must be struct/union object [103]
+msg_101.c(33): error: left operand of '->' must be pointer to struct/union not struct point [104]
+msg_101.c(38): error: type 'int' does not have member 'z' [101]
+msg_101.c(41): error: type 'int' does not have member 'z' [101]



CVS commit: src/tests/usr.bin/xlint/lint1

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 13:50:15 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_215.c msg_215.exp

Log Message:
tests/lint: extend and explain test for implicit function declaration


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_215.c \
src/tests/usr.bin/xlint/lint1/msg_215.exp

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



CVS commit: src/tests/usr.bin/xlint/lint1

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 13:50:15 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_215.c msg_215.exp

Log Message:
tests/lint: extend and explain test for implicit function declaration


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_215.c \
src/tests/usr.bin/xlint/lint1/msg_215.exp

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_215.c
diff -u src/tests/usr.bin/xlint/lint1/msg_215.c:1.3 src/tests/usr.bin/xlint/lint1/msg_215.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_215.c:1.3	Mon Jun 28 11:27:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_215.c	Wed Jun 30 13:50:15 2021
@@ -1,10 +1,27 @@
-/*	$NetBSD: msg_215.c,v 1.3 2021/06/28 11:27:00 rillig Exp $	*/
+/*	$NetBSD: msg_215.c,v 1.4 2021/06/30 13:50:15 rillig Exp $	*/
 # 3 "msg_215.c"
 
 // Test for message: function implicitly declared to return int [215]
 
+/*
+ * In traditional C and C90, it was possible to implicitly declare a function
+ * by just calling it, without defining a prototype first.  Such a function
+ * would then be defined as taking unspecified parameters and returning int.
+ */
+
+struct str {
+	int dummy;
+};
+
+/* ARGSUSED */
 void
-caller(void)
+test(struct str str)
 {
-	callee(12345);		/* expect: [215] */
+	/* expect+1: error: function implicitly declared to return int [215] */
+	name();
+
+	/* FIXME: "type 'int'" sounds wrong. */
+	/* expect+2: error: type 'int' does not have member 'member' [101] */
+	/* expect+1: error: illegal function (type int) [149] */
+	str.member();
 }
Index: src/tests/usr.bin/xlint/lint1/msg_215.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_215.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_215.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_215.exp:1.3	Mon Jun 28 11:27:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_215.exp	Wed Jun 30 13:50:15 2021
@@ -1 +1,3 @@
-msg_215.c(9): error: function implicitly declared to return int [215]
+msg_215.c(21): error: function implicitly declared to return int [215]
+msg_215.c(26): error: type 'int' does not have member 'member' [101]
+msg_215.c(26): error: illegal function (type int) [149]



CVS commit: src/usr.bin/xlint/lint1

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 12:28:03 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: improve comment about INT keeping t_is_enum


To generate a diff of this commit:
cvs rdiff -u -r1.298 -r1.299 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src/usr.bin/xlint/lint1

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 12:28:03 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: improve comment about INT keeping t_is_enum


To generate a diff of this commit:
cvs rdiff -u -r1.298 -r1.299 src/usr.bin/xlint/lint1/tree.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/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.298 src/usr.bin/xlint/lint1/tree.c:1.299
--- src/usr.bin/xlint/lint1/tree.c:1.298	Tue Jun 29 21:16:54 2021
+++ src/usr.bin/xlint/lint1/tree.c	Wed Jun 30 12:28:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.298 2021/06/29 21:16:54 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.299 2021/06/30 12:28:03 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.298 2021/06/29 21:16:54 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.299 2021/06/30 12:28:03 rillig Exp $");
 #endif
 
 #include 
@@ -1748,7 +1748,8 @@ promote(op_t op, bool farg, tnode_t *tn)
 		ntp = expr_dup_type(tn->tn_type);
 		ntp->t_tspec = t;
 		/*
-		 * Keep t_is_enum so we are later able to check compatibility
+		 * Keep t_is_enum even though t_tspec gets converted from
+		 * ENUM to INT, so we are later able to check compatibility
 		 * of enum types.
 		 */
 		tn = convert(op, 0, ntp, tn);



CVS commit: src/tests/usr.bin/xlint/lint1

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 12:26:35 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_155.c msg_155.exp

Log Message:
tests/lint: add test for type name of enum converted to int


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_155.c \
src/tests/usr.bin/xlint/lint1/msg_155.exp

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_155.c
diff -u src/tests/usr.bin/xlint/lint1/msg_155.c:1.7 src/tests/usr.bin/xlint/lint1/msg_155.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_155.c:1.7	Mon Jun 28 11:27:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_155.c	Wed Jun 30 12:26:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_155.c,v 1.7 2021/06/28 11:27:00 rillig Exp $	*/
+/*	$NetBSD: msg_155.c,v 1.8 2021/06/30 12:26:35 rillig Exp $	*/
 # 3 "msg_155.c"
 
 // Test for message: passing '%s' to incompatible '%s', arg #%d [155]
@@ -46,3 +46,33 @@ provoke_error_messages(struct incompatib
 	/* expect+1: 'pointer to const pointer to function(unsigned int, ...) returning int' */
 	c99_6_7_6_example_h(arg);
 }
+
+extern void sink(struct incompatible);
+
+/*
+ * The function type_name has a special case for an enum type that has been
+ * implicitly converted to an int.  Such a type is still output as the enum
+ * type.
+ *
+ * XXX: The expressions 'day + 0' and '0 + day' should result in the same
+ *  type.
+ */
+void
+type_name_of_enum(void)
+{
+	enum Day {
+		MONDAY
+	} day = MONDAY;
+
+	/* expect+1: passing 'enum Day' */
+	sink(day);
+
+	/* expect+1: passing 'enum Day' */
+	sink(day + 0);
+
+	/* expect+1: passing 'int' */
+	sink(0 + day);
+
+	/* expect+1: passing 'int' */
+	sink(0);
+}
Index: src/tests/usr.bin/xlint/lint1/msg_155.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_155.exp:1.7 src/tests/usr.bin/xlint/lint1/msg_155.exp:1.8
--- src/tests/usr.bin/xlint/lint1/msg_155.exp:1.7	Mon Jun 28 11:27:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_155.exp	Wed Jun 30 12:26:35 2021
@@ -6,3 +6,7 @@ msg_155.c(38): warning: passing 'struct 
 msg_155.c(41): error: function implicitly declared to return int [215]
 msg_155.c(44): warning: passing 'struct incompatible' to incompatible 'pointer to function(void) returning int', arg #1 [155]
 msg_155.c(47): warning: passing 'struct incompatible' to incompatible 'pointer to const pointer to function(unsigned int, ...) returning int', arg #1 [155]
+msg_155.c(68): warning: passing 'enum Day' to incompatible 'struct incompatible', arg #1 [155]
+msg_155.c(71): warning: passing 'enum Day' to incompatible 'struct incompatible', arg #1 [155]
+msg_155.c(74): warning: passing 'int' to incompatible 'struct incompatible', arg #1 [155]
+msg_155.c(77): warning: passing 'int' to incompatible 'struct incompatible', arg #1 [155]



CVS commit: src/tests/usr.bin/xlint/lint1

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 12:26:35 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_155.c msg_155.exp

Log Message:
tests/lint: add test for type name of enum converted to int


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_155.c \
src/tests/usr.bin/xlint/lint1/msg_155.exp

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



Re: CVS commit: src

2021-06-30 Thread Martin Husemann
On Tue, Jun 29, 2021 at 10:40:54PM +, David A. Holland wrote:
> Module Name:  src
> Committed By: dholland
> Date: Tue Jun 29 22:40:54 UTC 2021
> 
> Modified Files:
>   src/external/cddl/osnet/sys/sys: vnode.h
>   src/share/man/man9: errno.9 vnsubr.9
>   src/sys/dev: firmload.c fss.c kloader.c vnd.c
>   src/sys/kern: kern_acct.c kern_core.c kern_descrip.c kern_ktrace_vfs.c
>   kern_module_vfs.c subr_exec_fd.c subr_kobj_vfs.c tty_ptm.c
>   vfs_syscalls.c vfs_vnops.c
>   src/sys/miscfs/fdesc: fdesc_vnops.c
>   src/sys/modules/lua: lua.c
>   src/sys/sys: filedesc.h vnode.h
>   src/sys/ufs/lfs: ulfs_extattr.c ulfs_quota1.c
>   src/sys/ufs/ufs: ufs_extattr.c ufs_quota1.c
> 
> Log Message:
> Add containment for the cloning devices hack in vn_open.
> 
> Cloning devices (and also things like /dev/stderr) work by allocating
> a struct file, stuffing it in the file table (which is a layer
> violation), stuffing the file descriptor number for it in a magic
> field of struct lwp (which is gross), and then "failing" with one of
> two magic errnos, EDUPFD or EMOVEFD.

bpf seems to be completely broken after this change. At least for me on
amd64 with a monolithic kernel (neither dhcpcd nor wpa_supplicant work).

Martin


CVS commit: src/usr.bin/xlint/lint1

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 11:29:29 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: func.c

Log Message:
lint: invert condition in control flow analysis of switch statements

The condition previously contained many negations, which was hard to
understand.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/usr.bin/xlint/lint1/func.c

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



CVS commit: src/usr.bin/xlint/lint1

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 11:29:29 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: func.c

Log Message:
lint: invert condition in control flow analysis of switch statements

The condition previously contained many negations, which was hard to
understand.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/usr.bin/xlint/lint1/func.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/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.111 src/usr.bin/xlint/lint1/func.c:1.112
--- src/usr.bin/xlint/lint1/func.c:1.111	Sat Jun 19 19:59:02 2021
+++ src/usr.bin/xlint/lint1/func.c	Wed Jun 30 11:29:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: func.c,v 1.111 2021/06/19 19:59:02 rillig Exp $	*/
+/*	$NetBSD: func.c,v 1.112 2021/06/30 11:29:29 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.111 2021/06/19 19:59:02 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.112 2021/06/30 11:29:29 rillig Exp $");
 #endif
 
 #include 
@@ -747,12 +747,11 @@ switch2(void)
 
 	lint_assert(cstmt->c_switch_type != NULL);
 
-	/*
-	 * If the switch expression was of type enumeration, count the case
-	 * labels and the number of enumerators. If both counts are not
-	 * equal print a warning.
-	 */
 	if (cstmt->c_switch_type->t_is_enum) {
+		/*
+		 * Warn if the number of case labels is different from the
+		 * number of enumerators.
+		 */
 		nenum = nclab = 0;
 		lint_assert(cstmt->c_switch_type->t_enum != NULL);
 		for (esym = cstmt->c_switch_type->t_enum->en_first_enumerator;
@@ -771,22 +770,25 @@ switch2(void)
 
 	if (cstmt->c_break) {
 		/*
-		 * end of switch always reached (c_break is only set if the
-		 * break statement can be reached).
+		 * The end of the switch statement is always reached since
+		 * c_break is only set if a break statement can actually
+		 * be reached.
 		 */
 		set_reached(true);
-	} else if (!cstmt->c_default &&
-		   (!hflag || !cstmt->c_switch_type->t_is_enum ||
-		nenum != nclab)) {
+	} else if (cstmt->c_default ||
+		   (hflag && cstmt->c_switch_type->t_is_enum &&
+		nenum == nclab)) {
 		/*
-		 * there are possible values which are not handled in
-		 * switch
+		 * The end of the switch statement is reached if the end
+		 * of the last statement inside it is reached.
 		 */
-		set_reached(true);
-	}	/*
-		 * otherwise the end of the switch expression is reached
-		 * if the end of the last statement inside it is reached.
+	} else {
+		/*
+		 * There are possible values that are not handled in the
+		 * switch statement.
 		 */
+		set_reached(true);
+	}
 
 	end_control_statement(CS_SWITCH);
 }



CVS commit: src/sys/kern

2021-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 30 11:20:33 UTC 2021

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
PR/56286: Martin Husemann: Fix NULL deref on kmod load.
- No need to set ret_domove and ret_fd in the regular case, they are meaningless
- KASSERT instead of setting errno and then doing the NULL deref.


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/sys/kern/vfs_vnops.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/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.216 src/sys/kern/vfs_vnops.c:1.217
--- src/sys/kern/vfs_vnops.c:1.216	Tue Jun 29 18:40:53 2021
+++ src/sys/kern/vfs_vnops.c	Wed Jun 30 07:20:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnops.c,v 1.216 2021/06/29 22:40:53 dholland Exp $	*/
+/*	$NetBSD: vfs_vnops.c,v 1.217 2021/06/30 11:20:32 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.216 2021/06/29 22:40:53 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.217 2021/06/30 11:20:32 christos Exp $");
 
 #include "veriexec.h"
 
@@ -328,35 +328,20 @@ bad:
 out:
 	pathbuf_stringcopy_put(nd.ni_pathbuf, pathstring);
 
-	/* if the caller isn't prepared to handle fds, fail for them */
-	if (ret_fd == NULL && (error == EDUPFD || error == EMOVEFD)) {
-		/*
-		 * XXX: for EMOVEFD (cloning devices) this leaks the
-		 * device's file descriptor. That's not good, but
-		 * fixing it here would still be a layer violation and
-		 * callers not currently prepared to deal weren't
-		 * prepared before I rearranged things either and
-		 * would still have leaked the fd, so it's at least
-		 * not a regression.
-		 *-- dholland 20210627
-		 */
-		error = EOPNOTSUPP;
-	}
-
-	if (error == EDUPFD) {
+	switch (error) {
+	case EDUPFD:
+	case EMOVEFD:
+		/* if the caller isn't prepared to handle fds, fail for them */
+		KASSERTMSG(ret_domove && ret_fd,
+		"caller did not supply ret_domove and ret_fd for %d",
+		error);
 		*ret_vp = NULL;
-		*ret_domove = false;
+		*ret_domove = error == EMOVEFD;
 		*ret_fd = l->l_dupfd;
-		error = 0;
-	} else if (error == EMOVEFD) {
-		*ret_vp = NULL;
-		*ret_domove = true;
-		*ret_fd = l->l_dupfd;
-		error = 0;
-	} else if (error == 0) {
+		break;
+	case 0:
 		*ret_vp = vp;
-		*ret_domove = false;
-		*ret_fd = -1;
+		break;
 	}
 	l->l_dupfd = 0;
 	return error;



CVS commit: src/sys/kern

2021-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 30 11:20:33 UTC 2021

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
PR/56286: Martin Husemann: Fix NULL deref on kmod load.
- No need to set ret_domove and ret_fd in the regular case, they are meaningless
- KASSERT instead of setting errno and then doing the NULL deref.


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/sys/kern/vfs_vnops.c

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



CVS commit: src/usr.bin/xlint/common

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 10:56:24 UTC 2021

Modified Files:
src/usr.bin/xlint/common: inittyp.c

Log Message:
lint: fix bit-size of long double _Complex in portable mode

C99 6.2.5p13 says that LCOMPLEX has the same representation and
alignment requirements as an array type containing exactly two LDOUBLE.

When support for _Complex was added to lint in inittyp.c 1.10 from
2008-09-27, there was no explanation for making the bit-size of LCOMPLEX
different from what C99 says, so it was probably a mistake that went
unnoticed for more than 12 years.  It's an edge case anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/common/inittyp.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/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.23 src/usr.bin/xlint/common/inittyp.c:1.24
--- src/usr.bin/xlint/common/inittyp.c:1.23	Tue Jun 29 21:33:09 2021
+++ src/usr.bin/xlint/common/inittyp.c	Wed Jun 30 10:56:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inittyp.c,v 1.23 2021/06/29 21:33:09 rillig Exp $	*/
+/*	$NetBSD: inittyp.c,v 1.24 2021/06/30 10:56:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: inittyp.c,v 1.23 2021/06/29 21:33:09 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.24 2021/06/30 10:56:24 rillig Exp $");
 #endif
 
 #include 
@@ -115,13 +115,8 @@ inittyp(void)
 		0, 0, 1, 1, 1, 1, "float _Complex"),
 		typeinfo(DCOMPLEX, DCOMPLEX, DCOMPLEX, DOUBLE_SIZE * 2, 64 * 2,
 		0, 0, 1, 1, 1, 1, "double _Complex"),
-		/*
-		* XXX: with -p, LCOMPLEX.tt_portable_size_in_bits !=
-		*  2 * LDOUBLE.tt_portable_size_in_bits.
-		*  This may or may not have been intentional.
-		*/
 		typeinfo(LCOMPLEX, LCOMPLEX, LCOMPLEX,
-		LDOUBLE_SIZE * 2, 64 * 2,
+		LDOUBLE_SIZE * 2, 80 * 2,
 		0, 0, 1, 1, 1, 1, "long double _Complex"),
 		typeinfo(VOID, VOID, VOID, -1, -1,
 		0, 0, 0, 0, 0, 0, "void"),



CVS commit: src/usr.bin/xlint/common

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 10:56:24 UTC 2021

Modified Files:
src/usr.bin/xlint/common: inittyp.c

Log Message:
lint: fix bit-size of long double _Complex in portable mode

C99 6.2.5p13 says that LCOMPLEX has the same representation and
alignment requirements as an array type containing exactly two LDOUBLE.

When support for _Complex was added to lint in inittyp.c 1.10 from
2008-09-27, there was no explanation for making the bit-size of LCOMPLEX
different from what C99 says, so it was probably a mistake that went
unnoticed for more than 12 years.  It's an edge case anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/common/inittyp.c

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



CVS commit: src/usr.bin/xlint/lint1

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 10:25:03 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: lex.c

Log Message:
lint: inline 'sign' into convert_integer

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/xlint/lint1/lex.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.49 src/usr.bin/xlint/lint1/lex.c:1.50
--- src/usr.bin/xlint/lint1/lex.c:1.49	Tue Jun 29 21:16:54 2021
+++ src/usr.bin/xlint/lint1/lex.c	Wed Jun 30 10:25:02 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.49 2021/06/29 21:16:54 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.50 2021/06/30 10:25:02 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.49 2021/06/29 21:16:54 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.50 2021/06/30 10:25:02 rillig Exp $");
 #endif
 
 #include 
@@ -678,21 +678,6 @@ lex_integer_constant(const char *yytext,
 	return T_CON;
 }
 
-/*
- * Returns whether t is a signed type and the value is negative.
- *
- * len is the number of significant bits. If len is -1, len is set
- * to the width of type t.
- */
-static bool
-sign(int64_t q, tspec_t t, int len)
-{
-
-	if (t == PTR || is_uinteger(t))
-		return false;
-	return msb(q, t, len) != 0;
-}
-
 int
 msb(int64_t q, tspec_t t, int len)
 {
@@ -704,6 +689,9 @@ msb(int64_t q, tspec_t t, int len)
 
 /*
  * Extend or truncate q to match t.  If t is signed, sign-extend.
+ *
+ * len is the number of significant bits. If len is -1, len is set
+ * to the width of type t.
  */
 int64_t
 convert_integer(int64_t q, tspec_t t, int len)
@@ -714,7 +702,7 @@ convert_integer(int64_t q, tspec_t t, in
 		len = size_in_bits(t);
 
 	vbits = value_bits(len);
-	return t == PTR || is_uinteger(t) || !sign(q, t, len)
+	return t == PTR || is_uinteger(t) || msb(q, t, len) == 0
 	? q & vbits
 	: q | ~vbits;
 }



CVS commit: src/usr.bin/xlint/lint1

2021-06-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jun 30 10:25:03 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: lex.c

Log Message:
lint: inline 'sign' into convert_integer

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/xlint/lint1/lex.c

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



Re: CVS commit: src

2021-06-30 Thread Rin Okuyama

Hi,

GCC warns maybe-uninitialized for this commit (for some architectures and
optimization levels: https://releng.netbsd.org/builds/HEAD/202106292250Z/):


/home/source/ab/HEAD/src/sys/kern/vfs_vnops.c: In function 'vn_open':
/home/source/ab/HEAD/src/sys/kern/vfs_vnops.c:357:11: error: 'vp' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
  357 |   *ret_vp = vp;
  |   ^~~~
cc1: all warnings being treated as errors


Can you please double check and work around if no problem?

Thanks,
rin

On 2021/06/30 7:40, David A. Holland wrote:

Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:40:54 UTC 2021

Modified Files:
src/external/cddl/osnet/sys/sys: vnode.h
src/share/man/man9: errno.9 vnsubr.9
src/sys/dev: firmload.c fss.c kloader.c vnd.c
src/sys/kern: kern_acct.c kern_core.c kern_descrip.c kern_ktrace_vfs.c
kern_module_vfs.c subr_exec_fd.c subr_kobj_vfs.c tty_ptm.c
vfs_syscalls.c vfs_vnops.c
src/sys/miscfs/fdesc: fdesc_vnops.c
src/sys/modules/lua: lua.c
src/sys/sys: filedesc.h vnode.h
src/sys/ufs/lfs: ulfs_extattr.c ulfs_quota1.c
src/sys/ufs/ufs: ufs_extattr.c ufs_quota1.c

Log Message:
Add containment for the cloning devices hack in vn_open.

Cloning devices (and also things like /dev/stderr) work by allocating
a struct file, stuffing it in the file table (which is a layer
violation), stuffing the file descriptor number for it in a magic
field of struct lwp (which is gross), and then "failing" with one of
two magic errnos, EDUPFD or EMOVEFD.

Before this commit, all callers of vn_open in the kernel (there are
quite a few) were expected to check for these errors and handle the
situation. Needless to say, none of them except for open() itself did,
resulting in internal negative errnos being returned to userspace.

This hack is fairly deeply rooted and cannot be eliminated all at
once. This commit adds logic to handle the magic errnos inside
vn_open; now on success vn_open returns either a vnode or an integer
file descriptor, along with a flag that says whether the underlying
code requested EDUPFD or EMOVEFD. Callers not prepared to cope with
file descriptors can pass NULL for the extra return values, in which
case if a file descriptor would be produced vn_open fails with
EOPNOTSUPP.

Since I'm rearranging vn_open's signature anyway, stop exposing struct
nameidata. Instead, take three arguments: an optional vnode to use as
the starting point (like openat()), the path, and additional namei
flags to use, restricted to NOCHROOT and TRYEMULROOT. (Other namei
behavior, e.g. NOFOLLOW, can be requested via the open flags.)

This change requires a kernel bump. Ride the one an hour ago.
(That was supposed to be coordinated; did not intend to let an hour
slip by. My fault.)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/external/cddl/osnet/sys/sys/vnode.h
cvs rdiff -u -r1.5 -r1.6 src/share/man/man9/errno.9
cvs rdiff -u -r1.47 -r1.48 src/share/man/man9/vnsubr.9
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/firmload.c
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/fss.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/kloader.c
cvs rdiff -u -r1.281 -r1.282 src/sys/dev/vnd.c
cvs rdiff -u -r1.97 -r1.98 src/sys/kern/kern_acct.c
cvs rdiff -u -r1.34 -r1.35 src/sys/kern/kern_core.c
cvs rdiff -u -r1.250 -r1.251 src/sys/kern/kern_descrip.c
cvs rdiff -u -r1.2 -r1.3 src/sys/kern/kern_ktrace_vfs.c
cvs rdiff -u -r1.17 -r1.18 src/sys/kern/kern_module_vfs.c
cvs rdiff -u -r1.11 -r1.12 src/sys/kern/subr_exec_fd.c \
 src/sys/kern/subr_kobj_vfs.c
cvs rdiff -u -r1.42 -r1.43 src/sys/kern/tty_ptm.c
cvs rdiff -u -r1.549 -r1.550 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.215 -r1.216 src/sys/kern/vfs_vnops.c
cvs rdiff -u -r1.137 -r1.138 src/sys/miscfs/fdesc/fdesc_vnops.c
cvs rdiff -u -r1.24 -r1.25 src/sys/modules/lua/lua.c
cvs rdiff -u -r1.68 -r1.69 src/sys/sys/filedesc.h
cvs rdiff -u -r1.296 -r1.297 src/sys/sys/vnode.h
cvs rdiff -u -r1.16 -r1.17 src/sys/ufs/lfs/ulfs_extattr.c
cvs rdiff -u -r1.11 -r1.12 src/sys/ufs/lfs/ulfs_quota1.c
cvs rdiff -u -r1.52 -r1.53 src/sys/ufs/ufs/ufs_extattr.c
cvs rdiff -u -r1.23 -r1.24 src/sys/ufs/ufs/ufs_quota1.c

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


CVS commit: src/lib/libc/arch/arm/sys

2021-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 30 07:36:05 UTC 2021

Modified Files:
src/lib/libc/arch/arm/sys: __clone.S

Log Message:
The _INVOKE_CERROR macro deals with thumb so simplify the code (at the
expense of a couple more instructions).


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/arch/arm/sys/__clone.S

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



CVS commit: src/lib/libc/arch/arm/sys

2021-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 30 07:36:05 UTC 2021

Modified Files:
src/lib/libc/arch/arm/sys: __clone.S

Log Message:
The _INVOKE_CERROR macro deals with thumb so simplify the code (at the
expense of a couple more instructions).


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/arch/arm/sys/__clone.S

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

Modified files:

Index: src/lib/libc/arch/arm/sys/__clone.S
diff -u src/lib/libc/arch/arm/sys/__clone.S:1.12 src/lib/libc/arch/arm/sys/__clone.S:1.13
--- src/lib/libc/arch/arm/sys/__clone.S:1.12	Wed Jun 30 07:34:24 2021
+++ src/lib/libc/arch/arm/sys/__clone.S	Wed Jun 30 07:36:05 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: __clone.S,v 1.12 2021/06/30 07:34:24 skrll Exp $ */
+/* $NetBSD: __clone.S,v 1.13 2021/06/30 07:36:05 skrll Exp $ */
 
 /*
  * Copyright (c) 2001 Christopher Gilbert
@@ -65,11 +65,7 @@ ENTRY(__clone)
 	mov	r0, r2
 
 	SYSTRAP(__clone)
-#if !defined(__thumb__) || defined(_ARM_ARCH_T2)
 	_INVOKE_CERROR()
-#else
-	bcs	.Lcerror
-#endif
 
 	/*
 	 * r1 and r0 are the same as from fork:



CVS commit: src/lib/libc/arch/arm/sys

2021-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 30 07:34:24 UTC 2021

Modified Files:
src/lib/libc/arch/arm/sys: __clone.S

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/arch/arm/sys/__clone.S

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



CVS commit: src/lib/libc/arch/arm/sys

2021-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 30 07:34:24 UTC 2021

Modified Files:
src/lib/libc/arch/arm/sys: __clone.S

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/arch/arm/sys/__clone.S

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

Modified files:

Index: src/lib/libc/arch/arm/sys/__clone.S
diff -u src/lib/libc/arch/arm/sys/__clone.S:1.11 src/lib/libc/arch/arm/sys/__clone.S:1.12
--- src/lib/libc/arch/arm/sys/__clone.S:1.11	Wed Jun 30 00:00:49 2021
+++ src/lib/libc/arch/arm/sys/__clone.S	Wed Jun 30 07:34:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: __clone.S,v 1.11 2021/06/30 00:00:49 rin Exp $ */
+/* $NetBSD: __clone.S,v 1.12 2021/06/30 07:34:24 skrll Exp $ */
 
 /*
  * Copyright (c) 2001 Christopher Gilbert
@@ -55,12 +55,12 @@ ENTRY(__clone)
 
 	/* place the func and its arg onto the child's stack */
 #if !defined(__thumb__) || defined(_ARM_ARCH_T2)
-	stmfd	r1!, {r0, r3} 
+	stmfd	r1!, {r0, r3}
 #else
 	subs	r1, r1, #8
-	stmia	r1!, {r0, r3} 
+	stmia	r1!, {r0, r3}
 #endif
-	
+
 	/* syscall expects (flags, stack) */
 	mov	r0, r2
 



CVS commit: src/sys/net/lagg

2021-06-30 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Jun 30 06:39:47 UTC 2021

Modified Files:
src/sys/net/lagg: if_lagg_lacp.c

Log Message:
lagg: fix an uninitialize variable

pointed out by tnn@n.o., thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/net/lagg/if_lagg_lacp.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/net/lagg/if_lagg_lacp.c
diff -u src/sys/net/lagg/if_lagg_lacp.c:1.2 src/sys/net/lagg/if_lagg_lacp.c:1.3
--- src/sys/net/lagg/if_lagg_lacp.c:1.2	Tue May 18 11:02:58 2021
+++ src/sys/net/lagg/if_lagg_lacp.c	Wed Jun 30 06:39:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lagg_lacp.c,v 1.2 2021/05/18 11:02:58 hannken Exp $	*/
+/*	$NetBSD: if_lagg_lacp.c,v 1.3 2021/06/30 06:39:47 yamaguchi Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.2 2021/05/18 11:02:58 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.3 2021/06/30 06:39:47 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_lagg.h"
@@ -2368,13 +2368,17 @@ lacp_unselect(struct lacp_softc *lsc, st
 	lacpp->lp_aggregator = NULL;
 
 	if (LIST_EMPTY(>la_ports)) {
+		remove_actaggr = false;
+
 		if (la == lsc->lsc_aggregator) {
 			LACP_DPRINTF((lsc, NULL, "remove active aggregator\n"));
 			lsc->lsc_aggregator = NULL;
 			remove_actaggr = true;
 		}
+
 		TAILQ_REMOVE(>lsc_aggregators, la, la_q);
 		kmem_free(la, sizeof(*la));
+
 		if (remove_actaggr) {
 			lacp_select_active_aggregator(lsc);
 		}



CVS commit: src/sys/net/lagg

2021-06-30 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Wed Jun 30 06:39:47 UTC 2021

Modified Files:
src/sys/net/lagg: if_lagg_lacp.c

Log Message:
lagg: fix an uninitialize variable

pointed out by tnn@n.o., thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/net/lagg/if_lagg_lacp.c

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



CVS commit: src/sys/arch/arm/dts

2021-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 30 06:24:03 UTC 2021

Modified Files:
src/sys/arch/arm/dts: sun50i-a64-sopine-baseboard.dts

Log Message:
Revert previous. Apparently it's wrong.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts

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/arm/dts/sun50i-a64-sopine-baseboard.dts
diff -u src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.3 src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.4
--- src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.3	Fri Jun 25 07:03:28 2021
+++ src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts	Wed Jun 30 06:24:02 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64-sopine-baseboard.dts,v 1.3 2021/06/25 07:03:28 skrll Exp $ */
+/* $NetBSD: sun50i-a64-sopine-baseboard.dts,v 1.4 2021/06/30 06:24:02 skrll Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -37,7 +37,3 @@
 	status = "okay";
 };
 
- {
-	allwinner,tx-delay-ps = <500>;
-};
-



CVS commit: src/sys/arch/arm/dts

2021-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun 30 06:24:03 UTC 2021

Modified Files:
src/sys/arch/arm/dts: sun50i-a64-sopine-baseboard.dts

Log Message:
Revert previous. Apparently it's wrong.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts

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