Re: lint warning about extern (was: Re: CVS commit: src)

2023-03-28 Thread Valery Ushakov
On Tue, Mar 28, 2023 at 22:13:25 +0200, Roland Illig wrote:

> Am 28.03.2023 um 19:52 schrieb Valery Ushakov:
> > On Tue, Mar 28, 2023 at 14:44:36 +, Roland Illig wrote:
> > 
> > > lint: warn about extern declarations outside headers
> > 
> > vs.
> > 
> > > https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
> > 
> > which is nested extern declaration inside a function body.
> > 
> > I.e. the two lines of this log message contradict each other.  So
> > which one of those does this change actually address?
> 
> Oops, I implemented an entirely unrelated warning in message 351, which
> is about a function or object declaration that is outside a header and
> thus may lead to inconsistent definitions when it is declared
> differently in several translation units. This message helps finding
> cases where identifiers are needlessly exported instead of being
> declared 'static'.
> 
> I now added another message 352 that covers the case from the
> discussion, which is about declarations inside function bodies with
> storage class 'extern'.
> 
> Sorry for the confusion.

Thanks for the clarification and a quick follow up!

-uwe


lint warning about extern (was: Re: CVS commit: src)

2023-03-28 Thread Roland Illig

Am 28.03.2023 um 19:52 schrieb Valery Ushakov:

On Tue, Mar 28, 2023 at 14:44:36 +, Roland Illig wrote:


lint: warn about extern declarations outside headers


vs.


https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html


which is nested extern declaration inside a function body.

I.e. the two lines of this log message contradict each other.  So
which one of those does this change actually address?


Oops, I implemented an entirely unrelated warning in message 351, which
is about a function or object declaration that is outside a header and
thus may lead to inconsistent definitions when it is declared
differently in several translation units. This message helps finding
cases where identifiers are needlessly exported instead of being
declared 'static'.

I now added another message 352 that covers the case from the
discussion, which is about declarations inside function bodies with
storage class 'extern'.

Sorry for the confusion.

Roland



CVS commit: src/sys/arch/x68k/x68k

2023-03-28 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Mar 28 20:10:02 UTC 2023

Modified Files:
src/sys/arch/x68k/x68k: kgdb_stub.c

Log Message:
s/ourput/output/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x68k/x68k/kgdb_stub.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/x68k/x68k/kgdb_stub.c
diff -u src/sys/arch/x68k/x68k/kgdb_stub.c:1.19 src/sys/arch/x68k/x68k/kgdb_stub.c:1.20
--- src/sys/arch/x68k/x68k/kgdb_stub.c:1.19	Wed Nov 10 16:40:55 2021
+++ src/sys/arch/x68k/x68k/kgdb_stub.c	Tue Mar 28 20:10:01 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kgdb_stub.c,v 1.19 2021/11/10 16:40:55 msaitoh Exp $	*/
+/*	$NetBSD: kgdb_stub.c,v 1.20 2023/03/28 20:10:01 andvar Exp $	*/
 
 /*
  * Copyright (c) 1990, 1993
@@ -45,13 +45,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kgdb_stub.c,v 1.19 2021/11/10 16:40:55 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kgdb_stub.c,v 1.20 2023/03/28 20:10:01 andvar Exp $");
 
 #include "opt_kgdb.h"
 
 #ifdef KGDB
 #ifndef lint
-static char rcsid[] = "$NetBSD: kgdb_stub.c,v 1.19 2021/11/10 16:40:55 msaitoh Exp $";
+static char rcsid[] = "$NetBSD: kgdb_stub.c,v 1.20 2023/03/28 20:10:01 andvar Exp $";
 #endif
 
 #include 
@@ -415,7 +415,7 @@ kgdb_trap(int type, struct frame *frame)
 			 * knowing if we're in or out of this loop
 			 * when he issues a "remote-signal".  (Note
 			 * that without the length check, we could
-			 * loop here forever if the ourput line is
+			 * loop here forever if the output line is
 			 * looped back or the remote host is echoing.)
 			 */
 			if (inlen == 0) {



CVS commit: src/sys/arch/x68k/x68k

2023-03-28 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Mar 28 20:10:02 UTC 2023

Modified Files:
src/sys/arch/x68k/x68k: kgdb_stub.c

Log Message:
s/ourput/output/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x68k/x68k/kgdb_stub.c

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



CVS commit: src

2023-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar 28 20:04:52 UTC 2023

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: msg_090.c
src/usr.bin/xlint/lint1: decl.c err.c
Added Files:
src/tests/usr.bin/xlint/lint1: msg_352.c

Log Message:
lint: warn about 'extern' declarations inside function bodies

https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html

The previous attempt (message 351 about 'extern' declarations outside
headers) did not cover the proposal from the tech-userlevel mailing list
but instead warns about a different usage pattern of the 'extern'
keyword.


To generate a diff of this commit:
cvs rdiff -u -r1.1255 -r1.1256 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_090.c
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/msg_352.c
cvs rdiff -u -r1.306 -r1.307 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.190 -r1.191 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

2023-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar 28 20:04:52 UTC 2023

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: msg_090.c
src/usr.bin/xlint/lint1: decl.c err.c
Added Files:
src/tests/usr.bin/xlint/lint1: msg_352.c

Log Message:
lint: warn about 'extern' declarations inside function bodies

https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html

The previous attempt (message 351 about 'extern' declarations outside
headers) did not cover the proposal from the tech-userlevel mailing list
but instead warns about a different usage pattern of the 'extern'
keyword.


To generate a diff of this commit:
cvs rdiff -u -r1.1255 -r1.1256 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_090.c
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/msg_352.c
cvs rdiff -u -r1.306 -r1.307 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.190 -r1.191 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/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1255 src/distrib/sets/lists/tests/mi:1.1256
--- src/distrib/sets/lists/tests/mi:1.1255	Tue Mar 28 14:44:34 2023
+++ src/distrib/sets/lists/tests/mi	Tue Mar 28 20:04:51 2023
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1255 2023/03/28 14:44:34 rillig Exp $
+# $NetBSD: mi,v 1.1256 2023/03/28 20:04:51 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -7342,6 +7342,7 @@
 ./usr/tests/usr.bin/xlint/lint1/msg_349.exp			tests-obsolete		obsolete,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_350.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_351.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_352.c			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-obsolete		obsolete,atf
 ./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.c			tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/msg_090.c
diff -u src/tests/usr.bin/xlint/lint1/msg_090.c:1.5 src/tests/usr.bin/xlint/lint1/msg_090.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_090.c:1.5	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/msg_090.c	Tue Mar 28 20:04:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_090.c,v 1.5 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: msg_090.c,v 1.6 2023/03/28 20:04:52 rillig Exp $	*/
 # 3 "msg_090.c"
 
 // Test for message: inconsistent redeclaration of extern '%s' [90]
@@ -10,6 +10,7 @@ extern int random_number(void);
 void
 use(void)
 {
+	/* expect+2: warning: nested 'extern' declaration of 'random_number' [352] */
 	/* expect+1: warning: inconsistent redeclaration of extern 'random_number' [90] */
 	extern int random_number(int);
 }

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.306 src/usr.bin/xlint/lint1/decl.c:1.307
--- src/usr.bin/xlint/lint1/decl.c:1.306	Tue Mar 28 14:44:35 2023
+++ src/usr.bin/xlint/lint1/decl.c	Tue Mar 28 20:04:52 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.306 2023/03/28 14:44:35 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.307 2023/03/28 20:04:52 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.306 2023/03/28 14:44:35 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.307 2023/03/28 20:04:52 rillig Exp $");
 #endif
 
 #include 
@@ -2728,6 +2728,11 @@ declare_local(sym_t *dsym, bool initflg)
 			dsym->s_scl = EXTERN;
 	}
 
+	if (dsym->s_scl == EXTERN) {
+		/* nested 'extern' declaration of '%s' */
+		warning(352, dsym->s_name);
+	}
+
 	if (dsym->s_type->t_tspec == FUNC) {
 		if (dsym->s_scl == STATIC) {
 			/* dubious static function '%s' at block level */

Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.190 src/usr.bin/xlint/lint1/err.c:1.191
--- src/usr.bin/xlint/lint1/err.c:1.190	Tue Mar 28 14:44:35 2023
+++ src/usr.bin/xlint/lint1/err.c	Tue Mar 28 20:04:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.c,v 1.190 2023/03/28 14:44:35 rillig Exp $	*/
+/*	$NetBSD: err.c,v 1.191 2023/03/28 20:04:52 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: err.c,v 1.190 2023/03/28 14:44:35 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.191 2023/03/28 20:04:52 rillig Exp $");
 #endif
 
 #include 
@@ -407,6 +407,7 @@ static const char *const msgs[] = {
 	"non type argument to alignof is a GCC extension",	  /* 349 */
 	"'_Atomic' requires C11 or later",			  /* 350 */
 	"'extern' declaration of '%s' outside a header",	  /* 351 */
+	"nested 'extern' declaration of '%s'",			  /* 352 */
 };
 
 static bool	

CVS commit: src/sys

2023-03-28 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Mar 28 20:01:58 UTC 2023

Modified Files:
src/sys/arch/arm/xscale: pxa2x0_mci.c
src/sys/arch/ibmnws/ibmnws: machdep.c
src/sys/arch/luna68k/dev: sioreg.h
src/sys/arch/luna68k/stand/boot: sioreg.h
src/sys/arch/mvmeppc/mvmeppc: machdep.c
src/sys/arch/sparc/include: cgtworeg.h
src/sys/arch/sun3/include: cg2reg.h
src/sys/arch/x68k/x68k: machdep.c
src/sys/arch/zaurus/dev: zrc.c
src/sys/dev/ic: mb89352.c
src/sys/dev/usb: uhid.c

Log Message:
s/interrput/interrupt/ and s/accesss/access/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/xscale/pxa2x0_mci.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/ibmnws/ibmnws/machdep.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/luna68k/dev/sioreg.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/stand/boot/sioreg.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mvmeppc/mvmeppc/machdep.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sparc/include/cgtworeg.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sun3/include/cg2reg.h
cvs rdiff -u -r1.209 -r1.210 src/sys/arch/x68k/x68k/machdep.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/zaurus/dev/zrc.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/ic/mb89352.c
cvs rdiff -u -r1.126 -r1.127 src/sys/dev/usb/uhid.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/arm/xscale/pxa2x0_mci.c
diff -u src/sys/arch/arm/xscale/pxa2x0_mci.c:1.13 src/sys/arch/arm/xscale/pxa2x0_mci.c:1.14
--- src/sys/arch/arm/xscale/pxa2x0_mci.c:1.13	Tue Sep 27 06:36:43 2022
+++ src/sys/arch/arm/xscale/pxa2x0_mci.c	Tue Mar 28 20:01:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pxa2x0_mci.c,v 1.13 2022/09/27 06:36:43 skrll Exp $	*/
+/*	$NetBSD: pxa2x0_mci.c,v 1.14 2023/03/28 20:01:57 andvar Exp $	*/
 /*	$OpenBSD: pxa2x0_mmc.c,v 1.5 2009/02/23 18:09:55 miod Exp $	*/
 
 /*
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pxa2x0_mci.c,v 1.13 2022/09/27 06:36:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pxa2x0_mci.c,v 1.14 2023/03/28 20:01:57 andvar Exp $");
 
 #include 
 #include 
@@ -742,7 +742,7 @@ pxamci_stop_clock(struct pxamci_softc *s
 }
 
 /*
- * SD/MMC controller interrput handler
+ * SD/MMC controller interrupt handler
  */
 static int
 pxamci_intr(void *arg)

Index: src/sys/arch/ibmnws/ibmnws/machdep.c
diff -u src/sys/arch/ibmnws/ibmnws/machdep.c:1.19 src/sys/arch/ibmnws/ibmnws/machdep.c:1.20
--- src/sys/arch/ibmnws/ibmnws/machdep.c:1.19	Wed Feb 16 23:49:26 2022
+++ src/sys/arch/ibmnws/ibmnws/machdep.c	Tue Mar 28 20:01:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.19 2022/02/16 23:49:26 riastradh Exp $	*/
+/*	$NetBSD: machdep.c,v 1.20 2023/03/28 20:01:57 andvar Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.19 2022/02/16 23:49:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.20 2023/03/28 20:01:57 andvar Exp $");
 
 #include "opt_compat_netbsd.h"
 
@@ -159,7 +159,7 @@ void
 cpu_startup(void)
 {
 	/*
-	 * Mapping PReP interrput vector register.
+	 * Mapping PReP interrupt vector register.
 	 */
 	prep_intr_reg = (vaddr_t) mapiodev(PREP_INTR_REG, PAGE_SIZE, false);
 	if (!prep_intr_reg)

Index: src/sys/arch/luna68k/dev/sioreg.h
diff -u src/sys/arch/luna68k/dev/sioreg.h:1.5 src/sys/arch/luna68k/dev/sioreg.h:1.6
--- src/sys/arch/luna68k/dev/sioreg.h:1.5	Sat Sep 25 15:18:38 2021
+++ src/sys/arch/luna68k/dev/sioreg.h	Tue Mar 28 20:01:57 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: sioreg.h,v 1.5 2021/09/25 15:18:38 tsutsui Exp $ */
+/* $NetBSD: sioreg.h,v 1.6 2023/03/28 20:01:57 andvar Exp $ */
 /*
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -91,7 +91,7 @@
 #define WR0_RSTINT	0x10	/* Reset External/Status Interrupt */
 #define WR0_CHANRST	0x18	/* Channel Reset */
 #define WR0_INTNXT	0x20	/* Enable Interrupt on Next Receive Character */
-#define WR0_RSTPEND	0x28	/* Reset Transmitter Interrput/DMA Pending */
+#define WR0_RSTPEND	0x28	/* Reset Transmitter Interrupt/DMA Pending */
 #define WR0_ERRRST	0x30	/* Error Reset */
 #define WR0_ENDINTR	0x38	/* End of Interrupt */
 

Index: src/sys/arch/luna68k/stand/boot/sioreg.h
diff -u src/sys/arch/luna68k/stand/boot/sioreg.h:1.4 src/sys/arch/luna68k/stand/boot/sioreg.h:1.5
--- src/sys/arch/luna68k/stand/boot/sioreg.h:1.4	Sat Feb 14 05:03:09 2015
+++ src/sys/arch/luna68k/stand/boot/sioreg.h	Tue Mar 28 20:01:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sioreg.h,v 1.4 2015/02/14 05:03:09 tsutsui Exp $	*/
+/*	$NetBSD: sioreg.h,v 1.5 2023/03/28 20:01:57 andvar Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -115,7 +115,7 @@ struct siodevice {
 #define WR0_RSTINT	0x10	/* Reset External/Status Interrupt */
 #define WR0_CHANRST	0x18	/* Channel Reset */
 #define WR0_INTNXT	0x20	/* Enable Interrupt on Next Receive 

CVS commit: src/sys

2023-03-28 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Mar 28 20:01:58 UTC 2023

Modified Files:
src/sys/arch/arm/xscale: pxa2x0_mci.c
src/sys/arch/ibmnws/ibmnws: machdep.c
src/sys/arch/luna68k/dev: sioreg.h
src/sys/arch/luna68k/stand/boot: sioreg.h
src/sys/arch/mvmeppc/mvmeppc: machdep.c
src/sys/arch/sparc/include: cgtworeg.h
src/sys/arch/sun3/include: cg2reg.h
src/sys/arch/x68k/x68k: machdep.c
src/sys/arch/zaurus/dev: zrc.c
src/sys/dev/ic: mb89352.c
src/sys/dev/usb: uhid.c

Log Message:
s/interrput/interrupt/ and s/accesss/access/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/xscale/pxa2x0_mci.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/ibmnws/ibmnws/machdep.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/luna68k/dev/sioreg.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/stand/boot/sioreg.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mvmeppc/mvmeppc/machdep.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sparc/include/cgtworeg.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sun3/include/cg2reg.h
cvs rdiff -u -r1.209 -r1.210 src/sys/arch/x68k/x68k/machdep.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/zaurus/dev/zrc.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/ic/mb89352.c
cvs rdiff -u -r1.126 -r1.127 src/sys/dev/usb/uhid.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

2023-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar 28 20:01:21 UTC 2023

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

Log Message:
lint: clean up comments for handling 'linted' comments

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.150 src/usr.bin/xlint/lint1/func.c:1.151
--- src/usr.bin/xlint/lint1/func.c:1.150	Tue Mar 28 14:44:35 2023
+++ src/usr.bin/xlint/lint1/func.c	Tue Mar 28 20:01:21 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: func.c,v 1.150 2023/03/28 14:44:35 rillig Exp $	*/
+/*	$NetBSD: func.c,v 1.151 2023/03/28 20:01:21 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: func.c,v 1.150 2023/03/28 14:44:35 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.151 2023/03/28 20:01:21 rillig Exp $");
 #endif
 
 #include 
@@ -1324,10 +1324,7 @@ lintlib(int n)
 	vflag = false;
 }
 
-/*
- * Suppress most warnings at the current and the following line.
- */
-/* ARGSUSED */
+/* Suppress one or most warnings at the current and the following line. */
 void
 linted(int n)
 {



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

2023-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar 28 20:01:21 UTC 2023

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

Log Message:
lint: clean up comments for handling 'linted' comments

No functional change.


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

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



CVS commit: src/sys/arch/x86/x86

2023-03-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 28 19:55:42 UTC 2023

Modified Files:
src/sys/arch/x86/x86: bus_dma.c

Log Message:
x86/bus_dma.c: Sprinkle KASSERTMSG.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/x86/x86/bus_dma.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/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.89 src/sys/arch/x86/x86/bus_dma.c:1.90
--- src/sys/arch/x86/x86/bus_dma.c:1.89	Sat Aug 20 23:48:51 2022
+++ src/sys/arch/x86/x86/bus_dma.c	Tue Mar 28 19:55:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.89 2022/08/20 23:48:51 riastradh Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.90 2023/03/28 19:55:42 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007, 2020 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.89 2022/08/20 23:48:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.90 2023/03/28 19:55:42 riastradh Exp $");
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -207,7 +207,8 @@ _bus_dmamem_alloc_range(bus_dma_tag_t t,
 	/* Always round the size. */
 	size = round_page(size);
 
-	KASSERT(boundary >= PAGE_SIZE || boundary == 0);
+	KASSERTMSG(boundary >= PAGE_SIZE || boundary == 0,
+	"boundary=0x%"PRIxBUSSIZE, boundary);
 
 	/*
 	 * Allocate pages from the VM system.
@@ -389,7 +390,9 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 	 */
 	map->dm_mapsize = 0;
 	map->dm_nsegs = 0;
-	KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+	KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+	"maxsegsz=0x%"PRIxBUSSIZE", maxmaxsegsz=0x%"PRIxBUSSIZE,
+	map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
 	if (buflen > map->_dm_size)
 		return EINVAL;
@@ -517,9 +520,12 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 	 */
 	map->dm_mapsize = 0;
 	map->dm_nsegs = 0;
-	KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+	KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+	"maxsegsz=0x%"PRIxBUSSIZE", maxmaxsegsz=0x%"PRIxBUSSIZE,
+	map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
-	KASSERT(m0->m_flags & M_PKTHDR);
+	KASSERTMSG(m0->m_flags & M_PKTHDR, "m0=%p m_flags=0x%x", m0,
+	m0->m_flags);
 	if (m0->m_pkthdr.len > map->_dm_size)
 		return (EINVAL);
 
@@ -545,9 +551,15 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 			break;
 
 		case M_EXT|M_EXT_PAGES:
-			KASSERT(m->m_ext.ext_buf <= m->m_data);
-			KASSERT(m->m_data <=
-			m->m_ext.ext_buf + m->m_ext.ext_size);
+			KASSERTMSG(m->m_ext.ext_buf <= m->m_data,
+			"m=%p m_ext.ext_buf=%p m_ext.ext_size=%zu"
+			" m_data=%p",
+			m, m->m_ext.ext_buf, m->m_ext.ext_size, m->m_data);
+			KASSERTMSG((m->m_data <=
+m->m_ext.ext_buf + m->m_ext.ext_size),
+			"m=%p m_ext.ext_buf=%p m_ext.ext_size=%zu"
+			" m_data=%p",
+			m, m->m_ext.ext_buf, m->m_ext.ext_size, m->m_data);
 
 			offset = (vaddr_t)m->m_data -
 			trunc_page((vaddr_t)m->m_ext.ext_buf);
@@ -655,7 +667,9 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bu
 	 */
 	map->dm_mapsize = 0;
 	map->dm_nsegs = 0;
-	KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+	KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+	"maxsegsz=0x%"PRIxBUSSIZE", maxmaxsegsz=0x%"PRIxBUSSIZE,
+	map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
 	resid = uio->uio_resid;
 	iov = uio->uio_iov;
@@ -732,7 +746,9 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bu
 	 */
 	map->dm_mapsize = 0;
 	map->dm_nsegs = 0;
-	KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+	KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+	"maxsegsz=0x%"PRIxBUSSIZE", maxmaxsegsz=0x%"PRIxBUSSIZE,
+	map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
 	if (size0 > map->_dm_size)
 		return EINVAL;
@@ -811,8 +827,8 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 		"bad offset 0x%"PRIxBUSADDR" >= 0x%"PRIxBUSSIZE,
 		offset, map->dm_mapsize);
 		KASSERTMSG(len <= map->dm_mapsize - offset,
-		"bad length 0x%"PRIxBUSADDR" + %"PRIxBUSSIZE
-		" > %"PRIxBUSSIZE,
+		"bad length 0x%"PRIxBUSADDR" + 0x%"PRIxBUSSIZE
+		" > 0x%"PRIxBUSSIZE,
 		offset, len, map->dm_mapsize);
 	}
 



CVS commit: src/sys/arch/x86/x86

2023-03-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Mar 28 19:55:42 UTC 2023

Modified Files:
src/sys/arch/x86/x86: bus_dma.c

Log Message:
x86/bus_dma.c: Sprinkle KASSERTMSG.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/x86/x86/bus_dma.c

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



Re: CVS commit: src

2023-03-28 Thread Valery Ushakov
On Tue, Mar 28, 2023 at 14:44:36 +, Roland Illig wrote:

> lint: warn about extern declarations outside headers

vs.

> https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html

which is nested extern declaration inside a function body.

I.e. the two lines of this log message contradict each other.  So
which one of those does this change actually address?


-uwe


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

2023-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar 28 15:52:51 UTC 2023

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

Log Message:
lint: condense debugging code

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/lint1/debug.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/debug.c
diff -u src/usr.bin/xlint/lint1/debug.c:1.25 src/usr.bin/xlint/lint1/debug.c:1.26
--- src/usr.bin/xlint/lint1/debug.c:1.25	Sat Jan 21 13:07:22 2023
+++ src/usr.bin/xlint/lint1/debug.c	Tue Mar 28 15:52:50 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.25 2023/01/21 13:07:22 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.26 2023/03/28 15:52:50 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: debug.c,v 1.25 2023/01/21 13:07:22 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.26 2023/03/28 15:52:50 rillig Exp $");
 #endif
 
 #include 
@@ -393,30 +393,18 @@ debug_dinfo(const dinfo_t *d) // NOLINT(
 	if (d->d_sou_align_in_bits != 0)
 		debug_printf(" align=%u", (unsigned)d->d_sou_align_in_bits);
 
-	if (d->d_const)
-		debug_printf(" const");
-	if (d->d_volatile)
-		debug_printf(" volatile");
-	if (d->d_inline)
-		debug_printf(" inline");
-	if (d->d_multiple_storage_classes)
-		debug_printf(" multiple_storage_classes");
-	if (d->d_invalid_type_combination)
-		debug_printf(" invalid_type_combination");
-	if (d->d_nonempty_decl)
-		debug_printf(" nonempty_decl");
-	if (d->d_vararg)
-		debug_printf(" vararg");
-	if (d->d_proto)
-		debug_printf(" prototype");
-	if (d->d_notyp)
-		debug_printf(" no_type_specifier");
-	if (d->d_asm)
-		debug_printf(" asm");
-	if (d->d_packed)
-		debug_printf(" packed");
-	if (d->d_used)
-		debug_printf(" used");
+	debug_word(d->d_const, "const");
+	debug_word(d->d_volatile, "volatile");
+	debug_word(d->d_inline, "inline");
+	debug_word(d->d_multiple_storage_classes, "multiple_storage_classes");
+	debug_word(d->d_invalid_type_combination, "invalid_type_combination");
+	debug_word(d->d_nonempty_decl, "nonempty_decl");
+	debug_word(d->d_vararg, "vararg");
+	debug_word(d->d_proto, "prototype");
+	debug_word(d->d_notyp, "no_type_specifier");
+	debug_word(d->d_asm, "asm");
+	debug_word(d->d_packed, "packed");
+	debug_word(d->d_used, "used");
 
 	if (d->d_tagtyp != NULL)
 		debug_printf(" tagtyp='%s'", type_name(d->d_tagtyp));



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

2023-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar 28 15:52:51 UTC 2023

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

Log Message:
lint: condense debugging code

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/lint1/debug.c

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



CVS commit: src

2023-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar 28 14:44:35 UTC 2023

Modified Files:
src/distrib/sets/lists/tests: mi
src/lib/libppath: Makefile
src/lib/libpuffs: Makefile
src/lib/libutil: Makefile
src/tests/usr.bin/xlint/lint1: c11_generic_expression.c c90.c
d_c99_anon_union.c d_c99_bool.c d_c99_bool_strict.c
d_c99_bool_strict_syshdr.c d_c99_complex_num.c
d_c99_complex_split.c d_c99_flex_array_packed.c d_c99_for_loops.c
d_c99_func.c d_c99_init.c d_c99_nested_struct.c d_c99_struct_init.c
d_c99_union_init1.c d_c99_union_init2.c d_c99_union_init3.c
d_c99_union_init4.c d_c99_union_init5.c d_c9x_array_init.c
d_cast_lhs.c d_cast_typeof.c d_compound_literals2.c
d_constant_conv1.c d_constant_conv2.c d_decl_old_style_arguments.c
d_gcc_compound_statements1.c d_gcc_extension.c
d_init_array_using_string.c d_lint_assert.c d_nested_structs.c
d_packed_structs.c d_struct_init_nested.c d_type_conv1.c
d_type_conv2.c d_type_conv3.c d_typefun.c decl.c decl_arg.c
decl_direct_abstract.c decl_struct_member.c emit.c emit_lp64.c
expr_binary.c expr_binary_trad.c expr_fold.c expr_precedence.c
expr_promote.c expr_promote_trad.c expr_range.c expr_sizeof.c
gcc_attribute.c gcc_attribute_func.c gcc_attribute_label.c
gcc_attribute_stmt.c gcc_attribute_var.c gcc_bit_field_types.c
gcc_init_compound_literal.c gcc_typeof.c init.c init_c90.c
lex_char.c lex_char_uchar.c lex_floating.c lex_integer.c
lex_integer_binary.c lex_integer_ilp32.c lex_string.c
lex_wide_char.c lex_wide_string.c msg_000.c msg_001.c msg_001_c90.c
msg_002.c msg_004.c msg_006.c msg_007.c msg_009.c msg_010.c
msg_013.c msg_014.c msg_015.c msg_016.c msg_017.c msg_018.c
msg_019.c msg_020.c msg_022.c msg_024.c msg_026.c msg_027.c
msg_029.c msg_031.c msg_038.c msg_040.c msg_044.c msg_046.c
msg_049.c msg_051.c msg_058.c msg_060.c msg_061.c msg_067.c
msg_068.c msg_069.c msg_070.c msg_071.c msg_073.c msg_074.c
msg_075.c msg_076.c msg_077.c msg_078.c msg_079.c msg_080.c
msg_081.c msg_082.c msg_083.c msg_085.c msg_086.c msg_087.c
msg_088.c msg_090.c msg_095.c msg_101.c msg_112.c msg_115.c
msg_123.c msg_124.c msg_129.c msg_130.c msg_131.c msg_132.c
msg_132_ilp32.c msg_135.c msg_139.c msg_141.c msg_142.c msg_147.c
msg_150.c msg_151.c msg_152.c msg_153.c msg_154.c msg_155.c
msg_156.c msg_157.c msg_158.c msg_160.c msg_161.c msg_162.c
msg_168.c msg_169.c msg_172.c msg_173.c msg_175.c msg_176.c
msg_177.c msg_178.c msg_179.c msg_180.c msg_181.c msg_185.c
msg_186.c msg_187.c msg_188.c msg_190.c msg_193.c msg_204.c
msg_210.c msg_212.c msg_218.c msg_219.c msg_220.c msg_221.c
msg_222.c msg_238.c msg_241.c msg_242.c msg_243.c msg_245.c
msg_247.c msg_248.c msg_249.c msg_251.c msg_252.c msg_255.c
msg_256.c msg_257.c msg_258.c msg_259.c msg_259_c90.c
msg_259_ilp32.c msg_262.c msg_263.c msg_264.c msg_265.c msg_266.c
msg_269.c msg_270.c msg_276.c msg_277.c msg_278.c msg_279.c
msg_282.c msg_284.c msg_285.c msg_291.c msg_292.c msg_294.c
msg_296.c msg_297.c msg_298.c msg_301.c msg_303.c msg_304.c
msg_305.c msg_308.c msg_313.c msg_315.c msg_316.c msg_319.c
msg_321.c msg_323.c msg_325.c msg_326.c msg_327.c msg_330.c
msg_331.c msg_332.c msg_334.c msg_336.c msg_337.c msg_338.c
msg_339.c msg_341.c msg_342.c msg_343.c msg_346.c msg_347.c
msg_348.c msg_349.c op_colon.c op_shl_lp64.c
parse_init_declarator.c parse_stmt_error.c parse_stmt_iter_error.c
parse_type_name.c platform_ilp32_int.c platform_ilp32_long.c
platform_int.c platform_long.c platform_lp64.c queries.c stmt_if.c
src/usr.bin/xlint/lint1: Makefile decl.c err.c externs1.h func.c tree.c
src/usr.bin/xlint/lint2: main2.c
Added Files:
src/tests/usr.bin/xlint/lint1: msg_351.c

Log Message:
lint: warn about extern declarations outside headers

https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html


To generate a diff of this commit:
cvs rdiff -u -r1.1254 -r1.1255 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.3 -r1.4 src/lib/libppath/Makefile
cvs rdiff -u -r1.27 -r1.28 src/lib/libpuffs/Makefile
cvs rdiff -u -r1.85 -r1.86 src/lib/libutil/Makefile
cvs rdiff -u -r1.14 -r1.15 \
src/tests/usr.bin/xlint/lint1/c11_generic_expression.c \
src/tests/usr.bin/xlint/lint1/emit.c src/tests/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/c90.c \
src/tests/usr.bin/xlint/lint1/d_c99_union_init5.c \

CVS commit: src/usr.bin/make

2023-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar 28 14:39:31 UTC 2023

Modified Files:
src/usr.bin/make: main.c make.h meta.c trace.c var.c

Log Message:
make: declare all common symbols in headers, unexport others

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.592 -r1.593 src/usr.bin/make/main.c
cvs rdiff -u -r1.318 -r1.319 src/usr.bin/make/make.h
cvs rdiff -u -r1.204 -r1.205 src/usr.bin/make/meta.c
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/make/trace.c
cvs rdiff -u -r1.1048 -r1.1049 src/usr.bin/make/var.c

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.592 src/usr.bin/make/main.c:1.593
--- src/usr.bin/make/main.c:1.592	Sat Feb 25 00:07:08 2023
+++ src/usr.bin/make/main.c	Tue Mar 28 14:39:31 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.592 2023/02/25 00:07:08 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.593 2023/03/28 14:39:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.592 2023/02/25 00:07:08 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.593 2023/03/28 14:39:31 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -125,7 +125,7 @@ bool allPrecious;		/* .PRECIOUS given on
 bool deleteOnError;		/* .DELETE_ON_ERROR: set */
 
 static int maxJobTokens;	/* -j argument */
-bool enterFlagObj;		/* -w and objdir != srcdir */
+static bool enterFlagObj;	/* -w and objdir != srcdir */
 
 static int jp_0 = -1, jp_1 = -1; /* ends of parent job pipe */
 bool doing_depend;		/* Set while reading .depend */

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.318 src/usr.bin/make/make.h:1.319
--- src/usr.bin/make/make.h:1.318	Thu Mar  9 07:06:43 2023
+++ src/usr.bin/make/make.h	Tue Mar 28 14:39:31 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.318 2023/03/09 07:06:43 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.319 2023/03/28 14:39:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -768,6 +768,8 @@ typedef struct CmdOpts {
 } CmdOpts;
 
 extern CmdOpts opts;
+extern bool forceJobs;
+extern char **environ;
 
 /* arch.c */
 void Arch_Init(void);
@@ -1179,6 +1181,7 @@ pp_skip_hspace(char **pp)
 }
 
 #if defined(lint)
+extern void do_not_define_rcsid(void); /* for lint */
 # define MAKE_RCSID(id) extern void do_not_define_rcsid(void)
 #elif defined(MAKE_NATIVE)
 # include 

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.204 src/usr.bin/make/meta.c:1.205
--- src/usr.bin/make/meta.c:1.204	Tue Feb 28 06:04:28 2023
+++ src/usr.bin/make/meta.c	Tue Mar 28 14:39:31 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: meta.c,v 1.204 2023/02/28 06:04:28 sjg Exp $ */
+/*  $NetBSD: meta.c,v 1.205 2023/03/28 14:39:31 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -83,8 +83,6 @@ static bool metaCmpFilter = false;	/* do
 static bool metaCurdirOk = false;	/* write .meta in .CURDIR Ok? */
 static bool metaSilent = false;		/* if we have a .meta be SILENT */
 
-extern bool forceJobs;
-extern char**environ;
 
 #define MAKE_META_PREFIX	".MAKE.META.PREFIX"
 

Index: src/usr.bin/make/trace.c
diff -u src/usr.bin/make/trace.c:1.32 src/usr.bin/make/trace.c:1.33
--- src/usr.bin/make/trace.c:1.32	Sat Mar 26 14:02:40 2022
+++ src/usr.bin/make/trace.c	Tue Mar 28 14:39:31 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: trace.c,v 1.32 2022/03/26 14:02:40 rillig Exp $	*/
+/*	$NetBSD: trace.c,v 1.33 2023/03/28 14:39:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -48,11 +48,11 @@
 #include "job.h"
 #include "trace.h"
 
-MAKE_RCSID("$NetBSD: trace.c,v 1.32 2022/03/26 14:02:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: trace.c,v 1.33 2023/03/28 14:39:31 rillig Exp $");
 
 static FILE *trfile;
 static pid_t trpid;
-const char *trwd;
+static const char *trwd;
 
 static const char evname[][4] = {
 	"BEG",

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.1048 src/usr.bin/make/var.c:1.1049
--- src/usr.bin/make/var.c:1.1048	Thu Mar  9 06:49:37 2023
+++ src/usr.bin/make/var.c	Tue Mar 28 14:39:31 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1048 2023/03/09 06:49:37 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.1049 2023/03/28 14:39:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1048 2023/03/09 06:49:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1049 2023/03/28 14:39:31 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -786,8 +786,6 @@ Var_ExportVars(const char *varnames)
 }
 
 
-extern char **environ;
-
 static void
 ClearEnv(void)
 {



CVS commit: src/usr.bin/make

2023-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar 28 14:39:31 UTC 2023

Modified Files:
src/usr.bin/make: main.c make.h meta.c trace.c var.c

Log Message:
make: declare all common symbols in headers, unexport others

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.592 -r1.593 src/usr.bin/make/main.c
cvs rdiff -u -r1.318 -r1.319 src/usr.bin/make/make.h
cvs rdiff -u -r1.204 -r1.205 src/usr.bin/make/meta.c
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/make/trace.c
cvs rdiff -u -r1.1048 -r1.1049 src/usr.bin/make/var.c

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



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

2023-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar 28 14:38:29 UTC 2023

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

Log Message:
tests/make: add expectations for string comparison errors


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-cmp-string.exp
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/cond-cmp-string.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/cond-cmp-string.exp
diff -u src/usr.bin/make/unit-tests/cond-cmp-string.exp:1.12 src/usr.bin/make/unit-tests/cond-cmp-string.exp:1.13
--- src/usr.bin/make/unit-tests/cond-cmp-string.exp:1.12	Sun Sep  4 22:55:00 2022
+++ src/usr.bin/make/unit-tests/cond-cmp-string.exp	Tue Mar 28 14:38:29 2023
@@ -1,11 +1,11 @@
-make: "cond-cmp-string.mk" line 18: Malformed conditional (str != str)
-make: "cond-cmp-string.mk" line 42: Malformed conditional ("string" != "str""ing")
-make: "cond-cmp-string.mk" line 49: Malformed conditional (!("value" = "value"))
-make: "cond-cmp-string.mk" line 56: Malformed conditional (!("value" === "value"))
-make: "cond-cmp-string.mk" line 113: Comparison with '<' requires both operands 'string' and 'string' to be numeric
-make: "cond-cmp-string.mk" line 120: Comparison with '<=' requires both operands 'string' and 'string' to be numeric
-make: "cond-cmp-string.mk" line 127: Comparison with '>' requires both operands 'string' and 'string' to be numeric
-make: "cond-cmp-string.mk" line 134: Comparison with '>=' requires both operands 'string' and 'string' to be numeric
+make: "cond-cmp-string.mk" line 19: Malformed conditional (str != str)
+make: "cond-cmp-string.mk" line 44: Malformed conditional ("string" != "str""ing")
+make: "cond-cmp-string.mk" line 52: Malformed conditional (!("value" = "value"))
+make: "cond-cmp-string.mk" line 60: Malformed conditional (!("value" === "value"))
+make: "cond-cmp-string.mk" line 118: Comparison with '<' requires both operands 'string' and 'string' to be numeric
+make: "cond-cmp-string.mk" line 126: Comparison with '<=' requires both operands 'string' and 'string' to be numeric
+make: "cond-cmp-string.mk" line 134: Comparison with '>' requires both operands 'string' and 'string' to be numeric
+make: "cond-cmp-string.mk" line 142: Comparison with '>=' requires both operands 'string' and 'string' to be numeric
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/cond-cmp-string.mk
diff -u src/usr.bin/make/unit-tests/cond-cmp-string.mk:1.16 src/usr.bin/make/unit-tests/cond-cmp-string.mk:1.17
--- src/usr.bin/make/unit-tests/cond-cmp-string.mk:1.16	Sun May  8 06:51:27 2022
+++ src/usr.bin/make/unit-tests/cond-cmp-string.mk	Tue Mar 28 14:38:29 2023
@@ -1,4 +1,4 @@
-# $NetBSD: cond-cmp-string.mk,v 1.16 2022/05/08 06:51:27 rillig Exp $
+# $NetBSD: cond-cmp-string.mk,v 1.17 2023/03/28 14:38:29 rillig Exp $
 #
 # Tests for string comparisons in .if conditions.
 
@@ -15,6 +15,7 @@
 
 # The left-hand side of the comparison must be enclosed in quotes.
 # This one is not enclosed in quotes and thus generates an error message.
+# expect+1: Malformed conditional (str != str)
 .if str != str
 .  error
 .endif
@@ -39,6 +40,7 @@
 
 # It is not possible to concatenate two string literals to form a single
 # string.  In C, Python and the shell this is possible, but not in make.
+# expect+1: Malformed conditional ("string" != "str""ing")
 .if "string" != "str""ing"
 .  error
 .else
@@ -46,6 +48,7 @@
 .endif
 
 # There is no = operator for strings.
+# expect+1: Malformed conditional (!("value" = "value"))
 .if !("value" = "value")
 .  error
 .else
@@ -53,6 +56,7 @@
 .endif
 
 # There is no === operator for strings either.
+# expect+1: Malformed conditional (!("value" === "value"))
 .if !("value" === "value")
 .  error
 .else
@@ -110,6 +114,7 @@
 .endif
 
 # Strings cannot be compared relationally, only for equality.
+# expect+1: Comparison with '<' requires both operands 'string' and 'string' to be numeric
 .if "string" < "string"
 .  error
 .else
@@ -117,6 +122,7 @@
 .endif
 
 # Strings cannot be compared relationally, only for equality.
+# expect+1: Comparison with '<=' requires both operands 'string' and 'string' to be numeric
 .if "string" <= "string"
 .  error
 .else
@@ -124,6 +130,7 @@
 .endif
 
 # Strings cannot be compared relationally, only for equality.
+# expect+1: Comparison with '>' requires both operands 'string' and 'string' to be numeric
 .if "string" > "string"
 .  error
 .else
@@ -131,6 +138,7 @@
 .endif
 
 # Strings cannot be compared relationally, only for equality.
+# expect+1: Comparison with '>=' requires both operands 'string' and 'string' to be numeric
 .if "string" >= "string"
 .  error
 .else



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

2023-03-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar 28 14:38:29 UTC 2023

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

Log Message:
tests/make: add expectations for string comparison errors


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-cmp-string.exp
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/cond-cmp-string.mk

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



CVS commit: src/sys/arch/mips/include

2023-03-28 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Tue Mar 28 10:54:13 UTC 2023

Modified Files:
src/sys/arch/mips/include: bus_space_defs.h types.h

Log Message:
Add missing PRIuBUSSIZE to mips.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/include/bus_space_defs.h
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/mips/include/types.h

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

Modified files:

Index: src/sys/arch/mips/include/bus_space_defs.h
diff -u src/sys/arch/mips/include/bus_space_defs.h:1.4 src/sys/arch/mips/include/bus_space_defs.h:1.5
--- src/sys/arch/mips/include/bus_space_defs.h:1.4	Sun Jul 26 08:08:41 2020
+++ src/sys/arch/mips/include/bus_space_defs.h	Tue Mar 28 10:54:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space_defs.h,v 1.4 2020/07/26 08:08:41 simonb Exp $	*/
+/*	$NetBSD: bus_space_defs.h,v 1.5 2023/03/28 10:54:13 nakayama Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -112,11 +112,13 @@ typedef int64_t bus_addr_t;
 typedef uint64_t bus_size_t;
 #define	PRIxBUSADDR	PRIx64
 #define	PRIxBUSSIZE	PRIx64
+#define	PRIuBUSSIZE	PRIu64
 #else
 typedef paddr_t bus_addr_t;
 typedef psize_t bus_size_t;
 #define	PRIxBUSADDR	PRIxPADDR
 #define	PRIxBUSSIZE	PRIxPSIZE
+#define	PRIuBUSSIZE	PRIuPSIZE
 #endif
 
 /*

Index: src/sys/arch/mips/include/types.h
diff -u src/sys/arch/mips/include/types.h:1.77 src/sys/arch/mips/include/types.h:1.78
--- src/sys/arch/mips/include/types.h:1.77	Thu Jul  7 10:06:02 2022
+++ src/sys/arch/mips/include/types.h	Tue Mar 28 10:54:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.77 2022/07/07 10:06:02 martin Exp $	*/
+/*	$NetBSD: types.h,v 1.78 2023/03/28 10:54:13 nakayama Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -74,12 +74,14 @@ typedef __uint64_t	psize_t;
 #define	PRIxPADDR	PRIx64
 #define	PRIxPSIZE	PRIx64
 #define	PRIdPSIZE	PRId64
+#define	PRIuPSIZE	PRIu64
 #else
 typedef __uint32_t	paddr_t;
 typedef __uint32_t	psize_t;
 #define	PRIxPADDR	PRIx32
 #define	PRIxPSIZE	PRIx32
 #define	PRIdPSIZE	PRId32
+#define	PRIuPSIZE	PRIu32
 #endif
 #ifdef _LP64
 typedef __uint64_t	vaddr_t;



CVS commit: src/sys/arch/mips/include

2023-03-28 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Tue Mar 28 10:54:13 UTC 2023

Modified Files:
src/sys/arch/mips/include: bus_space_defs.h types.h

Log Message:
Add missing PRIuBUSSIZE to mips.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/include/bus_space_defs.h
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/mips/include/types.h

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