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

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Sep  1 06:48:24 UTC 2021

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

Log Message:
lint: remove array creation from expr_derive_type

It is only used for creating string types.  The creation of other array
types happens in add_array.

This is a preparation to make all stored types const.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.364 -r1.365 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.364 src/usr.bin/xlint/lint1/tree.c:1.365
--- src/usr.bin/xlint/lint1/tree.c:1.364	Tue Aug 31 19:17:45 2021
+++ src/usr.bin/xlint/lint1/tree.c	Wed Sep  1 06:48:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.364 2021/08/31 19:17:45 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.365 2021/09/01 06:48:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.364 2021/08/31 19:17:45 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.365 2021/09/01 06:48:24 rillig Exp $");
 #endif
 
 #include 
@@ -115,8 +115,8 @@ derive_type(type_t *tp, tspec_t t)
 }
 
 /*
- * Build 'pointer to tp', 'array of tp' or 'function returning tp'.  The
- * memory is freed at the end of the current expression.
+ * Derive 'pointer to tp' or 'function returning tp'.
+ * The memory is freed at the end of the current expression.
  */
 type_t *
 expr_derive_type(type_t *tp, tspec_t t)
@@ -274,14 +274,19 @@ build_string(strg_t *strg)
 {
 	size_t	len;
 	tnode_t	*n;
+	type_t *tp;
 
 	len = strg->st_len;
 
 	n = expr_zalloc_tnode();
 
+	tp = expr_zalloc(sizeof(*tp));
+	tp->t_tspec = ARRAY;
+	tp->t_subt = gettyp(strg->st_tspec);
+	tp->t_dim = len + 1;
+
 	n->tn_op = STRING;
-	n->tn_type = expr_derive_type(gettyp(strg->st_tspec), ARRAY);
-	n->tn_type->t_dim = len + 1;
+	n->tn_type = tp;
 	n->tn_lvalue = true;
 
 	n->tn_string = expr_zalloc(sizeof(*n->tn_string));



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

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Sep  1 06:48:24 UTC 2021

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

Log Message:
lint: remove array creation from expr_derive_type

It is only used for creating string types.  The creation of other array
types happens in add_array.

This is a preparation to make all stored types const.

No functional change.


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

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



CVS commit: src/tests/usr.sbin/inetd

2021-08-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep  1 06:12:51 UTC 2021

Modified Files:
src/tests/usr.sbin/inetd: Makefile t_inetd.c test_server.c

Log Message:
fix warnings


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.sbin/inetd/Makefile \
src/tests/usr.sbin/inetd/t_inetd.c src/tests/usr.sbin/inetd/test_server.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.sbin/inetd/Makefile
diff -u src/tests/usr.sbin/inetd/Makefile:1.1 src/tests/usr.sbin/inetd/Makefile:1.2
--- src/tests/usr.sbin/inetd/Makefile:1.1	Sun Aug 29 05:54:18 2021
+++ src/tests/usr.sbin/inetd/Makefile	Wed Sep  1 02:12:50 2021
@@ -1,5 +1,6 @@
-# $NetBSD: Makefile,v 1.1 2021/08/29 09:54:18 christos Exp $
+# $NetBSD: Makefile,v 1.2 2021/09/01 06:12:50 christos Exp $
 
+WARNS=6
 .include 
 
 TESTSDIR=${TESTSBASE}/usr.sbin/inetd
Index: src/tests/usr.sbin/inetd/t_inetd.c
diff -u src/tests/usr.sbin/inetd/t_inetd.c:1.1 src/tests/usr.sbin/inetd/t_inetd.c:1.2
--- src/tests/usr.sbin/inetd/t_inetd.c:1.1	Sun Aug 29 05:54:18 2021
+++ src/tests/usr.sbin/inetd/t_inetd.c	Wed Sep  1 02:12:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_inetd.c,v 1.1 2021/08/29 09:54:18 christos Exp $	*/
+/*	$NetBSD: t_inetd.c,v 1.2 2021/09/01 06:12:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_inetd.c,v 1.1 2021/08/29 09:54:18 christos Exp $");
+__RCSID("$NetBSD: t_inetd.c,v 1.2 2021/09/01 06:12:50 christos Exp $");
 
 #include 
 #include 
@@ -51,7 +51,7 @@ __RCSID("$NetBSD: t_inetd.c,v 1.1 2021/0
 #define TCP 6
 #define UDP 17
 
-static pid_t	run(const char *, char **);
+static pid_t	run(const char *, char *const *);
 static char	*concat(const char *restrict, const char *restrict);
 static void	waitfor(pid_t, const char *);
 static bool	run_udp_client(const char *);
@@ -83,15 +83,15 @@ ATF_TC_BODY(test_ratelimit, tc)
 	);
 	
 	/* Run inetd in debug mode using specified config file */
-	proc = run("inetd", (char*[]) {
-	"inetd", "-d",
+	proc = run("inetd", (char* const []) {
+	__UNCONST("inetd"), __UNCONST("-d"),
 	concat(atf_tc_get_config_var(tc, "srcdir"),
 	"/inetd_ratelimit.conf"),
 	NULL
 	});
 
 	/* Wait for inetd to load services */
-	CHECK_ERROR(sleep(1));
+	sleep(1);
 
 	/*
 	 * TODO test dgram/nowait? Specified in manpage but doesn't seem to
@@ -151,6 +151,8 @@ ATF_TC_BODY(test_ratelimit, tc)
 ATF_TP_ADD_TCS(tp)
 {
 	ATF_TP_ADD_TC(tp, test_ratelimit);
+
+	return atf_no_error();
 }
 
 /* Return true if successfully received message, false if timeout */
@@ -177,10 +179,6 @@ run_udp_client(const char *port)
 		.msg_iovlen = 1
 	};
 
-	struct mmsghdr msglist = {
-		.msg_hdr = &msg
-	};
-	
 	ssize_t count = recvmsg(udp, &msg, 0);
 	if (count == -1) {
 		if (errno == EAGAIN) {
@@ -254,7 +252,7 @@ create_socket(const char *address, const
 	ATF_REQUIRE_MSG(res->ai_next == NULL, "Ambiguous create_socket args");
 	CHECK_ERROR(fd = socket(res->ai_family, 
 	res->ai_socktype, res->ai_protocol));
-	struct timeval timeout = { timeout_sec };
+	struct timeval timeout = { timeout_sec, 0 };
 	CHECK_ERROR(setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, 
 	sizeof(timeout)));
 	memcpy(dst, res->ai_addr, res->ai_addrlen);
@@ -264,7 +262,7 @@ create_socket(const char *address, const
 
 /* Run program with args */
 static pid_t
-run(const char *prog, char **args)
+run(const char *prog, char *const *args)
 {
 	pid_t proc;
 	extern char **environ;
@@ -278,7 +276,9 @@ static void
 waitfor(pid_t pid, const char *taskname)
 {
 	int status;
-	CHECK_ERROR(waitpid(pid, &status, WALLSIG) == pid);
+	int rpid = waitpid(pid, &status, WALLSIG);
+	ATF_REQUIRE_MSG(rpid == pid, "wait %d != %d %s",
+	rpid, pid, strerror(errno));
 
 	ATF_REQUIRE_EQ_MSG(WEXITSTATUS(status), EXIT_SUCCESS, 
 	"%s failed with "
Index: src/tests/usr.sbin/inetd/test_server.c
diff -u src/tests/usr.sbin/inetd/test_server.c:1.1 src/tests/usr.sbin/inetd/test_server.c:1.2
--- src/tests/usr.sbin/inetd/test_server.c:1.1	Sun Aug 29 05:54:18 2021
+++ src/tests/usr.sbin/inetd/test_server.c	Wed Sep  1 02:12:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: test_server.c,v 1.1 2021/08/29 09:54:18 christos Exp $	*/
+/*	$NetBSD: test_server.c,v 1.2 2021/09/01 06:12:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: test_server.c,v 1.1 2021/08/29 09:54:18 christos Exp $");
+__RCSID("$NetBSD: test_server.c,v 1.2 2021/09/01 06:12:50 christos Exp $");
 
 #include 
 #include 
@@ -91,18 +91,18 @@ main(int argc, char **argv)
 }
 
 static void
-stream_nowait_service()
+stream_nowait_service(void)
 {
 	ssize_t count;
 	char buffer[10];
 	CHECK(count = recv(0, buffer, sizeof(buffer), 0));
 	syslog(LOG_WARNING, "Received stream/nowait message \"%.*s\"\n",
-	count, buffer);
-	CHECK(send(1, buffer, count, 

CVS commit: src/tests/usr.sbin/inetd

2021-08-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep  1 06:12:51 UTC 2021

Modified Files:
src/tests/usr.sbin/inetd: Makefile t_inetd.c test_server.c

Log Message:
fix warnings


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.sbin/inetd/Makefile \
src/tests/usr.sbin/inetd/t_inetd.c src/tests/usr.sbin/inetd/test_server.c

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



CVS commit: src/usr.sbin/wsmoused

2021-08-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Sep  1 06:10:06 UTC 2021

Modified Files:
src/usr.sbin/wsmoused: wsmoused.c

Log Message:
conditional build fix.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/wsmoused/wsmoused.c

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

Modified files:

Index: src/usr.sbin/wsmoused/wsmoused.c
diff -u src/usr.sbin/wsmoused/wsmoused.c:1.26 src/usr.sbin/wsmoused/wsmoused.c:1.27
--- src/usr.sbin/wsmoused/wsmoused.c:1.26	Tue May 31 03:37:02 2011
+++ src/usr.sbin/wsmoused/wsmoused.c	Wed Sep  1 06:10:06 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: wsmoused.c,v 1.26 2011/05/31 03:37:02 christos Exp $ */
+/* $NetBSD: wsmoused.c,v 1.27 2021/09/01 06:10:06 mlelstv Exp $ */
 
 /*
  * Copyright (c) 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 2002, 2003\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: wsmoused.c,v 1.26 2011/05/31 03:37:02 christos Exp $");
+__RCSID("$NetBSD: wsmoused.c,v 1.27 2021/09/01 06:10:06 mlelstv Exp $");
 #endif /* not lint */
 
 #include 
@@ -71,7 +71,7 @@ static int Foreground = 1;
 static int X_Console = -1;
 static int X_Console_Delay = 5;
 
-#ifdef WSMOUSED_SELECTION_MODE
+#ifdef WSMOUSED_ACTION_MODE
 extern struct mode_bootstrap Action_Mode;
 #endif
 #ifdef WSMOUSED_SELECTION_MODE



CVS commit: src/usr.sbin/wsmoused

2021-08-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Sep  1 06:10:06 UTC 2021

Modified Files:
src/usr.sbin/wsmoused: wsmoused.c

Log Message:
conditional build fix.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/wsmoused/wsmoused.c

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



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

2021-08-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Sep  1 03:08:08 UTC 2021

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_intr.c

Log Message:
PR port-arm/56264

Register all PICs when bcmicu1 is attached, in order to avoid calling
pic_add() from cpu_hatch(), which blocks for aarch64 kernel on RPI3.
This prevented MP kernel to boot due to KASSERT failure as described
in the PR.

This is a kind of a workaround; the real fix should be to

(a) reorganize cpu_hatch() for aarch64 and arm:
http://mail-index.netbsd.org/port-arm/2021/06/21/msg007320.html

(b) or change MI abstraction of ``MP ready'':
http://mail-index.netbsd.org/port-arm/2021/06/22/msg007327.html

However, still, this fix does not bring about any penalty, and it is
not good to leave RPI3 broken for months...

Tested on RPI3 (aarch64 MP, armv7hf MP) as well as RPI1 (armv6hf UP).


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/arm/broadcom/bcm2835_intr.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/broadcom/bcm2835_intr.c
diff -u src/sys/arch/arm/broadcom/bcm2835_intr.c:1.38 src/sys/arch/arm/broadcom/bcm2835_intr.c:1.39
--- src/sys/arch/arm/broadcom/bcm2835_intr.c:1.38	Mon Mar  8 14:22:42 2021
+++ src/sys/arch/arm/broadcom/bcm2835_intr.c	Wed Sep  1 03:08:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_intr.c,v 1.38 2021/03/08 14:22:42 mlelstv Exp $	*/
+/*	$NetBSD: bcm2835_intr.c,v 1.39 2021/09/01 03:08:08 rin Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2015, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.38 2021/03/08 14:22:42 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.39 2021/09/01 03:08:08 rin Exp $");
 
 #define _INTR_PRIVATE
 
@@ -359,6 +359,34 @@ bcm2835_icu_attach(device_t parent, devi
 
 		ifuncs = &bcm2836mpicu_fdt_funcs;
 
+		/*
+		 * XXX
+		 * Register all PICs here in order to avoid pic_add() from
+		 * cpu_hatch(). See port-arm/56264.
+		 */
+		CPU_INFO_ITERATOR cii;
+		struct cpu_info *ci;
+		for (CPU_INFO_FOREACH(cii, ci)) {
+			const cpuid_t cpuid = ci->ci_core_id;
+			struct pic_softc * const pic = &bcm2836mp_pic[cpuid];
+
+			KASSERT(cpuid < BCM2836_NCPUS);
+
+#if defined(MULTIPROCESSOR)
+			pic->pic_cpus = ci->ci_kcpuset;
+			/*
+			 * Append "#n" to avoid duplication of .pic_name[]
+			 * It should be a unique id for intr_get_source()
+			 */
+			char suffix[sizeof("#0")];
+			snprintf(suffix, sizeof(suffix), "#%lu", cpuid);
+			strlcat(pic->pic_name, suffix, sizeof(pic->pic_name));
+#endif
+
+			bcm2836mp_int_base[cpuid] =
+			pic_add(pic, PIC_IRQBASE_ALLOC);
+		}
+
 		bcm2836mp_intr_init(self, curcpu());
 		arm_fdt_cpu_hatch_register(self, bcm2836mp_intr_init);
 	} else {
@@ -865,24 +893,10 @@ static void
 bcm2836mp_intr_init(void *priv, struct cpu_info *ci)
 {
 	const cpuid_t cpuid = ci->ci_core_id;
-	struct pic_softc * const pic = &bcm2836mp_pic[cpuid];
 
 	KASSERT(cpuid < BCM2836_NCPUS);
 
 #if defined(MULTIPROCESSOR)
-	pic->pic_cpus = ci->ci_kcpuset;
-
-	/*
-	 * Append "#n" to avoid duplication of .pic_name[]
-	 * It should be a unique id for intr_get_source()
-	 */
-	char suffix[sizeof("#0")];
-	snprintf(suffix, sizeof(suffix), "#%lu", cpuid);
-	strlcat(pic->pic_name, suffix, sizeof(pic->pic_name));
-#endif
-	bcm2836mp_int_base[cpuid] = pic_add(pic, PIC_IRQBASE_ALLOC);
-
-#if defined(MULTIPROCESSOR)
 	intr_establish(BCM2836_INT_MAILBOX0_CPUN(cpuid), IPL_HIGH,
 	IST_LEVEL | IST_MPSAFE, bcm2836mp_ipi_handler, NULL);
 



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

2021-08-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Sep  1 03:08:08 UTC 2021

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_intr.c

Log Message:
PR port-arm/56264

Register all PICs when bcmicu1 is attached, in order to avoid calling
pic_add() from cpu_hatch(), which blocks for aarch64 kernel on RPI3.
This prevented MP kernel to boot due to KASSERT failure as described
in the PR.

This is a kind of a workaround; the real fix should be to

(a) reorganize cpu_hatch() for aarch64 and arm:
http://mail-index.netbsd.org/port-arm/2021/06/21/msg007320.html

(b) or change MI abstraction of ``MP ready'':
http://mail-index.netbsd.org/port-arm/2021/06/22/msg007327.html

However, still, this fix does not bring about any penalty, and it is
not good to leave RPI3 broken for months...

Tested on RPI3 (aarch64 MP, armv7hf MP) as well as RPI1 (armv6hf UP).


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/arm/broadcom/bcm2835_intr.c

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



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

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 23:49:22 UTC 2021

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

Log Message:
lint: remove unnecessary switch statement

The switch statement covers only the few structural types, there is no
need to list all integer types as well.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/xlint/common/tyname.c

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

Modified files:

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.45 src/usr.bin/xlint/common/tyname.c:1.46
--- src/usr.bin/xlint/common/tyname.c:1.45	Sat Aug 28 13:29:26 2021
+++ src/usr.bin/xlint/common/tyname.c	Tue Aug 31 23:49:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.45 2021/08/28 13:29:26 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.46 2021/08/31 23:49:21 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.45 2021/08/28 13:29:26 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.46 2021/08/31 23:49:21 rillig Exp $");
 #endif
 
 #include 
@@ -303,33 +303,6 @@ type_name(const type_t *tp)
 	buf_add(&buf, tspec_name(t));
 
 	switch (t) {
-	case BOOL:
-	case CHAR:
-	case UCHAR:
-	case SCHAR:
-	case SHORT:
-	case USHORT:
-	case INT:
-	case UINT:
-	case LONG:
-	case ULONG:
-	case QUAD:
-	case UQUAD:
-#ifdef INT128_SIZE
-	case INT128:
-	case UINT128:
-#endif
-	case FLOAT:
-	case DOUBLE:
-	case LDOUBLE:
-	case VOID:
-	case COMPLEX:
-	case FCOMPLEX:
-	case DCOMPLEX:
-	case LCOMPLEX:
-	case SIGNED:
-	case UNSIGN:
-		break;
 	case PTR:
 		buf_add(&buf, " to ");
 		buf_add(&buf, type_name(tp->t_subt));
@@ -348,7 +321,7 @@ type_name(const type_t *tp)
 		type_name_of_function(&buf, tp);
 		break;
 	default:
-		INTERNAL_ERROR("type_name(%d)", t);
+		break;
 	}
 
 	name = intern(buf.data);



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

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 23:49:22 UTC 2021

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

Log Message:
lint: remove unnecessary switch statement

The switch statement covers only the few structural types, there is no
need to list all integer types as well.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/xlint/common/tyname.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-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 23:10:53 UTC 2021

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

Log Message:
lint: reduce verbose switch statement to table lookup

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.bin/xlint/lint1/emit1.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/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.52 src/usr.bin/xlint/lint1/emit1.c:1.53
--- src/usr.bin/xlint/lint1/emit1.c:1.52	Mon Aug 30 19:48:21 2021
+++ src/usr.bin/xlint/lint1/emit1.c	Tue Aug 31 23:10:52 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.52 2021/08/30 19:48:21 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.53 2021/08/31 23:10:52 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit1.c,v 1.52 2021/08/30 19:48:21 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.53 2021/08/31 23:10:52 rillig Exp $");
 #endif
 
 #include "lint1.h"
@@ -92,52 +92,30 @@ static	void	outfstrg(strg_t *);
 void
 outtype(const type_t *tp)
 {
-	int	t, s, na;
+	/* Available letters: --GH--K-MNO--R--U-W-YZ */
+#ifdef INT128_SIZE
+	static const char tt[NTSPEC] = "???BCCCSSIILLQQJJDDDVTTTPAF?XXX";
+	static const char ss[NTSPEC] = "???  su u u u u us l sue   ?s l";
+#else
+	static const char tt[NTSPEC] = "???BCCCSSIILLQQDDDVTTTPAF?XXX";
+	static const char ss[NTSPEC] = "???  su u u u us l sue   ?s l";
+#endif
+	char	t, s;
+	int	na;
 	sym_t	*arg;
 	tspec_t	ts;
 
 	while (tp != NULL) {
 		if ((ts = tp->t_tspec) == INT && tp->t_is_enum)
 			ts = ENUM;
-		/* Available letters: --GH--K-MNO--R--U-W-YZ */
-		switch (ts) {
-		case BOOL:	t = 'B';	s = '\0';	break;
-		case CHAR:	t = 'C';	s = '\0';	break;
-		case SCHAR:	t = 'C';	s = 's';	break;
-		case UCHAR:	t = 'C';	s = 'u';	break;
-		case SHORT:	t = 'S';	s = '\0';	break;
-		case USHORT:	t = 'S';	s = 'u';	break;
-		case INT:	t = 'I';	s = '\0';	break;
-		case UINT:	t = 'I';	s = 'u';	break;
-		case LONG:	t = 'L';	s = '\0';	break;
-		case ULONG:	t = 'L';	s = 'u';	break;
-		case QUAD:	t = 'Q';	s = '\0';	break;
-		case UQUAD:	t = 'Q';	s = 'u';	break;
-#ifdef INT128_SIZE
-		case INT128:	t = 'J';	s = '\0';	break;
-		case UINT128:	t = 'J';	s = 'u';	break;
-#endif
-		case FLOAT:	t = 'D';	s = 's';	break;
-		case DOUBLE:	t = 'D';	s = '\0';	break;
-		case LDOUBLE:	t = 'D';	s = 'l';	break;
-		case VOID:	t = 'V';	s = '\0';	break;
-		case STRUCT:	t = 'T';	s = 's';	break;
-		case UNION:	t = 'T';	s = 'u';	break;
-		case ENUM:	t = 'T';	s = 'e';	break;
-		case PTR:	t = 'P';	s = '\0';	break;
-		case ARRAY:	t = 'A';	s = '\0';	break;
-		case FUNC:	t = 'F';	s = '\0';	break;
-		case FCOMPLEX:	t = 'X';	s = 's';	break;
-		case DCOMPLEX:	t = 'X';	s = '\0';	break;
-		case LCOMPLEX:	t = 'X';	s = 'l';	break;
-		default:
-			lint_assert(/*CONSTCOND*/false);
-		}
+		t = tt[ts];
+		s = ss[ts];
+		lint_assert(t != '?' && t != '?');
 		if (tp->t_const)
 			outchar('c');
 		if (tp->t_volatile)
 			outchar('v');
-		if (s != '\0')
+		if (s != ' ')
 			outchar(s);
 		outchar(t);
 		if (ts == ARRAY) {



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

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 23:10:53 UTC 2021

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

Log Message:
lint: reduce verbose switch statement to table lookup

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.bin/xlint/lint1/emit1.c

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



Re: CVS commit: src

2021-08-31 Thread Roland Illig
Am 30.08.2021 um 11:11 schrieb matthew green:
> "Roland Illig" writes:
>> Module Name: src
>> Committed By:rillig
>> Date:Sun Aug 29 09:29:32 UTC 2021
>>
>> Modified Files:
>>  src/tests/usr.bin/xlint/lint1: msg_220.c msg_220.exp
>>  src/usr.bin/xlint/common: lint.h
>>  src/usr.bin/xlint/lint1: lex.c
>>
>> Log Message:
>> lint: allow 'fallthrough' as alternative spelling of FALLTHROUGH
>
> if you would like to see what GCC allows here, it's pretty involved.
> see external/gpl3/gcc/dist/libcpp/lex.c:fallthrough_comment_p().

Yep, I tried to read through these regular expressions myself but then
decided that I would focus on those few cases that we actually have in
the NetBSD tree.  I prefer not to use regular expressions in lint, to
keep it as simple as possible.

Roland


Re: CVS commit: src/usr.sbin/inetd

2021-08-31 Thread Roland Illig
Am 31.08.2021 um 18:29 schrieb Tobias Nygren:
> -   SWAP(int, cp->se_type, sep->se_type);
> +   SWAP(enum service_type, cp->se_type, sep->se_type);

Thanks for the note, I just fixed it.

I left out the 'enum' since there is a typedef for it.

Roland


CVS commit: src/usr.sbin/inetd

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 19:34:42 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
inetd: fix Clang build

error: implicit conversion changes signedness: 'service_type' to 'int'


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/usr.sbin/inetd/inetd.c

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

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.131 src/usr.sbin/inetd/inetd.c:1.132
--- src/usr.sbin/inetd/inetd.c:1.131	Mon Aug 30 18:21:11 2021
+++ src/usr.sbin/inetd/inetd.c	Tue Aug 31 19:34:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.131 2021/08/30 18:21:11 rillig Exp $	*/
+/*	$NetBSD: inetd.c,v 1.132 2021/08/31 19:34:42 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.131 2021/08/30 18:21:11 rillig Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.132 2021/08/31 19:34:42 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -760,7 +760,7 @@ config(void)
 #ifdef IPSEC
 			SWAP(char *, sep->se_policy, cp->se_policy);
 #endif
-			SWAP(int, cp->se_type, sep->se_type);
+			SWAP(service_type, cp->se_type, sep->se_type);
 			SWAP(size_t, cp->se_service_max, sep->se_service_max);
 			SWAP(size_t, cp->se_ip_max, sep->se_ip_max);
 #undef SWAP



CVS commit: src/usr.sbin/inetd

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 19:34:42 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
inetd: fix Clang build

error: implicit conversion changes signedness: 'service_type' to 'int'


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/usr.sbin/inetd/inetd.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-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 19:26:23 UTC 2021

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

Log Message:
tests/lint: add cross-references to message 297

The check for lossy integer conversions is already implemented, it's
just not activated in the default NetBSD build.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/usr.bin/xlint/lint1/msg_259.c
cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/xlint/lint1/msg_259.exp
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_259_c90.c \
src/tests/usr.bin/xlint/lint1/msg_259_c90.exp \
src/tests/usr.bin/xlint/lint1/msg_259_ilp32.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_259_ilp32.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_259.c
diff -u src/tests/usr.bin/xlint/lint1/msg_259.c:1.15 src/tests/usr.bin/xlint/lint1/msg_259.c:1.16
--- src/tests/usr.bin/xlint/lint1/msg_259.c:1.15	Tue Aug 31 18:59:26 2021
+++ src/tests/usr.bin/xlint/lint1/msg_259.c	Tue Aug 31 19:26:23 2021
@@ -1,8 +1,13 @@
-/*	$NetBSD: msg_259.c,v 1.15 2021/08/31 18:59:26 rillig Exp $	*/
+/*	$NetBSD: msg_259.c,v 1.16 2021/08/31 19:26:23 rillig Exp $	*/
 # 3 "msg_259.c"
 
 // Test for message: argument #%d is converted from '%s' to '%s' due to prototype [259]
 
+/*
+ * See also msg_297, but that requires the flags -a -p -P, which are not
+ * enabled in the default NetBSD build.
+ */
+
 /* lint1-only-if: lp64 */
 /* lint1-extra-flags: -h */
 

Index: src/tests/usr.bin/xlint/lint1/msg_259.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_259.exp:1.12 src/tests/usr.bin/xlint/lint1/msg_259.exp:1.13
--- src/tests/usr.bin/xlint/lint1/msg_259.exp:1.12	Tue Aug 31 18:59:26 2021
+++ src/tests/usr.bin/xlint/lint1/msg_259.exp	Tue Aug 31 19:26:23 2021
@@ -1,24 +1,24 @@
-msg_259.c(32): warning: argument #1 is converted from 'long' to 'int' due to prototype [259]
-msg_259.c(52): warning: argument #1 is converted from 'int' to 'unsigned int' due to prototype [259]
-msg_259.c(55): warning: argument #1 is converted from 'long' to 'unsigned int' due to prototype [259]
-msg_259.c(58): warning: argument #1 is converted from 'long long' to 'unsigned int' due to prototype [259]
-msg_259.c(67): warning: argument #1 is converted from 'long' to 'unsigned long' due to prototype [259]
-msg_259.c(69): warning: argument #1 is converted from 'long long' to 'unsigned long' due to prototype [259]
-msg_259.c(78): warning: argument #1 is converted from 'long' to 'unsigned long long' due to prototype [259]
-msg_259.c(81): warning: argument #1 is converted from 'long long' to 'unsigned long long' due to prototype [259]
-msg_259.c(88): warning: argument #1 is converted from 'unsigned int' to 'int' due to prototype [259]
-msg_259.c(90): warning: argument #1 is converted from 'unsigned long' to 'int' due to prototype [259]
-msg_259.c(92): warning: argument #1 is converted from 'unsigned long long' to 'int' due to prototype [259]
-msg_259.c(95): warning: argument #1 is converted from 'unsigned long' to 'long' due to prototype [259]
-msg_259.c(97): warning: argument #1 is converted from 'unsigned long long' to 'long' due to prototype [259]
-msg_259.c(100): warning: argument #1 is converted from 'unsigned long' to 'long long' due to prototype [259]
-msg_259.c(102): warning: argument #1 is converted from 'unsigned long long' to 'long long' due to prototype [259]
-msg_259.c(110): warning: argument #1 is converted from 'long' to 'int' due to prototype [259]
-msg_259.c(112): warning: argument #1 is converted from 'long long' to 'int' due to prototype [259]
-msg_259.c(116): warning: argument #1 is converted from 'long long' to 'long' due to prototype [259]
-msg_259.c(119): warning: argument #1 is converted from 'long' to 'long long' due to prototype [259]
-msg_259.c(128): warning: argument #1 is converted from 'unsigned long' to 'unsigned int' due to prototype [259]
-msg_259.c(130): warning: argument #1 is converted from 'unsigned long long' to 'unsigned int' due to prototype [259]
-msg_259.c(134): warning: argument #1 is converted from 'unsigned long long' to 'unsigned long' due to prototype [259]
-msg_259.c(137): warning: argument #1 is converted from 'unsigned long' to 'unsigned long long' due to prototype [259]
-msg_259.c(151): warning: argument #1 is converted from 'unsigned long' to 'unsigned int' due to prototype [259]
+msg_259.c(37): warning: argument #1 is converted from 'long' to 'int' due to prototype [259]
+msg_259.c(57): warning: argument #1 is converted from 'int' to 'unsigned int' due to prototype [259]
+msg_259.c(60): warning: argument #1 is converted from 'long' to 'unsigned int' due to prototype [259]
+msg_259.c(63): warning: argument #1 is converted from 'long long' to 'unsigned int' due to prototype [259]

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

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 19:26:23 UTC 2021

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

Log Message:
tests/lint: add cross-references to message 297

The check for lossy integer conversions is already implemented, it's
just not activated in the default NetBSD build.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/usr.bin/xlint/lint1/msg_259.c
cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/xlint/lint1/msg_259.exp
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_259_c90.c \
src/tests/usr.bin/xlint/lint1/msg_259_c90.exp \
src/tests/usr.bin/xlint/lint1/msg_259_ilp32.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_259_ilp32.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-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 19:17:46 UTC 2021

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

Log Message:
lint: extract condition for message 259 into separate function

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.363 -r1.364 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.363 src/usr.bin/xlint/lint1/tree.c:1.364
--- src/usr.bin/xlint/lint1/tree.c:1.363	Sun Aug 29 17:01:27 2021
+++ src/usr.bin/xlint/lint1/tree.c	Tue Aug 31 19:17:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.363 2021/08/29 17:01:27 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.364 2021/08/31 19:17:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.363 2021/08/29 17:01:27 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.364 2021/08/31 19:17:45 rillig Exp $");
 #endif
 
 #include 
@@ -1975,19 +1975,29 @@ convert(op_t op, int arg, type_t *tp, tn
 
 /*
  * The types differ in sign or base type (char, short, int, long, long long,
- * float, double, long double).
+ * int128_t, float, double, long double).
  *
  * If they differ only in sign and the argument is representable in both
  * types, print no warning.
  */
-static void
-check_prototype_conversion_integer(const tnode_t *tn, const tnode_t *ptn,
-   const type_t *tp, tspec_t nt, tspec_t ot,
-   int arg)
+static bool
+should_warn_about_prototype_conversion(
+int arg,
+const type_t *tp, tspec_t nt,
+const tnode_t *tn, tspec_t ot,
+const tnode_t *ptn)
 {
 
+	if (is_floating(nt) != is_floating(ot) ||
+	portable_size_in_bits(nt) != portable_size_in_bits(ot)) {
+		/* representation and/or width change */
+		if (!is_integer(ot))
+			return true;
+		return portable_size_in_bits(ot) > portable_size_in_bits(INT);
+	}
+
 	if (!hflag)
-		return;
+		return false;
 
 	/*
 	 * If the types differ only in sign and the argument has the same
@@ -1996,11 +2006,9 @@ check_prototype_conversion_integer(const
 	if (ptn->tn_op == CON && is_integer(nt) &&
 	signed_type(nt) == signed_type(ot) &&
 	!msb(ptn->tn_val->v_quad, ot))
-		return;
+		return false;
 
-	/* argument #%d is converted from '%s' to '%s' ... */
-	warning(259,
-	arg, type_name(tn->tn_type), type_name(tp));
+	return true;
 }
 
 /*
@@ -2037,17 +2045,11 @@ check_prototype_conversion(int arg, tspe
 	if (nt == ot || (nt == ENUM && ot == INT))
 		return;
 
-	if (is_floating(nt) != is_floating(ot) ||
-	portable_size_in_bits(nt) != portable_size_in_bits(ot)) {
-		/* representation and/or width change */
-		if (!is_integer(ot) ||
-		portable_size_in_bits(ot) > portable_size_in_bits(INT)) {
-			/* argument #%d is converted from '%s' to '%s' ... */
-			warning(259,
-			arg, type_name(tn->tn_type), type_name(tp));
-		}
-	} else
-		check_prototype_conversion_integer(tn, ptn, tp, nt, ot, arg);
+	if (should_warn_about_prototype_conversion(
+	arg, tp, nt, tn, ot, ptn)) {
+		/* argument #%d is converted from '%s' to '%s' ... */
+		warning(259, arg, type_name(tn->tn_type), type_name(tp));
+	}
 }
 
 /*



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

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 19:17:46 UTC 2021

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

Log Message:
lint: extract condition for message 259 into separate function

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.363 -r1.364 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-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 18:59:26 UTC 2021

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

Log Message:
tests/lint: add test for prototype conversions in C90

The purpose of warning 259 is to find function calls that differ in the
ABI.  The warning's original purpose was not to warn about lossy
conversions, that's just a side effect.

Warning 259 had been implemented before C99 was published, which is more
than 20 years ago.  In the meantime, almost all code has migrated to
using function prototypes.  With the default lint flags from NetBSD's
, it would rather make sense to focus on lossy conversions now.

To prepare for potentially upcoming differences in lint's C90 and C99
modes, clone the test now as far as possible.  The test for C90 mode is
smaller than for C99 mode, since 'long long' was not available back
then.


To generate a diff of this commit:
cvs rdiff -u -r1.1120 -r1.1121 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.107 -r1.108 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/msg_259.c
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/msg_259.exp
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/msg_259_c90.c \
src/tests/usr.bin/xlint/lint1/msg_259_c90.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.1120 src/distrib/sets/lists/tests/mi:1.1121
--- src/distrib/sets/lists/tests/mi:1.1120	Mon Aug 30 17:08:13 2021
+++ src/distrib/sets/lists/tests/mi	Tue Aug 31 18:59:26 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1120 2021/08/30 17:08:13 rillig Exp $
+# $NetBSD: mi,v 1.1121 2021/08/31 18:59:26 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6844,6 +6844,8 @@
 ./usr/tests/usr.bin/xlint/lint1/msg_258.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_259.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_259.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_259_c90.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_259_c90.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_259_ilp32.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_259_ilp32.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_260.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.107 src/tests/usr.bin/xlint/lint1/Makefile:1.108
--- src/tests/usr.bin/xlint/lint1/Makefile:1.107	Wed Aug 25 22:04:52 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Tue Aug 31 18:59:26 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.107 2021/08/25 22:04:52 rillig Exp $
+# $NetBSD: Makefile,v 1.108 2021/08/31 18:59:26 rillig Exp $
 
 NOMAN=		# defined
 MAX_MESSAGE=	346		# see lint1/err.c
@@ -16,6 +16,8 @@ archsubdir.sh:
 	@echo archsubdir=${ARCHSUBDIR} >${.TARGET}
 
 FILESDIR=	${TESTSDIR}
+FILES+=		msg_259_c90.c
+FILES+=		msg_259_c90.exp
 FILES+=		c11_generic_expression.c
 FILES+=		c11_generic_expression.exp
 FILES+=		c90.c

Index: src/tests/usr.bin/xlint/lint1/msg_259.c
diff -u src/tests/usr.bin/xlint/lint1/msg_259.c:1.14 src/tests/usr.bin/xlint/lint1/msg_259.c:1.15
--- src/tests/usr.bin/xlint/lint1/msg_259.c:1.14	Tue Aug 31 18:15:56 2021
+++ src/tests/usr.bin/xlint/lint1/msg_259.c	Tue Aug 31 18:59:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_259.c,v 1.14 2021/08/31 18:15:56 rillig Exp $	*/
+/*	$NetBSD: msg_259.c,v 1.15 2021/08/31 18:59:26 rillig Exp $	*/
 # 3 "msg_259.c"
 
 // Test for message: argument #%d is converted from '%s' to '%s' due to prototype [259]
@@ -65,8 +65,8 @@ signed_to_unsigned(int si, long sl, long
 
 	/* expect+1: warning: argument #1 is converted from 'long' to 'unsigned long' due to prototype [259] */
 	unsigned_long(sl);
-
-	unsigned_long(si);
+	/* expect+1: warning: argument #1 is converted from 'long long' to 'unsigned long' due to prototype [259] */
+	unsigned_long(sll);
 
 	/*
 	 * XXX: Why no warning?  Even though 'unsigned long long' is 64 bits
@@ -93,7 +93,8 @@ unsigned_to_signed(unsigned int ui, unsi
 	signed_long(ui);
 	/* expect+1: warning: argument #1 is converted from 'unsigned long' to 'long' due to prototype [259] */
 	signed_long(ul);
-	signed_long(ui);
+	/* expect+1: warning: argument #1 is converted from 'unsigned long long' to 'long' due to prototype [259] */
+	signed_long(ull);
 	signed_long_long(ui);
 	/* expect+1: warning: argument #1 is converted from 'unsigned long' to 'long long' due to prototype [259] */
 	signed_long_long(ul);
@@ -111,7 +112,8 

CVS commit: src

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 18:59:26 UTC 2021

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

Log Message:
tests/lint: add test for prototype conversions in C90

The purpose of warning 259 is to find function calls that differ in the
ABI.  The warning's original purpose was not to warn about lossy
conversions, that's just a side effect.

Warning 259 had been implemented before C99 was published, which is more
than 20 years ago.  In the meantime, almost all code has migrated to
using function prototypes.  With the default lint flags from NetBSD's
, it would rather make sense to focus on lossy conversions now.

To prepare for potentially upcoming differences in lint's C90 and C99
modes, clone the test now as far as possible.  The test for C90 mode is
smaller than for C99 mode, since 'long long' was not available back
then.


To generate a diff of this commit:
cvs rdiff -u -r1.1120 -r1.1121 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.107 -r1.108 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/msg_259.c
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/msg_259.exp
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/msg_259_c90.c \
src/tests/usr.bin/xlint/lint1/msg_259_c90.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-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 18:15:56 UTC 2021

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

Log Message:
tests/lint: add missing test cases for integer conversions

While adding the missing test cases, I re-read the comments and
discarded several of them, since converting a signed value to an
unsigned type can be lossy as well, which warrants a warning.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/msg_259.c
cvs rdiff -u -r1.10 -r1.11 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.13 src/tests/usr.bin/xlint/lint1/msg_259.c:1.14
--- src/tests/usr.bin/xlint/lint1/msg_259.c:1.13	Mon Aug 30 18:33:37 2021
+++ src/tests/usr.bin/xlint/lint1/msg_259.c	Tue Aug 31 18:15:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_259.c,v 1.13 2021/08/30 18:33:37 rillig Exp $	*/
+/*	$NetBSD: msg_259.c,v 1.14 2021/08/31 18:15:56 rillig Exp $	*/
 # 3 "msg_259.c"
 
 // Test for message: argument #%d is converted from '%s' to '%s' due to prototype [259]
@@ -6,67 +6,133 @@
 /* lint1-only-if: lp64 */
 /* lint1-extra-flags: -h */
 
-void farg_char(char);
-void farg_int(int);
-void farg_long(long);
+void plain_char(char);
+void signed_int(int);
+void unsigned_int(unsigned int);
+void signed_long(long);
+void unsigned_long(unsigned long);
+void signed_long_long(long long);
+void unsigned_long_long(unsigned long long);
 
 void
-example(char c, int i, long l)
+change_in_type_width(char c, int i, long l)
 {
-	farg_char(c);
-	farg_int(c);
+	plain_char(c);
+	signed_int(c);
 	/* No warning 259 on LP64, only on ILP32 */
-	farg_long(c);
+	signed_long(c);
 
-	farg_char(i);		/* XXX: why no warning? */
-	farg_int(i);
+	plain_char(i);		/* XXX: why no warning? */
+	signed_int(i);
 	/* No warning 259 on LP64, only on ILP32 */
-	farg_long(i);
+	signed_long(i);
 
-	farg_char(l);		/* XXX: why no warning? */
+	plain_char(l);		/* XXX: why no warning? */
 	/* expect+1: from 'long' to 'int' due to prototype [259] */
-	farg_int(l);
-	farg_long(l);
+	signed_int(l);
+	signed_long(l);
 }
 
-void farg_unsigned_int(unsigned int);
-void farg_unsigned_long(unsigned long);
-void farg_unsigned_long_long(unsigned long long);
-
 /*
  * Converting a signed integer type to its corresponding unsigned integer
- * type (C99 6.2.5p6) is usually not a problem.  A common case where it
- * occurs is when the difference of two pointers is converted to size_t.
+ * type (C99 6.2.5p6) is usually not a problem since the actual values of the
+ * expressions are usually not anywhere near the maximum signed value.  From
+ * a technical standpoint, it is correct to warn here since even small
+ * negative numbers may result in very large positive numbers.
+ *
+ * A common case where it occurs is when the difference of two pointers is
+ * converted to size_t.  The type ptrdiff_t is defined to be signed, but in
+ * many practical cases, the expression is '(end - start)', which makes the
+ * resulting value necessarily positive.
  */
 void
-convert_to_corresponding_unsigned(int i, long l, long long ll)
+signed_to_unsigned(int si, long sl, long long sll)
 {
-	/* TODO: don't warn here. */
 	/* expect+1: warning: argument #1 is converted from 'int' to 'unsigned int' due to prototype [259] */
-	farg_unsigned_int(i);
+	unsigned_int(si);
 
-	/* TODO: don't warn here. */
-	/* expect+1: warning: argument #1 is converted from 'long' to 'unsigned long' due to prototype [259] */
-	farg_unsigned_long(l);
+	/* expect+1: warning: argument #1 is converted from 'long' to 'unsigned int' due to prototype [259] */
+	unsigned_int(sl);
 
-	/* TODO: don't warn here. */
-	/* expect+1: warning: argument #1 is converted from 'long long' to 'unsigned long long' due to prototype [259] */
-	farg_unsigned_long_long(ll);
+	/* expect+1: warning: argument #1 is converted from 'long long' to 'unsigned int' due to prototype [259] */
+	unsigned_int(sll);
 
 	/*
 	 * XXX: Why no warning?  Even though 'unsigned long' is 64 bits
 	 * wide, it cannot represent negative 32-bit values.
 	 */
-	farg_unsigned_long(i);
+	unsigned_long(si);
+
+	/* expect+1: warning: argument #1 is converted from 'long' to 'unsigned long' due to prototype [259] */
+	unsigned_long(sl);
+
+	unsigned_long(si);
 
 	/*
 	 * XXX: Why no warning?  Even though 'unsigned long long' is 64 bits
 	 * wide, it cannot represent negative 32-bit values.
 	 */
-	farg_unsigned_long_long(i);
+	unsigned_long_long(si);
 
 	/* expect+1: warning: argument #1 is converted from 'long' to 'unsigned long long' due to prototype [259] */
-	farg_unsigned_long_long(l);
+	unsigned_long_long(sl);
+
+	/* expect+1: warning: argument #1 is converted from 'long long' to 'unsigned long long' due to prototype [259] */
+	unsigned_long_long(sll);
+}
+
+void
+unsi

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

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 18:15:56 UTC 2021

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

Log Message:
tests/lint: add missing test cases for integer conversions

While adding the missing test cases, I re-read the comments and
discarded several of them, since converting a signed value to an
unsigned type can be lossy as well, which warrants a warning.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/msg_259.c
cvs rdiff -u -r1.10 -r1.11 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/usr.bin/xlint/lint1

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 17:51:30 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: err.c externs1.h lint1.h

Log Message:
lint: remove unused function for generic messages

The function message_at is still used, for information about previous
occurrences of a symbol.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.137 -r1.138 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.127 -r1.128 src/usr.bin/xlint/lint1/lint1.h

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-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 17:51:30 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: err.c externs1.h lint1.h

Log Message:
lint: remove unused function for generic messages

The function message_at is still used, for information about previous
occurrences of a symbol.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.137 -r1.138 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.127 -r1.128 src/usr.bin/xlint/lint1/lint1.h

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

Modified files:

Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.141 src/usr.bin/xlint/lint1/err.c:1.142
--- src/usr.bin/xlint/lint1/err.c:1.141	Fri Aug 27 20:19:45 2021
+++ src/usr.bin/xlint/lint1/err.c	Tue Aug 31 17:51:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.c,v 1.141 2021/08/27 20:19:45 rillig Exp $	*/
+/*	$NetBSD: err.c,v 1.142 2021/08/31 17:51:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.141 2021/08/27 20:19:45 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.142 2021/08/31 17:51:30 rillig Exp $");
 #endif
 
 #include 
@@ -623,16 +623,6 @@ void
 	va_end(ap);
 }
 
-void
-(message)(int msgid, ...)
-{
-	va_list	ap;
-
-	va_start(ap, msgid);
-	vmessage_at(msgid, &curr_pos, ap);
-	va_end(ap);
-}
-
 /*
  * XXX I think the logic is possibly somewhat screwed up here. The
  * question is, how do we want to interpret the -s and -S flags going

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.137 src/usr.bin/xlint/lint1/externs1.h:1.138
--- src/usr.bin/xlint/lint1/externs1.h:1.137	Sun Aug 29 15:49:04 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Tue Aug 31 17:51:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.137 2021/08/29 15:49:04 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.138 2021/08/31 17:51:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -152,7 +152,6 @@ extern	void	warning_at(int, const pos_t 
 extern	void	message_at(int, const pos_t *, ...);
 extern	void	error(int, ...);
 extern	void	warning(int, ...);
-extern	void	message(int, ...);
 extern	void	gnuism(int, ...);
 extern	void	c99ism(int, ...);
 extern	void	c11ism(int, ...);

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.127 src/usr.bin/xlint/lint1/lint1.h:1.128
--- src/usr.bin/xlint/lint1/lint1.h:1.127	Sat Aug 28 12:41:03 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Tue Aug 31 17:51:30 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.127 2021/08/28 12:41:03 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.128 2021/08/31 17:51:30 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -518,7 +518,6 @@ check_printf(const char *fmt, ...)
 
 #  define error(msgid, args...) wrap_check_printf(error, msgid, ##args)
 #  define warning(msgid, args...) wrap_check_printf(warning, msgid, ##args)
-#  define message(msgid, args...) wrap_check_printf(message, msgid, ##args)
 #  define gnuism(msgid, args...) wrap_check_printf(gnuism, msgid, ##args)
 #  define c99ism(msgid, args...) wrap_check_printf(c99ism, msgid, ##args)
 #  define c11ism(msgid, args...) wrap_check_printf(c11ism, msgid, ##args)



CVS commit: src/usr.bin/xlint

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 17:22:25 UTC 2021

Modified Files:
src/usr.bin/xlint/common: externs.h mem.c
src/usr.bin/xlint/lint1: mem1.c
src/usr.bin/xlint/lint2: mem2.c

Log Message:
lint: fix memory allocation (since 2021-08-28)

In mem1.c 1.50 and mem2.c 1.13 from 2021-08-28, I accidentally changed
the initialization of mblklen from round_up to round_down, trying to
avoid a division instruction.

On NetBSD x86_64 this resulted in a few more malloc calls, but on Cygwin
with its 64k pagesize, mblklen became 0.  Later, the function xalloc in
lint2 called xalloc(mblklen) and blindly assumed that the returned
memory would be large enough.  This in turn led to out-of-bounds memory
access and crashes.  Lint1 was not affected since it adjust mblklen
during runtime if it gets too small.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/common/mem.c
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/lint2/mem2.c

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

Modified files:

Index: src/usr.bin/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.20 src/usr.bin/xlint/common/externs.h:1.21
--- src/usr.bin/xlint/common/externs.h:1.20	Sun Aug 22 15:06:49 2021
+++ src/usr.bin/xlint/common/externs.h	Tue Aug 31 17:22:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.20 2021/08/22 15:06:49 rillig Exp $	*/
+/*	$NetBSD: externs.h,v 1.21 2021/08/31 17:22:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -45,6 +45,7 @@ extern	const	char *tspec_name(tspec_t);
 /*
  * mem.c
  */
+extern	size_t	mem_block_size(void);
 extern	void	*xmalloc(size_t);
 extern	void	*xcalloc(size_t, size_t);
 extern	void	*xrealloc(void *, size_t);

Index: src/usr.bin/xlint/common/mem.c
diff -u src/usr.bin/xlint/common/mem.c:1.18 src/usr.bin/xlint/common/mem.c:1.19
--- src/usr.bin/xlint/common/mem.c:1.18	Sat Aug 28 13:29:26 2021
+++ src/usr.bin/xlint/common/mem.c	Tue Aug 31 17:22:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.18 2021/08/28 13:29:26 rillig Exp $	*/
+/*	$NetBSD: mem.c,v 1.19 2021/08/31 17:22:24 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,15 +37,27 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem.c,v 1.18 2021/08/28 13:29:26 rillig Exp $");
+__RCSID("$NetBSD: mem.c,v 1.19 2021/08/31 17:22:24 rillig Exp $");
 #endif
 
 #include 
 #include 
 #include 
+#include 
 
 #include "lint.h"
 
+#if defined(IS_LINT1) || defined(IS_LINT2)
+size_t
+mem_block_size(void)
+{
+	unsigned int pagesize;
+
+	pagesize = (unsigned int)getpagesize();
+	return (MBLKSIZ + pagesize - 1) / pagesize * pagesize;
+}
+#endif
+
 static void *
 not_null(void *ptr)
 {

Index: src/usr.bin/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.51 src/usr.bin/xlint/lint1/mem1.c:1.52
--- src/usr.bin/xlint/lint1/mem1.c:1.51	Sat Aug 28 13:29:26 2021
+++ src/usr.bin/xlint/lint1/mem1.c	Tue Aug 31 17:22:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.51 2021/08/28 13:29:26 rillig Exp $	*/
+/*	$NetBSD: mem1.c,v 1.52 2021/08/31 17:22:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,14 +37,12 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.51 2021/08/28 13:29:26 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.52 2021/08/31 17:22:25 rillig Exp $");
 #endif
 
-#include 
 #include 
 #include 
 #include 
-#include 
 
 #include "lint1.h"
 
@@ -286,7 +284,7 @@ void
 initmem(void)
 {
 
-	mblklen = MBLKSIZ - MBLKSIZ % (unsigned int)getpagesize();
+	mblklen = mem_block_size();
 	mblks = xcalloc(nmblks = ML_INC, sizeof(*mblks));
 }
 

Index: src/usr.bin/xlint/lint2/mem2.c
diff -u src/usr.bin/xlint/lint2/mem2.c:1.13 src/usr.bin/xlint/lint2/mem2.c:1.14
--- src/usr.bin/xlint/lint2/mem2.c:1.13	Sat Aug 28 12:59:25 2021
+++ src/usr.bin/xlint/lint2/mem2.c	Tue Aug 31 17:22:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem2.c,v 1.13 2021/08/28 12:59:25 rillig Exp $	*/
+/*	$NetBSD: mem2.c,v 1.14 2021/08/31 17:22:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,13 +37,11 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem2.c,v 1.13 2021/08/28 12:59:25 rillig Exp $");
+__RCSID("$NetBSD: mem2.c,v 1.14 2021/08/31 17:22:25 rillig Exp $");
 #endif
 
 #include 
-#include 
 #include 
-#include 
 
 #include "lint2.h"
 
@@ -60,7 +58,7 @@ void
 initmem(void)
 {
 
-	mblklen = MBLKSIZ - MBLKSIZ % (unsigned int)getpagesize();
+	mblklen = mem_block_size();
 	nxtfree = mblklen;
 }
 



CVS commit: src/usr.bin/xlint

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 17:22:25 UTC 2021

Modified Files:
src/usr.bin/xlint/common: externs.h mem.c
src/usr.bin/xlint/lint1: mem1.c
src/usr.bin/xlint/lint2: mem2.c

Log Message:
lint: fix memory allocation (since 2021-08-28)

In mem1.c 1.50 and mem2.c 1.13 from 2021-08-28, I accidentally changed
the initialization of mblklen from round_up to round_down, trying to
avoid a division instruction.

On NetBSD x86_64 this resulted in a few more malloc calls, but on Cygwin
with its 64k pagesize, mblklen became 0.  Later, the function xalloc in
lint2 called xalloc(mblklen) and blindly assumed that the returned
memory would be large enough.  This in turn led to out-of-bounds memory
access and crashes.  Lint1 was not affected since it adjust mblklen
during runtime if it gets too small.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/common/mem.c
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/lint2/mem2.c

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



Re: CVS commit: src/usr.sbin/inetd

2021-08-31 Thread Tobias Nygren
On Mon, 30 Aug 2021 18:21:11 +
Roland Illig  wrote:

> Module Name:  src
> Committed By: rillig
> Date: Mon Aug 30 18:21:11 UTC 2021
> 
> Modified Files:
>   src/usr.sbin/inetd: Makefile inetd.c parse_v2.c
> 
> Log Message:
> inetd: raise WARNS from 5 to 6

clang complains:

/work/src/usr.sbin/inetd/inetd.c:763:18: error: implicit conversion changes 
signedness: 'service_type' (aka 'enum service_type') to 'int' 
[-Werror,-Wsign-conversion]
SWAP(int, cp->se_type, sep->se_type);
~~^~

Works for me:

--- inetd.c 30 Aug 2021 18:21:11 -  1.131
+++ inetd.c 31 Aug 2021 16:26:45 -
@@ -760,7 +760,7 @@ config(void)
 #ifdef IPSEC
SWAP(char *, sep->se_policy, cp->se_policy);
 #endif
-   SWAP(int, cp->se_type, sep->se_type);
+   SWAP(enum service_type, cp->se_type, sep->se_type);
SWAP(size_t, cp->se_service_max, sep->se_service_max);
SWAP(size_t, cp->se_ip_max, sep->se_ip_max);


CVS commit: src/usr.sbin/inetd

2021-08-31 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Aug 31 11:16:00 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
Use Dq.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/usr.sbin/inetd/inetd.8

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

Modified files:

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.63 src/usr.sbin/inetd/inetd.8:1.64
--- src/usr.sbin/inetd/inetd.8:1.63	Mon Aug 30 16:10:34 2021
+++ src/usr.sbin/inetd/inetd.8	Tue Aug 31 11:16:00 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.63 2021/08/30 16:10:34 wiz Exp $
+.\"	$NetBSD: inetd.8,v 1.64 2021/08/31 11:16:00 wiz Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -545,8 +545,9 @@ By convention, the first argument should
 .It Sy ipsec
 An IPsec policy string.
 Defaults to the global default setting.
-If specified without a value (i.e. "ipsec=,"), IPsec will be disabled
-for this service.
+If specified without a value (i.e.,
+.Dq ipsec=, ) ,
+IPsec will be disabled for this service.
 See the
 .Sx Directives
 section for details.



CVS commit: src/usr.sbin/inetd

2021-08-31 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Aug 31 11:16:00 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
Use Dq.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/usr.sbin/inetd/inetd.8

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



Re: CVS commit: src/sys/arch/evbarm/conf

2021-08-31 Thread Rin Okuyama

Hi,

On 2021/08/30 18:20, matthew green wrote:

hi.


nice work on BE marvell :)


Thanks!


"Rin Okuyama" writes:

Module Name:src
Committed By:   rin
Date:   Mon Aug 30 00:12:15 UTC 2021

Modified Files:
src/sys/arch/evbarm/conf: MARVELL_NAS

Log Message:
Enable FFS_EI and DISKLABEL_EI as this SoC supports both endians now.


personally, i think we should do these everywhere that isn't
size constrained.  they're useful for accessing other platform
disks quite often on all netbsd systems.


Yeah, I agree. Probably, we can have these options in
sys/conf/filesystems.config. Most powerful platforms have
already used that file:


$ cd /usr/src/sys/arch && grep filesystems.conf */conf/*
amd64/conf/GENERIC:include "conf/filesystems.config"
amd64/conf/XEN3_DOM0:include "conf/filesystems.config"
amd64/conf/XEN3_DOMU:include "conf/filesystems.config"
evbarm/conf/GENERIC.common:include "conf/filesystems.config"
i386/conf/GENERIC:include "conf/filesystems.config"
macppc/conf/GENERIC:include "conf/filesystems.config"
riscv/conf/GENERIC:include  "conf/filesystems.config"
sgimips/conf/GENERIC32_IP2x:include "conf/filesystems.config"
sgimips/conf/GENERIC32_IP3x:include "conf/filesystems.config"
sgimips/conf/GENERIC32_IP12:include "conf/filesystems.config"
sparc64/conf/GENERIC:include "conf/filesystems.config"


And we can switch other machines to use it.

Thanks,
rin


CVS commit: src/sys/dev/usb

2021-08-31 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug 31 08:22:28 UTC 2021

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

Log Message:
add missing newline and fix conditional for askroot/single user
hand over delay message.  PR#56366.


To generate a diff of this commit:
cvs rdiff -u -r1.285 -r1.286 src/sys/dev/usb/ehci.c

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

Modified files:

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.285 src/sys/dev/usb/ehci.c:1.286
--- src/sys/dev/usb/ehci.c:1.285	Tue Jan  5 18:00:21 2021
+++ src/sys/dev/usb/ehci.c	Tue Aug 31 08:22:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.285 2021/01/05 18:00:21 skrll Exp $ */
+/*	$NetBSD: ehci.c,v 1.286 2021/08/31 08:22:28 mrg Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.285 2021/01/05 18:00:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.286 2021/08/31 08:22:28 mrg Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -2655,8 +2655,8 @@ ehci_disown_sched_callback(ehci_softc_t 
 	mutex_exit(&sc->sc_complock);
 
 	config_pending_incr(sc->sc_dev);
-	aprint_normal("delaying %s by %u seconds due to USB owner change.",
-	(boothowto & RB_ASKNAME) == 0 ? "ask root" : "single user",
+	aprint_normal("delaying %s by %u seconds due to USB owner change.\n",
+	(boothowto & RB_ASKNAME) != 0 ? "ask root" : "single user",
 	ehci_disown_delay_seconds);
 }
 



CVS commit: src/sys/dev/usb

2021-08-31 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug 31 08:22:28 UTC 2021

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

Log Message:
add missing newline and fix conditional for askroot/single user
hand over delay message.  PR#56366.


To generate a diff of this commit:
cvs rdiff -u -r1.285 -r1.286 src/sys/dev/usb/ehci.c

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