CVS commit: src/sys/arch/alpha

2021-07-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jul  4 22:42:36 UTC 2021

Modified Files:
src/sys/arch/alpha/alpha: core_machdep.c interrupt.c machdep.c pmap.c
vm_machdep.c
src/sys/arch/alpha/common: sgmap_common.c
src/sys/arch/alpha/isa: isapnp_machdep.c
src/sys/arch/alpha/jensenio: jensenio_bus_intio.c jensenio_bus_io.c
jensenio_bus_mem.c jensenio_dma.c jensenio_intr.c
src/sys/arch/alpha/mcbus: mcbus.c mcmem.c
src/sys/arch/alpha/pci: apecs.c apecs_bus_io.c apecs_bus_mem.c
apecs_dma.c cia.c cia_bwx_bus_io.c cia_bwx_bus_mem.c cia_dma.c
cia_swiz_bus_io.c cia_swiz_bus_mem.c dwlpx_bus_io.c dwlpx_bus_mem.c
irongate.c irongate_bus_io.c irongate_bus_mem.c irongate_dma.c
lca.c lca_bus_io.c lca_bus_mem.c lca_dma.c mcpcia_bus_io.c
mcpcia_bus_mem.c mcpcia_dma.c pci_1000.c pci_1000a.c
pci_2100_a500.c pci_550.c pci_6600.c pci_eb164.c pci_eb64plus.c
pci_eb66.c pci_kn20aa.c pci_kn300.c pci_kn8ae.c pci_sgmap_pte32.c
pci_sgmap_pte64.c sio_pic.c tsc.c tsp_bus_io.c tsp_bus_mem.c
tsp_dma.c ttwoga.c ttwoga_bus_io.c ttwoga_bus_mem.c
src/sys/arch/alpha/tc: tc_bus_mem.c tc_sgmap.c
src/sys/arch/alpha/tlsb: kftxx.c tlsb.c tlsbmem.c

Log Message:
Remove unnecessary #include 


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/alpha/alpha/core_machdep.c
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/alpha/alpha/interrupt.c
cvs rdiff -u -r1.372 -r1.373 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.293 -r1.294 src/sys/arch/alpha/alpha/pmap.c
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/alpha/alpha/vm_machdep.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/alpha/common/sgmap_common.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/alpha/isa/isapnp_machdep.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/jensenio/jensenio_bus_intio.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/alpha/jensenio/jensenio_bus_io.c \
src/sys/arch/alpha/jensenio/jensenio_bus_mem.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/alpha/jensenio/jensenio_dma.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/alpha/jensenio/jensenio_intr.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/alpha/mcbus/mcbus.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/mcbus/mcmem.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/alpha/pci/apecs.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/pci/apecs_bus_io.c \
src/sys/arch/alpha/pci/apecs_bus_mem.c \
src/sys/arch/alpha/pci/irongate_bus_mem.c \
src/sys/arch/alpha/pci/lca_bus_io.c src/sys/arch/alpha/pci/lca_bus_mem.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/alpha/pci/apecs_dma.c
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/alpha/pci/cia.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/pci/cia_bwx_bus_io.c \
src/sys/arch/alpha/pci/cia_bwx_bus_mem.c \
src/sys/arch/alpha/pci/mcpcia_bus_io.c \
src/sys/arch/alpha/pci/mcpcia_bus_mem.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/pci/cia_dma.c \
src/sys/arch/alpha/pci/pci_kn8ae.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/pci/cia_swiz_bus_io.c \
src/sys/arch/alpha/pci/pci_2100_a500.c src/sys/arch/alpha/pci/tsp_dma.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/pci/cia_swiz_bus_mem.c \
src/sys/arch/alpha/pci/ttwoga.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/alpha/pci/dwlpx_bus_io.c \
src/sys/arch/alpha/pci/dwlpx_bus_mem.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/pci/irongate.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/pci/irongate_bus_io.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/pci/irongate_dma.c \
src/sys/arch/alpha/pci/pci_sgmap_pte32.c \
src/sys/arch/alpha/pci/pci_sgmap_pte64.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/alpha/pci/lca.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/alpha/pci/lca_dma.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/alpha/pci/mcpcia_dma.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/alpha/pci/pci_1000.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/pci/pci_1000a.c \
src/sys/arch/alpha/pci/pci_6600.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/pci/pci_550.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/alpha/pci/pci_eb164.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/pci/pci_eb64plus.c \
src/sys/arch/alpha/pci/pci_eb66.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/alpha/pci/pci_kn20aa.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/alpha/pci/pci_kn300.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/alpha/pci/sio_pic.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/alpha/pci/tsc.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/alpha/pci/tsp_bus_io.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/alpha/pci/tsp_bus_mem.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/alpha/pci/ttwoga_bus_io.c \
src/sys/arch/alpha/pci/ttwoga_bus_mem.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/alpha/tc/tc_bus_mem.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/tc/tc_sgmap.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/tlsb/kftxx.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/alpha/tlsb/tlsb.c
cvs rdiff -u -r1.11 

CVS commit: src/sys/arch/alpha

2021-07-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jul  4 22:42:36 UTC 2021

Modified Files:
src/sys/arch/alpha/alpha: core_machdep.c interrupt.c machdep.c pmap.c
vm_machdep.c
src/sys/arch/alpha/common: sgmap_common.c
src/sys/arch/alpha/isa: isapnp_machdep.c
src/sys/arch/alpha/jensenio: jensenio_bus_intio.c jensenio_bus_io.c
jensenio_bus_mem.c jensenio_dma.c jensenio_intr.c
src/sys/arch/alpha/mcbus: mcbus.c mcmem.c
src/sys/arch/alpha/pci: apecs.c apecs_bus_io.c apecs_bus_mem.c
apecs_dma.c cia.c cia_bwx_bus_io.c cia_bwx_bus_mem.c cia_dma.c
cia_swiz_bus_io.c cia_swiz_bus_mem.c dwlpx_bus_io.c dwlpx_bus_mem.c
irongate.c irongate_bus_io.c irongate_bus_mem.c irongate_dma.c
lca.c lca_bus_io.c lca_bus_mem.c lca_dma.c mcpcia_bus_io.c
mcpcia_bus_mem.c mcpcia_dma.c pci_1000.c pci_1000a.c
pci_2100_a500.c pci_550.c pci_6600.c pci_eb164.c pci_eb64plus.c
pci_eb66.c pci_kn20aa.c pci_kn300.c pci_kn8ae.c pci_sgmap_pte32.c
pci_sgmap_pte64.c sio_pic.c tsc.c tsp_bus_io.c tsp_bus_mem.c
tsp_dma.c ttwoga.c ttwoga_bus_io.c ttwoga_bus_mem.c
src/sys/arch/alpha/tc: tc_bus_mem.c tc_sgmap.c
src/sys/arch/alpha/tlsb: kftxx.c tlsb.c tlsbmem.c

Log Message:
Remove unnecessary #include 


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/alpha/alpha/core_machdep.c
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/alpha/alpha/interrupt.c
cvs rdiff -u -r1.372 -r1.373 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.293 -r1.294 src/sys/arch/alpha/alpha/pmap.c
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/alpha/alpha/vm_machdep.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/alpha/common/sgmap_common.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/alpha/isa/isapnp_machdep.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/jensenio/jensenio_bus_intio.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/alpha/jensenio/jensenio_bus_io.c \
src/sys/arch/alpha/jensenio/jensenio_bus_mem.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/alpha/jensenio/jensenio_dma.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/alpha/jensenio/jensenio_intr.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/alpha/mcbus/mcbus.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/mcbus/mcmem.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/alpha/pci/apecs.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/pci/apecs_bus_io.c \
src/sys/arch/alpha/pci/apecs_bus_mem.c \
src/sys/arch/alpha/pci/irongate_bus_mem.c \
src/sys/arch/alpha/pci/lca_bus_io.c src/sys/arch/alpha/pci/lca_bus_mem.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/alpha/pci/apecs_dma.c
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/alpha/pci/cia.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/pci/cia_bwx_bus_io.c \
src/sys/arch/alpha/pci/cia_bwx_bus_mem.c \
src/sys/arch/alpha/pci/mcpcia_bus_io.c \
src/sys/arch/alpha/pci/mcpcia_bus_mem.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/pci/cia_dma.c \
src/sys/arch/alpha/pci/pci_kn8ae.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/pci/cia_swiz_bus_io.c \
src/sys/arch/alpha/pci/pci_2100_a500.c src/sys/arch/alpha/pci/tsp_dma.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/pci/cia_swiz_bus_mem.c \
src/sys/arch/alpha/pci/ttwoga.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/alpha/pci/dwlpx_bus_io.c \
src/sys/arch/alpha/pci/dwlpx_bus_mem.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/pci/irongate.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/pci/irongate_bus_io.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/pci/irongate_dma.c \
src/sys/arch/alpha/pci/pci_sgmap_pte32.c \
src/sys/arch/alpha/pci/pci_sgmap_pte64.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/alpha/pci/lca.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/alpha/pci/lca_dma.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/alpha/pci/mcpcia_dma.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/alpha/pci/pci_1000.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/pci/pci_1000a.c \
src/sys/arch/alpha/pci/pci_6600.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/pci/pci_550.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/alpha/pci/pci_eb164.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/pci/pci_eb64plus.c \
src/sys/arch/alpha/pci/pci_eb66.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/alpha/pci/pci_kn20aa.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/alpha/pci/pci_kn300.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/alpha/pci/sio_pic.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/alpha/pci/tsc.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/alpha/pci/tsp_bus_io.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/alpha/pci/tsp_bus_mem.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/alpha/pci/ttwoga_bus_io.c \
src/sys/arch/alpha/pci/ttwoga_bus_mem.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/alpha/tc/tc_bus_mem.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/tc/tc_sgmap.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/tlsb/kftxx.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/alpha/tlsb/tlsb.c
cvs rdiff -u -r1.11 

CVS commit: src/sys/arch/alpha

2021-07-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jul  4 22:36:43 UTC 2021

Modified Files:
src/sys/arch/alpha/common: shared_intr.c
src/sys/arch/alpha/include: intr.h pci_machdep.h
src/sys/arch/alpha/jensenio: jensenio_intr.c
src/sys/arch/alpha/pci: pci_1000.c pci_1000a.c pci_2100_a500.c
pci_550.c pci_6600.c pci_eb164.c pci_eb64plus.c pci_eb66.c
pci_kn20aa.c pci_kn300.c pci_machdep.c sio_pic.c

Log Message:
Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
  and just uses kmem_asprintf() to create an "irq %u" string by default.
  This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
  the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
  no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
  into a new alpha_pci_intr_alloc(), which is suitable for nearly every
  Alpha PCI platform.  Callers are expected to first have initialized
  the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/common/shared_intr.c
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/alpha/include/intr.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/alpha/include/pci_machdep.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/alpha/jensenio/jensenio_intr.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/pci/pci_1000.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/alpha/pci/pci_1000a.c \
src/sys/arch/alpha/pci/pci_6600.c src/sys/arch/alpha/pci/pci_machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/alpha/pci/pci_2100_a500.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/alpha/pci/pci_550.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/pci/pci_eb164.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/alpha/pci/pci_eb64plus.c \
src/sys/arch/alpha/pci/pci_eb66.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/alpha/pci/pci_kn20aa.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/pci/pci_kn300.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/alpha/pci/sio_pic.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/alpha/common/shared_intr.c
diff -u src/sys/arch/alpha/common/shared_intr.c:1.28 src/sys/arch/alpha/common/shared_intr.c:1.29
--- src/sys/arch/alpha/common/shared_intr.c:1.28	Fri Jun 25 18:08:34 2021
+++ src/sys/arch/alpha/common/shared_intr.c	Sun Jul  4 22:36:43 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: shared_intr.c,v 1.28 2021/06/25 18:08:34 thorpej Exp $ */
+/* $NetBSD: shared_intr.c,v 1.29 2021/07/04 22:36:43 thorpej Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: shared_intr.c,v 1.28 2021/06/25 18:08:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: shared_intr.c,v 1.29 2021/07/04 22:36:43 thorpej Exp $");
 
 #include 
 #include 
@@ -96,25 +96,23 @@ intr_typename(int type)
 }
 
 struct alpha_shared_intr *
-alpha_shared_intr_alloc(unsigned int n, unsigned int namesize)
+alpha_shared_intr_alloc(unsigned int n)
 {
 	struct alpha_shared_intr *intr;
 	unsigned int i;
 
+	KASSERT(n != 0);
+
 	intr = kmem_alloc(n * sizeof(*intr), KM_SLEEP);
 	for (i = 0; i < n; i++) {
 		TAILQ_INIT([i].intr_q);
 		intr[i].intr_sharetype = IST_NONE;
 		intr[i].intr_dfltsharetype = IST_NONE;
 		intr[i].intr_nstrays = 0;
-		intr[i].intr_maxstrays = 5;
+		intr[i].intr_maxstrays = 0;
 		intr[i].intr_private = NULL;
 		intr[i].intr_cpu = NULL;
-		if (namesize != 0) {
-			intr[i].intr_string = kmem_zalloc(namesize, KM_SLEEP);
-		} else {
-			intr[i].intr_string = NULL;
-		}
+		intr[i].intr_string = kmem_asprintf("irq %u", i);
 	}
 
 	return (intr);
@@ -492,7 +490,16 @@ alpha_shared_intr_evcnt(struct alpha_sha
 	return ([num].intr_evcnt);
 }
 
-char *
+void
+alpha_shared_intr_set_string(struct alpha_shared_intr *intr,
+unsigned int num, char *str)
+{
+	char *ostr = intr[num].intr_string;
+	intr[num].intr_string = str;
+	kmem_strfree(ostr);
+}
+
+const char *
 alpha_shared_intr_string(struct alpha_shared_intr *intr,
 unsigned int num)
 {

Index: src/sys/arch/alpha/include/intr.h
diff -u src/sys/arch/alpha/include/intr.h:1.83 src/sys/arch/alpha/include/intr.h:1.84
--- src/sys/arch/alpha/include/intr.h:1.83	Sat Oct 10 03:05:04 2020
+++ src/sys/arch/alpha/include/intr.h	Sun Jul  4 22:36:43 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.83 2020/10/10 03:05:04 thorpej Exp $ */
+/* $NetBSD: intr.h,v 1.84 2021/07/04 22:36:43 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
@@ -227,7 +227,7 @@ struct alpha_shared_intr {
 	

CVS commit: src/sys/arch/alpha

2021-07-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jul  4 22:36:43 UTC 2021

Modified Files:
src/sys/arch/alpha/common: shared_intr.c
src/sys/arch/alpha/include: intr.h pci_machdep.h
src/sys/arch/alpha/jensenio: jensenio_intr.c
src/sys/arch/alpha/pci: pci_1000.c pci_1000a.c pci_2100_a500.c
pci_550.c pci_6600.c pci_eb164.c pci_eb64plus.c pci_eb66.c
pci_kn20aa.c pci_kn300.c pci_machdep.c sio_pic.c

Log Message:
Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
  and just uses kmem_asprintf() to create an "irq %u" string by default.
  This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
  the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
  no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
  into a new alpha_pci_intr_alloc(), which is suitable for nearly every
  Alpha PCI platform.  Callers are expected to first have initialized
  the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/common/shared_intr.c
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/alpha/include/intr.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/alpha/include/pci_machdep.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/alpha/jensenio/jensenio_intr.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/pci/pci_1000.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/alpha/pci/pci_1000a.c \
src/sys/arch/alpha/pci/pci_6600.c src/sys/arch/alpha/pci/pci_machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/alpha/pci/pci_2100_a500.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/alpha/pci/pci_550.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/pci/pci_eb164.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/alpha/pci/pci_eb64plus.c \
src/sys/arch/alpha/pci/pci_eb66.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/alpha/pci/pci_kn20aa.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/pci/pci_kn300.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/alpha/pci/sio_pic.c

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



Re: CVS commit: src/common/lib/libc/arch/aarch64/atomic

2021-07-04 Thread Joerg Sonnenberger
On Sun, Jul 04, 2021 at 06:55:47AM +, Nick Hudson wrote:
> Module Name:  src
> Committed By: skrll
> Date: Sun Jul  4 06:55:47 UTC 2021
> 
> Modified Files:
>   src/common/lib/libc/arch/aarch64/atomic: atomic_nand_16.S
>   atomic_nand_32.S atomic_nand_64.S atomic_nand_8.S
> 
> Log Message:
> Fix the logic operation for atomic_nand_{8,16,32,64}
> 
> From the gcc docs the operations are as follows
> 
>  { tmp = *ptr; *ptr = ~(tmp & value); return tmp; }   // nand
>  { tmp = ~(*ptr & value); *ptr = tmp; return *ptr; }   // nand
> 
> yes, this is really rather strange.

This depends on which GCC version you are looking at. They changed it
sometime in the early GCC 4 days.

Joerg


CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 20:22:31 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile
Added Files:
src/tests/usr.bin/xlint/lint1: op_shl_lp64.c op_shl_lp64.exp

Log Message:
test/lint: demonstrate wrong warnings for 128-bit shifts


To generate a diff of this commit:
cvs rdiff -u -r1.1075 -r1.1076 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.78 -r1.79 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/op_shl_lp64.c \
src/tests/usr.bin/xlint/lint1/op_shl_lp64.exp

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1075 src/distrib/sets/lists/tests/mi:1.1076
--- src/distrib/sets/lists/tests/mi:1.1075	Sun Jul  4 13:14:53 2021
+++ src/distrib/sets/lists/tests/mi	Sun Jul  4 20:22:31 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1075 2021/07/04 13:14:53 rillig Exp $
+# $NetBSD: mi,v 1.1076 2021/07/04 20:22:31 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6941,6 +6941,8 @@
 ./usr/tests/usr.bin/xlint/lint1/msg_345.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/op_colon.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/op_colon.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/stmt_for.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/stmt_for.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/t_integration			tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.78 src/tests/usr.bin/xlint/lint1/Makefile:1.79
--- src/tests/usr.bin/xlint/lint1/Makefile:1.78	Sun Jul  4 13:14:54 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Sun Jul  4 20:22:31 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.78 2021/07/04 13:14:54 rillig Exp $
+# $NetBSD: Makefile,v 1.79 2021/07/04 20:22:31 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	345		# see lint1/err.c
@@ -151,6 +151,8 @@ FILES+=		msg_259_ilp32.c
 FILES+=		msg_259_ilp32.exp
 FILES+=		op_colon.c
 FILES+=		op_colon.exp
+FILES+=		op_shl_lp64.c
+FILES+=		op_shl_lp64.exp
 FILES+=		stmt_for.c
 FILES+=		stmt_for.exp
 

Added files:

Index: src/tests/usr.bin/xlint/lint1/op_shl_lp64.c
diff -u /dev/null src/tests/usr.bin/xlint/lint1/op_shl_lp64.c:1.1
--- /dev/null	Sun Jul  4 20:22:31 2021
+++ src/tests/usr.bin/xlint/lint1/op_shl_lp64.c	Sun Jul  4 20:22:31 2021
@@ -0,0 +1,18 @@
+/*	$NetBSD: op_shl_lp64.c,v 1.1 2021/07/04 20:22:31 rillig Exp $	*/
+# 3 "op_shl_lp64.c"
+
+/*
+ * Test overflow on shl of 128-bit integers, as seen in
+ * ecp_nistp256.c(296).
+ */
+
+/* lint1-only-if lp64 */
+
+const __uint128_t zero105 =
+/* FIXME: 105 is ok for __uint128_t */
+/* expect+1: warning: shift amount 105 is greater than bit-size 32 of 'int' [122] */
+(((__uint128_t)1) << 105)
+/* FIXME: 41 is ok for __uint128_t */
+/* expect+1: warning: shift amount 41 is greater than bit-size 32 of 'int' [122] */
+- (((__uint128_t)1) << 41)
+- (((__uint128_t)1) << 9);
Index: src/tests/usr.bin/xlint/lint1/op_shl_lp64.exp
diff -u /dev/null src/tests/usr.bin/xlint/lint1/op_shl_lp64.exp:1.1
--- /dev/null	Sun Jul  4 20:22:31 2021
+++ src/tests/usr.bin/xlint/lint1/op_shl_lp64.exp	Sun Jul  4 20:22:31 2021
@@ -0,0 +1,2 @@
+op_shl_lp64.c(14): warning: shift amount 105 is greater than bit-size 32 of 'int' [122]
+op_shl_lp64.c(17): warning: shift amount 41 is greater than bit-size 32 of 'int' [122]



CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 20:22:31 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile
Added Files:
src/tests/usr.bin/xlint/lint1: op_shl_lp64.c op_shl_lp64.exp

Log Message:
test/lint: demonstrate wrong warnings for 128-bit shifts


To generate a diff of this commit:
cvs rdiff -u -r1.1075 -r1.1076 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.78 -r1.79 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/op_shl_lp64.c \
src/tests/usr.bin/xlint/lint1/op_shl_lp64.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-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 17:32:24 UTC 2021

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

Log Message:
tests/lint: align tests for argument conversion to each other


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_259.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_259.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_259.c
diff -u src/tests/usr.bin/xlint/lint1/msg_259.c:1.8 src/tests/usr.bin/xlint/lint1/msg_259.c:1.9
--- src/tests/usr.bin/xlint/lint1/msg_259.c:1.8	Tue Jun 29 13:58:13 2021
+++ src/tests/usr.bin/xlint/lint1/msg_259.c	Sun Jul  4 17:32:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_259.c,v 1.8 2021/06/29 13:58:13 rillig Exp $	*/
+/*	$NetBSD: msg_259.c,v 1.9 2021/07/04 17:32:24 rillig Exp $	*/
 # 3 "msg_259.c"
 
 // Test for message: argument #%d is converted from '%s' to '%s' due to prototype [259]
@@ -15,11 +15,16 @@ example(char c, int i, long l)
 {
 	farg_char(c);
 	farg_int(c);
-	farg_long(c);		/* XXX: 259 on ILP32 but not LP64 */
+	/* No warning 259 on LP64, only on ILP32 */
+	farg_long(c);
+
 	farg_char(i);		/* XXX: why no warning? */
 	farg_int(i);
-	farg_long(i);		/* XXX: 259 on ILP32 but not LP64 */
+	/* No warning 259 on LP64, only on ILP32 */
+	farg_long(i);
+
 	farg_char(l);		/* XXX: why no warning? */
-	farg_int(l);		/* expect: 259 */
+	/* expect+1: from 'long' to 'int' due to prototype [259] */
+	farg_int(l);
 	farg_long(l);
 }

Index: src/tests/usr.bin/xlint/lint1/msg_259.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_259.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_259.exp:1.7
--- src/tests/usr.bin/xlint/lint1/msg_259.exp:1.6	Tue Jun 29 09:19:17 2021
+++ src/tests/usr.bin/xlint/lint1/msg_259.exp	Sun Jul  4 17:32:24 2021
@@ -1 +1 @@
-msg_259.c(23): warning: argument #1 is converted from 'long' to 'int' due to prototype [259]
+msg_259.c(28): warning: argument #1 is converted from 'long' to 'int' due to prototype [259]



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

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 17:32:24 UTC 2021

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

Log Message:
tests/lint: align tests for argument conversion to each other


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

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



CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 17:28:06 UTC 2021

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

Log Message:
lint: replace wrong assumption with citation from C99

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_101.c
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_101.exp
cvs rdiff -u -r1.311 -r1.312 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.8 src/tests/usr.bin/xlint/lint1/msg_101.c:1.9
--- src/tests/usr.bin/xlint/lint1/msg_101.c:1.8	Sun Jul  4 17:16:09 2021
+++ src/tests/usr.bin/xlint/lint1/msg_101.c	Sun Jul  4 17:28:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_101.c,v 1.8 2021/07/04 17:16:09 rillig Exp $	*/
+/*	$NetBSD: msg_101.c,v 1.9 2021/07/04 17:28:06 rillig Exp $	*/
 # 3 "msg_101.c"
 
 // Test for message: type '%s' does not have member '%s' [101]
@@ -31,7 +31,6 @@ test(const struct point *ptr, const stru
 	/* accessing a nonexistent member via the wrong operator */
 	/* expect+1: error: type 'pointer to const struct point' does not have member 'z' [101] */
 	sink(ptr.z);
-	/* FIXME: In cconv, don't set t_const unconditionally to false. */
 	/* 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.7 src/tests/usr.bin/xlint/lint1/msg_101.exp:1.8
--- src/tests/usr.bin/xlint/lint1/msg_101.exp:1.7	Sun Jul  4 17:01:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_101.exp	Sun Jul  4 17:28:06 2021
@@ -3,4 +3,4 @@ msg_101.c(23): error: type 'const struct
 msg_101.c(27): error: left operand of '.' must be struct or union, not 'pointer to const struct point' [103]
 msg_101.c(29): error: left operand of '->' must be pointer to struct or union, not 'struct point' [104]
 msg_101.c(33): error: type 'pointer to const struct point' does not have member 'z' [101]
-msg_101.c(36): error: type 'struct point' does not have member 'z' [101]
+msg_101.c(35): error: type 'struct point' does not have member 'z' [101]

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.311 src/usr.bin/xlint/lint1/tree.c:1.312
--- src/usr.bin/xlint/lint1/tree.c:1.311	Sun Jul  4 17:16:09 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sun Jul  4 17:28:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.311 2021/07/04 17:16:09 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.312 2021/07/04 17:28:05 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.311 2021/07/04 17:16:09 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.312 2021/07/04 17:28:05 rillig Exp $");
 #endif
 
 #include 
@@ -728,7 +728,7 @@ cconv(tnode_t *tn)
 	/* lvalue to rvalue */
 	if (tn->tn_lvalue) {
 		tp = expr_dup_type(tn->tn_type);
-		/* FIXME: even rvalues can be const/volatile, see msg_101 */
+		/* C99 6.3.2.1p2 sentence 2 says to remove the qualifiers. */
 		tp->t_const = tp->t_volatile = false;
 		tn = new_tnode(LOAD, tp, tn, NULL);
 	}



CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 17:28:06 UTC 2021

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

Log Message:
lint: replace wrong assumption with citation from C99

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_101.c
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_101.exp
cvs rdiff -u -r1.311 -r1.312 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-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 17:01:58 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_101.c msg_101.exp msg_103.c
msg_103.exp msg_104.c msg_104.exp
src/usr.bin/xlint/lint1: err.c tree.c

Log Message:
lint: align messages for invalid left operand of '.' or '->'


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_101.c \
src/tests/usr.bin/xlint/lint1/msg_101.exp
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_103.c \
src/tests/usr.bin/xlint/lint1/msg_103.exp \
src/tests/usr.bin/xlint/lint1/msg_104.c \
src/tests/usr.bin/xlint/lint1/msg_104.exp
cvs rdiff -u -r1.124 -r1.125 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.309 -r1.310 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.6 src/tests/usr.bin/xlint/lint1/msg_101.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_101.c:1.6	Wed Jun 30 14:11:08 2021
+++ src/tests/usr.bin/xlint/lint1/msg_101.c	Sun Jul  4 17:01:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_101.c,v 1.6 2021/06/30 14:11:08 rillig Exp $	*/
+/*	$NetBSD: msg_101.c,v 1.7 2021/07/04 17:01:58 rillig Exp $	*/
 # 3 "msg_101.c"
 
 // Test for message: type '%s' does not have member '%s' [101]
@@ -23,11 +23,9 @@ test(const struct point *ptr, const stru
 	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] */
+	/* expect+1: error: left operand of '.' must be struct or union, not 'pointer to const struct point' [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] */
+	/* expect+1: error: left operand of '->' must be pointer to struct or union, not 'struct point' [104] */
 	sink(pt->x);
 
 	/* accessing a nonexistent member via the wrong operator */
Index: src/tests/usr.bin/xlint/lint1/msg_101.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_101.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_101.exp:1.7
--- src/tests/usr.bin/xlint/lint1/msg_101.exp:1.6	Wed Jun 30 14:11:08 2021
+++ src/tests/usr.bin/xlint/lint1/msg_101.exp	Sun Jul  4 17:01:58 2021
@@ -1,6 +1,6 @@
 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]
+msg_101.c(27): error: left operand of '.' must be struct or union, not 'pointer to const struct point' [103]
+msg_101.c(29): error: left operand of '->' must be pointer to struct or union, not 'struct point' [104]
+msg_101.c(33): error: type 'pointer to const struct point' does not have member 'z' [101]
+msg_101.c(36): error: type 'struct point' does not have member 'z' [101]

Index: src/tests/usr.bin/xlint/lint1/msg_103.c
diff -u src/tests/usr.bin/xlint/lint1/msg_103.c:1.2 src/tests/usr.bin/xlint/lint1/msg_103.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_103.c:1.2	Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_103.c	Sun Jul  4 17:01:58 2021
@@ -1,7 +1,16 @@
-/*	$NetBSD: msg_103.c,v 1.2 2021/02/21 09:07:58 rillig Exp $	*/
+/*	$NetBSD: msg_103.c,v 1.3 2021/07/04 17:01:58 rillig Exp $	*/
 # 3 "msg_103.c"
 
-// Test for message: left operand of '.' must be struct/union object [103]
+// Test for message: left operand of '.' must be struct or union, not '%s' [103]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+struct point {
+	int x, y;
+};
+
+void
+test(struct point pt, struct point *ptr)
+{
+	pt.x = 0;
+	/* expect+1: left operand of '.' must be struct or union, not 'pointer to struct point' [103] */
+	ptr.y = 0;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_103.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_103.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_103.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_103.exp:1.2	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_103.exp	Sun Jul  4 17:01:58 2021
@@ -1 +1 @@
-msg_103.c(6): error: syntax error ':' [249]
+msg_103.c(15): error: left operand of '.' must be struct or union, not 'pointer to struct point' [103]
Index: src/tests/usr.bin/xlint/lint1/msg_104.c
diff -u src/tests/usr.bin/xlint/lint1/msg_104.c:1.2 src/tests/usr.bin/xlint/lint1/msg_104.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_104.c:1.2	Sun Feb 21 09:07:58 2021

CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 17:01:58 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_101.c msg_101.exp msg_103.c
msg_103.exp msg_104.c msg_104.exp
src/usr.bin/xlint/lint1: err.c tree.c

Log Message:
lint: align messages for invalid left operand of '.' or '->'


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_101.c \
src/tests/usr.bin/xlint/lint1/msg_101.exp
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_103.c \
src/tests/usr.bin/xlint/lint1/msg_103.exp \
src/tests/usr.bin/xlint/lint1/msg_104.c \
src/tests/usr.bin/xlint/lint1/msg_104.exp
cvs rdiff -u -r1.124 -r1.125 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.309 -r1.310 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-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 16:44:13 UTC 2021

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

Log Message:
lint: clean up new_tnode

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 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-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 16:44:13 UTC 2021

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

Log Message:
lint: clean up new_tnode

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 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.308 src/usr.bin/xlint/lint1/tree.c:1.309
--- src/usr.bin/xlint/lint1/tree.c:1.308	Sun Jul  4 13:14:54 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sun Jul  4 16:44:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.308 2021/07/04 13:14:54 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.309 2021/07/04 16:44: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.308 2021/07/04 13:14:54 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.309 2021/07/04 16:44:13 rillig Exp $");
 #endif
 
 #include 
@@ -1627,7 +1627,7 @@ new_tnode(op_t op, type_t *type, tnode_t
 {
 	tnode_t	*ntn;
 	tspec_t	t;
-#ifdef notyet
+#if 0 /* not yet */
 	size_t l;
 	uint64_t rnum;
 #endif
@@ -1636,15 +1636,12 @@ new_tnode(op_t op, type_t *type, tnode_t
 
 	ntn->tn_op = op;
 	ntn->tn_type = type;
-	if (ln->tn_relaxed)
-		ntn->tn_relaxed = true;
-	if (rn != NULL && rn->tn_relaxed)
-		ntn->tn_relaxed = true;
+	ntn->tn_relaxed = ln->tn_relaxed || (rn != NULL && rn->tn_relaxed);
 	ntn->tn_left = ln;
 	ntn->tn_right = rn;
 
 	switch (op) {
-#ifdef notyet
+#if 0 /* not yet */
 	case SHR:
 		if (rn->tn_op != CON)
 			break;



CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 17:16:09 UTC 2021

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

Log Message:
lint: document where to fix missing const in lvalue-to-rvalue

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_101.c
cvs rdiff -u -r1.310 -r1.311 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.7 src/tests/usr.bin/xlint/lint1/msg_101.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_101.c:1.7	Sun Jul  4 17:01:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_101.c	Sun Jul  4 17:16:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_101.c,v 1.7 2021/07/04 17:01:58 rillig Exp $	*/
+/*	$NetBSD: msg_101.c,v 1.8 2021/07/04 17:16:09 rillig Exp $	*/
 # 3 "msg_101.c"
 
 // Test for message: type '%s' does not have member '%s' [101]
@@ -31,7 +31,7 @@ test(const struct point *ptr, const stru
 	/* accessing a nonexistent member via the wrong operator */
 	/* expect+1: error: type 'pointer to const struct point' does not have member 'z' [101] */
 	sink(ptr.z);
-	/* XXX: Why is the 'const' missing here, but not above? */
+	/* FIXME: In cconv, don't set t_const unconditionally to false. */
 	/* expect+1: error: type 'struct point' does not have member 'z' [101] */
 	sink(pt->z);
 }

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.310 src/usr.bin/xlint/lint1/tree.c:1.311
--- src/usr.bin/xlint/lint1/tree.c:1.310	Sun Jul  4 17:01:58 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sun Jul  4 17:16:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.310 2021/07/04 17:01:58 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.311 2021/07/04 17:16:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.310 2021/07/04 17:01:58 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.311 2021/07/04 17:16:09 rillig Exp $");
 #endif
 
 #include 
@@ -728,6 +728,7 @@ cconv(tnode_t *tn)
 	/* lvalue to rvalue */
 	if (tn->tn_lvalue) {
 		tp = expr_dup_type(tn->tn_type);
+		/* FIXME: even rvalues can be const/volatile, see msg_101 */
 		tp->t_const = tp->t_volatile = false;
 		tn = new_tnode(LOAD, tp, tn, NULL);
 	}



CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 17:16:09 UTC 2021

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

Log Message:
lint: document where to fix missing const in lvalue-to-rvalue

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_101.c
cvs rdiff -u -r1.310 -r1.311 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/lib/libc/include

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 16:18:50 UTC 2021

Modified Files:
src/lib/libc/include: namespace.h

Log Message:
libc: remove special handling for lint

In namespace.h 1.102 from 2005-07-16, the #ifndef was added to fix the
broken lint2 pass.  Somewhere between 2005 and now, lint has been
changed so that it does not need this workaround anymore.

After usr.bin/xlint/lint1/tree.c 1.303 from 2021-06-30, the #ifndef in
namespace.h caused the only warning about an implicit function
declaration in the whole NetBSD tree, in lib/libc/gen/sysconf.c:149,
where _getpagesize was not defined, but only getpagesize.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/lib/libc/include/namespace.h

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/include/namespace.h
diff -u src/lib/libc/include/namespace.h:1.200 src/lib/libc/include/namespace.h:1.201
--- src/lib/libc/include/namespace.h:1.200	Tue Sep 22 21:38:50 2020
+++ src/lib/libc/include/namespace.h	Sun Jul  4 16:18:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: namespace.h,v 1.200 2020/09/22 21:38:50 nia Exp $	*/
+/*	$NetBSD: namespace.h,v 1.201 2021/07/04 16:18:50 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -32,7 +32,6 @@
 #include 
 #include 
 
-#ifndef __lint__
 #define aio_suspend	_aio_suspend
 #define brk		_brk
 #define catclose	_catclose
@@ -961,6 +960,5 @@
 
 #define __learn_tree		___learn_tree
 #endif /* __weak_alias */
-#endif /* !__lint__ */
 
 #endif /* _NAMESPACE_H_ */



CVS commit: src/lib/libc/include

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 16:18:50 UTC 2021

Modified Files:
src/lib/libc/include: namespace.h

Log Message:
libc: remove special handling for lint

In namespace.h 1.102 from 2005-07-16, the #ifndef was added to fix the
broken lint2 pass.  Somewhere between 2005 and now, lint has been
changed so that it does not need this workaround anymore.

After usr.bin/xlint/lint1/tree.c 1.303 from 2021-06-30, the #ifndef in
namespace.h caused the only warning about an implicit function
declaration in the whole NetBSD tree, in lib/libc/gen/sysconf.c:149,
where _getpagesize was not defined, but only getpagesize.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/lib/libc/include/namespace.h

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-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 13:32:35 UTC 2021

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

Log Message:
tests/lint: document why lint does not need to detect wrong types


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_004.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_004.c
diff -u src/tests/usr.bin/xlint/lint1/msg_004.c:1.4 src/tests/usr.bin/xlint/lint1/msg_004.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_004.c:1.4	Mon Apr  5 01:35:34 2021
+++ src/tests/usr.bin/xlint/lint1/msg_004.c	Sun Jul  4 13:32:35 2021
@@ -1,9 +1,9 @@
-/*	$NetBSD: msg_004.c,v 1.4 2021/04/05 01:35:34 rillig Exp $	*/
+/*	$NetBSD: msg_004.c,v 1.5 2021/07/04 13:32:35 rillig Exp $	*/
 # 3 "msg_004.c"
 
 // Test for message: illegal type combination [4]
 
-// XXX: this goes undetected
+// Lint does not detect "two or more data types", but GCC does.
 signed double signed_double;
 
 int ok_int;



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

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 13:32:35 UTC 2021

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

Log Message:
tests/lint: document why lint does not need to detect wrong types


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

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



CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 12:24:39 UTC 2021

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

Log Message:
lint: remove support for obsolete GCC-style lvalue casts

Since GCC 4.0, a cast results in an rvalue.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_163.c \
src/tests/usr.bin/xlint/lint1/msg_163.exp
cvs rdiff -u -r1.306 -r1.307 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_163.c
diff -u src/tests/usr.bin/xlint/lint1/msg_163.c:1.3 src/tests/usr.bin/xlint/lint1/msg_163.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_163.c:1.3	Mon Apr  5 01:35:34 2021
+++ src/tests/usr.bin/xlint/lint1/msg_163.c	Sun Jul  4 12:24:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_163.c,v 1.3 2021/04/05 01:35:34 rillig Exp $	*/
+/*	$NetBSD: msg_163.c,v 1.4 2021/07/04 12:24:39 rillig Exp $	*/
 # 3 "msg_163.c"
 
 // Test for message: a cast does not yield an lvalue [163]
@@ -7,7 +7,21 @@ void
 example(char *p, int i)
 {
 	p++;
-	((char *)p)++;		/* XXX: why is this ok? */
+
+	/*
+	 * Using a cast as an lvalue had been a GCC extension until 3.4.
+	 * It was removed in GCC 4.0.
+	 *
+	 * https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Lvalues.html#Lvalues
+	 * https://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/index.html#toc_C-Extensions
+	 */
+	/* expect+2: error: a cast does not yield an lvalue [163] */
+	/* expect+1: error: operand of 'x++' must be lvalue [114] */
+	((char *)p)++;
+
 	i++;
-	((int)i)++;		/* expect: 163 *//* expect: 114 */
+
+	/* expect+2: error: a cast does not yield an lvalue [163] */
+	/* expect+1: error: operand of 'x++' must be lvalue [114] */
+	((int)i)++;
 }
Index: src/tests/usr.bin/xlint/lint1/msg_163.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_163.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_163.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_163.exp:1.3	Sun Mar 21 20:45:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_163.exp	Sun Jul  4 12:24:39 2021
@@ -1,2 +1,4 @@
-msg_163.c(12): error: a cast does not yield an lvalue [163]
-msg_163.c(12): error: operand of 'x++' must be lvalue [114]
+msg_163.c(20): error: a cast does not yield an lvalue [163]
+msg_163.c(20): error: operand of 'x++' must be lvalue [114]
+msg_163.c(26): error: a cast does not yield an lvalue [163]
+msg_163.c(26): error: operand of 'x++' must be lvalue [114]

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.306 src/usr.bin/xlint/lint1/tree.c:1.307
--- src/usr.bin/xlint/lint1/tree.c:1.306	Sun Jul  4 09:13:59 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sun Jul  4 12:24:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.306 2021/07/04 09:13:59 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.307 2021/07/04 12:24:38 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.306 2021/07/04 09:13:59 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.307 2021/07/04 12:24:38 rillig Exp $");
 #endif
 
 #include 
@@ -760,8 +760,6 @@ typeok_incdec(op_t op, const tnode_t *tn
 	if (!tn->tn_lvalue) {
 		if (tn->tn_op == CVT && tn->tn_cast &&
 		tn->tn_left->tn_op == LOAD) {
-			if (tn->tn_type->t_tspec == PTR)
-return true;
 			/* a cast does not yield an lvalue */
 			error(163);
 		}



CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 12:24:39 UTC 2021

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

Log Message:
lint: remove support for obsolete GCC-style lvalue casts

Since GCC 4.0, a cast results in an rvalue.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_163.c \
src/tests/usr.bin/xlint/lint1/msg_163.exp
cvs rdiff -u -r1.306 -r1.307 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-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 13:14:54 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile d_cast_lhs.c
src/usr.bin/xlint/lint1: tree.c
Added Files:
src/tests/usr.bin/xlint/lint1: d_cast_lhs.exp

Log Message:
lint: remove remaining support for lvalue casts

These had been GCC extensions until GCC 3.4, they were removed in GCC
4.0.


To generate a diff of this commit:
cvs rdiff -u -r1.1074 -r1.1075 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.77 -r1.78 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/d_cast_lhs.c
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/d_cast_lhs.exp
cvs rdiff -u -r1.307 -r1.308 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/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1074 src/distrib/sets/lists/tests/mi:1.1075
--- src/distrib/sets/lists/tests/mi:1.1074	Sun Jul  4 08:19:05 2021
+++ src/distrib/sets/lists/tests/mi	Sun Jul  4 13:14:53 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1074 2021/07/04 08:19:05 rillig Exp $
+# $NetBSD: mi,v 1.1075 2021/07/04 13:14:53 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6151,6 +6151,7 @@
 ./usr/tests/usr.bin/xlint/lint1/d_cast_init.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_cast_init2.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_cast_lhs.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/d_cast_lhs.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_cast_typeof.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_compound_literals1.c		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_compound_literals2.c		tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.77 src/tests/usr.bin/xlint/lint1/Makefile:1.78
--- src/tests/usr.bin/xlint/lint1/Makefile:1.77	Sun Jul  4 08:50:26 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Sun Jul  4 13:14:54 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.77 2021/07/04 08:50:26 rillig Exp $
+# $NetBSD: Makefile,v 1.78 2021/07/04 13:14:54 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	345		# see lint1/err.c
@@ -55,6 +55,7 @@ FILES+=		d_cast_fun_array_param.c
 FILES+=		d_cast_init.c
 FILES+=		d_cast_init2.c
 FILES+=		d_cast_lhs.c
+FILES+=		d_cast_lhs.exp
 FILES+=		d_cast_typeof.c
 FILES+=		d_compound_literals1.c
 FILES+=		d_compound_literals2.c

Index: src/tests/usr.bin/xlint/lint1/d_cast_lhs.c
diff -u src/tests/usr.bin/xlint/lint1/d_cast_lhs.c:1.4 src/tests/usr.bin/xlint/lint1/d_cast_lhs.c:1.5
--- src/tests/usr.bin/xlint/lint1/d_cast_lhs.c:1.4	Sat Mar 27 13:59:18 2021
+++ src/tests/usr.bin/xlint/lint1/d_cast_lhs.c	Sun Jul  4 13:14:54 2021
@@ -1,18 +1,29 @@
-/*	$NetBSD: d_cast_lhs.c,v 1.4 2021/03/27 13:59:18 rillig Exp $	*/
+/*	$NetBSD: d_cast_lhs.c,v 1.5 2021/07/04 13:14:54 rillig Exp $	*/
 # 3 "d_cast_lhs.c"
 
 /*
- * pointer casts are valid lhs lvalues
+ * Pointer casts had been valid lvalues in GCC before 4.0.
  *
- * XXX: C99 6.5.4 "Cast operators" footnote 85 says "A cast does not yield an
- * lvalue".  It does not mention any exceptional rule for pointers.
+ * https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Lvalues.html#Lvalues
+ *
+ * C99 6.5.4 "Cast operators" footnote 85 says "A cast does not yield an
+ * lvalue".
  */
-struct sockaddr {
+struct str {
+	int member;
 };
 
+void sink(const void *);
+
+/* ARGSUSED */
 void
-foo()
+foo(void *p)
 {
-	unsigned long p = 6;
-	((struct sockaddr *)p) = 0;
+	/* expect+2: error: a cast does not yield an lvalue [163] */
+	/* expect+1: error: left operand of '=' must be lvalue [114] */
+	((struct str *)p) = 0;
+
+	/* expect+2: error: a cast does not yield an lvalue [163] */
+	/* expect+1: error: operand of '&' must be lvalue [114] */
+	sink(&(const void *)p);
 }

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.307 src/usr.bin/xlint/lint1/tree.c:1.308
--- src/usr.bin/xlint/lint1/tree.c:1.307	Sun Jul  4 12:24:38 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sun Jul  4 13:14:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.307 2021/07/04 12:24:38 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.308 2021/07/04 13:14:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.307 2021/07/04 12:24:38 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.308 2021/07/04 13:14:54 rillig Exp $");
 #endif
 
 #include 
@@ -783,8 +783,6 @@ typeok_address(const mod_t *mp,
 	} else if (!tn->tn_lvalue) {
 		if (tn->tn_op == CVT && tn->tn_cast &&
 		tn->tn_left->tn_op == 

CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 13:14:54 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile d_cast_lhs.c
src/usr.bin/xlint/lint1: tree.c
Added Files:
src/tests/usr.bin/xlint/lint1: d_cast_lhs.exp

Log Message:
lint: remove remaining support for lvalue casts

These had been GCC extensions until GCC 3.4, they were removed in GCC
4.0.


To generate a diff of this commit:
cvs rdiff -u -r1.1074 -r1.1075 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.77 -r1.78 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/d_cast_lhs.c
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/d_cast_lhs.exp
cvs rdiff -u -r1.307 -r1.308 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/tools/compat

2021-07-04 Thread Chris Pinnock
Module Name:src
Committed By:   cjep
Date:   Sun Jul  4 12:57:48 UTC 2021

Modified Files:
src/tools/compat: README

Log Message:
LLVM RT library will actually cross-build from OpenBSD provided sufficient
limits are in place for the build user.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/tools/compat/README

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

Modified files:

Index: src/tools/compat/README
diff -u src/tools/compat/README:1.19 src/tools/compat/README:1.20
--- src/tools/compat/README:1.19	Tue Jun 29 10:02:34 2021
+++ src/tools/compat/README	Sun Jul  4 12:57:48 2021
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.19 2021/06/29 10:02:34 cjep Exp $
+$NetBSD: README,v 1.20 2021/07/04 12:57:48 cjep Exp $
 
 Special notes for cross-hosting a NetBSD build on certain platforms.  
 Only those platforms which have been tested to complete a "build.sh" run
@@ -65,10 +65,14 @@ OpenBSD
 ---
 
 As of -current 20210629, ./build.sh will build src on OpenBSD 6.9
-for some platforms. Known problems:
-* MIPS targets do not currently build. 
-* The LLVM RT library will not build and consequently nor will X on 
-  amd64 and i386.
+for all targets except MIPS-based ones. 
+
+For builds requiring the LLVM RT library (including X on amd64, 
+i386 and evbarm64-el), the build user's limits needs to be setup 
+for higher memory usage, otherwise the build will fail. This can
+be achieved by either building as root (not recommended) or
+by changing the datasize attribute to infinity for the relevant
+groups and users in /etc/login.conf.
 
 NetBSD (earlier releases)
 -



CVS commit: src/tools/compat

2021-07-04 Thread Chris Pinnock
Module Name:src
Committed By:   cjep
Date:   Sun Jul  4 12:57:48 UTC 2021

Modified Files:
src/tools/compat: README

Log Message:
LLVM RT library will actually cross-build from OpenBSD provided sufficient
limits are in place for the build user.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/tools/compat/README

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-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 13:44:43 UTC 2021

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

Log Message:
tests/lint: fix unintended character constant in test

I originally intended to type ASCII DEL as an example of a nonprintable
character code.  The actual character that landed in the code was
instead U+2303 "house", which looks similar to the typical
representation of the DEL character.  The UTF-8 byte sequence for that
code point started with \xE2, or in octal \342.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_080.c \
src/tests/usr.bin/xlint/lint1/msg_080.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_080.c
diff -u src/tests/usr.bin/xlint/lint1/msg_080.c:1.3 src/tests/usr.bin/xlint/lint1/msg_080.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_080.c:1.3	Tue Jun 29 07:17:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_080.c	Sun Jul  4 13:44:43 2021
@@ -1,9 +1,7 @@
-/*	$NetBSD: msg_080.c,v 1.3 2021/06/29 07:17:43 rillig Exp $	*/
+/*	$NetBSD: msg_080.c,v 1.4 2021/07/04 13:44:43 rillig Exp $	*/
 # 3 "msg_080.c"
 
 // Test for message: dubious escape \%o [80]
 
-/* expect+3: dubious escape \342 [80] */ /* FIXME: Why 342? */
-/* expect+2: multi-character character constant [294] */
-/* expect+1: initializer does not fit */
-char backslash_delete = '\⌂';
+/* expect+1: dubious escape \177 [80] */
+char backslash_delete = '\';
Index: src/tests/usr.bin/xlint/lint1/msg_080.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_080.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_080.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_080.exp:1.3	Tue Jun 29 07:17:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_080.exp	Sun Jul  4 13:44:43 2021
@@ -1,3 +1 @@
-msg_080.c(9): warning: dubious escape \342 [80]
-msg_080.c(9): warning: multi-character character constant [294]
-msg_080.c(9): warning: initializer does not fit [178]
+msg_080.c(7): warning: dubious escape \177 [80]



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

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 13:44:43 UTC 2021

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

Log Message:
tests/lint: fix unintended character constant in test

I originally intended to type ASCII DEL as an example of a nonprintable
character code.  The actual character that landed in the code was
instead U+2303 "house", which looks similar to the typical
representation of the DEL character.  The UTF-8 byte sequence for that
code point started with \xE2, or in octal \342.


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

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



CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 13:31:10 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_031.c msg_031.exp msg_152.exp
msg_175.exp
src/usr.bin/xlint/lint1: decl.c err.c

Log Message:
lint: improve wording for incomplete struct or union


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_031.c \
src/tests/usr.bin/xlint/lint1/msg_031.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_152.exp
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_175.exp
cvs rdiff -u -r1.192 -r1.193 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.123 -r1.124 src/usr.bin/xlint/lint1/err.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_031.c
diff -u src/tests/usr.bin/xlint/lint1/msg_031.c:1.4 src/tests/usr.bin/xlint/lint1/msg_031.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_031.c:1.4	Tue Mar 16 23:39:41 2021
+++ src/tests/usr.bin/xlint/lint1/msg_031.c	Sun Jul  4 13:31:10 2021
@@ -1,7 +1,7 @@
-/*	$NetBSD: msg_031.c,v 1.4 2021/03/16 23:39:41 rillig Exp $	*/
+/*	$NetBSD: msg_031.c,v 1.5 2021/07/04 13:31:10 rillig Exp $	*/
 # 3 "msg_031.c"
 
-// Test for message: incomplete structure or union %s: %s [31]
+// Test for message: argument '%s' has type '%s' [31]
 
 struct complete {
 	int dummy;
@@ -14,5 +14,6 @@ struct complete complete_var;
 
 struct incomplete incomplete_var;	/* expect: 31 */
 
-/* XXX: the 'incomplete: ' in the diagnostic looks strange */
-void function(struct incomplete);	/* expect: incomplete:  [31] */
+
+/* expect+1: error: argument '' has type 'incomplete struct incomplete' [31] */
+void function(struct incomplete);
Index: src/tests/usr.bin/xlint/lint1/msg_031.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_031.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_031.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_031.exp:1.4	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_031.exp	Sun Jul  4 13:31:10 2021
@@ -1,3 +1,3 @@
-msg_031.c(18): error: incomplete structure or union incomplete:  [31]
+msg_031.c(19): error: argument '' has type 'incomplete struct incomplete' [31]
 msg_031.c(10): warning: struct incomplete never defined [233]
-msg_031.c(15): error: incomplete structure or union incomplete: incomplete_var [31]
+msg_031.c(15): error: argument 'incomplete_var' has type 'incomplete struct incomplete' [31]

Index: src/tests/usr.bin/xlint/lint1/msg_152.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_152.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_152.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_152.exp:1.3	Sun Mar 21 20:45:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_152.exp	Sun Jul  4 13:31:10 2021
@@ -1,4 +1,4 @@
-msg_152.c(8): error: incomplete structure or union incomplete:  [31]
-msg_152.c(13): error: incomplete structure or union incomplete: local_var [31]
+msg_152.c(8): error: argument '' has type 'incomplete struct incomplete' [31]
+msg_152.c(13): error: argument 'local_var' has type 'incomplete struct incomplete' [31]
 msg_152.c(14): error: argument cannot have unknown size, arg #1 [152]
 msg_152.c(6): warning: struct incomplete never defined [233]

Index: src/tests/usr.bin/xlint/lint1/msg_175.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_175.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_175.exp:1.7
--- src/tests/usr.bin/xlint/lint1/msg_175.exp:1.6	Fri Apr  9 19:37:39 2021
+++ src/tests/usr.bin/xlint/lint1/msg_175.exp	Sun Jul  4 13:31:10 2021
@@ -1,3 +1,3 @@
 msg_175.c(8): error: initialization of incomplete type 'incomplete struct incomplete' [175]
-msg_175.c(10): error: incomplete structure or union incomplete: incomplete [31]
+msg_175.c(10): error: argument 'incomplete' has type 'incomplete struct incomplete' [31]
 msg_175.c(6): warning: struct incomplete never defined [233]

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.192 src/usr.bin/xlint/lint1/decl.c:1.193
--- src/usr.bin/xlint/lint1/decl.c:1.192	Mon Jun 28 10:07:43 2021
+++ src/usr.bin/xlint/lint1/decl.c	Sun Jul  4 13:31:10 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.192 2021/06/28 10:07:43 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.193 2021/07/04 13:31:10 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.192 2021/06/28 10:07:43 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.193 2021/07/04 13:31:10 rillig Exp $");
 #endif
 
 #include 
@@ -917,8 +917,8 @@ length(const type_t *tp, const char *nam
 	case STRUCT:
 	case UNION:
 		if (is_incomplete(tp) && name != NULL) {
-			/* incomplete structure or union %s: %s */
-			error(31, tp->t_str->sou_tag->s_name, name);
+			/* argument '%s' has type '%s' */
+			error(31, name, type_name(tp));
 		}
 		elsz = tp->t_str->sou_size_in_bits;
 		break;

Index: 

CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 13:31:10 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_031.c msg_031.exp msg_152.exp
msg_175.exp
src/usr.bin/xlint/lint1: decl.c err.c

Log Message:
lint: improve wording for incomplete struct or union


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_031.c \
src/tests/usr.bin/xlint/lint1/msg_031.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_152.exp
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_175.exp
cvs rdiff -u -r1.192 -r1.193 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.123 -r1.124 src/usr.bin/xlint/lint1/err.c

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



CVS commit: src/sys/fs/union

2021-07-04 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Jul  4 11:24:09 UTC 2021

Modified Files:
src/sys/fs/union: union_vnops.c

Log Message:
Fix union_parsepath(), either the upper or the lower dvp may be NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/fs/union/union_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/fs/union/union_vnops.c
diff -u src/sys/fs/union/union_vnops.c:1.77 src/sys/fs/union/union_vnops.c:1.78
--- src/sys/fs/union/union_vnops.c:1.77	Tue Jun 29 22:39:20 2021
+++ src/sys/fs/union/union_vnops.c	Sun Jul  4 11:24:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_vnops.c,v 1.77 2021/06/29 22:39:20 dholland Exp $	*/
+/*	$NetBSD: union_vnops.c,v 1.78 2021/07/04 11:24:09 hannken Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993, 1994, 1995
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.77 2021/06/29 22:39:20 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.78 2021/07/04 11:24:09 hannken Exp $");
 
 #include 
 #include 
@@ -213,14 +213,26 @@ union_parsepath(void *v)
 	upperdvp = UPPERVP(ap->a_dvp);
 	lowerdvp = LOWERVP(ap->a_dvp);
 
-	error = VOP_PARSEPATH(upperdvp, ap->a_name, );
-	if (error) {
-		return error;
+	if (upperdvp != NULLVP) {
+		error = VOP_PARSEPATH(upperdvp, ap->a_name, );
+		if (error) {
+			return error;
+		}
+	} else {
+		upper = 0;
 	}
 
-	error = VOP_PARSEPATH(lowerdvp, ap->a_name, );
-	if (error) {
-		return error;
+	if (lowerdvp != NULLVP) {
+		error = VOP_PARSEPATH(lowerdvp, ap->a_name, );
+		if (error) {
+			return error;
+		}
+	} else {
+		lower = 0;
+	}
+
+	if (upper == 0 && lower == 0) {
+		panic("%s: missing both layers", __func__);
 	}
 
 	/*



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2021-07-04 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Jul  4 11:25:07 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_ctldir.c

Log Message:
Add VOP_PARSEPATH to zfs control dir vnode op table.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.12 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.13
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.12	Sat May 16 18:31:46 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c	Sun Jul  4 11:25:07 2021
@@ -1825,6 +1825,7 @@ sfs_print(void *v)
 
 const struct vnodeopv_entry_desc zfs_sfsop_entries[] = {
 	{ _default_desc,		vn_default_error },
+	{ _parsepath_desc,		genfs_parsepath },
 	{ _lookup_desc,		sfs_lookup },
 	{ _open_desc,		sfs_open },
 	{ _close_desc,		sfs_close },



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2021-07-04 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Jul  4 11:25:07 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_ctldir.c

Log Message:
Add VOP_PARSEPATH to zfs control dir vnode op table.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c

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



CVS commit: src/sys/fs/union

2021-07-04 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Jul  4 11:24:09 UTC 2021

Modified Files:
src/sys/fs/union: union_vnops.c

Log Message:
Fix union_parsepath(), either the upper or the lower dvp may be NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/fs/union/union_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/lint1

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 09:13:59 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: Makefile ckbool.c lint1.h mem1.c tree.c

Log Message:
lint: in strict bool mode, allow mixed types in generated C code

This allows flex lexers to be run through lint in strict bool mode.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/xlint/lint1/ckbool.c
cvs rdiff -u -r1.109 -r1.110 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.305 -r1.306 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-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 09:13:59 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: Makefile ckbool.c lint1.h mem1.c tree.c

Log Message:
lint: in strict bool mode, allow mixed types in generated C code

This allows flex lexers to be run through lint in strict bool mode.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/xlint/lint1/ckbool.c
cvs rdiff -u -r1.109 -r1.110 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.305 -r1.306 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/Makefile
diff -u src/usr.bin/xlint/lint1/Makefile:1.76 src/usr.bin/xlint/lint1/Makefile:1.77
--- src/usr.bin/xlint/lint1/Makefile:1.76	Sun Jul  4 08:49:41 2021
+++ src/usr.bin/xlint/lint1/Makefile	Sun Jul  4 09:13:59 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.76 2021/07/04 08:49:41 rillig Exp $
+#	$NetBSD: Makefile,v 1.77 2021/07/04 09:13:59 rillig Exp $
 
 .include 
 
@@ -19,7 +19,6 @@ CWARNFLAGS.clang+=	-Wno-error=implicit-i
 LINTFLAGS+=		-T
 LOBJS.${PROG}+=		${SRCS:M*.y:.y=.ln}
 LOBJS.${PROG}+=		${SRCS:M*.l:.l=.ln}
-LINTFLAGS.scan.c=	-X 107,126,330,331,332,333
 
 CPPFLAGS+=	-DIS_LINT1
 CPPFLAGS+=	-I${.CURDIR}

Index: src/usr.bin/xlint/lint1/ckbool.c
diff -u src/usr.bin/xlint/lint1/ckbool.c:1.6 src/usr.bin/xlint/lint1/ckbool.c:1.7
--- src/usr.bin/xlint/lint1/ckbool.c:1.6	Fri Jul  2 21:22:26 2021
+++ src/usr.bin/xlint/lint1/ckbool.c	Sun Jul  4 09:13:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ckbool.c,v 1.6 2021/07/02 21:22:26 rillig Exp $ */
+/* $NetBSD: ckbool.c,v 1.7 2021/07/04 09:13:59 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include 
 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: ckbool.c,v 1.6 2021/07/02 21:22:26 rillig Exp $");
+__RCSID("$NetBSD: ckbool.c,v 1.7 2021/07/04 09:13:59 rillig Exp $");
 #endif
 
 #include 
@@ -89,13 +89,12 @@ is_typeok_strict_bool_binary(op_t op,
 	if ((lt == BOOL) == (rt == BOOL))
 		return true;
 
-	if ((ln->tn_from_system_header || rn->tn_from_system_header) &&
+	if ((ln->tn_relaxed || rn->tn_relaxed) &&
 	(is_int_constant_zero(ln, lt) || is_int_constant_zero(rn, rt)))
 		return true;
 
 	if (is_assignment_bool_or_other(op)) {
-		return lt != BOOL &&
-		   (ln->tn_from_system_header || rn->tn_from_system_header);
+		return lt != BOOL && (ln->tn_relaxed || rn->tn_relaxed);
 	}
 
 	return !is_symmetric_bool_or_other(op);
@@ -223,7 +222,7 @@ is_typeok_bool_operand(const tnode_t *tn
 	if (t == BOOL)
 		return true;
 
-	if (tn->tn_from_system_header && is_scalar(t))
+	if (tn->tn_relaxed && is_scalar(t))
 		return true;
 
 	/* For enums that are used as bit sets, allow "flags & FLAG". */

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.109 src/usr.bin/xlint/lint1/lint1.h:1.110
--- src/usr.bin/xlint/lint1/lint1.h:1.109	Fri Jul  2 18:22:09 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Sun Jul  4 09:13:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.109 2021/07/02 18:22:09 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.110 2021/07/04 09:13:59 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -306,7 +306,10 @@ typedef	struct tnode {
 	bool	tn_lvalue : 1;	/* node is lvalue */
 	bool	tn_cast : 1;	/* if tn_op == CVT, it's an explicit cast */
 	bool	tn_parenthesized : 1;
-	bool	tn_from_system_header : 1;
+	bool	tn_relaxed : 1;	/* in strict bool mode, allow mixture between
+ * bool and scalar, for backwards
+ * compatibility
+ */
 	bool	tn_system_dependent : 1; /* depends on sizeof or offsetof */
 	union {
 		struct {

Index: src/usr.bin/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.44 src/usr.bin/xlint/lint1/mem1.c:1.45
--- src/usr.bin/xlint/lint1/mem1.c:1.44	Sun Jun 20 18:51:50 2021
+++ src/usr.bin/xlint/lint1/mem1.c	Sun Jul  4 09:13:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.44 2021/06/20 18:51:50 rillig Exp $	*/
+/*	$NetBSD: mem1.c,v 1.45 2021/07/04 09:13:59 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.44 2021/06/20 18:51:50 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.45 2021/07/04 09:13:59 rillig Exp $");
 #endif
 
 #include 
@@ -346,6 +346,16 @@ expr_zalloc(size_t s)
 	return xgetblk(, s);
 }
 
+static bool
+str_endswith(const char *haystack, const char *needle)
+{
+	size_t hlen = strlen(haystack);
+	size_t nlen = strlen(needle);
+
+	return nlen <= hlen &&
+	   memcmp(haystack + hlen - nlen, needle, nlen) == 0;
+}
+
 /*
  * Return a freshly allocated tree node that is freed at the end of the
  * current expression.
@@ -354,7 +364,14 @@ tnode_t *
 expr_zalloc_tnode(void)
 {
 	

CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 07:50:53 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile
Added Files:
src/tests/usr.bin/xlint/lint1: c99_bool_strict_suppressed.c
c99_bool_strict_suppressed.exp

Log Message:
tests/lint: add test for suppressing errors in strict bool mode


To generate a diff of this commit:
cvs rdiff -u -r1.1072 -r1.1073 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.74 -r1.75 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 \
src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c \
src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.exp

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



CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 07:09:39 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_bool_strict.c
d_c99_bool_strict.exp msg_333.c msg_333.exp
src/usr.bin/xlint/lint1: func.c

Log Message:
lint: in strict bool mode, continue after error message

If a controlling expression is not of type bool but of any other scalar
type, keep the expression.  Its value is still useful for control flow
analysis.

This prevents an assertion failure when running lint on the generated
scan.c, which contains a "while (1)" that does not stem from a system
header.  If it did, lint would accept it, see tn_from_system_header. But
"scan.c" is not considered a system header.  Maybe lint's definition of
a system header needs to be revisited.

After fixing this, there is another assertion failure though, so scan.c
is not yet ready to be inspected by lint.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c
cvs rdiff -u -r1.26 -r1.27 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_333.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_333.exp
cvs rdiff -u -r1.112 -r1.113 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/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.29 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.30
--- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.29	Fri Jul  2 18:52:20 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c	Sun Jul  4 07:09:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_c99_bool_strict.c,v 1.29 2021/07/02 18:52:20 rillig Exp $	*/
+/*	$NetBSD: d_c99_bool_strict.c,v 1.30 2021/07/04 07:09:39 rillig Exp $	*/
 # 3 "d_c99_bool_strict.c"
 
 /*
@@ -373,13 +373,13 @@ strict_bool_controlling_expression(bool 
 	if (b)
 		do_nothing();
 
-	if (0)			/* expect: 333 */
-		do_nothing();
+	if (/*CONSTCOND*/0)	/* expect: 333 */
+		do_nothing();	/* expect: statement not reached [193] */
 
-	if (1)			/* expect: 333 */
+	if (/*CONSTCOND*/1)	/* expect: 333 */
 		do_nothing();
 
-	if (2)			/* expect: 333 */
+	if (/*CONSTCOND*/2)	/* expect: 333 */
 		do_nothing();
 
 	/* Not allowed: There is no implicit conversion from scalar to bool. */

Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp
diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.26 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.27
--- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.26	Fri Jul  2 18:52:20 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp	Sun Jul  4 07:09:39 2021
@@ -58,6 +58,7 @@ d_c99_bool_strict.c(367): warning: const
 d_c99_bool_strict.c(368): warning: statement not reached [193]
 d_c99_bool_strict.c(370): warning: constant in conditional context [161]
 d_c99_bool_strict.c(376): error: controlling expression must be bool, not 'int' [333]
+d_c99_bool_strict.c(377): warning: statement not reached [193]
 d_c99_bool_strict.c(379): error: controlling expression must be bool, not 'int' [333]
 d_c99_bool_strict.c(382): error: controlling expression must be bool, not 'int' [333]
 d_c99_bool_strict.c(386): error: controlling expression must be bool, not 'int' [333]

Index: src/tests/usr.bin/xlint/lint1/msg_333.c
diff -u src/tests/usr.bin/xlint/lint1/msg_333.c:1.3 src/tests/usr.bin/xlint/lint1/msg_333.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_333.c:1.3	Sun Mar 21 14:36:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_333.c	Sun Jul  4 07:09:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_333.c,v 1.3 2021/03/21 14:36:59 rillig Exp $	*/
+/*	$NetBSD: msg_333.c,v 1.4 2021/07/04 07:09:39 rillig Exp $	*/
 # 3 "msg_333.c"
 
 // Test for message: controlling expression must be bool, not '%s' [333]
@@ -12,15 +12,28 @@ typedef _Bool bool;
 const char *
 example(bool b, int i, const char *p)
 {
+
 	if (b)
 		return "bool";
-	if (i)			/* expect: 333 */
+
+	/* expect+1: must be bool, not 'int' [333] */
+	if (i)
 		return "int";
-	if (p)			/* expect: 333 */
+
+	/* expect+1: must be bool, not 'pointer' [333] */
+	if (p)
 		return "pointer";
-	if (__lint_false)
-		return "bool constant"; /* expect: statement not reached */
-	if (0)			/* expect: 333 */
+
+	if (__lint_false) {
+		/* expect+1: warning: statement not reached [193] */
+		return "bool constant";
+	}
+
+	/* expect+1: controlling expression must be bool, not 'int' [333] */
+	if (0) {
+		/* expect+1: warning: statement not reached [193] */
 		return "integer constant";
+	}
+
 	return p + i;
 }

Index: src/tests/usr.bin/xlint/lint1/msg_333.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_333.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_333.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_333.exp:1.4	Sun Mar 21 20:45:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_333.exp	Sun Jul  4 

CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 07:09:39 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c99_bool_strict.c
d_c99_bool_strict.exp msg_333.c msg_333.exp
src/usr.bin/xlint/lint1: func.c

Log Message:
lint: in strict bool mode, continue after error message

If a controlling expression is not of type bool but of any other scalar
type, keep the expression.  Its value is still useful for control flow
analysis.

This prevents an assertion failure when running lint on the generated
scan.c, which contains a "while (1)" that does not stem from a system
header.  If it did, lint would accept it, see tn_from_system_header. But
"scan.c" is not considered a system header.  Maybe lint's definition of
a system header needs to be revisited.

After fixing this, there is another assertion failure though, so scan.c
is not yet ready to be inspected by lint.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c
cvs rdiff -u -r1.26 -r1.27 \
src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_333.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_333.exp
cvs rdiff -u -r1.112 -r1.113 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: xsrc/external/mit/xorg-server/dist/hw/xfree86/os-support/bsd

2021-07-04 Thread Christos Zoulas
Module Name:xsrc
Committed By:   christos
Date:   Sun Jul  4 07:03:16 UTC 2021

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/xfree86/os-support/bsd:
ppc_video.c

Log Message:
elide cast warning: error: cast from pointer to integer of different size


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/os-support/bsd/ppc_video.c

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

Modified files:

Index: xsrc/external/mit/xorg-server/dist/hw/xfree86/os-support/bsd/ppc_video.c
diff -u xsrc/external/mit/xorg-server/dist/hw/xfree86/os-support/bsd/ppc_video.c:1.14 xsrc/external/mit/xorg-server/dist/hw/xfree86/os-support/bsd/ppc_video.c:1.15
--- xsrc/external/mit/xorg-server/dist/hw/xfree86/os-support/bsd/ppc_video.c:1.14	Sat Jul  3 05:43:29 2021
+++ xsrc/external/mit/xorg-server/dist/hw/xfree86/os-support/bsd/ppc_video.c	Sun Jul  4 03:03:16 2021
@@ -61,7 +61,7 @@ volatile unsigned char *ioBase = MAP_FAI
 
 /* XXX why the hell is this necessary?! */
 #if defined(__arm__) || defined(__mips__)
-unsigned PORT_SIZE IOPortBase = (unsigned PORT_SIZE)MAP_FAILED;
+unsigned PORT_SIZE IOPortBase = (unsigned PORT_SIZE)(intptr_t)MAP_FAILED;
 #endif
 
 Bool



CVS commit: xsrc/external/mit/xorg-server/dist/hw/xfree86/os-support/bsd

2021-07-04 Thread Christos Zoulas
Module Name:xsrc
Committed By:   christos
Date:   Sun Jul  4 07:03:16 UTC 2021

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/xfree86/os-support/bsd:
ppc_video.c

Log Message:
elide cast warning: error: cast from pointer to integer of different size


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/os-support/bsd/ppc_video.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-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 08:50:26 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: Makefile

Log Message:
tests/lint: re-enable test c99_bool_strict_suppressed

It had been disabled accidentally in the previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/tests/usr.bin/xlint/lint1/Makefile

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/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.76 src/tests/usr.bin/xlint/lint1/Makefile:1.77
--- src/tests/usr.bin/xlint/lint1/Makefile:1.76	Sun Jul  4 08:19:06 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Sun Jul  4 08:50:26 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.76 2021/07/04 08:19:06 rillig Exp $
+# $NetBSD: Makefile,v 1.77 2021/07/04 08:50:26 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	345		# see lint1/err.c
@@ -12,6 +12,7 @@ TESTS_SH=	t_integration
 FILESDIR=	${TESTSDIR}
 FILES+=		c11_generic_expression.c
 FILES+=		c11_generic_expression.exp
+FILES+=		c99_bool_strict_suppressed.c
 FILES+=		c99_init_array.c
 FILES+=		c99_init_array.exp
 FILES+=		c99_init_designator.c



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

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 08:50:26 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: Makefile

Log Message:
tests/lint: re-enable test c99_bool_strict_suppressed

It had been disabled accidentally in the previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/tests/usr.bin/xlint/lint1/Makefile

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-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 08:49:41 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: Makefile

Log Message:
lint: include scan.c in 'make lint'

This theoretically enables strict bool mode for the few remaining code
in scan.l.  Since scan.l is not yet detected as generated code, all
interesting errors have to be suppressed though.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/xlint/lint1/Makefile

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-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 08:49:41 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: Makefile

Log Message:
lint: include scan.c in 'make lint'

This theoretically enables strict bool mode for the few remaining code
in scan.l.  Since scan.l is not yet detected as generated code, all
interesting errors have to be suppressed though.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/xlint/lint1/Makefile

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

Modified files:

Index: src/usr.bin/xlint/lint1/Makefile
diff -u src/usr.bin/xlint/lint1/Makefile:1.75 src/usr.bin/xlint/lint1/Makefile:1.76
--- src/usr.bin/xlint/lint1/Makefile:1.75	Tue Jun 29 07:37:34 2021
+++ src/usr.bin/xlint/lint1/Makefile	Sun Jul  4 08:49:41 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.75 2021/06/29 07:37:34 rillig Exp $
+#	$NetBSD: Makefile,v 1.76 2021/07/04 08:49:41 rillig Exp $
 
 .include 
 
@@ -18,8 +18,8 @@ YHEADER=
 CWARNFLAGS.clang+=	-Wno-error=implicit-int-float-conversion
 LINTFLAGS+=		-T
 LOBJS.${PROG}+=		${SRCS:M*.y:.y=.ln}
-#LOBJS.${PROG}+=	${SRCS:M*.l:.l=.ln}
-LINTFLAGS.scan.c=	-X 107,330,331,333
+LOBJS.${PROG}+=		${SRCS:M*.l:.l=.ln}
+LINTFLAGS.scan.c=	-X 107,126,330,331,332,333
 
 CPPFLAGS+=	-DIS_LINT1
 CPPFLAGS+=	-I${.CURDIR}



CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 08:19:06 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile c99_bool_strict_suppressed.c
src/usr.bin/xlint/lint1: tree.c
Removed Files:
src/tests/usr.bin/xlint/lint1: c99_bool_strict_suppressed.exp

Log Message:
lint: remove outdated assertion

Since err.c 1.12 from 2000-07-06, lint allows to suppress individual
error messages.  Suppressed error messages do not increment nerr.
Keeping nerr at 0 had triggered the assertion.


To generate a diff of this commit:
cvs rdiff -u -r1.1073 -r1.1074 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.75 -r1.76 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.1 -r1.2 \
src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c
cvs rdiff -u -r1.1 -r0 \
src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.exp
cvs rdiff -u -r1.304 -r1.305 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/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1073 src/distrib/sets/lists/tests/mi:1.1074
--- src/distrib/sets/lists/tests/mi:1.1073	Sun Jul  4 07:50:53 2021
+++ src/distrib/sets/lists/tests/mi	Sun Jul  4 08:19:05 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1073 2021/07/04 07:50:53 rillig Exp $
+# $NetBSD: mi,v 1.1074 2021/07/04 08:19:05 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6108,7 +6108,7 @@
 ./usr/tests/usr.bin/xlint/lint1/c11_generic_expression.c	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/c11_generic_expression.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.exp	tests-obsolete		obsolete
 ./usr/tests/usr.bin/xlint/lint1/c99_init_array.c		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/c99_init_array.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/c99_init_designator.c		tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.75 src/tests/usr.bin/xlint/lint1/Makefile:1.76
--- src/tests/usr.bin/xlint/lint1/Makefile:1.75	Sun Jul  4 07:50:53 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Sun Jul  4 08:19:06 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.75 2021/07/04 07:50:53 rillig Exp $
+# $NetBSD: Makefile,v 1.76 2021/07/04 08:19:06 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	345		# see lint1/err.c
@@ -12,8 +12,6 @@ TESTS_SH=	t_integration
 FILESDIR=	${TESTSDIR}
 FILES+=		c11_generic_expression.c
 FILES+=		c11_generic_expression.exp
-FILES+=		c99_bool_strict_suppressed.c
-FILES+=		c99_bool_strict_suppressed.exp
 FILES+=		c99_init_array.c
 FILES+=		c99_init_array.exp
 FILES+=		c99_init_designator.c

Index: src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c
diff -u src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c:1.1 src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c:1.2
--- src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c:1.1	Sun Jul  4 07:50:53 2021
+++ src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c	Sun Jul  4 08:19:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: c99_bool_strict_suppressed.c,v 1.1 2021/07/04 07:50:53 rillig Exp $	*/
+/*	$NetBSD: c99_bool_strict_suppressed.c,v 1.2 2021/07/04 08:19:06 rillig Exp $	*/
 # 3 "c99_bool_strict_suppressed.c"
 
 /*
@@ -17,8 +17,7 @@
  * interaction with the assertion in expr().
  */
 
-/* lint1-extra-flags: -T */
-/* TODO: -X 107,330,331,332,333 */
+/* lint1-extra-flags: -T -X 107,330,331,332,333 */
 
 /* ARGSUSED */
 void

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.304 src/usr.bin/xlint/lint1/tree.c:1.305
--- src/usr.bin/xlint/lint1/tree.c:1.304	Sat Jul  3 20:40:17 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sun Jul  4 08:19:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.304 2021/07/03 20:40:17 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.305 2021/07/04 08:19:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.304 2021/07/03 20:40:17 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.305 2021/07/04 08:19:06 rillig Exp $");
 #endif
 
 #include 
@@ -3682,9 +3682,7 @@ void
 expr(tnode_t *tn, bool vctx, bool tctx, bool dofreeblk, bool is_do_while)
 {
 
-	lint_assert(tn != NULL || nerr != 0);
-
-	if (tn == NULL) {
+	if (tn == NULL) {	/* in case of errors */
 		expr_free_all();
 		return;
 	}



CVS commit: src

2021-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 08:19:06 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile c99_bool_strict_suppressed.c
src/usr.bin/xlint/lint1: tree.c
Removed Files:
src/tests/usr.bin/xlint/lint1: c99_bool_strict_suppressed.exp

Log Message:
lint: remove outdated assertion

Since err.c 1.12 from 2000-07-06, lint allows to suppress individual
error messages.  Suppressed error messages do not increment nerr.
Keeping nerr at 0 had triggered the assertion.


To generate a diff of this commit:
cvs rdiff -u -r1.1073 -r1.1074 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.75 -r1.76 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.1 -r1.2 \
src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c
cvs rdiff -u -r1.1 -r0 \
src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.exp
cvs rdiff -u -r1.304 -r1.305 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-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 07:50:53 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile
Added Files:
src/tests/usr.bin/xlint/lint1: c99_bool_strict_suppressed.c
c99_bool_strict_suppressed.exp

Log Message:
tests/lint: add test for suppressing errors in strict bool mode


To generate a diff of this commit:
cvs rdiff -u -r1.1072 -r1.1073 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.74 -r1.75 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 \
src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c \
src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.exp

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1072 src/distrib/sets/lists/tests/mi:1.1073
--- src/distrib/sets/lists/tests/mi:1.1072	Sat Jul  3 19:31:22 2021
+++ src/distrib/sets/lists/tests/mi	Sun Jul  4 07:50:53 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1072 2021/07/03 19:31:22 rillig Exp $
+# $NetBSD: mi,v 1.1073 2021/07/04 07:50:53 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6107,6 +6107,8 @@
 ./usr/tests/usr.bin/xlint/lint1/Kyuafile			tests-usr.bin-tests	compattestfile,atf,kyua
 ./usr/tests/usr.bin/xlint/lint1/c11_generic_expression.c	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/c11_generic_expression.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/c99_init_array.c		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/c99_init_array.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/c99_init_designator.c		tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.74 src/tests/usr.bin/xlint/lint1/Makefile:1.75
--- src/tests/usr.bin/xlint/lint1/Makefile:1.74	Sat Jul  3 19:31:22 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Sun Jul  4 07:50:53 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.74 2021/07/03 19:31:22 rillig Exp $
+# $NetBSD: Makefile,v 1.75 2021/07/04 07:50:53 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	345		# see lint1/err.c
@@ -12,6 +12,8 @@ TESTS_SH=	t_integration
 FILESDIR=	${TESTSDIR}
 FILES+=		c11_generic_expression.c
 FILES+=		c11_generic_expression.exp
+FILES+=		c99_bool_strict_suppressed.c
+FILES+=		c99_bool_strict_suppressed.exp
 FILES+=		c99_init_array.c
 FILES+=		c99_init_array.exp
 FILES+=		c99_init_designator.c

Added files:

Index: src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c
diff -u /dev/null src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c:1.1
--- /dev/null	Sun Jul  4 07:50:53 2021
+++ src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c	Sun Jul  4 07:50:53 2021
@@ -0,0 +1,43 @@
+/*	$NetBSD: c99_bool_strict_suppressed.c,v 1.1 2021/07/04 07:50:53 rillig Exp $	*/
+# 3 "c99_bool_strict_suppressed.c"
+
+/*
+ * In strict bool mode, like everywhere else, individual errors can be
+ * suppressed.  Suppressing a message affects lint's output as well as the
+ * exit status.  Lint's control flow stays the same as before though.
+ *
+ * This can result in assertion failures later.  One such assertion has been
+ * there since at least 1995, at the beginning of expr(), ensuring that the
+ * expression is either non-null or an error message has been _printed_.
+ * In 1995 it was not possible to suppress error messages, which means that
+ * the number of printed errors equaled the number of occurred errors.
+ *
+ * In err.c 1.12 from 2000-07-06, the option -X was added, allowing to
+ * suppress individual error messages.  That commit did not mention any
+ * interaction with the assertion in expr().
+ */
+
+/* lint1-extra-flags: -T */
+/* TODO: -X 107,330,331,332,333 */
+
+/* ARGSUSED */
+void
+test(_Bool b, int i, const char *p)
+{
+
+	/* expect+1: error: controlling expression must be bool, not 'int' [333] */
+	while (1)
+		break;
+
+	/* expect+1: error: operands of '=' have incompatible types (_Bool != int) [107] */
+	b = i;
+
+	/* expect+1: error: operand of '!' must be bool, not 'int' [330] */
+	b = !i;
+
+	/* expect+1: error: left operand of '&&' must be bool, not 'int' [331] */
+	b = i && b;
+
+	/* expect+1: error: right operand of '&&' must be bool, not 'int' [332] */
+	b = b && i;
+}
Index: src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.exp
diff -u /dev/null src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.exp:1.1
--- /dev/null	Sun Jul  4 07:50:53 2021
+++ src/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.exp	Sun Jul  4 07:50:53 2021

CVS commit: src/common/lib/libc/arch/aarch64/atomic

2021-07-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul  4 06:55:47 UTC 2021

Modified Files:
src/common/lib/libc/arch/aarch64/atomic: atomic_nand_16.S
atomic_nand_32.S atomic_nand_64.S atomic_nand_8.S

Log Message:
Fix the logic operation for atomic_nand_{8,16,32,64}

>From the gcc docs the operations are as follows

 { tmp = *ptr; *ptr = ~(tmp & value); return tmp; }   // nand
 { tmp = ~(*ptr & value); *ptr = tmp; return *ptr; }   // nand

yes, this is really rather strange.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S

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

Modified files:

Index: src/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S
diff -u src/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S:1.2 src/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S:1.3
--- src/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S:1.2	Wed Aug 12 12:59:57 2020
+++ src/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S	Sun Jul  4 06:55:47 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_nand_16.S,v 1.2 2020/08/12 12:59:57 skrll Exp $ */
+/* $NetBSD: atomic_nand_16.S,v 1.3 2021/07/04 06:55:47 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,11 +31,14 @@
 
 #include "atomic_op_asm.h"
 
+/*
+ * { tmp = *ptr; *ptr = ~(tmp & value); return tmp; }   // nand
+ */
 ENTRY_NP(_atomic_nand_16)
 	mov	x4, x0
-1:	ldxrh	w0, [x4]		/* load old value (to be returned) */
-	mvn	w3, w0			/* complement source */
-	and	w3, w3, w1		/* calculate new value */
+1:	ldxrh	w0, [x4]		/* load old value (*ptr) */
+	and	w3, w0, w1		/* w3 =  (*ptr & value) */
+	mvn	w3, w3			/* w3 = ~(*pte & value) */
 	stxrh	w2, w3, [x4]		/* try to store */
 	cbnz	w2, 2f			/*   succeed? no, try again */
 	ret/* return old value */
@@ -47,11 +50,15 @@ ATOMIC_OP_ALIAS(atomic_nand_ushort,_atom
 STRONG_ALIAS(__sync_fetch_and_nand_2,_atomic_nand_16)
 STRONG_ALIAS(_atomic_nand_ushort,_atomic_nand_16)
 
+
+/*
+ * { tmp = ~(*ptr & value); *ptr = tmp; return *ptr; }   // nand
+ */
 ENTRY_NP(_atomic_nand_16_nv)
 	mov	x4, x0			/* need r0 for return value */
-1:	ldxrh	w0, [x4]		/* load old value */
-	mvn	w0, w0			/* complement source */
-	and	w0, w0, w1		/* calculate new value (return value) */
+1:	ldxrh	w0, [x4]		/* load old value (*ptr) */
+	and	w0, w0, w1		/* w0 =  (*ptr & value) */
+	mvn	w0, w0			/* w0 = ~(*pte & value), return value */
 	stxrh	w2, w0, [x4]		/* try to store */
 	cbnz	w2, 2f			/*   succeed? no, try again? */
 	ret/* return new value */
Index: src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S
diff -u src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S:1.2 src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S:1.3
--- src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S:1.2	Wed Aug 12 12:59:57 2020
+++ src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S	Sun Jul  4 06:55:47 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_nand_32.S,v 1.2 2020/08/12 12:59:57 skrll Exp $ */
+/* $NetBSD: atomic_nand_32.S,v 1.3 2021/07/04 06:55:47 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,11 +31,14 @@
 
 #include "atomic_op_asm.h"
 
+/*
+ * { tmp = *ptr; *ptr = ~(tmp & value); return tmp; }   // nand
+ */
 ENTRY_NP(_atomic_nand_32)
 	mov	x4, x0
 1:	ldxr	w0, [x4]		/* load old value (to be returned) */
-	mvn	w3, w0			/* complement source */
-	and	w3, w3, w1		/* calculate new value */
+	and	w3, w0, w1		/* w3 =  (*ptr & value) */
+	mvn	w3, w3			/* x3 = ~(*pte & value) */
 	stxr	w2, w3, [x4]		/* try to store */
 	cbnz	w2, 2f			/*   succeed? no, try again */
 	ret/* return old value */
@@ -47,11 +50,15 @@ ATOMIC_OP_ALIAS(atomic_nand_uint,_atomic
 STRONG_ALIAS(__sync_fetch_and_nand_4,_atomic_nand_32)
 STRONG_ALIAS(_atomic_nand_uint,_atomic_nand_32)
 
+
+/*
+ * { tmp = ~(*ptr & value); *ptr = tmp; return *ptr; }   // nand
+ */
 ENTRY_NP(_atomic_nand_32_nv)
 	mov	x4, x0			/* need r0 for return value */
-1:	ldxr	w0, [x4]		/* load old value */
-	mvn	w0, w0			/* complement source */
-	and	w0, w0, w1		/* calculate new value (return value) */
+1:	ldxr	w0, [x4]		/* load old value (*ptr) */
+	and	w0, w0, w1		/* x0 =  (*ptr & value) */
+	mvn	w0, w0			/* x0 = ~(*pte & value), return value */
 	stxr	w2, w0, [x4]		/* try to store */
 	cbnz	w2, 2f			/*   succeed? no, try again? */
 	ret/* return new value */
Index: src/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S
diff -u src/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S:1.2 src/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S:1.3
--- src/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S:1.2	Wed Aug 12 12:59:57 2020
+++ 

CVS commit: src/common/lib/libc/arch/aarch64/atomic

2021-07-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul  4 06:55:47 UTC 2021

Modified Files:
src/common/lib/libc/arch/aarch64/atomic: atomic_nand_16.S
atomic_nand_32.S atomic_nand_64.S atomic_nand_8.S

Log Message:
Fix the logic operation for atomic_nand_{8,16,32,64}

>From the gcc docs the operations are as follows

 { tmp = *ptr; *ptr = ~(tmp & value); return tmp; }   // nand
 { tmp = ~(*ptr & value); *ptr = tmp; return *ptr; }   // nand

yes, this is really rather strange.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S \
src/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S

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-07-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Jul  4 05:49:20 UTC 2021

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

Log Message:
lint: sync stdout and stderr when compiled in debug mode

If lint is compiled with -DDEBUG, its debug output goes to stdout, no
matter whether the option -d is given or not.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.bin/xlint/lint1/main1.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/main1.c
diff -u src/usr.bin/xlint/lint1/main1.c:1.48 src/usr.bin/xlint/lint1/main1.c:1.49
--- src/usr.bin/xlint/lint1/main1.c:1.48	Sat Jul  3 21:27:48 2021
+++ src/usr.bin/xlint/lint1/main1.c	Sun Jul  4 05:49:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: main1.c,v 1.48 2021/07/03 21:27:48 rillig Exp $	*/
+/*	$NetBSD: main1.c,v 1.49 2021/07/04 05:49:20 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main1.c,v 1.48 2021/07/03 21:27:48 rillig Exp $");
+__RCSID("$NetBSD: main1.c,v 1.49 2021/07/04 05:49:20 rillig Exp $");
 #endif
 
 #include 
@@ -254,6 +254,9 @@ main(int argc, char *argv[])
 	/* initialize output */
 	outopen(argv[1]);
 
+#ifdef DEBUG
+	setvbuf(stdout, NULL, _IONBF, 0);
+#endif
 	if (dflag)
 		setvbuf(stdout, NULL, _IONBF, 0);
 #ifdef YYDEBUG