CVS commit: src/usr.bin/xlint

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 21:52:15 UTC 2021

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

Log Message:
lint: clean up hash functions

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint2/hash.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.77 src/usr.bin/xlint/lint1/lex.c:1.78
--- src/usr.bin/xlint/lint1/lex.c:1.77	Sat Aug 28 21:14:32 2021
+++ src/usr.bin/xlint/lint1/lex.c	Sat Aug 28 21:52:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.77 2021/08/28 21:14:32 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.78 2021/08/28 21:52:14 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.77 2021/08/28 21:14:32 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.78 2021/08/28 21:52:14 rillig Exp $");
 #endif
 
 #include 
@@ -397,11 +397,11 @@ static unsigned int
 hash(const char *s)
 {
 	unsigned int v;
-	const unsigned char *us;
+	const char *p;
 
 	v = 0;
-	for (us = (const unsigned char *)s; *us != '\0'; us++) {
-		v = (v << 4) + *us;
+	for (p = s; *p != '\0'; p++) {
+		v = (v << 4) + (unsigned char)*p;
 		v ^= v >> 28;
 	}
 	return v % HSHSIZ1;

Index: src/usr.bin/xlint/lint2/hash.c
diff -u src/usr.bin/xlint/lint2/hash.c:1.21 src/usr.bin/xlint/lint2/hash.c:1.22
--- src/usr.bin/xlint/lint2/hash.c:1.21	Sat Aug 28 19:27:44 2021
+++ src/usr.bin/xlint/lint2/hash.c	Sat Aug 28 21:52:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.c,v 1.21 2021/08/28 19:27:44 rillig Exp $	*/
+/*	$NetBSD: hash.c,v 1.22 2021/08/28 21:52:14 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: hash.c,v 1.21 2021/08/28 19:27:44 rillig Exp $");
+__RCSID("$NetBSD: hash.c,v 1.22 2021/08/28 21:52:14 rillig Exp $");
 #endif
 
 /*
@@ -54,8 +54,6 @@ __RCSID("$NetBSD: hash.c,v 1.21 2021/08/
 /* pointer to hash table, initialized in inithash() */
 static	hte_t	**htab;
 
-static	unsigned int hash(const char *);
-
 /*
  * Initialize hash table.
  */
@@ -76,11 +74,11 @@ static unsigned int
 hash(const char *s)
 {
 	unsigned int v;
-	const unsigned char *us;
+	const char *p;
 
 	v = 0;
-	for (us = (const unsigned char *)s; *us != '\0'; us++) {
-		v = (v << 4) + *us;
+	for (p = s; *p != '\0'; p++) {
+		v = (v << 4) + (unsigned char)*p;
 		v ^= v >> 28;
 	}
 	return v % HSHSIZ2;



CVS commit: src/usr.bin/xlint

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 21:52:15 UTC 2021

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

Log Message:
lint: clean up hash functions

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint2/hash.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-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 21:14:32 UTC 2021

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

Log Message:
lint: remove unreachable code for parsing integer constants

The largest possible type of an integer constant is 'unsigned long
long'.  Any larger type can only be expressed using casts.

See also https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.76 src/usr.bin/xlint/lint1/lex.c:1.77
--- src/usr.bin/xlint/lint1/lex.c:1.76	Sat Aug 28 19:27:44 2021
+++ src/usr.bin/xlint/lint1/lex.c	Sat Aug 28 21:14:32 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.76 2021/08/28 19:27:44 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.77 2021/08/28 21:14:32 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.76 2021/08/28 19:27:44 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.77 2021/08/28 21:14:32 rillig Exp $");
 #endif
 
 #include 
@@ -510,22 +510,13 @@ lex_integer_constant(const char *yytext,
 	tspec_t	typ;
 	bool	ansiu;
 	bool	warned = false;
-#ifdef TARG_INT128_MAX
-	__uint128_t uq = 0;
-	/* FIXME: INT128 doesn't belong here. */
-	/* TODO: const */
-	/* TODO: remove #ifdef */
-	static	tspec_t contypes[2][4] = {
-		{ INT,  LONG,  QUAD, INT128, },
-		{ UINT, ULONG, UQUAD, UINT128, }
-	};
-#else
 	uint64_t uq = 0;
-	static	tspec_t contypes[2][3] = {
+
+	/* C11 6.4.4.1p5 */
+	static const tspec_t suffix_type[2][3] = {
 		{ INT,  LONG,  QUAD, },
 		{ UINT, ULONG, UQUAD, }
 	};
-#endif
 
 	cp = yytext;
 	len = yyleng;
@@ -560,7 +551,7 @@ lex_integer_constant(const char *yytext,
 		/* suffix U is illegal in traditional C */
 		warning(97);
 	}
-	typ = contypes[u_suffix][l_suffix];
+	typ = suffix_type[u_suffix][l_suffix];
 
 	errno = 0;
 
@@ -643,25 +634,6 @@ lex_integer_constant(const char *yytext,
 			warning(252);
 		}
 		break;
-#ifdef INT128_SIZE
-	case INT128:
-#ifdef TARG_INT128_MAX
-		if (uq > TARG_INT128_MAX && !tflag) {
-			typ = UINT128;
-			if (!sflag)
-ansiu = true;
-		}
-#endif
-		break;
-	case UINT128:
-#ifdef TARG_INT128_MAX
-		if (uq > TARG_UINT128_MAX && !warned) {
-			/* integer constant out of range */
-			warning(252);
-		}
-#endif
-		break;
-#endif
 	default:
 		break;
 	}



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 21:14:32 UTC 2021

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

Log Message:
lint: remove unreachable code for parsing integer constants

The largest possible type of an integer constant is 'unsigned long
long'.  Any larger type can only be expressed using casts.

See also https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html.


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

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



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 21:01:34 UTC 2021

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

Log Message:
tests/lint: test parsing of octal integer constants


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/lex_integer.c
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/lex_integer.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/lex_integer.c
diff -u src/tests/usr.bin/xlint/lint1/lex_integer.c:1.8 src/tests/usr.bin/xlint/lint1/lex_integer.c:1.9
--- src/tests/usr.bin/xlint/lint1/lex_integer.c:1.8	Sat Aug 28 20:51:10 2021
+++ src/tests/usr.bin/xlint/lint1/lex_integer.c	Sat Aug 28 21:01:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex_integer.c,v 1.8 2021/08/28 20:51:10 rillig Exp $	*/
+/*	$NetBSD: lex_integer.c,v 1.9 2021/08/28 21:01:34 rillig Exp $	*/
 # 3 "lex_integer.c"
 
 /*
@@ -26,17 +26,22 @@ no_suffix(void)
 {
 	/* expect+1: passing 'int' */
 	print_type(0);
-	/* The '-' is not part of the constant, it's a unary operator. */
+	/* The '-' is not part of the constant, it is a unary operator. */
 	/* expect+1: passing 'int' */
 	print_type(-1);
+
 	/* expect+1: passing 'int' */
 	print_type(2147483647);
 	/* expect+1: passing 'int' */
 	print_type(0x7fff);
+	/* expect+1: passing 'int' */
+	print_type(0177);
 
 	/* expect+1: passing 'unsigned int' */
 	print_type(0x8000);
 	/* expect+1: passing 'unsigned int' */
+	print_type(0200);
+	/* expect+1: passing 'unsigned int' */
 	print_type(0x);
 
 	/* expect+1: passing 'long' */

Index: src/tests/usr.bin/xlint/lint1/lex_integer.exp
diff -u src/tests/usr.bin/xlint/lint1/lex_integer.exp:1.3 src/tests/usr.bin/xlint/lint1/lex_integer.exp:1.4
--- src/tests/usr.bin/xlint/lint1/lex_integer.exp:1.3	Sat Aug 28 20:51:10 2021
+++ src/tests/usr.bin/xlint/lint1/lex_integer.exp	Sat Aug 28 21:01:34 2021
@@ -1,34 +1,36 @@
 lex_integer.c(28): warning: passing 'int' to incompatible 'struct s', arg #1 [155]
 lex_integer.c(31): warning: passing 'int' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(33): warning: passing 'int' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(35): warning: passing 'int' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(38): warning: passing 'unsigned int' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(40): warning: passing 'unsigned int' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(43): warning: passing 'long' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(45): warning: passing 'long' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(47): warning: passing 'long' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(50): warning: passing 'unsigned long' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(52): warning: passing 'unsigned long' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(56): warning: integer constant out of range [252]
-lex_integer.c(56): warning: passing 'unsigned long' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(63): warning: passing 'unsigned int' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(65): warning: passing 'unsigned int' to incompatible 'struct s', arg #1 [155]
+lex_integer.c(34): warning: passing 'int' to incompatible 'struct s', arg #1 [155]
+lex_integer.c(36): warning: passing 'int' to incompatible 'struct s', arg #1 [155]
+lex_integer.c(38): warning: passing 'int' to incompatible 'struct s', arg #1 [155]
+lex_integer.c(41): warning: passing 'unsigned int' to incompatible 'struct s', arg #1 [155]
+lex_integer.c(43): warning: passing 'unsigned int' to incompatible 'struct s', arg #1 [155]
+lex_integer.c(45): warning: passing 'unsigned int' to incompatible 'struct s', arg #1 [155]
+lex_integer.c(48): warning: passing 'long' to incompatible 'struct s', arg #1 [155]
+lex_integer.c(50): warning: passing 'long' to incompatible 'struct s', arg #1 [155]
+lex_integer.c(52): warning: passing 'long' to incompatible 'struct s', arg #1 [155]
+lex_integer.c(55): warning: passing 'unsigned long' to incompatible 'struct s', arg #1 [155]
+lex_integer.c(57): warning: passing 'unsigned long' to incompatible 'struct s', arg #1 [155]
+lex_integer.c(61): warning: integer constant out of range [252]
+lex_integer.c(61): warning: passing 'unsigned long' to incompatible 'struct s', arg #1 [155]
 lex_integer.c(68): warning: passing 'unsigned int' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(70): warning: passing 'unsigned long' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(77): warning: passing 'long' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(80): warning: passing 'long' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(87): warning: passing 'unsigned long' to incompatible 'struct s', arg #1 [155]
-lex_integer.c(89): warning: passing 'unsigne

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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 21:01:34 UTC 2021

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

Log Message:
tests/lint: test parsing of octal integer constants


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/lex_integer.c
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/lex_integer.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-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 20:51:10 UTC 2021

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

Log Message:
tests/lint: test parsing of integer constants

The previous version of this test did not focus on the integer constants
but instead on conversions of function arguments.  The current test
covers several corner cases, such as non-decimal bases and all
combinations of suffixes.

This test does not cover lex_integer_constant completely since several
code paths are only reachable on 32-bit target platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/lex_integer.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/lex_integer.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/lex_integer.c
diff -u src/tests/usr.bin/xlint/lint1/lex_integer.c:1.7 src/tests/usr.bin/xlint/lint1/lex_integer.c:1.8
--- src/tests/usr.bin/xlint/lint1/lex_integer.c:1.7	Sat Aug 21 11:50:57 2021
+++ src/tests/usr.bin/xlint/lint1/lex_integer.c	Sat Aug 28 20:51:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex_integer.c,v 1.7 2021/08/21 11:50:57 rillig Exp $	*/
+/*	$NetBSD: lex_integer.c,v 1.8 2021/08/28 20:51:10 rillig Exp $	*/
 # 3 "lex_integer.c"
 
 /*
@@ -9,60 +9,137 @@
 
 /* lint1-only-if: lp64 */
 
-void sinki(int);
-void sinku(unsigned int);
+long signed_long;
+unsigned long long unsigned_long_long_var;
+
+struct s {
+	int member;
+};
+/*
+ * When lint tries to convert the argument to 'struct s', it prints the
+ * actual type of the argument as a side effect.
+ */
+void print_type(struct s);
 
-/* All platforms supported by lint have 32-bit int in two's complement. */
 void
-test_signed_int(void)
+no_suffix(void)
 {
-	sinki(0);
-
-	sinki(-1);
+	/* expect+1: passing 'int' */
+	print_type(0);
+	/* The '-' is not part of the constant, it's a unary operator. */
+	/* expect+1: passing 'int' */
+	print_type(-1);
+	/* expect+1: passing 'int' */
+	print_type(2147483647);
+	/* expect+1: passing 'int' */
+	print_type(0x7fff);
+
+	/* expect+1: passing 'unsigned int' */
+	print_type(0x8000);
+	/* expect+1: passing 'unsigned int' */
+	print_type(0x);
+
+	/* expect+1: passing 'long' */
+	print_type(2147483648);
+	/* expect+1: passing 'long' */
+	print_type(0x0001);
+	/* expect+1: passing 'long' */
+	print_type(0x7fff);
+
+	/* expect+1: passing 'unsigned long' */
+	print_type(0x8000);
+	/* expect+1: passing 'unsigned long' */
+	print_type(0x);
+
+	/* expect+2: warning: integer constant out of range [252] */
+	/* expect+1: warning: passing 'unsigned long' */
+	print_type(0x0001);
+}
 
-	sinki(2147483647);
+void
+suffix_u(void)
+{
+	/* expect+1: passing 'unsigned int' */
+	print_type(3U);
+	/* expect+1: passing 'unsigned int' */
+	print_type(3u);
+
+	/* expect+1: passing 'unsigned int' */
+	print_type(4294967295U);
+	/* expect+1: passing 'unsigned long' */
+	print_type(4294967296U);
+}
 
-	/* expect+2: converted from 'long' to 'int' due to prototype */
-	/* expect+1: conversion of 'long' to 'int' is out of range */
-	sinki(2147483648);
+void
+suffix_l(void)
+{
+	/* expect+1: passing 'long' */
+	print_type(3L);
 
-	sinki(-2147483647);
+	/* expect+1: passing 'long' */
+	print_type(3l);
+}
 
-	/* expect+1: converted from 'long' to 'int' due to prototype */
-	sinki(-2147483648);
+void
+suffix_ul(void)
+{
+	/* expect+1: passing 'unsigned long' */
+	print_type(3UL);
+	/* expect+1: passing 'unsigned long' */
+	print_type(3LU);
 }
 
 void
-test_unsigned_int(void)
+suffix_ll(void)
 {
-	sinku(0);
+	/* expect+1: passing 'long long' */
+	print_type(3LL);
 
-	sinku(4294967295U);
+	/* The 'Ll' must not use mixed case. Checked by the compiler. */
+	/* expect+1: passing 'long long' */
+	print_type(3Ll);
 
-	/* expect+2: from 'unsigned long' to 'unsigned int' due to prototype */
-	/* expect+1: conversion of 'unsigned long' to 'unsigned int' is out of range */
-	sinku(4294967296U);
+	/* expect+1: passing 'long long' */
+	print_type(3ll);
 }
 
-void sinkull(unsigned long long);
-
 void
-suffixes(void)
+suffix_ull(void)
 {
-	sinkull(3u);
-	sinkull(3ll);
-	sinkull(3llu);
-	sinkull(3Ull);
+	/* expect+1: passing 'unsigned long long' */
+	print_type(3llu);
+	/* expect+1: passing 'unsigned long long' */
+	print_type(3Ull);
 
 	/* The 'LL' must not be split. Checked by the compiler. */
-	sinkull(3lul);
-	/* The 'Ll' must not used mixed case. Checked by the compiler. */
-	sinkull(3ULl);
+	/* expect+1: passing 'unsigned long long' */
+	print_type(3lul);
+
+	/* The 'Ll' must not use mixed case. Checked by the compiler. */
+	/* expect+1: passing 'unsigned long long' */
+	print_type(3ULl);
+}
+
+void
+suffix_too_many(void)
+{
+	/* expect+2: warning: malformed integer constant [251] */
+	/* expect+1: passing 'long long' */
+	print_type(3LLL);
+
+	/* expec

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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 20:51:10 UTC 2021

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

Log Message:
tests/lint: test parsing of integer constants

The previous version of this test did not focus on the integer constants
but instead on conversions of function arguments.  The current test
covers several corner cases, such as non-decimal bases and all
combinations of suffixes.

This test does not cover lex_integer_constant completely since several
code paths are only reachable on 32-bit target platforms.


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

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



CVS commit: src

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 19:49:29 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint2: output_sorted.exp
src/usr.bin/xlint/lint2: main2.c

Log Message:
lint: sort the lint2 diagnostics by symbol name


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint2/output_sorted.exp
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint2/main2.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/lint2/output_sorted.exp
diff -u src/tests/usr.bin/xlint/lint2/output_sorted.exp:1.1 src/tests/usr.bin/xlint/lint2/output_sorted.exp:1.2
--- src/tests/usr.bin/xlint/lint2/output_sorted.exp:1.1	Sat Aug 28 19:45:18 2021
+++ src/tests/usr.bin/xlint/lint2/output_sorted.exp	Sat Aug 28 19:49:28 2021
@@ -1,12 +1,6 @@
-func7000 used( output_sorted.c(10) ), but not defined
-func7000, arg 1 used inconsistently  	output_sorted.c(10)[int]  ::  output_sorted.c(11)[pointer to const char]
-func7000, arg 2 used inconsistently  	output_sorted.c(10)[pointer to const char]  ::  output_sorted.c(11)[double]
 func used( output_sorted.c(10) ), but not defined
 func, arg 1 used inconsistently  	output_sorted.c(10)[int]  ::  output_sorted.c(11)[pointer to const char]
 func, arg 2 used inconsistently  	output_sorted.c(10)[pointer to const char]  ::  output_sorted.c(11)[double]
-no_prototype used( output_sorted.c(10) ), but not defined
-no_prototype, arg 1 used inconsistently  	output_sorted.c(10)[int]  ::  output_sorted.c(11)[pointer to const char]
-no_prototype, arg 2 used inconsistently  	output_sorted.c(10)[pointer to const char]  ::  output_sorted.c(11)[double]
 func1000 used( output_sorted.c(10) ), but not defined
 func1000, arg 1 used inconsistently  	output_sorted.c(10)[int]  ::  output_sorted.c(11)[pointer to const char]
 func1000, arg 2 used inconsistently  	output_sorted.c(10)[pointer to const char]  ::  output_sorted.c(11)[double]
@@ -25,3 +19,9 @@ func5000, arg 2 used inconsistently  	ou
 func6000 used( output_sorted.c(10) ), but not defined
 func6000, arg 1 used inconsistently  	output_sorted.c(10)[int]  ::  output_sorted.c(11)[pointer to const char]
 func6000, arg 2 used inconsistently  	output_sorted.c(10)[pointer to const char]  ::  output_sorted.c(11)[double]
+func7000 used( output_sorted.c(10) ), but not defined
+func7000, arg 1 used inconsistently  	output_sorted.c(10)[int]  ::  output_sorted.c(11)[pointer to const char]
+func7000, arg 2 used inconsistently  	output_sorted.c(10)[pointer to const char]  ::  output_sorted.c(11)[double]
+no_prototype used( output_sorted.c(10) ), but not defined
+no_prototype, arg 1 used inconsistently  	output_sorted.c(10)[int]  ::  output_sorted.c(11)[pointer to const char]
+no_prototype, arg 2 used inconsistently  	output_sorted.c(10)[pointer to const char]  ::  output_sorted.c(11)[double]

Index: src/usr.bin/xlint/lint2/main2.c
diff -u src/usr.bin/xlint/lint2/main2.c:1.20 src/usr.bin/xlint/lint2/main2.c:1.21
--- src/usr.bin/xlint/lint2/main2.c:1.20	Sat Aug 28 17:11:19 2021
+++ src/usr.bin/xlint/lint2/main2.c	Sat Aug 28 19:49:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: main2.c,v 1.20 2021/08/28 17:11:19 rillig Exp $	*/
+/*	$NetBSD: main2.c,v 1.21 2021/08/28 19:49:28 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main2.c,v 1.20 2021/08/28 17:11:19 rillig Exp $");
+__RCSID("$NetBSD: main2.c,v 1.21 2021/08/28 19:49:28 rillig Exp $");
 #endif
 
 #include 
@@ -187,8 +187,7 @@ main(int argc, char *argv[])
 	mainused();
 
 	/* perform all tests */
-	/* TODO: sort the names; hashcode order looks chaotic. */
-	symtab_forall(check_name);
+	symtab_forall_sorted(check_name);
 
 	exit(0);
 	/* NOTREACHED */



CVS commit: src

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 19:49:29 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint2: output_sorted.exp
src/usr.bin/xlint/lint2: main2.c

Log Message:
lint: sort the lint2 diagnostics by symbol name


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint2/output_sorted.exp
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint2/main2.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-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 19:45:18 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint2: Makefile
Added Files:
src/tests/usr.bin/xlint/lint2: output_sorted.exp output_sorted.ln

Log Message:
tests/lint: demonstrate hashcode sorting of the lint2 output

The hashcodes modulo 1009 are:

 48 func7000
637 func
646 no_prototype
697 func1000
757 func2000
817 func3000
877 func4000
937 func5000
997 func6000


To generate a diff of this commit:
cvs rdiff -u -r1.1117 -r1.1118 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint2/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint2/output_sorted.exp \
src/tests/usr.bin/xlint/lint2/output_sorted.ln

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.1117 src/distrib/sets/lists/tests/mi:1.1118
--- src/distrib/sets/lists/tests/mi:1.1117	Wed Aug 25 22:04:51 2021
+++ src/distrib/sets/lists/tests/mi	Sat Aug 28 19:45:18 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1117 2021/08/25 22:04:51 rillig Exp $
+# $NetBSD: mi,v 1.1118 2021/08/28 19:45:18 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -7083,6 +7083,8 @@
 ./usr/tests/usr.bin/xlint/lint2/msg_017.ln		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint2/msg_018.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint2/msg_018.ln		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint2/output_sorted.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint2/output_sorted.ln	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint2/read.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint2/read.ln			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint2/read_lp64.exp		tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint2/Makefile
diff -u src/tests/usr.bin/xlint/lint2/Makefile:1.7 src/tests/usr.bin/xlint/lint2/Makefile:1.8
--- src/tests/usr.bin/xlint/lint2/Makefile:1.7	Tue Aug 24 21:30:52 2021
+++ src/tests/usr.bin/xlint/lint2/Makefile	Sat Aug 28 19:45:18 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.7 2021/08/24 21:30:52 rillig Exp $
+# $NetBSD: Makefile,v 1.8 2021/08/28 19:45:18 rillig Exp $
 
 NOMAN=		yes
 
@@ -17,6 +17,7 @@ TESTS+=		emit_lp64
 010 011 012 013 014 015 016 017 018
 TESTS+=		msg_${msg}
 .endfor
+TESTS+=		output_sorted
 TESTS+=		read
 TESTS+=		read_lp64
 TESTS+=		read_printf

Added files:

Index: src/tests/usr.bin/xlint/lint2/output_sorted.exp
diff -u /dev/null src/tests/usr.bin/xlint/lint2/output_sorted.exp:1.1
--- /dev/null	Sat Aug 28 19:45:18 2021
+++ src/tests/usr.bin/xlint/lint2/output_sorted.exp	Sat Aug 28 19:45:18 2021
@@ -0,0 +1,27 @@
+func7000 used( output_sorted.c(10) ), but not defined
+func7000, arg 1 used inconsistently  	output_sorted.c(10)[int]  ::  output_sorted.c(11)[pointer to const char]
+func7000, arg 2 used inconsistently  	output_sorted.c(10)[pointer to const char]  ::  output_sorted.c(11)[double]
+func used( output_sorted.c(10) ), but not defined
+func, arg 1 used inconsistently  	output_sorted.c(10)[int]  ::  output_sorted.c(11)[pointer to const char]
+func, arg 2 used inconsistently  	output_sorted.c(10)[pointer to const char]  ::  output_sorted.c(11)[double]
+no_prototype used( output_sorted.c(10) ), but not defined
+no_prototype, arg 1 used inconsistently  	output_sorted.c(10)[int]  ::  output_sorted.c(11)[pointer to const char]
+no_prototype, arg 2 used inconsistently  	output_sorted.c(10)[pointer to const char]  ::  output_sorted.c(11)[double]
+func1000 used( output_sorted.c(10) ), but not defined
+func1000, arg 1 used inconsistently  	output_sorted.c(10)[int]  ::  output_sorted.c(11)[pointer to const char]
+func1000, arg 2 used inconsistently  	output_sorted.c(10)[pointer to const char]  ::  output_sorted.c(11)[double]
+func2000 used( output_sorted.c(10) ), but not defined
+func2000, arg 1 used inconsistently  	output_sorted.c(10)[int]  ::  output_sorted.c(11)[pointer to const char]
+func2000, arg 2 used inconsistently  	output_sorted.c(10)[pointer to const char]  ::  output_sorted.c(11)[double]
+func3000 used( output_sorted.c(10) ), but not defined
+func3000, arg 1 used inconsistently  	output_sorted.c(10)[int]  ::  output_sorted.c(11)[pointer to const char]
+func3000, arg 2 used inconsistently  	output_sorted.c(10)[pointer to const char]  ::  output_sorted.c(11)[double]
+func4000 used( output_sorted.c(10) ), but not defined
+func4000, arg 1 used inconsistently  	output_sorted.c(10)[int]  ::  output_sorted.c(11)[pointer to const char]
+func4000, arg 2 used inconsistently  	output_sorted.c(10)[pointer to const char]  ::  output_sorted.c(11)[double]
+func5000 used( out

CVS commit: src

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 19:45:18 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint2: Makefile
Added Files:
src/tests/usr.bin/xlint/lint2: output_sorted.exp output_sorted.ln

Log Message:
tests/lint: demonstrate hashcode sorting of the lint2 output

The hashcodes modulo 1009 are:

 48 func7000
637 func
646 no_prototype
697 func1000
757 func2000
817 func3000
877 func4000
937 func5000
997 func6000


To generate a diff of this commit:
cvs rdiff -u -r1.1117 -r1.1118 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint2/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint2/output_sorted.exp \
src/tests/usr.bin/xlint/lint2/output_sorted.ln

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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 19:27:44 UTC 2021

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

Log Message:
lint: fold constants in hash functions

All platforms supported by lint have sizeof(unsigned int) == 4 and
CHAR_BIT == 8.  There is no need to encode these expressions in a hash
function, they only made the code harder to read.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint2/hash.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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 19:27:44 UTC 2021

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

Log Message:
lint: fold constants in hash functions

All platforms supported by lint have sizeof(unsigned int) == 4 and
CHAR_BIT == 8.  There is no need to encode these expressions in a hash
function, they only made the code harder to read.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint2/hash.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.75 src/usr.bin/xlint/lint1/lex.c:1.76
--- src/usr.bin/xlint/lint1/lex.c:1.75	Sat Aug 28 18:58:24 2021
+++ src/usr.bin/xlint/lint1/lex.c	Sat Aug 28 19:27:44 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.75 2021/08/28 18:58:24 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.76 2021/08/28 19:27:44 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.75 2021/08/28 18:58:24 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.76 2021/08/28 19:27:44 rillig Exp $");
 #endif
 
 #include 
@@ -401,8 +401,8 @@ hash(const char *s)
 
 	v = 0;
 	for (us = (const unsigned char *)s; *us != '\0'; us++) {
-		v = (v << sizeof(v)) + *us;
-		v ^= v >> (sizeof(v) * CHAR_BIT - sizeof(v));
+		v = (v << 4) + *us;
+		v ^= v >> 28;
 	}
 	return v % HSHSIZ1;
 }

Index: src/usr.bin/xlint/lint2/hash.c
diff -u src/usr.bin/xlint/lint2/hash.c:1.20 src/usr.bin/xlint/lint2/hash.c:1.21
--- src/usr.bin/xlint/lint2/hash.c:1.20	Sat Aug 28 19:00:55 2021
+++ src/usr.bin/xlint/lint2/hash.c	Sat Aug 28 19:27:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.c,v 1.20 2021/08/28 19:00:55 rillig Exp $	*/
+/*	$NetBSD: hash.c,v 1.21 2021/08/28 19:27:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: hash.c,v 1.20 2021/08/28 19:00:55 rillig Exp $");
+__RCSID("$NetBSD: hash.c,v 1.21 2021/08/28 19:27:44 rillig Exp $");
 #endif
 
 /*
@@ -80,8 +80,8 @@ hash(const char *s)
 
 	v = 0;
 	for (us = (const unsigned char *)s; *us != '\0'; us++) {
-		v = (v << sizeof(v)) + *us;
-		v ^= v >> (sizeof(v) * CHAR_BIT - sizeof(v));
+		v = (v << 4) + *us;
+		v ^= v >> 28;
 	}
 	return v % HSHSIZ2;
 }



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 19:00:55 UTC 2021

Modified Files:
src/usr.bin/xlint/lint2: hash.c

Log Message:
lint: fix memory leak in symtab_forall_sorted (since today)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/xlint/lint2/hash.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/lint2/hash.c
diff -u src/usr.bin/xlint/lint2/hash.c:1.19 src/usr.bin/xlint/lint2/hash.c:1.20
--- src/usr.bin/xlint/lint2/hash.c:1.19	Sat Aug 28 17:18:42 2021
+++ src/usr.bin/xlint/lint2/hash.c	Sat Aug 28 19:00:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.c,v 1.19 2021/08/28 17:18:42 rillig Exp $	*/
+/*	$NetBSD: hash.c,v 1.20 2021/08/28 19:00:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: hash.c,v 1.19 2021/08/28 17:18:42 rillig Exp $");
+__RCSID("$NetBSD: hash.c,v 1.20 2021/08/28 19:00:55 rillig Exp $");
 #endif
 
 /*
@@ -169,7 +169,6 @@ symtab_forall(void (*action)(hte_t *))
 	}
 }
 
-
 /* Run the action for each name in the symbol table, in alphabetic order. */
 void
 symtab_forall_sorted(void (*action)(hte_t *))
@@ -187,6 +186,8 @@ symtab_forall_sorted(void (*action)(hte_
 
 	for (i = 0; i < sorted.len; i++)
 		action(sorted.items[i]);
+
+	free(sorted.items);
 }
 
 /*



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 19:00:55 UTC 2021

Modified Files:
src/usr.bin/xlint/lint2: hash.c

Log Message:
lint: fix memory leak in symtab_forall_sorted (since today)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/xlint/lint2/hash.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-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 18:58:24 UTC 2021

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

Log Message:
lint: replace obsolete strtouq with equivalent strtoull


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.74 src/usr.bin/xlint/lint1/lex.c:1.75
--- src/usr.bin/xlint/lint1/lex.c:1.74	Sat Aug 28 15:01:43 2021
+++ src/usr.bin/xlint/lint1/lex.c	Sat Aug 28 18:58:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.74 2021/08/28 15:01:43 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.75 2021/08/28 18:58:24 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.74 2021/08/28 15:01:43 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.75 2021/08/28 18:58:24 rillig Exp $");
 #endif
 
 #include 
@@ -512,6 +512,9 @@ lex_integer_constant(const char *yytext,
 	bool	warned = false;
 #ifdef TARG_INT128_MAX
 	__uint128_t uq = 0;
+	/* FIXME: INT128 doesn't belong here. */
+	/* TODO: const */
+	/* TODO: remove #ifdef */
 	static	tspec_t contypes[2][4] = {
 		{ INT,  LONG,  QUAD, INT128, },
 		{ UINT, ULONG, UQUAD, UINT128, }
@@ -561,7 +564,7 @@ lex_integer_constant(const char *yytext,
 
 	errno = 0;
 
-	uq = strtouq(cp, &eptr, base);
+	uq = strtoull(cp, &eptr, base);
 	lint_assert(eptr == cp + len);
 	if (errno != 0) {
 		/* integer constant out of range */



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 18:58:24 UTC 2021

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

Log Message:
lint: replace obsolete strtouq with equivalent strtoull


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

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



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 18:40:15 UTC 2021

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

Log Message:
tests/lint: disable test for message 252 on ILP32 platforms


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_252.c \
src/tests/usr.bin/xlint/lint1/msg_252.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_252.c
diff -u src/tests/usr.bin/xlint/lint1/msg_252.c:1.3 src/tests/usr.bin/xlint/lint1/msg_252.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_252.c:1.3	Fri Aug 27 20:49:25 2021
+++ src/tests/usr.bin/xlint/lint1/msg_252.c	Sat Aug 28 18:40:15 2021
@@ -1,7 +1,29 @@
-/*	$NetBSD: msg_252.c,v 1.3 2021/08/27 20:49:25 rillig Exp $	*/
+/*	$NetBSD: msg_252.c,v 1.4 2021/08/28 18:40:15 rillig Exp $	*/
 # 3 "msg_252.c"
 
 // Test for message: integer constant out of range [252]
 
+/*
+ * On ILP32 platforms, lint additionally and unnecessarily warns:
+ *
+ *	conversion of 'unsigned long' to 'int' is out of range [119]
+ *
+ * On an ILP32 platform, lex_integer_constant interprets this number as
+ * having type ULONG, which is stored as 'ULONG 0x___'.
+ * This number is passed to convert_constant, which calls convert_integer,
+ * which sign-extends the number to 'INT 0x___'.  This
+ * converted number is passed to convert_constant_check_range, and at this
+ * point, v->v_quad != nv->v_quad, due to the sign extension.  This triggers
+ * an additional warning 119.
+ *
+ * On a 64-bit platform, lex_integer_constant stores the number as
+ * 'ULONG 0x___', which has the same representation as the
+ * 'INT 0x___', therefore no warning.
+ *
+ * Due to this unnecessary difference, disable this test on ILP32 platforms
+ * for now (2021-08-28).
+ */
+/* lint1-skip-if: ilp32 */
+
 /* expect+1: warning: integer constant out of range [252] */
 int constant = ;
Index: src/tests/usr.bin/xlint/lint1/msg_252.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_252.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_252.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_252.exp:1.3	Fri Aug 27 20:49:25 2021
+++ src/tests/usr.bin/xlint/lint1/msg_252.exp	Sat Aug 28 18:40:15 2021
@@ -1 +1 @@
-msg_252.c(7): warning: integer constant out of range [252]
+msg_252.c(29): warning: integer constant out of range [252]



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 18:40:15 UTC 2021

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

Log Message:
tests/lint: disable test for message 252 on ILP32 platforms


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

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



CVS commit: src

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 17:18:42 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint2: emit.exp-ln emit_lp64.exp-ln
src/usr.bin/xlint/lint2: emit2.c externs2.h hash.c

Log Message:
lint: write the entries for the libraries in alphabetical order

This makes them easier to read by humans.

The checks are still performed in hashcode order since there are no
tests that would cover this change.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint2/emit.exp-ln \
src/tests/usr.bin/xlint/lint2/emit_lp64.exp-ln
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint2/emit2.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/lint2/externs2.h
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/lint2/hash.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-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 17:18:42 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint2: emit.exp-ln emit_lp64.exp-ln
src/usr.bin/xlint/lint2: emit2.c externs2.h hash.c

Log Message:
lint: write the entries for the libraries in alphabetical order

This makes them easier to read by humans.

The checks are still performed in hashcode order since there are no
tests that would cover this change.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint2/emit.exp-ln \
src/tests/usr.bin/xlint/lint2/emit_lp64.exp-ln
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint2/emit2.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/lint2/externs2.h
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/lint2/hash.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/lint2/emit.exp-ln
diff -u src/tests/usr.bin/xlint/lint2/emit.exp-ln:1.2 src/tests/usr.bin/xlint/lint2/emit.exp-ln:1.3
--- src/tests/usr.bin/xlint/lint2/emit.exp-ln:1.2	Tue Aug 24 23:38:51 2021
+++ src/tests/usr.bin/xlint/lint2/emit.exp-ln	Sat Aug 28 17:18:42 2021
@@ -1,4 +1,4 @@
-# $NetBSD: emit.exp-ln,v 1.2 2021/08/24 23:38:51 rillig Exp $
+# $NetBSD: emit.exp-ln,v 1.3 2021/08/28 17:18:42 rillig Exp $
 
 S llib-lemit.ln
 0 s llib-lemit.ln
@@ -11,8 +11,11 @@ S llib-lemit.ln
 1s emit.c
 2s expr_promote.c
 
-# from emit.c
-0 d 0.0 t u 11defined_int I
-0 d 0.0 d u 14cover_outqchar F0 V
+# Since emit2.c 1.22 from 2021-08-28, the symbols are written in alphabetic
+# order.
+
 # from expr_promote.c
 0 d 0.0 d u 6caller F1 PsT116arithmetic_types V
+# from emit.c
+0 d 0.0 d u 14cover_outqchar F0 V
+0 d 0.0 t u 11defined_int I
Index: src/tests/usr.bin/xlint/lint2/emit_lp64.exp-ln
diff -u src/tests/usr.bin/xlint/lint2/emit_lp64.exp-ln:1.2 src/tests/usr.bin/xlint/lint2/emit_lp64.exp-ln:1.3
--- src/tests/usr.bin/xlint/lint2/emit_lp64.exp-ln:1.2	Tue Aug 24 23:38:51 2021
+++ src/tests/usr.bin/xlint/lint2/emit_lp64.exp-ln	Sat Aug 28 17:18:42 2021
@@ -1,7 +1,7 @@
-# $NetBSD: emit_lp64.exp-ln,v 1.2 2021/08/24 23:38:51 rillig Exp $
+# $NetBSD: emit_lp64.exp-ln,v 1.3 2021/08/28 17:18:42 rillig Exp $
 
 S llib-lemit_lp64.ln
 0 s llib-lemit_lp64.ln
 
-0 d 0.0 du 16uint128_function F0 uJ
 0 d 0.0 tu 15int128_variable J
+0 d 0.0 du 16uint128_function F0 uJ

Index: src/usr.bin/xlint/lint2/emit2.c
diff -u src/usr.bin/xlint/lint2/emit2.c:1.21 src/usr.bin/xlint/lint2/emit2.c:1.22
--- src/usr.bin/xlint/lint2/emit2.c:1.21	Sat Aug 28 17:11:19 2021
+++ src/usr.bin/xlint/lint2/emit2.c	Sat Aug 28 17:18:42 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: emit2.c,v 1.21 2021/08/28 17:11:19 rillig Exp $ */
+/* $NetBSD: emit2.c,v 1.22 2021/08/28 17:18:42 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -34,7 +34,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit2.c,v 1.21 2021/08/28 17:11:19 rillig Exp $");
+__RCSID("$NetBSD: emit2.c,v 1.22 2021/08/28 17:18:42 rillig Exp $");
 #endif
 
 #include "lint2.h"
@@ -246,7 +246,7 @@ outlib(const char *name)
 	outfiles();
 
 	/* write all definitions with external linkage */
-	symtab_forall(dumpname);
+	symtab_forall_sorted(dumpname);
 
 	/* close the output */
 	outclose();

Index: src/usr.bin/xlint/lint2/externs2.h
diff -u src/usr.bin/xlint/lint2/externs2.h:1.13 src/usr.bin/xlint/lint2/externs2.h:1.14
--- src/usr.bin/xlint/lint2/externs2.h:1.13	Sat Aug 28 17:11:19 2021
+++ src/usr.bin/xlint/lint2/externs2.h	Sat Aug 28 17:18:42 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: externs2.h,v 1.13 2021/08/28 17:11:19 rillig Exp $ */
+/* $NetBSD: externs2.h,v 1.14 2021/08/28 17:18:42 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -54,6 +54,7 @@ extern	void	_inithash(hte_t ***);
 extern	hte_t	*_hsearch(hte_t **, const char *, bool);
 extern	void	symtab_forall(void (*)(hte_t *));
 extern	void	_destroyhash(hte_t **);
+extern	void	symtab_forall_sorted(void (*)(hte_t *));
 
 #define	inithash()	_inithash(NULL);
 #define	hsearch(a, b)	_hsearch(NULL, (a), (b))

Index: src/usr.bin/xlint/lint2/hash.c
diff -u src/usr.bin/xlint/lint2/hash.c:1.18 src/usr.bin/xlint/lint2/hash.c:1.19
--- src/usr.bin/xlint/lint2/hash.c:1.18	Sat Aug 28 17:11:19 2021
+++ src/usr.bin/xlint/lint2/hash.c	Sat Aug 28 17:18:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.c,v 1.18 2021/08/28 17:11:19 rillig Exp $	*/
+/*	$NetBSD: hash.c,v 1.19 2021/08/28 17:18:42 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: hash.c,v 1.18 2021/08/28 17:11:19 rillig Exp $");
+__RCSID("$NetBSD: hash.c,v 1.19 2021/08/28 17:18:42 rillig Exp $");
 #endif
 
 /*
@@ -127,6 +127,32 @@ _hsearch(hte_t **table, const char *s, b
 	return hte;
 }
 
+struct hte_list {
+	hte_t **items;
+	size_t len;
+	size_t cap;
+};
+
+static void
+hte_list_add(str

CVS commit: src/lib/libedit

2021-08-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 28 17:17:48 UTC 2021

Modified Files:
src/lib/libedit: vi.c

Log Message:
Respect $EDITOR when execution one (Baptiste Daroussin)


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/lib/libedit/vi.c

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

Modified files:

Index: src/lib/libedit/vi.c
diff -u src/lib/libedit/vi.c:1.63 src/lib/libedit/vi.c:1.64
--- src/lib/libedit/vi.c:1.63	Tue Jul 23 06:18:52 2019
+++ src/lib/libedit/vi.c	Sat Aug 28 13:17:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vi.c,v 1.63 2019/07/23 10:18:52 christos Exp $	*/
+/*	$NetBSD: vi.c,v 1.64 2021/08/28 17:17:47 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)vi.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: vi.c,v 1.63 2019/07/23 10:18:52 christos Exp $");
+__RCSID("$NetBSD: vi.c,v 1.64 2021/08/28 17:17:47 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -1008,12 +1008,15 @@ vi_histedit(EditLine *el, wint_t c __att
 	char *cp = NULL;
 	size_t len;
 	wchar_t *line = NULL;
+	const char *editor;
 
 	if (el->el_state.doingarg) {
 		if (vi_to_history_line(el, 0) == CC_ERROR)
 			return CC_ERROR;
 	}
 
+	if ((editor = getenv("EDITOR")) == NULL)
+		editor = "vi";
 	fd = mkstemp(tempfile);
 	if (fd < 0)
 		return CC_ERROR;
@@ -1038,7 +1041,7 @@ vi_histedit(EditLine *el, wint_t c __att
 		goto error;
 	case 0:
 		close(fd);
-		execlp("vi", "vi", tempfile, (char *)NULL);
+		execlp(editor, editor, tempfile, (char *)NULL);
 		exit(0);
 		/*NOTREACHED*/
 	default:



CVS commit: src/lib/libedit

2021-08-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 28 17:17:48 UTC 2021

Modified Files:
src/lib/libedit: vi.c

Log Message:
Respect $EDITOR when execution one (Baptiste Daroussin)


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/lib/libedit/vi.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/lint2

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 17:11:19 UTC 2021

Modified Files:
src/usr.bin/xlint/lint2: emit2.c externs2.h hash.c main2.c

Log Message:
lint: remove unused parameter from forall

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint2/emit2.c
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint2/externs2.h
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/xlint/lint2/hash.c
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/xlint/lint2/main2.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/lint2/emit2.c
diff -u src/usr.bin/xlint/lint2/emit2.c:1.20 src/usr.bin/xlint/lint2/emit2.c:1.21
--- src/usr.bin/xlint/lint2/emit2.c:1.20	Tue Aug 24 21:30:52 2021
+++ src/usr.bin/xlint/lint2/emit2.c	Sat Aug 28 17:11:19 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: emit2.c,v 1.20 2021/08/24 21:30:52 rillig Exp $ */
+/* $NetBSD: emit2.c,v 1.21 2021/08/28 17:11:19 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -34,7 +34,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit2.c,v 1.20 2021/08/24 21:30:52 rillig Exp $");
+__RCSID("$NetBSD: emit2.c,v 1.21 2021/08/28 17:11:19 rillig Exp $");
 #endif
 
 #include "lint2.h"
@@ -246,7 +246,7 @@ outlib(const char *name)
 	outfiles();
 
 	/* write all definitions with external linkage */
-	forall(dumpname);
+	symtab_forall(dumpname);
 
 	/* close the output */
 	outclose();

Index: src/usr.bin/xlint/lint2/externs2.h
diff -u src/usr.bin/xlint/lint2/externs2.h:1.12 src/usr.bin/xlint/lint2/externs2.h:1.13
--- src/usr.bin/xlint/lint2/externs2.h:1.12	Sun Aug 22 14:50:06 2021
+++ src/usr.bin/xlint/lint2/externs2.h	Sat Aug 28 17:11:19 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: externs2.h,v 1.12 2021/08/22 14:50:06 rillig Exp $ */
+/* $NetBSD: externs2.h,v 1.13 2021/08/28 17:11:19 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -52,12 +52,11 @@ extern	bool	Tflag;
  */
 extern	void	_inithash(hte_t ***);
 extern	hte_t	*_hsearch(hte_t **, const char *, bool);
-extern	void	_forall(hte_t **, void (*)(hte_t *));
+extern	void	symtab_forall(void (*)(hte_t *));
 extern	void	_destroyhash(hte_t **);
 
 #define	inithash()	_inithash(NULL);
 #define	hsearch(a, b)	_hsearch(NULL, (a), (b))
-#define	forall(a)	_forall(NULL, (a))
 
 /*
  * read.c

Index: src/usr.bin/xlint/lint2/hash.c
diff -u src/usr.bin/xlint/lint2/hash.c:1.17 src/usr.bin/xlint/lint2/hash.c:1.18
--- src/usr.bin/xlint/lint2/hash.c:1.17	Sat Aug 28 12:21:53 2021
+++ src/usr.bin/xlint/lint2/hash.c	Sat Aug 28 17:11:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.c,v 1.17 2021/08/28 12:21:53 rillig Exp $	*/
+/*	$NetBSD: hash.c,v 1.18 2021/08/28 17:11:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: hash.c,v 1.17 2021/08/28 12:21:53 rillig Exp $");
+__RCSID("$NetBSD: hash.c,v 1.18 2021/08/28 17:11:19 rillig Exp $");
 #endif
 
 /*
@@ -128,20 +128,18 @@ _hsearch(hte_t **table, const char *s, b
 }
 
 /*
- * Call function f for each name in the hash table.
+ * Call the action for each name in the hash table.
  */
 void
-_forall(hte_t **table, void (*f)(hte_t *))
+symtab_forall(void (*action)(hte_t *))
 {
 	int	i;
 	hte_t	*hte;
-
-	if (table == NULL)
-		table = htab;
+	hte_t	**table = htab;
 
 	for (i = 0; i < HSHSIZ2; i++) {
 		for (hte = table[i]; hte != NULL; hte = hte->h_link)
-			(*f)(hte);
+			action(hte);
 	}
 }
 

Index: src/usr.bin/xlint/lint2/main2.c
diff -u src/usr.bin/xlint/lint2/main2.c:1.19 src/usr.bin/xlint/lint2/main2.c:1.20
--- src/usr.bin/xlint/lint2/main2.c:1.19	Sun Aug 22 04:43:44 2021
+++ src/usr.bin/xlint/lint2/main2.c	Sat Aug 28 17:11:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: main2.c,v 1.19 2021/08/22 04:43:44 rillig Exp $	*/
+/*	$NetBSD: main2.c,v 1.20 2021/08/28 17:11:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main2.c,v 1.19 2021/08/22 04:43:44 rillig Exp $");
+__RCSID("$NetBSD: main2.c,v 1.20 2021/08/28 17:11:19 rillig Exp $");
 #endif
 
 #include 
@@ -174,7 +174,7 @@ main(int argc, char *argv[])
 
 	/* write the lint library */
 	if (Cflag) {
-		forall(mkstatic);
+		symtab_forall(mkstatic);
 		outlib(libname);
 	}
 
@@ -182,13 +182,13 @@ main(int argc, char *argv[])
 	for (i = 0; libs[i] != NULL; i++)
 		readfile(libs[i]);
 
-	forall(mkstatic);
+	symtab_forall(mkstatic);
 
 	mainused();
 
 	/* perform all tests */
 	/* TODO: sort the names; hashcode order looks chaotic. */
-	forall(check_name);
+	symtab_forall(check_name);
 
 	exit(0);
 	/* NOTREACHED */



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 17:11:19 UTC 2021

Modified Files:
src/usr.bin/xlint/lint2: emit2.c externs2.h hash.c main2.c

Log Message:
lint: remove unused parameter from forall

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint2/emit2.c
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint2/externs2.h
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/xlint/lint2/hash.c
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/xlint/lint2/main2.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-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 16:51:57 UTC 2021

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

Log Message:
lint: remove double inversion from is_out_of_char_range

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.359 -r1.360 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.359 src/usr.bin/xlint/lint1/tree.c:1.360
--- src/usr.bin/xlint/lint1/tree.c:1.359	Sat Aug 28 16:43:50 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sat Aug 28 16:51:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.359 2021/08/28 16:43:50 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.360 2021/08/28 16:51:57 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.359 2021/08/28 16:43:50 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.360 2021/08/28 16:51:57 rillig Exp $");
 #endif
 
 #include 
@@ -4102,8 +4102,8 @@ static bool
 is_out_of_char_range(const tnode_t *tn)
 {
 	return tn->tn_op == CON &&
-	(tn->tn_val->v_quad < 0 ||
-	 tn->tn_val->v_quad > (int)~(~0U << (CHAR_SIZE - 1)));
+	   !(0 <= tn->tn_val->v_quad &&
+		 tn->tn_val->v_quad < 1 << (CHAR_SIZE - 1));
 }
 
 /*



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 16:51:57 UTC 2021

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

Log Message:
lint: remove double inversion from is_out_of_char_range

No functional change.


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

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



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 16:43:50 UTC 2021

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

Log Message:
lint: clean up check_integer_comparison

No functional change.


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

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



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 16:43:50 UTC 2021

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

Log Message:
lint: clean up check_integer_comparison

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.358 -r1.359 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.358 src/usr.bin/xlint/lint1/tree.c:1.359
--- src/usr.bin/xlint/lint1/tree.c:1.358	Sat Aug 28 16:36:54 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sat Aug 28 16:43:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.358 2021/08/28 16:36:54 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.359 2021/08/28 16:43:50 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.358 2021/08/28 16:36:54 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.359 2021/08/28 16:43:50 rillig Exp $");
 #endif
 
 #include 
@@ -4098,6 +4098,14 @@ check_array_index(tnode_t *tn, bool ampe
 	}
 }
 
+static bool
+is_out_of_char_range(const tnode_t *tn)
+{
+	return tn->tn_op == CON &&
+	(tn->tn_val->v_quad < 0 ||
+	 tn->tn_val->v_quad > (int)~(~0U << (CHAR_SIZE - 1)));
+}
+
 /*
  * Check for ordered comparisons of unsigned values with 0.
  */
@@ -4115,16 +4123,8 @@ check_integer_comparison(op_t op, tnode_
 	if (!is_integer(lt) || !is_integer(rt))
 		return;
 
-	if ((hflag || pflag) && lt == CHAR && rn->tn_op == CON &&
-	(rn->tn_val->v_quad < 0 ||
-	 rn->tn_val->v_quad > (int)~(~0U << (CHAR_SIZE - 1 {
-		/* nonportable character comparison, op %s */
-		warning(230, op_name(op));
-		return;
-	}
-	if ((hflag || pflag) && rt == CHAR && ln->tn_op == CON &&
-	(ln->tn_val->v_quad < 0 ||
-	 ln->tn_val->v_quad > (int)~(~0U << (CHAR_SIZE - 1 {
+	if ((hflag || pflag) && ((lt == CHAR && is_out_of_char_range(rn)) ||
+ (rt == CHAR && is_out_of_char_range(ln {
 		/* nonportable character comparison, op %s */
 		warning(230, op_name(op));
 		return;



CVS commit: src

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 16:36:54 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: emit.exp-ln
src/usr.bin/xlint/lint1: decl.c externs1.h tree.c

Log Message:
lint: do not emit GCC builtin functions

Lint1 no longer emits declarations of GCC builtin functions and calls to
them.

Previously, lint generated 3421 useless warnings in a default NetBSD
build, like this:

__atomic_load_n, arg 1 used inconsistently
acl.c(216)[pointer to unsigned int]
rbtdb.c(921)[pointer to unsigned short]

This was because lint just doesn't understand that these functions are
type-generic, which is indeed unusual in C.

These useless warnings made the lint output more frightening than it
should actually be.  Together with the strange formatting of the
diagnostics (space-space-tab after the main message, two spaces and two
colons between the occurrences, symbols are listed in hashcode order),
this creates the impression that lint is not intended to be a
user-friendly tool.

For now, fix the excess warnings, leaving the other items for later.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/emit.exp-ln
cvs rdiff -u -r1.226 -r1.227 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.135 -r1.136 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.357 -r1.358 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/emit.exp-ln
diff -u src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.3 src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.4
--- src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.3	Sat Aug 28 16:21:24 2021
+++ src/tests/usr.bin/xlint/lint1/emit.exp-ln	Sat Aug 28 16:36:54 2021
@@ -1,6 +1,3 @@
-1d-1.1e15__builtin_isinfF1lDI
-2d-1.2e15__builtin_isnanF1lDI
-3d-1.3e18__builtin_copysignF2lDlDI
 0semit.c
 Semit.c
 47d0.47e12extern__BoolB
@@ -59,7 +56,4 @@ Semit.c
 163c0.163s2"%%"i9my_printff2PcCPCV
 164c0.164s2"%\a%\b%\f%\n%\r%\t%\v%\177"i9my_printff2PcCPCV
 159d0.159d14cover_outqcharF0V
-177c0.177p2i16__builtin_expectf2III
-178c0.178p1i17__builtin_bswap32f1II
-180c0.180z3i13__atomic_loadf3PLPLII
 173d0.173d17call_gcc_builtinsF2IPLV

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.226 src/usr.bin/xlint/lint1/decl.c:1.227
--- src/usr.bin/xlint/lint1/decl.c:1.226	Sat Aug 28 12:59:25 2021
+++ src/usr.bin/xlint/lint1/decl.c	Sat Aug 28 16:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.226 2021/08/28 12:59:25 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.227 2021/08/28 16:36:54 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.226 2021/08/28 12:59:25 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.227 2021/08/28 16:36:54 rillig Exp $");
 #endif
 
 #include 
@@ -1972,7 +1972,7 @@ declare_extern(sym_t *dsym, bool initflg
 		 */
 		rval = dsym->s_type->t_subt->t_tspec != VOID;
 		outfdef(dsym, &dsym->s_def_pos, rval, false, NULL);
-	} else {
+	} else if (!is_gcc_builtin(dsym->s_name)) {
 		outsym(dsym, dsym->s_scl, dsym->s_def);
 	}
 

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.135 src/usr.bin/xlint/lint1/externs1.h:1.136
--- src/usr.bin/xlint/lint1/externs1.h:1.135	Sat Aug 28 13:11:10 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Sat Aug 28 16:36:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.135 2021/08/28 13:11:10 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.136 2021/08/28 16:36:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -234,6 +234,7 @@ extern	const char *scl_name(scl_t);
 extern	const tnode_t *before_conversion(const tnode_t *);
 extern	type_t	*derive_type(type_t *, tspec_t);
 extern	type_t	*expr_derive_type(type_t *, tspec_t);
+extern	bool	is_gcc_builtin(const char *);
 extern	tnode_t	*build_constant(type_t *, val_t *);
 extern	tnode_t	*build_name(sym_t *, int);
 extern	tnode_t	*build_string(strg_t *);

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.357 src/usr.bin/xlint/lint1/tree.c:1.358
--- src/usr.bin/xlint/lint1/tree.c:1.357	Sat Aug 28 15:36:54 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sat Aug 28 16:36:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.357 2021/08/28 15:36:54 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.358 2021/08/28 16:36:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.357 2021/08/28 15:36:54 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.358 2021/08/28 16:36:54 rillig Exp $");
 #endif
 
 #include 
@@ -191,8 +191,14 @@ fallback_symbol(sym_t *sym)
 	error(99, sym->s_name);
 }
 
-/* https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html */
-static bool
+/*
+ * Functions that are pr

CVS commit: src

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 16:36:54 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: emit.exp-ln
src/usr.bin/xlint/lint1: decl.c externs1.h tree.c

Log Message:
lint: do not emit GCC builtin functions

Lint1 no longer emits declarations of GCC builtin functions and calls to
them.

Previously, lint generated 3421 useless warnings in a default NetBSD
build, like this:

__atomic_load_n, arg 1 used inconsistently
acl.c(216)[pointer to unsigned int]
rbtdb.c(921)[pointer to unsigned short]

This was because lint just doesn't understand that these functions are
type-generic, which is indeed unusual in C.

These useless warnings made the lint output more frightening than it
should actually be.  Together with the strange formatting of the
diagnostics (space-space-tab after the main message, two spaces and two
colons between the occurrences, symbols are listed in hashcode order),
this creates the impression that lint is not intended to be a
user-friendly tool.

For now, fix the excess warnings, leaving the other items for later.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/emit.exp-ln
cvs rdiff -u -r1.226 -r1.227 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.135 -r1.136 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.357 -r1.358 src/usr.bin/xlint/lint1/tree.c

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



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 16:21:25 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: emit.c emit.exp-ln

Log Message:
tests/lint: demonstrate that GCC builtins are emitted by default

They will be skipped in a follow-up commit, but to see the effects of
that, they first need to be emitted.


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

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/emit.c
diff -u src/tests/usr.bin/xlint/lint1/emit.c:1.2 src/tests/usr.bin/xlint/lint1/emit.c:1.3
--- src/tests/usr.bin/xlint/lint1/emit.c:1.2	Sun Aug  8 11:07:19 2021
+++ src/tests/usr.bin/xlint/lint1/emit.c	Sat Aug 28 16:21:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: emit.c,v 1.2 2021/08/08 11:07:19 rillig Exp $	*/
+/*	$NetBSD: emit.c,v 1.3 2021/08/28 16:21:24 rillig Exp $	*/
 # 3 "emit.c"
 
 /*
@@ -7,8 +7,8 @@
  * consistently across different translation units.
  */
 
-// omit the option '-g' to avoid having the GCC builtins in the .ln file.
-/* lint1-flags: -Sw */
+
+
 
 /*
  * Define some derived types.
@@ -163,3 +163,19 @@ cover_outqchar(void)
 	my_printf("%s", "%%");
 	my_printf("%s", "%\a %\b %\f %\n %\r %\t %\v %\177");
 }
+
+/*
+ * Calls to GCC builtin functions should not be emitted since GCC already
+ * guarantees a consistent definition of these function and checks the
+ * arguments, so there is nothing left to do for lint.
+ */
+void
+call_gcc_builtins(int x, long *ptr)
+{
+	long value;
+
+	__builtin_expect(x > 0, 1);
+	__builtin_bswap32(0x12345678);
+
+	__atomic_load(ptr, &value, 0);
+}
Index: src/tests/usr.bin/xlint/lint1/emit.exp-ln
diff -u src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.2 src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.3
--- src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.2	Sun Aug  8 11:07:19 2021
+++ src/tests/usr.bin/xlint/lint1/emit.exp-ln	Sat Aug 28 16:21:24 2021
@@ -1,3 +1,6 @@
+1d-1.1e15__builtin_isinfF1lDI
+2d-1.2e15__builtin_isnanF1lDI
+3d-1.3e18__builtin_copysignF2lDlDI
 0semit.c
 Semit.c
 47d0.47e12extern__BoolB
@@ -56,3 +59,7 @@ Semit.c
 163c0.163s2"%%"i9my_printff2PcCPCV
 164c0.164s2"%\a%\b%\f%\n%\r%\t%\v%\177"i9my_printff2PcCPCV
 159d0.159d14cover_outqcharF0V
+177c0.177p2i16__builtin_expectf2III
+178c0.178p1i17__builtin_bswap32f1II
+180c0.180z3i13__atomic_loadf3PLPLII
+173d0.173d17call_gcc_builtinsF2IPLV



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 16:21:25 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: emit.c emit.exp-ln

Log Message:
tests/lint: demonstrate that GCC builtins are emitted by default

They will be skipped in a follow-up commit, but to see the effects of
that, they first need to be emitted.


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

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



CVS commit: src/sys/dev/raidframe

2021-08-28 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sat Aug 28 16:00:52 UTC 2021

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
If there is a FS_RAID partition on a disk, then we shouldn't look at
the raw partition.  In particular, we now need to account for the case
where an existing FS_RAID partition is now open because it is in use.
If that is the case, we don't look at the raw partition.

Addresses PR kern/56369.


To generate a diff of this commit:
cvs rdiff -u -r1.399 -r1.400 src/sys/dev/raidframe/rf_netbsdkintf.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/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.399 src/sys/dev/raidframe/rf_netbsdkintf.c:1.400
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.399	Sat Aug  7 16:19:15 2021
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sat Aug 28 16:00:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.399 2021/08/07 16:19:15 thorpej Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.400 2021/08/28 16:00:52 oster Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.399 2021/08/07 16:19:15 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.400 2021/08/28 16:00:52 oster Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_autoconfig.h"
@@ -3040,7 +3040,19 @@ rf_find_raid_components(void)
 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 error = VOP_OPEN(vp, FREAD, NOCRED);
 if (error) {
-	/* Whatever... */
+	/* Not quite a 'whatever'.  In
+	 * this situation we know 
+	 * there is a FS_RAID
+	 * partition, but we can't
+	 * open it.  The most likely
+	 * reason is that the
+	 * partition is already in
+	 * use by another RAID set.
+	 * So note that we've already
+	 * found a partition on this
+	 * disk so we don't attempt
+	 * to use the raw disk later. */
+	rf_part_found = 1;
 	vput(vp);
 	continue;
 }



CVS commit: src/sys/dev/raidframe

2021-08-28 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sat Aug 28 16:00:52 UTC 2021

Modified Files:
src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
If there is a FS_RAID partition on a disk, then we shouldn't look at
the raw partition.  In particular, we now need to account for the case
where an existing FS_RAID partition is now open because it is in use.
If that is the case, we don't look at the raw partition.

Addresses PR kern/56369.


To generate a diff of this commit:
cvs rdiff -u -r1.399 -r1.400 src/sys/dev/raidframe/rf_netbsdkintf.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-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 15:36:54 UTC 2021

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

Log Message:
lint: merge duplicate code in convert_constant_floating


To generate a diff of this commit:
cvs rdiff -u -r1.356 -r1.357 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.356 src/usr.bin/xlint/lint1/tree.c:1.357
--- src/usr.bin/xlint/lint1/tree.c:1.356	Sat Aug 28 13:11:10 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sat Aug 28 15:36:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.356 2021/08/28 13:11:10 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.357 2021/08/28 15:36:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.356 2021/08/28 13:11:10 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.357 2021/08/28 15:36:54 rillig Exp $");
 #endif
 
 #include 
@@ -2251,6 +2251,7 @@ convert_constant_floating(op_t op, int a
 		}
 		v->v_ldbl = v->v_ldbl > 0 ? max : min;
 	}
+
 	if (nt == FLOAT) {
 		nv->v_ldbl = (float)v->v_ldbl;
 	} else if (nt == DOUBLE) {
@@ -2258,8 +2259,7 @@ convert_constant_floating(op_t op, int a
 	} else if (nt == LDOUBLE) {
 		nv->v_ldbl = v->v_ldbl;
 	} else {
-		nv->v_quad = (nt == PTR || is_uinteger(nt)) ?
-		(int64_t)v->v_ldbl : (int64_t)v->v_ldbl;
+		nv->v_quad = (int64_t)v->v_ldbl;
 	}
 }
 



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 15:36:54 UTC 2021

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

Log Message:
lint: merge duplicate code in convert_constant_floating


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

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



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 15:25:10 UTC 2021

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

Log Message:
tests/lint: align tests for unsigned char and signed char


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_230.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_230.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_230_uchar.c
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_230_uchar.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_230.c
diff -u src/tests/usr.bin/xlint/lint1/msg_230.c:1.7 src/tests/usr.bin/xlint/lint1/msg_230.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_230.c:1.7	Sat Aug 28 14:45:19 2021
+++ src/tests/usr.bin/xlint/lint1/msg_230.c	Sat Aug 28 15:25:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_230.c,v 1.7 2021/08/28 14:45:19 rillig Exp $	*/
+/*	$NetBSD: msg_230.c,v 1.8 2021/08/28 15:25:10 rillig Exp $	*/
 # 3 "msg_230.c"
 
 // Test for message: nonportable character comparison, op %s [230]
@@ -88,6 +88,10 @@ compare_lt(char c)
 	/* expect+1: warning: nonportable character comparison, op > [230] */
 	if (c > -1)
 		return;
+	/*
+	 * On platforms where char is unsigned, lint warns that the
+	 * comparison always evaluates to true; see msg_230_uchar.c.
+	 */
 	if (c >= 0)
 		return;
 

Index: src/tests/usr.bin/xlint/lint1/msg_230.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_230.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_230.exp:1.7
--- src/tests/usr.bin/xlint/lint1/msg_230.exp:1.6	Sat Aug 28 14:45:19 2021
+++ src/tests/usr.bin/xlint/lint1/msg_230.exp	Sat Aug 28 15:25:10 2021
@@ -13,6 +13,6 @@ msg_230.c(69): warning: nonportable char
 msg_230.c(78): warning: nonportable character comparison, op > [230]
 msg_230.c(81): warning: nonportable character comparison, op >= [230]
 msg_230.c(89): warning: nonportable character comparison, op > [230]
-msg_230.c(101): warning: nonportable character comparison, op >= [230]
-msg_230.c(105): warning: nonportable character comparison, op > [230]
-msg_230.c(108): warning: nonportable character comparison, op >= [230]
+msg_230.c(105): warning: nonportable character comparison, op >= [230]
+msg_230.c(109): warning: nonportable character comparison, op > [230]
+msg_230.c(112): warning: nonportable character comparison, op >= [230]

Index: src/tests/usr.bin/xlint/lint1/msg_230_uchar.c
diff -u src/tests/usr.bin/xlint/lint1/msg_230_uchar.c:1.3 src/tests/usr.bin/xlint/lint1/msg_230_uchar.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_230_uchar.c:1.3	Sat Aug 28 14:45:19 2021
+++ src/tests/usr.bin/xlint/lint1/msg_230_uchar.c	Sat Aug 28 15:25:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_230_uchar.c,v 1.3 2021/08/28 14:45:19 rillig Exp $	*/
+/*	$NetBSD: msg_230_uchar.c,v 1.4 2021/08/28 15:25:10 rillig Exp $	*/
 # 3 "msg_230_uchar.c"
 
 // Test for message: nonportable character comparison, op %s [230]
@@ -6,30 +6,113 @@
 /* lint1-flags: -S -g -p -w */
 /* lint1-only-if: uchar */
 
-void example(char c, unsigned char uc, signed char sc)
+/*
+ * C11 6.2.5p15 defines that 'char' has the same range, representation, and
+ * behavior as either 'signed char' or 'unsigned char'.
+ *
+ * The portable range of 'char' is from 0 to 127 since all lint platforms
+ * define CHAR_SIZE to be 8.
+ *
+ * See msg_162.c, which covers 'signed char' and 'unsigned char'.
+ */
+
+void
+compare_plain_char(char c)
+{
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (c == -129)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (c == -128)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (c == -1)
+		return;
+	if (c == 0)
+		return;
+	if (c == 127)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (c == 128)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (c == 255)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (c == 256)
+		return;
+}
+
+void
+compare_plain_char_yoda(char c)
+{
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (-129 == c)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (-128 == c)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (-1 == c)
+		return;
+	if (0 == c)
+		return;
+	if (127 == c)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (128 == c)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (255 == c)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (256 == c)
+		return;
+}
+
+void
+compare_lt(char c)
 {
-	/* ex

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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 15:25:10 UTC 2021

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

Log Message:
tests/lint: align tests for unsigned char and signed char


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_230.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_230.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_230_uchar.c
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_230_uchar.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-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 15:01:43 UTC 2021

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

Log Message:
lint: fix lexing of character constants

The final value of the character constant must be determined by the
target platform, not the host platform.

This allows to run the tests for a target platform with different
signedness of characters, by editing targparam.h and t_integration.

Lint is not completely cross-compileable though.  64-bit host platforms
can run lint for 32-bit platforms, but not vice versa, since 32-bit GCC
does not provide 128-bit integer types.


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

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

Modified files:

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.73 src/usr.bin/xlint/lint1/lex.c:1.74
--- src/usr.bin/xlint/lint1/lex.c:1.73	Sat Aug 28 13:29:26 2021
+++ src/usr.bin/xlint/lint1/lex.c	Sat Aug 28 15:01:43 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.73 2021/08/28 13:29:26 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.74 2021/08/28 15:01:43 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.73 2021/08/28 13:29:26 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.74 2021/08/28 15:01:43 rillig Exp $");
 #endif
 
 #include 
@@ -816,14 +816,8 @@ lex_character_constant(void)
 		/* empty character constant */
 		error(73);
 	}
-	if (n == 1) {
-		/*
-		 * XXX: use the target platform's 'char' instead of the
-		 *  'char' from the execution environment, to be able to
-		 *  run lint for powerpc on x86_64.
-		 */
-		val = (char)val;
-	}
+	if (n == 1)
+		val = (int)convert_integer(val, CHAR, CHAR_SIZE);
 
 	yylval.y_val = xcalloc(1, sizeof(*yylval.y_val));
 	yylval.y_val->v_tspec = INT;



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 15:01:43 UTC 2021

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

Log Message:
lint: fix lexing of character constants

The final value of the character constant must be determined by the
target platform, not the host platform.

This allows to run the tests for a target platform with different
signedness of characters, by editing targparam.h and t_integration.

Lint is not completely cross-compileable though.  64-bit host platforms
can run lint for 32-bit platforms, but not vice versa, since 32-bit GCC
does not provide 128-bit integer types.


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

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



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 14:45:19 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_162.c msg_162.exp msg_230.c
msg_230.exp msg_230_uchar.c

Log Message:
tests/lint: extend test for nonportable character comparison


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_162.c \
src/tests/usr.bin/xlint/lint1/msg_162.exp
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_230.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_230.exp
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_230_uchar.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_162.c
diff -u src/tests/usr.bin/xlint/lint1/msg_162.c:1.3 src/tests/usr.bin/xlint/lint1/msg_162.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_162.c:1.3	Mon Aug 23 17:47:34 2021
+++ src/tests/usr.bin/xlint/lint1/msg_162.c	Sat Aug 28 14:45:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_162.c,v 1.3 2021/08/23 17:47:34 rillig Exp $	*/
+/*	$NetBSD: msg_162.c,v 1.4 2021/08/28 14:45:19 rillig Exp $	*/
 # 3 "msg_162.c"
 
 // Test for message: comparison of %s with %s, op %s [162]
@@ -51,3 +51,34 @@ right_unsigned(unsigned int ui)
 	if (0 >= ui) {
 	}
 }
+
+/*
+ * Lint does not care about these comparisons, even though they are obviously
+ * out of range.
+ */
+void
+compare_signed_char(signed char sc)
+{
+	if (sc == -129)
+		return;
+	if (sc == -128)
+		return;
+	if (sc == 127)
+		return;
+	if (sc == 128)
+		return;
+}
+
+void
+compare_unsigned_char(unsigned char uc)
+{
+	/* expect+1: warning: comparison of unsigned char with negative constant, op == [162] */
+	if (uc == -1)
+		return;
+	if (uc == 0)
+		return;
+	if (uc == 255)
+		return;
+	if (uc == 256)
+		return;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_162.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_162.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_162.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_162.exp:1.3	Mon Aug 23 17:47:34 2021
+++ src/tests/usr.bin/xlint/lint1/msg_162.exp	Sat Aug 28 14:45:19 2021
@@ -6,3 +6,4 @@ msg_162.c(39): warning: comparison of ne
 msg_162.c(43): warning: comparison of 0 with unsigned int, op > [162]
 msg_162.c(47): warning: comparison of 0 with unsigned int, op <= [162]
 msg_162.c(51): warning: comparison of 0 with unsigned int, op >= [162]
+msg_162.c(76): warning: comparison of unsigned char with negative constant, op == [162]

Index: src/tests/usr.bin/xlint/lint1/msg_230.c
diff -u src/tests/usr.bin/xlint/lint1/msg_230.c:1.6 src/tests/usr.bin/xlint/lint1/msg_230.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_230.c:1.6	Mon Aug 23 17:47:34 2021
+++ src/tests/usr.bin/xlint/lint1/msg_230.c	Sat Aug 28 14:45:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_230.c,v 1.6 2021/08/23 17:47:34 rillig Exp $	*/
+/*	$NetBSD: msg_230.c,v 1.7 2021/08/28 14:45:19 rillig Exp $	*/
 # 3 "msg_230.c"
 
 // Test for message: nonportable character comparison, op %s [230]
@@ -6,36 +6,105 @@
 /* lint1-flags: -S -g -p -w */
 /* lint1-only-if: schar */
 
-void example(char c, unsigned char uc, signed char sc)
+/*
+ * C11 6.2.5p15 defines that 'char' has the same range, representation, and
+ * behavior as either 'signed char' or 'unsigned char'.
+ *
+ * The portable range of 'char' is from 0 to 127 since all lint platforms
+ * define CHAR_SIZE to be 8.
+ *
+ * See msg_162.c, which covers 'signed char' and 'unsigned char'.
+ */
+
+void
+compare_plain_char(char c)
 {
-	if (c < 0)
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (c == -129)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (c == -128)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (c == -1)
+		return;
+	if (c == 0)
 		return;
-	/* expect+1: warning: comparison of unsigned char with 0, op < [162] */
-	if (uc < 0)
+	if (c == 127)
 		return;
-	if (sc < 0)
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (c == 128)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (c == 255)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (c == 256)
+		return;
+}
+
+void
+compare_plain_char_yoda(char c)
+{
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (-129 == c)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (-128 == c)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (-1 == c)
+		return;
+	if (0 == c)
+		return;
+	if (127 == c)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (128 == c)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */
+	if (255 == c)
+		return;
+	/* expect+1: warning: nonportable character comparison, op == [230] */

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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 14:45:19 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_162.c msg_162.exp msg_230.c
msg_230.exp msg_230_uchar.c

Log Message:
tests/lint: extend test for nonportable character comparison


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_162.c \
src/tests/usr.bin/xlint/lint1/msg_162.exp
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_230.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_230.exp
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_230_uchar.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/xlint

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 14:42:30 UTC 2021

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

Log Message:
lint: explicitly ignore the return value of close


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/usr.bin/xlint/xlint/xlint.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/xlint/xlint.c
diff -u src/usr.bin/xlint/xlint/xlint.c:1.79 src/usr.bin/xlint/xlint/xlint.c:1.80
--- src/usr.bin/xlint/xlint/xlint.c:1.79	Fri Aug 20 05:45:19 2021
+++ src/usr.bin/xlint/xlint/xlint.c	Sat Aug 28 14:42:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.79 2021/08/20 05:45:19 rillig Exp $ */
+/* $NetBSD: xlint.c,v 1.80 2021/08/28 14:42:29 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: xlint.c,v 1.79 2021/08/20 05:45:19 rillig Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.80 2021/08/28 14:42:29 rillig Exp $");
 #endif
 
 #include 
@@ -652,7 +652,7 @@ fname(const char *name)
 			warn("can't make temp");
 			terminate(-1);
 		}
-		close(fd);
+		(void)close(fd);
 	}
 	if (!iflag)
 		list_add_copy(&lint1.outfiles, ofn);
@@ -746,7 +746,7 @@ runchild(const char *path, char *const *
 		/* setup the standard output if necessary */
 		if (fdout != -1) {
 			dup2(fdout, STDOUT_FILENO);
-			close(fdout);
+			(void)close(fdout);
 		}
 		(void)execvp(path, args);
 		warn("cannot exec %s", path);



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 14:42:30 UTC 2021

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

Log Message:
lint: explicitly ignore the return value of close


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/usr.bin/xlint/xlint/xlint.c

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



CVS commit: xsrc/external/mit/xf86-video-modesetting/dist

2021-08-28 Thread Maya Rashish
Module Name:xsrc
Committed By:   maya
Date:   Sat Aug 28 13:30:25 UTC 2021

Removed Files:
xsrc/external/mit/xf86-video-modesetting/dist: COPYING ChangeLog
INSTALL Makefile.am Makefile.in README aclocal.m4 config.guess
config.h.in config.sub configure configure.ac depcomp install-sh
ltmain.sh missing
xsrc/external/mit/xf86-video-modesetting/dist/m4: libtool.m4
ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4
xsrc/external/mit/xf86-video-modesetting/dist/man: Makefile.am
Makefile.in modesetting.man
xsrc/external/mit/xf86-video-modesetting/dist/src: Makefile.am
Makefile.in compat-api.h driver.c driver.h drmmode_display.c
drmmode_display.h

Log Message:
Remove unused standalone modesetting driver.

We use the one embedded into xorg-server.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r0 \
xsrc/external/mit/xf86-video-modesetting/dist/COPYING \
xsrc/external/mit/xf86-video-modesetting/dist/ChangeLog \
xsrc/external/mit/xf86-video-modesetting/dist/INSTALL \
xsrc/external/mit/xf86-video-modesetting/dist/Makefile.am \
xsrc/external/mit/xf86-video-modesetting/dist/Makefile.in \
xsrc/external/mit/xf86-video-modesetting/dist/README \
xsrc/external/mit/xf86-video-modesetting/dist/aclocal.m4 \
xsrc/external/mit/xf86-video-modesetting/dist/config.guess \
xsrc/external/mit/xf86-video-modesetting/dist/config.h.in \
xsrc/external/mit/xf86-video-modesetting/dist/config.sub \
xsrc/external/mit/xf86-video-modesetting/dist/configure \
xsrc/external/mit/xf86-video-modesetting/dist/configure.ac \
xsrc/external/mit/xf86-video-modesetting/dist/depcomp \
xsrc/external/mit/xf86-video-modesetting/dist/install-sh \
xsrc/external/mit/xf86-video-modesetting/dist/ltmain.sh \
xsrc/external/mit/xf86-video-modesetting/dist/missing
cvs rdiff -u -r1.1.1.1 -r0 \
xsrc/external/mit/xf86-video-modesetting/dist/m4/libtool.m4 \
xsrc/external/mit/xf86-video-modesetting/dist/m4/ltoptions.m4 \
xsrc/external/mit/xf86-video-modesetting/dist/m4/ltsugar.m4 \
xsrc/external/mit/xf86-video-modesetting/dist/m4/ltversion.m4 \
xsrc/external/mit/xf86-video-modesetting/dist/m4/lt~obsolete.m4
cvs rdiff -u -r1.1.1.1 -r0 \
xsrc/external/mit/xf86-video-modesetting/dist/man/Makefile.am \
xsrc/external/mit/xf86-video-modesetting/dist/man/Makefile.in \
xsrc/external/mit/xf86-video-modesetting/dist/man/modesetting.man
cvs rdiff -u -r1.1.1.1 -r0 \
xsrc/external/mit/xf86-video-modesetting/dist/src/Makefile.am \
xsrc/external/mit/xf86-video-modesetting/dist/src/Makefile.in \
xsrc/external/mit/xf86-video-modesetting/dist/src/compat-api.h \
xsrc/external/mit/xf86-video-modesetting/dist/src/driver.h \
xsrc/external/mit/xf86-video-modesetting/dist/src/drmmode_display.h
cvs rdiff -u -r1.2 -r0 \
xsrc/external/mit/xf86-video-modesetting/dist/src/driver.c \
xsrc/external/mit/xf86-video-modesetting/dist/src/drmmode_display.c

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



CVS commit: xsrc/external/mit/xf86-video-modesetting/dist

2021-08-28 Thread Maya Rashish
Module Name:xsrc
Committed By:   maya
Date:   Sat Aug 28 13:30:25 UTC 2021

Removed Files:
xsrc/external/mit/xf86-video-modesetting/dist: COPYING ChangeLog
INSTALL Makefile.am Makefile.in README aclocal.m4 config.guess
config.h.in config.sub configure configure.ac depcomp install-sh
ltmain.sh missing
xsrc/external/mit/xf86-video-modesetting/dist/m4: libtool.m4
ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4
xsrc/external/mit/xf86-video-modesetting/dist/man: Makefile.am
Makefile.in modesetting.man
xsrc/external/mit/xf86-video-modesetting/dist/src: Makefile.am
Makefile.in compat-api.h driver.c driver.h drmmode_display.c
drmmode_display.h

Log Message:
Remove unused standalone modesetting driver.

We use the one embedded into xorg-server.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r0 \
xsrc/external/mit/xf86-video-modesetting/dist/COPYING \
xsrc/external/mit/xf86-video-modesetting/dist/ChangeLog \
xsrc/external/mit/xf86-video-modesetting/dist/INSTALL \
xsrc/external/mit/xf86-video-modesetting/dist/Makefile.am \
xsrc/external/mit/xf86-video-modesetting/dist/Makefile.in \
xsrc/external/mit/xf86-video-modesetting/dist/README \
xsrc/external/mit/xf86-video-modesetting/dist/aclocal.m4 \
xsrc/external/mit/xf86-video-modesetting/dist/config.guess \
xsrc/external/mit/xf86-video-modesetting/dist/config.h.in \
xsrc/external/mit/xf86-video-modesetting/dist/config.sub \
xsrc/external/mit/xf86-video-modesetting/dist/configure \
xsrc/external/mit/xf86-video-modesetting/dist/configure.ac \
xsrc/external/mit/xf86-video-modesetting/dist/depcomp \
xsrc/external/mit/xf86-video-modesetting/dist/install-sh \
xsrc/external/mit/xf86-video-modesetting/dist/ltmain.sh \
xsrc/external/mit/xf86-video-modesetting/dist/missing
cvs rdiff -u -r1.1.1.1 -r0 \
xsrc/external/mit/xf86-video-modesetting/dist/m4/libtool.m4 \
xsrc/external/mit/xf86-video-modesetting/dist/m4/ltoptions.m4 \
xsrc/external/mit/xf86-video-modesetting/dist/m4/ltsugar.m4 \
xsrc/external/mit/xf86-video-modesetting/dist/m4/ltversion.m4 \
xsrc/external/mit/xf86-video-modesetting/dist/m4/lt~obsolete.m4
cvs rdiff -u -r1.1.1.1 -r0 \
xsrc/external/mit/xf86-video-modesetting/dist/man/Makefile.am \
xsrc/external/mit/xf86-video-modesetting/dist/man/Makefile.in \
xsrc/external/mit/xf86-video-modesetting/dist/man/modesetting.man
cvs rdiff -u -r1.1.1.1 -r0 \
xsrc/external/mit/xf86-video-modesetting/dist/src/Makefile.am \
xsrc/external/mit/xf86-video-modesetting/dist/src/Makefile.in \
xsrc/external/mit/xf86-video-modesetting/dist/src/compat-api.h \
xsrc/external/mit/xf86-video-modesetting/dist/src/driver.h \
xsrc/external/mit/xf86-video-modesetting/dist/src/drmmode_display.h
cvs rdiff -u -r1.2 -r0 \
xsrc/external/mit/xf86-video-modesetting/dist/src/driver.c \
xsrc/external/mit/xf86-video-modesetting/dist/src/drmmode_display.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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 13:29:27 UTC 2021

Modified Files:
src/usr.bin/xlint/common: mem.c tyname.c
src/usr.bin/xlint/lint1: cgram.y func.c lex.c main1.c mem1.c

Log Message:
lint: explicitly ignore return value of some function calls

This fixes the warning from lint2 that these functions return values
which are sometimes ignored.

The remaining calls to fprintf that ignore the return value come from
scan.c.  Lint does not currently detect the auto-generated portions of
that file and the interesting ones since it assumes that scan.c is the
main filename, see expr_zalloc_tnode.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/xlint/common/mem.c
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/xlint/common/tyname.c
cvs rdiff -u -r1.358 -r1.359 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.56 -r1.57 src/usr.bin/xlint/lint1/main1.c
cvs rdiff -u -r1.50 -r1.51 src/usr.bin/xlint/lint1/mem1.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/mem.c
diff -u src/usr.bin/xlint/common/mem.c:1.17 src/usr.bin/xlint/common/mem.c:1.18
--- src/usr.bin/xlint/common/mem.c:1.17	Sun Aug 22 15:06:49 2021
+++ src/usr.bin/xlint/common/mem.c	Sat Aug 28 13:29:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.17 2021/08/22 15:06:49 rillig Exp $	*/
+/*	$NetBSD: mem.c,v 1.18 2021/08/28 13:29:26 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem.c,v 1.17 2021/08/22 15:06:49 rillig Exp $");
+__RCSID("$NetBSD: mem.c,v 1.18 2021/08/28 13:29:26 rillig Exp $");
 #endif
 
 #include 
@@ -95,7 +95,7 @@ xasprintf(const char *fmt, ...)
 	e = vasprintf(&str, fmt, ap);
 	va_end(ap);
 	if (e < 0)
-		not_null(NULL);
+		(void)not_null(NULL);
 	return str;
 }
 #endif

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.44 src/usr.bin/xlint/common/tyname.c:1.45
--- src/usr.bin/xlint/common/tyname.c:1.44	Tue Aug  3 17:44:58 2021
+++ src/usr.bin/xlint/common/tyname.c	Sat Aug 28 13:29:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.44 2021/08/03 17:44:58 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.45 2021/08/28 13:29:26 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.44 2021/08/03 17:44:58 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.45 2021/08/28 13:29:26 rillig Exp $");
 #endif
 
 #include 
@@ -143,7 +143,7 @@ buf_add_int(buffer *buf, int n)
 {
 	char num[1 + sizeof(n) * CHAR_BIT + 1];
 
-	snprintf(num, sizeof(num), "%d", n);
+	(void)snprintf(num, sizeof(num), "%d", n);
 	buf_add(buf, num);
 }
 

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.358 src/usr.bin/xlint/lint1/cgram.y:1.359
--- src/usr.bin/xlint/lint1/cgram.y:1.358	Wed Aug 25 22:48:40 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Sat Aug 28 13:29:26 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.358 2021/08/25 22:48:40 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.359 2021/08/28 13:29:26 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.358 2021/08/25 22:48:40 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.359 2021/08/28 13:29:26 rillig Exp $");
 #endif
 
 #include 
@@ -2166,7 +2166,7 @@ cgram_to_string(int token, YYSTYPE val)
 static void
 cgram_print(FILE *output, int token, YYSTYPE val)
 {
-	fprintf(output, "%s", cgram_to_string(token, val));
+	(void)fprintf(output, "%s", cgram_to_string(token, val));
 }
 #endif
 

Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.121 src/usr.bin/xlint/lint1/func.c:1.122
--- src/usr.bin/xlint/lint1/func.c:1.121	Sat Aug 28 12:21:53 2021
+++ src/usr.bin/xlint/lint1/func.c	Sat Aug 28 13:29:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: func.c,v 1.121 2021/08/28 12:21:53 rillig Exp $	*/
+/*	$NetBSD: func.c,v 1.122 2021/08/28 13:29:26 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.121 2021/08/28 12:21:53 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.122 2021/08/28 13:29:26 rillig Exp $");
 #endif
 
 #include 
@@ -718,7 +718,7 @@ switch1(tnode_t *tn)
 	}
 
 	/* leak the memory, for check_case_label_bitand */
-	expr_save_memory();
+	(void)expr_save_memory();
 
 	check_getopt_begin_switch();
 	expr(tn, true, false, false, false);

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.72 src/usr.bin/xlint/lint1/lex.c:1.73
--- src/usr.bin/xlint/lint1/l

CVS commit: src/usr.bin/xlint

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 13:29:27 UTC 2021

Modified Files:
src/usr.bin/xlint/common: mem.c tyname.c
src/usr.bin/xlint/lint1: cgram.y func.c lex.c main1.c mem1.c

Log Message:
lint: explicitly ignore return value of some function calls

This fixes the warning from lint2 that these functions return values
which are sometimes ignored.

The remaining calls to fprintf that ignore the return value come from
scan.c.  Lint does not currently detect the auto-generated portions of
that file and the interesting ones since it assumes that scan.c is the
main filename, see expr_zalloc_tnode.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/xlint/common/mem.c
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/xlint/common/tyname.c
cvs rdiff -u -r1.358 -r1.359 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.56 -r1.57 src/usr.bin/xlint/lint1/main1.c
cvs rdiff -u -r1.50 -r1.51 src/usr.bin/xlint/lint1/mem1.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-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 13:11:10 UTC 2021

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

Log Message:
lint: use 'unsigned int' for bit-size of types in convert_integer

There was no need to have two separate magic values (0 and -1) to mean
the same.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.71 -r1.72 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.355 -r1.356 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/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.134 src/usr.bin/xlint/lint1/externs1.h:1.135
--- src/usr.bin/xlint/lint1/externs1.h:1.134	Sat Aug 28 12:59:25 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Sat Aug 28 13:11:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.134 2021/08/28 12:59:25 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.135 2021/08/28 13:11:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -78,7 +78,7 @@ extern	symt_t	symtyp;
 extern	FILE	*yyin;
 
 extern	void	initscan(void);
-extern	int64_t	convert_integer(int64_t, tspec_t, int);
+extern	int64_t	convert_integer(int64_t, tspec_t, unsigned int);
 extern	void	clear_warn_flags(void);
 extern	sym_t	*getsym(sbuf_t *);
 extern	void	cleanup(void);

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.71 src/usr.bin/xlint/lint1/lex.c:1.72
--- src/usr.bin/xlint/lint1/lex.c:1.71	Sat Aug 28 12:21:53 2021
+++ src/usr.bin/xlint/lint1/lex.c	Sat Aug 28 13:11:10 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.71 2021/08/28 12:21:53 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.72 2021/08/28 13:11:10 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.71 2021/08/28 12:21:53 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.72 2021/08/28 13:11:10 rillig Exp $");
 #endif
 
 #include 
@@ -52,7 +52,7 @@ __RCSID("$NetBSD: lex.c,v 1.71 2021/08/2
 #include "lint1.h"
 #include "cgram.h"
 
-#define CHAR_MASK	((int)(~(~0U << CHAR_SIZE)))
+#define CHAR_MASK	((1U << CHAR_SIZE) - 1)
 
 
 /* Current position (it's also updated when an included file is parsed) */
@@ -504,7 +504,7 @@ int
 lex_integer_constant(const char *yytext, size_t yyleng, int base)
 {
 	int	l_suffix, u_suffix;
-	int	len;
+	size_t	len;
 	const	char *cp;
 	char	c, *eptr;
 	tspec_t	typ;
@@ -663,7 +663,7 @@ lex_integer_constant(const char *yytext,
 		break;
 	}
 
-	uq = (uint64_t)convert_integer((int64_t)uq, typ, -1);
+	uq = (uint64_t)convert_integer((int64_t)uq, typ, 0);
 
 	yylval.y_val = xcalloc(1, sizeof(*yylval.y_val));
 	yylval.y_val->v_tspec = typ;
@@ -680,11 +680,11 @@ lex_integer_constant(const char *yytext,
  * to the width of type t.
  */
 int64_t
-convert_integer(int64_t q, tspec_t t, int len)
+convert_integer(int64_t q, tspec_t t, unsigned int len)
 {
 	uint64_t vbits;
 
-	if (len <= 0)
+	if (len == 0)
 		len = size_in_bits(t);
 
 	vbits = value_bits(len);

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.355 src/usr.bin/xlint/lint1/tree.c:1.356
--- src/usr.bin/xlint/lint1/tree.c:1.355	Sat Aug 28 12:59:25 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sat Aug 28 13:11:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.355 2021/08/28 12:59:25 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.356 2021/08/28 13:11:10 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.355 2021/08/28 12:59:25 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.356 2021/08/28 13:11:10 rillig Exp $");
 #endif
 
 #include 
@@ -3145,7 +3145,7 @@ fold(tnode_t *tn)
 			warning(141, op_name(tn->tn_op));
 	}
 
-	v->v_quad = convert_integer(q, t, -1);
+	v->v_quad = convert_integer(q, t, 0);
 
 	cn = build_constant(tn->tn_type, v);
 	if (tn->tn_left->tn_system_dependent)



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 13:11:10 UTC 2021

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

Log Message:
lint: use 'unsigned int' for bit-size of types in convert_integer

There was no need to have two separate magic values (0 and -1) to mean
the same.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.71 -r1.72 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.355 -r1.356 src/usr.bin/xlint/lint1/tree.c

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



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 13:02:26 UTC 2021

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

Log Message:
lint: fix lint warning about initializing with negative number

No functional change.


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

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

Modified files:

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.25 src/usr.bin/xlint/common/inittyp.c:1.26
--- src/usr.bin/xlint/common/inittyp.c:1.25	Sun Aug 22 14:50:06 2021
+++ src/usr.bin/xlint/common/inittyp.c	Sat Aug 28 13:02:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inittyp.c,v 1.25 2021/08/22 14:50:06 rillig Exp $	*/
+/*	$NetBSD: inittyp.c,v 1.26 2021/08/28 13:02:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: inittyp.c,v 1.25 2021/08/22 14:50:06 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.26 2021/08/28 13:02:25 rillig Exp $");
 #endif
 
 #include 
@@ -122,19 +122,19 @@ inittyp(void)
 		typeinfo(LCOMPLEX, LCOMPLEX, LCOMPLEX,
 		LDOUBLE_SIZE * 2, 80 * 2,
 		0, 0, 1, 1, 1, 1, "long double _Complex"),
-		typeinfo(VOID, VOID, VOID, -1, -1,
+		typeinfo(VOID, VOID, VOID, 0, 0,
 		0, 0, 0, 0, 0, 0, "void"),
-		typeinfo(STRUCT, STRUCT, STRUCT, -1, -1,
+		typeinfo(STRUCT, STRUCT, STRUCT, 0, 0,
 		0, 0, 0, 0, 0, 0, "struct"),
-		typeinfo(UNION, UNION, UNION, -1, -1,
+		typeinfo(UNION, UNION, UNION, 0, 0,
 		0, 0, 0, 0, 0, 0, "union"),
 		typeinfo(ENUM, ENUM, ENUM, ENUM_SIZE, 24,
 		1, 0, 0, 1, 1, 0, "enum"),
 		typeinfo(PTR, PTR, PTR, PTR_SIZE, 32,
 		0, 1, 0, 0, 1, 0, "pointer"),
-		typeinfo(ARRAY, ARRAY, ARRAY, -1, -1,
+		typeinfo(ARRAY, ARRAY, ARRAY, 0, 0,
 		0, 0, 0, 0, 0, 0, "array"),
-		typeinfo(FUNC, FUNC, FUNC, -1, -1,
+		typeinfo(FUNC, FUNC, FUNC, 0, 0,
 		0, 0, 0, 0, 0, 0, "function"),
 #undef typeinfo
 	};



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 13:02:26 UTC 2021

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

Log Message:
lint: fix lint warning about initializing with negative number

No functional change.


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

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



CVS commit: src/usr.bin/xlint

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 12:59:26 UTC 2021

Modified Files:
src/usr.bin/xlint/common: lint.h
src/usr.bin/xlint/lint1: decl.c externs1.h mem1.c tree.c
src/usr.bin/xlint/lint2: mem2.c

Log Message:
lint: use 'unsigned int' for bit-size of types

Lint does not need to support any types larger than 256 MB since they
don't occur in practice.  Practically, such large types have never been
supported at all since the function type_size_in_bits used int for the
internal calculations, resulting in overflows.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.225 -r1.226 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.133 -r1.134 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.354 -r1.355 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.12 -r1.13 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.



CVS commit: src/usr.bin/xlint

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 12:59:26 UTC 2021

Modified Files:
src/usr.bin/xlint/common: lint.h
src/usr.bin/xlint/lint1: decl.c externs1.h mem1.c tree.c
src/usr.bin/xlint/lint2: mem2.c

Log Message:
lint: use 'unsigned int' for bit-size of types

Lint does not need to support any types larger than 256 MB since they
don't occur in practice.  Practically, such large types have never been
supported at all since the function type_size_in_bits used int for the
internal calculations, resulting in overflows.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.225 -r1.226 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.133 -r1.134 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/xlint/lint1/mem1.c
cvs rdiff -u -r1.354 -r1.355 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.12 -r1.13 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/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.29 src/usr.bin/xlint/common/lint.h:1.30
--- src/usr.bin/xlint/common/lint.h:1.29	Sun Aug 22 15:06:49 2021
+++ src/usr.bin/xlint/common/lint.h	Sat Aug 28 12:59:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.h,v 1.29 2021/08/22 15:06:49 rillig Exp $	*/
+/*	$NetBSD: lint.h,v 1.30 2021/08/28 12:59:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -92,9 +92,9 @@ typedef enum {
  * size of types, name and classification
  */
 typedef	struct {
-	size_t	tt_size_in_bits;
-	size_t	tt_portable_size_in_bits; /* different from tt_size_in_bits
-	 * if pflag is set */
+	unsigned int tt_size_in_bits;
+	unsigned int tt_portable_size_in_bits; /* different from
+	 * tt_size_in_bits if pflag is set */
 	tspec_t	tt_signed_counterpart;
 	tspec_t	tt_unsigned_counterpart;
 	bool	tt_is_integer : 1;	/* integer type */

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.225 src/usr.bin/xlint/lint1/decl.c:1.226
--- src/usr.bin/xlint/lint1/decl.c:1.225	Sat Aug 28 12:41:03 2021
+++ src/usr.bin/xlint/lint1/decl.c	Sat Aug 28 12:59:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.225 2021/08/28 12:41:03 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.226 2021/08/28 12:59:25 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.225 2021/08/28 12:41:03 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.226 2021/08/28 12:59:25 rillig Exp $");
 #endif
 
 #include 
@@ -581,7 +581,7 @@ setpackedsize(type_t *tp)
 if (mem == NULL)
 	break;
 			}
-			size_t x = (size_t)type_size_in_bits(mem->s_type);
+			unsigned int x = type_size_in_bits(mem->s_type);
 			if (tp->t_tspec == STRUCT)
 sp->sou_size_in_bits += x;
 			else if (x > sp->sou_size_in_bits)
@@ -1227,7 +1227,7 @@ declarator_1_struct_union(sym_t *dsym)
 	if (dsym->s_bitfield) {
 		align(alignment_in_bits(tp), tp->t_flen);
 		dsym->s_value.v_quad =
-		(dcs->d_offset / size_in_bits(t)) * size_in_bits(t);
+		dcs->d_offset - dcs->d_offset % size_in_bits(t);
 		tp->t_foffs = dcs->d_offset - (int)dsym->s_value.v_quad;
 		dcs->d_offset += tp->t_flen;
 	} else {
@@ -1852,7 +1852,7 @@ complete_tag_struct_or_union(type_t *tp,
 	break;
 			}
 			sp->sou_size_in_bits +=
-			(u_int)type_size_in_bits(mem->s_type);
+			type_size_in_bits(mem->s_type);
 		}
 		if (mem->s_name != unnamed)
 			n++;

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.133 src/usr.bin/xlint/lint1/externs1.h:1.134
--- src/usr.bin/xlint/lint1/externs1.h:1.133	Sat Aug 28 12:41:03 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Sat Aug 28 12:59:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.133 2021/08/28 12:41:03 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.134 2021/08/28 12:59:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -262,7 +262,7 @@ extern	void	check_expr_misc(const tnode_
 		bool, bool, bool);
 extern	bool	constant_addr(const tnode_t *, const sym_t **, ptrdiff_t *);
 extern	strg_t	*cat_strings(strg_t *, strg_t *);
-extern  int64_t type_size_in_bits(const type_t *);
+extern  unsigned int type_size_in_bits(const type_t *);
 
 /*
  * func.c

Index: src/usr.bin/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.49 src/usr.bin/xlint/lint1/mem1.c:1.50
--- src/usr.bin/xlint/lint1/mem1.c:1.49	Tue Aug 10 17:57:16 2021
+++ src/usr.bin/xlint/lint1/mem1.c	Sat Aug 28 12:59:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.49 2021/08/10 17:57:16 rillig Exp $	*/
+/*	$NetBSD: mem1.c,v 1.50 2021/08/28 12:59:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.49 2021/08/10 17:57:16 rillig Exp $");
+_

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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 12:41:03 UTC 2021

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

Log Message:
lint: fix a few lint warnings about type conversions

A simple 'unsigned int' is more than enough for representing the size of
a bit-field, as well as the maximum alignment of any type.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.224 -r1.225 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.132 -r1.133 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.126 -r1.127 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-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 12:41:03 UTC 2021

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

Log Message:
lint: fix a few lint warnings about type conversions

A simple 'unsigned int' is more than enough for representing the size of
a bit-field, as well as the maximum alignment of any type.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.224 -r1.225 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.132 -r1.133 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.126 -r1.127 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/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.224 src/usr.bin/xlint/lint1/decl.c:1.225
--- src/usr.bin/xlint/lint1/decl.c:1.224	Sat Aug 28 12:21:53 2021
+++ src/usr.bin/xlint/lint1/decl.c	Sat Aug 28 12:41:03 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.224 2021/08/28 12:21:53 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.225 2021/08/28 12:41:03 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.224 2021/08/28 12:21:53 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.225 2021/08/28 12:41:03 rillig Exp $");
 #endif
 
 #include 
@@ -552,15 +552,15 @@ settdsym(type_t *tp, sym_t *sym)
 	}
 }
 
-static size_t
+static unsigned int
 bitfieldsize(sym_t **mem)
 {
-	size_t len = (*mem)->s_type->t_flen;
+	unsigned int len = (*mem)->s_type->t_flen;
 	while (*mem != NULL && (*mem)->s_type->t_bitfield) {
 		len += (*mem)->s_type->t_flen;
 		*mem = (*mem)->s_next;
 	}
-	return ((len + INT_SIZE - 1) / INT_SIZE) * INT_SIZE;
+	return len - len % INT_SIZE;
 }
 
 static void
@@ -951,7 +951,7 @@ length(const type_t *tp, const char *nam
 	return elem * elsz;
 }
 
-int
+unsigned int
 alignment_in_bits(const type_t *tp)
 {
 	size_t	a;
@@ -1807,6 +1807,7 @@ storage_class_name(scl_t sc)
 	case ENUM_TAG:	return "enum";
 	default:	lint_assert(/*CONSTCOND*/false);
 	}
+	/* NOTREACHED */
 }
 
 /*
@@ -1826,7 +1827,7 @@ complete_tag_struct_or_union(type_t *tp,
 	setcomplete(tp, true);
 
 	t = tp->t_tspec;
-	align(dcs->d_sou_align_in_bits, 0);
+	align((u_int)dcs->d_sou_align_in_bits, 0);
 	sp = tp->t_str;
 	sp->sou_align_in_bits = dcs->d_sou_align_in_bits;
 	sp->sou_first_member = fmem;
@@ -1850,7 +1851,8 @@ complete_tag_struct_or_union(type_t *tp,
 if (mem == NULL)
 	break;
 			}
-			sp->sou_size_in_bits += type_size_in_bits(mem->s_type);
+			sp->sou_size_in_bits +=
+			(u_int)type_size_in_bits(mem->s_type);
 		}
 		if (mem->s_name != unnamed)
 			n++;

Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.132 src/usr.bin/xlint/lint1/externs1.h:1.133
--- src/usr.bin/xlint/lint1/externs1.h:1.132	Mon Aug 23 06:26:37 2021
+++ src/usr.bin/xlint/lint1/externs1.h	Sat Aug 28 12:41:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs1.h,v 1.132 2021/08/23 06:26:37 rillig Exp $	*/
+/*	$NetBSD: externs1.h,v 1.133 2021/08/28 12:41:03 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -187,7 +187,7 @@ extern	void	setasm(void);
 extern	void	begin_type(void);
 extern	void	end_type(void);
 extern	int	length(const type_t *, const char *);
-extern	int	alignment_in_bits(const type_t *);
+extern	unsigned int alignment_in_bits(const type_t *);
 extern	sym_t	*lnklst(sym_t *, sym_t *);
 extern	void	check_type(sym_t *);
 extern	sym_t	*declarator_1_struct_union(sym_t *);

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.126 src/usr.bin/xlint/lint1/lint1.h:1.127
--- src/usr.bin/xlint/lint1/lint1.h:1.126	Sat Aug 28 12:21:53 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Sat Aug 28 12:41:03 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.126 2021/08/28 12:21:53 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.127 2021/08/28 12:41:03 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -575,7 +575,7 @@ bit(unsigned i)
 static inline bool
 msb(int64_t q, tspec_t t)
 {
-	return (q & bit(size_in_bits(t) - 1)) != 0;
+	return (q & bit((unsigned int)size_in_bits(t) - 1)) != 0;
 }
 
 static inline uint64_t



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 12:29:40 UTC 2021

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

Log Message:
lint: remove redundant type casts from convert_constant_floating

Since tree.c 1.70 from 2012-03-27, lint has been using properly typed
constants for the min and max values, independent from the host
platform.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.353 -r1.354 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.353 src/usr.bin/xlint/lint1/tree.c:1.354
--- src/usr.bin/xlint/lint1/tree.c:1.353	Sat Aug 28 12:21:53 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sat Aug 28 12:29:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.353 2021/08/28 12:21:53 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.354 2021/08/28 12:29:40 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.353 2021/08/28 12:21:53 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.354 2021/08/28 12:29:40 rillig Exp $");
 #endif
 
 #include 
@@ -2215,15 +2215,15 @@ convert_constant_floating(op_t op, int a
 	case INT:
 		max = TARG_INT_MAX;	min = TARG_INT_MIN;	break;
 	case UINT:
-		max = (unsigned int)TARG_UINT_MAX; min = 0;	break;
+		max = TARG_UINT_MAX;	min = 0;		break;
 	case LONG:
 		max = TARG_LONG_MAX;	min = TARG_LONG_MIN;	break;
 	case ULONG:
-		max = (unsigned long)TARG_ULONG_MAX; min = 0;	break;
+		max = TARG_ULONG_MAX;	min = 0;		break;
 	case QUAD:
 		max = QUAD_MAX;		min = QUAD_MIN;		break;
 	case UQUAD:
-		max = (uint64_t)UQUAD_MAX; min = 0;		break;
+		max = UQUAD_MAX;	min = 0;		break;
 	case FLOAT:
 	case FCOMPLEX:
 		max = FLT_MAX;		min = -FLT_MAX;		break;



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 12:29:40 UTC 2021

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

Log Message:
lint: remove redundant type casts from convert_constant_floating

Since tree.c 1.70 from 2012-03-27, lint has been using properly typed
constants for the min and max values, independent from the host
platform.

No functional change.


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

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



CVS commit: src/usr.bin/xlint

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 12:21:53 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: decl.c emit1.c func.c lex.c lint1.h tree.c
src/usr.bin/xlint/lint2: hash.c lint2.h msg.c read.c

Log Message:
lint: un-abbreviate unsigned integer types

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.50 -r1.51 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.70 -r1.71 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.352 -r1.353 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/xlint/lint2/hash.c \
src/usr.bin/xlint/lint2/lint2.h
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/xlint/lint2/msg.c
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/xlint/lint2/read.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/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.223 src/usr.bin/xlint/lint1/decl.c:1.224
--- src/usr.bin/xlint/lint1/decl.c:1.223	Sat Aug 28 12:06:08 2021
+++ src/usr.bin/xlint/lint1/decl.c	Sat Aug 28 12:21:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.223 2021/08/28 12:06:08 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.224 2021/08/28 12:21:53 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.223 2021/08/28 12:06:08 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.224 2021/08/28 12:21:53 rillig Exp $");
 #endif
 
 #include 
@@ -64,7 +64,7 @@ dinfo_t	*dcs;
 
 static	type_t	*tdeferr(type_t *, tspec_t);
 static	void	settdsym(type_t *, sym_t *);
-static	void	align(u_int, u_int);
+static	void	align(unsigned int, unsigned int);
 static	sym_t	*newtag(sym_t *, scl_t, bool, bool);
 static	bool	eqargs(const type_t *, const type_t *, bool *);
 static	bool	mnoarg(const type_t *, bool *);
@@ -1180,7 +1180,7 @@ declarator_1_struct_union(sym_t *dsym)
 	type_t	*tp;
 	tspec_t	t;
 	int	sz;
-	u_int	o = 0;	/* Appease GCC */
+	unsigned int o = 0;	/* Appease GCC */
 
 	lint_assert(dsym->s_scl == MOS || dsym->s_scl == MOU);
 
@@ -1257,9 +1257,9 @@ declarator_1_struct_union(sym_t *dsym)
  * al contains the required alignment, len the length of a bit-field.
  */
 static void
-align(u_int al, u_int len)
+align(unsigned int al, unsigned int len)
 {
-	u_int no;
+	unsigned int no;
 
 	/*
 	 * The alignment of the current element becomes the alignment of

Index: src/usr.bin/xlint/lint1/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.50 src/usr.bin/xlint/lint1/emit1.c:1.51
--- src/usr.bin/xlint/lint1/emit1.c:1.50	Mon Aug 23 06:21:59 2021
+++ src/usr.bin/xlint/lint1/emit1.c	Sat Aug 28 12:21:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.50 2021/08/23 06:21:59 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.51 2021/08/28 12:21:53 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.50 2021/08/23 06:21:59 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.51 2021/08/28 12:21:53 rillig Exp $");
 #endif
 
 #include "lint1.h"
@@ -462,7 +462,7 @@ outfstrg(strg_t *strg)
 {
 	unsigned char c, oc;
 	bool	first;
-	u_char	*cp;
+	unsigned char *cp;
 
 	lint_assert(strg->st_tspec == CHAR);
 

Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.120 src/usr.bin/xlint/lint1/func.c:1.121
--- src/usr.bin/xlint/lint1/func.c:1.120	Sun Aug 22 13:52:19 2021
+++ src/usr.bin/xlint/lint1/func.c	Sat Aug 28 12:21:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: func.c,v 1.120 2021/08/22 13:52:19 rillig Exp $	*/
+/*	$NetBSD: func.c,v 1.121 2021/08/28 12:21:53 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.120 2021/08/22 13:52:19 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.121 2021/08/28 12:21:53 rillig Exp $");
 #endif
 
 #include 
@@ -541,7 +541,7 @@ check_case_label(tnode_t *tn, control_st
 	}
 	if (cl != NULL && is_uinteger(nv.v_tspec)) {
 		/* duplicate case in switch: %lu */
-		error(200, (u_long)nv.v_quad);
+		error(200, (unsigned long)nv.v_quad);
 	} else if (cl != NULL) {
 		/* duplicate case in switch: %ld */
 		error(199, (long)nv.v_quad);

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.70 src/usr.bin/xlint/lint1/lex.c:1.71
--- src/usr.bin/xlint/lint1/lex.c:1.70	Wed Aug 25 22:48:40 2021
+++ src/usr.bin/xlint/lint1/lex.c	Sat Aug 28 12:21:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.70 2021/08/25 22:48:40 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.71 2021/08/28 12:21:53 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@

CVS commit: src/usr.bin/xlint

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 12:21:53 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: decl.c emit1.c func.c lex.c lint1.h tree.c
src/usr.bin/xlint/lint2: hash.c lint2.h msg.c read.c

Log Message:
lint: un-abbreviate unsigned integer types

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.50 -r1.51 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.70 -r1.71 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.352 -r1.353 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/xlint/lint2/hash.c \
src/usr.bin/xlint/lint2/lint2.h
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/xlint/lint2/msg.c
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/xlint/lint2/read.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-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 12:06:09 UTC 2021

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

Log Message:
lint: clean up alignment_in_bits

The given type can never be NULL, and an array can never have NULL as
subtype.


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/usr.bin/xlint/lint1/decl.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/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.222 src/usr.bin/xlint/lint1/decl.c:1.223
--- src/usr.bin/xlint/lint1/decl.c:1.222	Mon Aug 16 06:49:56 2021
+++ src/usr.bin/xlint/lint1/decl.c	Sat Aug 28 12:06:08 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.222 2021/08/16 06:49:56 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.223 2021/08/28 12:06:08 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.222 2021/08/16 06:49:56 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.223 2021/08/28 12:06:08 rillig Exp $");
 #endif
 
 #include 
@@ -957,12 +957,9 @@ alignment_in_bits(const type_t *tp)
 	size_t	a;
 	tspec_t	t;
 
-	while (tp != NULL && tp->t_tspec == ARRAY)
+	while (tp->t_tspec == ARRAY)
 		tp = tp->t_subt;
 
-	if (tp == NULL)
-		return -1;
-
 	if ((t = tp->t_tspec) == STRUCT || t == UNION) {
 		a = tp->t_str->sou_align_in_bits;
 	} else if (t == FUNC) {



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

2021-08-28 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Aug 28 12:06:09 UTC 2021

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

Log Message:
lint: clean up alignment_in_bits

The given type can never be NULL, and an array can never have NULL as
subtype.


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/usr.bin/xlint/lint1/decl.c

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



CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2021-08-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 28 10:47:46 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_import.c

Log Message:
libzfs: Zero DIOCLWEDGES input before ioctl.

Otherwise we ask the kernel to write over whatever random pointer was
in the stack garbage here, when all we wanted was to learn whether
dkwl_nwedges is zero or nonzero.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c

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

Modified files:

Index: src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c
diff -u src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.6 src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.7
--- src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c:1.6	Sat Apr  4 13:45:22 2020
+++ src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c	Sat Aug 28 10:47:45 2021
@@ -1099,6 +1099,7 @@ zpool_open_func(void *arg)
 	off_t size;
 
 	/* skip devices with wedges */
+	memset(&dkwl, 0, sizeof(dkwl));
 	if (native_ioctl(fd, DIOCLWEDGES, &dkwl) == 0 &&
 	dkwl.dkwl_nwedges > 0) {
 		(void) close(fd);



CVS commit: src/external/cddl/osnet/dist/lib/libzfs/common

2021-08-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 28 10:47:46 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/lib/libzfs/common: libzfs_import.c

Log Message:
libzfs: Zero DIOCLWEDGES input before ioctl.

Otherwise we ask the kernel to write over whatever random pointer was
in the stack garbage here, when all we wanted was to learn whether
dkwl_nwedges is zero or nonzero.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.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/base64

2021-08-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 28 10:29:15 UTC 2021

Modified Files:
src/usr.bin/base64: base64.1

Log Message:
reflect reality.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/base64/base64.1

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/base64/base64.1
diff -u src/usr.bin/base64/base64.1:1.3 src/usr.bin/base64/base64.1:1.4
--- src/usr.bin/base64/base64.1:1.3	Thu Sep  3 05:41:21 2020
+++ src/usr.bin/base64/base64.1	Sat Aug 28 06:29:15 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: base64.1,v 1.3 2020/09/03 09:41:21 nia Exp $
+.\"	$NetBSD: base64.1,v 1.4 2021/08/28 10:29:15 christos Exp $
 .\"
 .\" Copyright (c) 2018 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd September 3, 2020
+.Dd August 28, 2021
 .Dt BASE64 1
 .Os
 .Sh NAME
@@ -50,7 +50,7 @@ The following options are available:
 .It Fl d
 Decode the input instead of encoding it.
 .It Fl i
-Ignore whitespace characters when decoding.
+Ignore non-base64 characters when decoding. (not implemented)
 .It Fl w Ar wrap
 Wrap lines longer than
 .Ar wrap



CVS commit: src/usr.bin/base64

2021-08-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 28 10:29:15 UTC 2021

Modified Files:
src/usr.bin/base64: base64.1

Log Message:
reflect reality.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/base64/base64.1

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



CVS commit: src/external/mit/xorg/server/drivers

2021-08-28 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sat Aug 28 08:56:10 UTC 2021

Modified Files:
src/external/mit/xorg/server/drivers: Makefile
Removed Files:
src/external/mit/xorg/server/drivers/xf86-video-modesetting: Makefile

Log Message:
Remove unused xf86-video-modesetting.

In newer xorg-server, it is integrated into the server
No users of old xorg-server use modesetting.

It requires drm drivers, but also, the sole possible user of old
xorg-server that could be handled by this Makefile is netwinder,
but it has a different ${MACHINE} and so seems like it never built the
driver.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/external/mit/xorg/server/drivers/Makefile
cvs rdiff -u -r1.2 -r0 \
src/external/mit/xorg/server/drivers/xf86-video-modesetting/Makefile

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

Modified files:

Index: src/external/mit/xorg/server/drivers/Makefile
diff -u src/external/mit/xorg/server/drivers/Makefile:1.102 src/external/mit/xorg/server/drivers/Makefile:1.103
--- src/external/mit/xorg/server/drivers/Makefile:1.102	Thu May 27 04:54:21 2021
+++ src/external/mit/xorg/server/drivers/Makefile	Sat Aug 28 08:56:10 2021
@@ -1,14 +1,7 @@
-#	$NetBSD: Makefile,v 1.102 2021/05/27 04:54:21 jdc Exp $
+#	$NetBSD: Makefile,v 1.103 2021/08/28 08:56:10 maya Exp $
 
 .include 
 
-# modesetting is builtin to xorg-server 1.18 tree
-.if ${XORG_SERVER_SUBDIR} == "xorg-server.old"
-MODE_SETTING=	xf86-video-modesetting
-.else
-MODE_SETTING=
-.endif
-
 # xf86-input drivers
 
 SUBDIR= \
@@ -44,7 +37,6 @@ SUBDIR+= \
 	xf86-video-intel \
 	xf86-video-mach64 \
 	xf86-video-mga \
-	${MODE_SETTING} \
 	xf86-video-neomagic \
 	xf86-video-nv \
 	xf86-video-nouveau \
@@ -181,7 +173,6 @@ SUBDIR+= \
 .if ${MACHINE} == "evbarm"
 SUBDIR+= \
 	xf86-video-ati \
-	${MODE_SETTING} \
 	xf86-video-nouveau \
 	xf86-video-radeon \
 	xf86-video-radeon-kms \



CVS commit: src/external/mit/xorg/server/drivers

2021-08-28 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sat Aug 28 08:56:10 UTC 2021

Modified Files:
src/external/mit/xorg/server/drivers: Makefile
Removed Files:
src/external/mit/xorg/server/drivers/xf86-video-modesetting: Makefile

Log Message:
Remove unused xf86-video-modesetting.

In newer xorg-server, it is integrated into the server
No users of old xorg-server use modesetting.

It requires drm drivers, but also, the sole possible user of old
xorg-server that could be handled by this Makefile is netwinder,
but it has a different ${MACHINE} and so seems like it never built the
driver.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/external/mit/xorg/server/drivers/Makefile
cvs rdiff -u -r1.2 -r0 \
src/external/mit/xorg/server/drivers/xf86-video-modesetting/Makefile

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