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

2023-07-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 12 20:13:28 UTC 2023

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

Log Message:
lint: reduce runtime relocations


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 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/usr.bin/xlint/lint1

2023-07-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 12 20:13:28 UTC 2023

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

Log Message:
lint: reduce runtime relocations


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 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.177 src/usr.bin/xlint/lint1/lex.c:1.178
--- src/usr.bin/xlint/lint1/lex.c:1.177	Wed Jul 12 18:26:04 2023
+++ src/usr.bin/xlint/lint1/lex.c	Wed Jul 12 20:13:28 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.177 2023/07/12 18:26:04 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.178 2023/07/12 20:13:28 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: lex.c,v 1.177 2023/07/12 18:26:04 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.178 2023/07/12 20:13:28 rillig Exp $");
 #endif
 
 #include 
@@ -96,7 +96,7 @@ bool in_system_header;
 
 /* During initialization, these keywords are written to the symbol table. */
 static const struct keyword {
-	const	char *kw_name;
+	const	char kw_name[20];
 	int	kw_token;	/* token to be returned by yylex() */
 	union {
 		bool kw_dummy;



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

2023-07-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 12 19:34:01 UTC 2023

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

Log Message:
lint: clean up handling of __real__ and __imag__

These two operatos are not binary, therefore they don't need a right
operand.  The questionable operands were a copy-and-paste mistake, as
the code was taken from the ++ and -- operands (tree.c 1.46 from
2008-04-25).  The ++ and -- operands aren't binary either, but since
lint represents address calculations in their premultiplied form, the
expression ptr++ contains a hidden right operand specifying the number
of bytes by which to increment the pointer.

Creating an integer-constant-expression node with type 'long double'
didn't make sense either.  Luckily, these expressions are only built but
not analyzed any further.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.560 -r1.561 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/debug.c
diff -u src/usr.bin/xlint/lint1/debug.c:1.51 src/usr.bin/xlint/lint1/debug.c:1.52
--- src/usr.bin/xlint/lint1/debug.c:1.51	Wed Jul 12 18:26:04 2023
+++ src/usr.bin/xlint/lint1/debug.c	Wed Jul 12 19:34:01 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.51 2023/07/12 18:26:04 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.52 2023/07/12 19:34:01 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: debug.c,v 1.51 2023/07/12 18:26:04 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.52 2023/07/12 19:34:01 rillig Exp $");
 #endif
 
 #include 
@@ -227,7 +227,7 @@ debug_node(const tnode_t *tn) // NOLINT(
 		debug_node(tn->tn_left);
 		if (op != INCBEF && op != INCAFT
 		&& op != DECBEF && op != DECAFT
-		&& op != CALL && op != PUSH)
+		&& op != CALL && op != ICALL && op != PUSH)
 			lint_assert(is_binary(tn) == (tn->tn_right != NULL));
 		if (tn->tn_right != NULL)
 			debug_node(tn->tn_right);

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.560 src/usr.bin/xlint/lint1/tree.c:1.561
--- src/usr.bin/xlint/lint1/tree.c:1.560	Mon Jul 10 19:47:12 2023
+++ src/usr.bin/xlint/lint1/tree.c	Wed Jul 12 19:34:01 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.560 2023/07/10 19:47:12 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.561 2023/07/12 19:34:01 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.560 2023/07/10 19:47:12 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.561 2023/07/12 19:34:01 rillig Exp $");
 #endif
 
 #include 
@@ -1391,19 +1391,16 @@ build_real_imag(op_t op, bool sys, tnode
 		mark_as_set(ln->tn_sym);
 	}
 
-	tnode_t *cn;
+	tspec_t t;
 	switch (ln->tn_type->t_tspec) {
 	case LCOMPLEX:
-		/* XXX: integer and LDOUBLE don't match. */
-		cn = build_integer_constant(LDOUBLE, (int64_t)1);
+		t = LDOUBLE;
 		break;
 	case DCOMPLEX:
-		/* XXX: integer and DOUBLE don't match. */
-		cn = build_integer_constant(DOUBLE, (int64_t)1);
+		t = DOUBLE;
 		break;
 	case FCOMPLEX:
-		/* XXX: integer and FLOAT don't match. */
-		cn = build_integer_constant(FLOAT, (int64_t)1);
+		t = FLOAT;
 		break;
 	default:
 		/* '__%s__' is illegal for type '%s' */
@@ -1412,7 +1409,7 @@ build_real_imag(op_t op, bool sys, tnode
 		return NULL;
 	}
 
-	tnode_t *ntn = new_tnode(op, sys, cn->tn_type, ln, cn);
+	tnode_t *ntn = new_tnode(op, sys, gettyp(t), ln, NULL);
 	ntn->tn_lvalue = true;
 	return ntn;
 }



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

2023-07-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 12 19:34:01 UTC 2023

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

Log Message:
lint: clean up handling of __real__ and __imag__

These two operatos are not binary, therefore they don't need a right
operand.  The questionable operands were a copy-and-paste mistake, as
the code was taken from the ++ and -- operands (tree.c 1.46 from
2008-04-25).  The ++ and -- operands aren't binary either, but since
lint represents address calculations in their premultiplied form, the
expression ptr++ contains a hidden right operand specifying the number
of bytes by which to increment the pointer.

Creating an integer-constant-expression node with type 'long double'
didn't make sense either.  Luckily, these expressions are only built but
not analyzed any further.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.560 -r1.561 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

2023-07-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 12 18:26:04 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: c11.c
src/usr.bin/xlint/lint1: cgram.y debug.c lex.c lint1.h

Log Message:
lint: reject _Noreturn if it occurs in invalid places

C11 introduced _Noreturn as a function-specifier, not as a type
attribute.  The latter may occur in more places.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/c11.c
cvs rdiff -u -r1.456 -r1.457 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.50 -r1.51 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.176 -r1.177 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.186 -r1.187 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/tests/usr.bin/xlint/lint1/c11.c
diff -u src/tests/usr.bin/xlint/lint1/c11.c:1.1 src/tests/usr.bin/xlint/lint1/c11.c:1.2
--- src/tests/usr.bin/xlint/lint1/c11.c:1.1	Wed Jul 12 18:13:39 2023
+++ src/tests/usr.bin/xlint/lint1/c11.c	Wed Jul 12 18:26:04 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: c11.c,v 1.1 2023/07/12 18:13:39 rillig Exp $	*/
+/*	$NetBSD: c11.c,v 1.2 2023/07/12 18:26:04 rillig Exp $	*/
 # 3 "c11.c"
 
 /*
@@ -11,9 +11,6 @@
 _Noreturn void exit(int);
 void _Noreturn exit(int);
 
-/* XXX: Syntactically invalid, yet lint accepts it. */
-void _Noreturn exit(int) _Noreturn;
-
 _Noreturn void
 noreturn_before_type(void)
 {
@@ -44,3 +41,10 @@ three_times(void)
 {
 	exit(0);
 }
+
+/* The '_Noreturn' must not appear after the declarator. */
+void _Noreturn exit(int) _Noreturn;
+/* expect-1: error: formal parameter #1 lacks name [59] */
+/* expect-2: warning: empty declaration [2] */
+/* expect+2: error: syntax error '' [249] */
+/* expect+1: error: cannot recover from previous errors [224] */

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.456 src/usr.bin/xlint/lint1/cgram.y:1.457
--- src/usr.bin/xlint/lint1/cgram.y:1.456	Wed Jul 12 16:07:35 2023
+++ src/usr.bin/xlint/lint1/cgram.y	Wed Jul 12 18:26:04 2023
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.456 2023/07/12 16:07:35 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.457 2023/07/12 18:26:04 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.456 2023/07/12 16:07:35 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.457 2023/07/12 18:26:04 rillig Exp $");
 #endif
 
 #include 
@@ -132,7 +132,7 @@ is_either(const char *s, const char *a, 
 
 %}
 
-%expect 132
+%expect 104
 
 %union {
 	val_t	*y_val;
@@ -223,7 +223,6 @@ is_either(const char *s, const char *a, 
 %token			T_REAL
 %token			T_IMAG
 %token			T_GENERIC
-%token			T_NORETURN
 
 /* storage classes (extern, static, auto, register and typedef) */
 %token			T_SCLASS
@@ -932,7 +931,6 @@ type_attribute:			/* See C11 6.7 declara
 |	T_PACKED {
 		dcs_add_packed();
 	}
-|	T_NORETURN
 ;
 
 begin_type:
@@ -1969,7 +1967,7 @@ for_exprs:			/* see C99 6.8.5 */
 		c99ism(325);
 		stmt_for_exprs(NULL, $6, $8);
 		clear_warning_flags();
-	}
+	}
 |	for_start
 	expression_opt T_SEMI
 	expression_opt T_SEMI

Index: src/usr.bin/xlint/lint1/debug.c
diff -u src/usr.bin/xlint/lint1/debug.c:1.50 src/usr.bin/xlint/lint1/debug.c:1.51
--- src/usr.bin/xlint/lint1/debug.c:1.50	Wed Jul 12 16:07:35 2023
+++ src/usr.bin/xlint/lint1/debug.c	Wed Jul 12 18:26:04 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.50 2023/07/12 16:07:35 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.51 2023/07/12 18:26:04 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: debug.c,v 1.50 2023/07/12 16:07:35 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.51 2023/07/12 18:26:04 rillig Exp $");
 #endif
 
 #include 
@@ -320,6 +320,7 @@ function_specifier_name(function_specifi
 {
 	static const char *const name[] = {
 		"inline",
+		"_Noreturn",
 	};
 
 	return name[spec];

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.176 src/usr.bin/xlint/lint1/lex.c:1.177
--- src/usr.bin/xlint/lint1/lex.c:1.176	Wed Jul 12 16:07:35 2023
+++ src/usr.bin/xlint/lint1/lex.c	Wed Jul 12 18:26:04 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.176 2023/07/12 16:07:35 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.177 2023/07/12 18:26:04 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: lex.c,v 1.176 2023/07/12 16:07:35 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.177 2023/07/12 18:26:04 rillig Exp $");
 #endif
 
 #include 
@@ -148,7 +148,7 @@ static const struct keyword {
 	kwdef_type(	"__int128_t",	INT128,			99),
 #endif
 	kwdef_type(	"long",		LONG,			78),
-	kwdef_token(	"_Noreturn",	T_NORETURN,		11,0,1),
+	kwdef("_Noreturn", T_FUNCTION_SPECIFIER, .u.kw_fs = 

CVS commit: src

2023-07-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 12 18:26:04 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: c11.c
src/usr.bin/xlint/lint1: cgram.y debug.c lex.c lint1.h

Log Message:
lint: reject _Noreturn if it occurs in invalid places

C11 introduced _Noreturn as a function-specifier, not as a type
attribute.  The latter may occur in more places.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/c11.c
cvs rdiff -u -r1.456 -r1.457 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.50 -r1.51 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.176 -r1.177 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.186 -r1.187 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

2023-07-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 12 18:13:40 UTC 2023

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

Log Message:
tests/lint: add test for _Noreturn from C11


To generate a diff of this commit:
cvs rdiff -u -r1.1275 -r1.1276 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/c11.c

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1275 src/distrib/sets/lists/tests/mi:1.1276
--- src/distrib/sets/lists/tests/mi:1.1275	Fri Jul  7 00:20:39 2023
+++ src/distrib/sets/lists/tests/mi	Wed Jul 12 18:13:39 2023
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1275 2023/07/07 00:20:39 rillig Exp $
+# $NetBSD: mi,v 1.1276 2023/07/12 18:13:39 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6506,6 +6506,7 @@
 ./usr/tests/usr.bin/xlint/lint1tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/Atffiletests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/Kyuafile			tests-usr.bin-tests	compattestfile,atf,kyua
+./usr/tests/usr.bin/xlint/lint1/c11.ctests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/c11_atomic.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/c11_generic_expression.c	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/c11_generic_expression.exp	tests-obsolete		obsolete,atf

Added files:

Index: src/tests/usr.bin/xlint/lint1/c11.c
diff -u /dev/null src/tests/usr.bin/xlint/lint1/c11.c:1.1
--- /dev/null	Wed Jul 12 18:13:40 2023
+++ src/tests/usr.bin/xlint/lint1/c11.c	Wed Jul 12 18:13:39 2023
@@ -0,0 +1,46 @@
+/*	$NetBSD: c11.c,v 1.1 2023/07/12 18:13:39 rillig Exp $	*/
+# 3 "c11.c"
+
+/*
+ * Test the language level C11, which adds _Generic expressions, _Noreturn
+ * functions, anonymous struct/union members, and several more.
+ */
+
+/* lint1-flags: -Ac11 -w -X 236 -X 351 */
+
+_Noreturn void exit(int);
+void _Noreturn exit(int);
+
+/* XXX: Syntactically invalid, yet lint accepts it. */
+void _Noreturn exit(int) _Noreturn;
+
+_Noreturn void
+noreturn_before_type(void)
+{
+	exit(0);
+}
+
+void _Noreturn
+noreturn_after_type(void)
+{
+	exit(0);
+}
+
+static _Noreturn void
+noreturn_after_storage_class(void)
+{
+	exit(0);
+}
+
+_Noreturn static void
+noreturn_before_storage_class(void)
+{
+	exit(0);
+}
+
+/* C11 6.7.4p5: A function specifier may appear more than once. */
+_Noreturn _Noreturn _Noreturn void
+three_times(void)
+{
+	exit(0);
+}



CVS commit: src

2023-07-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 12 18:13:40 UTC 2023

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

Log Message:
tests/lint: add test for _Noreturn from C11


To generate a diff of this commit:
cvs rdiff -u -r1.1275 -r1.1276 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/c11.c

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



CVS commit: src/doc

2023-07-12 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Wed Jul 12 16:07:52 UTC 2023

Modified Files:
src/doc: CHANGES.prev

Log Message:
CHANGES.prev: correct date entries for a few items


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/doc/CHANGES.prev

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

Modified files:

Index: src/doc/CHANGES.prev
diff -u src/doc/CHANGES.prev:1.171 src/doc/CHANGES.prev:1.172
--- src/doc/CHANGES.prev:1.171	Sat Jun 24 05:26:40 2023
+++ src/doc/CHANGES.prev	Wed Jul 12 16:07:52 2023
@@ -1,4 +1,4 @@
-LIST OF CHANGES FROM PREVIOUS RELEASES:			<$Revision: 1.171 $>
+LIST OF CHANGES FROM PREVIOUS RELEASES:			<$Revision: 1.172 $>
 
 
 Changes from 386bsd 0.1 + patchkit 0.2.2 to NetBSD 0.8:
@@ -12876,11 +12876,9 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	file(1): Upgraded to 5.39. [christos 20200614]
 	blocklist: import current version [christos 20200614]
 	dhcpcd: Import version 9.1.2 [roy 20200615]
-	evbmips: Create an "octeon.img.gz" bootable image for
-		evbmips64-eb release builds. [jmcneill 20200617]
 	evbarm: Add support for loading modules with the bootloader.
-		[jmcneill 20200221]
-	evbarm: Added boot.cfg support to efiboot [jmcneill 20200211]
+		[jmcneill 20200621]
+	evbarm: Added boot.cfg support to efiboot [jmcneill 20200621]
 	evbmips: Add ofctl(8) and /dev/openfirm support for Cavium
 		Octeon devices. [jmcneill 20200624]
 	mv(1): Add -h option to atomically replace a symlink to a
@@ -12916,6 +12914,8 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 		ERLITE -> OCTEON
 		INSTALL_ERLITE -> INSTALL_OCTEON
 		[simonb 20200715]
+	evbmips: Create an "octeon.img.gz" bootable image for
+		evbmips64-eb release builds. [jmcneill 20200717]
 	libc: Added ppoll() wrapper around native pollts(2) [kamil 20200717]
 	openresolv: Import version 3.11.0 [roy 20200722]
 	sun3: Add Xorg-Server-1.20'fied ancient monolithc Xsun servers.



CVS commit: src/doc

2023-07-12 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Wed Jul 12 16:07:52 UTC 2023

Modified Files:
src/doc: CHANGES.prev

Log Message:
CHANGES.prev: correct date entries for a few items


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/doc/CHANGES.prev

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



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

2023-07-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 12 16:07:35 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: cgram.y debug.c decl.c externs1.h lex.c
lint1.h

Log Message:
lint: don't treat 'inline' as a storage class

The additional conflict in the grammar is in the same place as the other
conflicts, as T_SCLASS and T_FUNCTION_SPECIFIER are now separate tokens.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.455 -r1.456 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.348 -r1.349 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.190 -r1.191 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.175 -r1.176 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.185 -r1.186 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/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.455 src/usr.bin/xlint/lint1/cgram.y:1.456
--- src/usr.bin/xlint/lint1/cgram.y:1.455	Wed Jul 12 13:00:09 2023
+++ src/usr.bin/xlint/lint1/cgram.y	Wed Jul 12 16:07:35 2023
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.455 2023/07/12 13:00:09 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.456 2023/07/12 16:07:35 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.455 2023/07/12 13:00:09 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.456 2023/07/12 16:07:35 rillig Exp $");
 #endif
 
 #include 
@@ -132,7 +132,7 @@ is_either(const char *s, const char *a, 
 
 %}
 
-%expect 131
+%expect 132
 
 %union {
 	val_t	*y_val;
@@ -142,6 +142,7 @@ is_either(const char *s, const char *a, 
 	scl_t	y_scl;
 	tspec_t	y_tspec;
 	tqual_t	y_tqual;
+	function_specifier y_function_specifier;
 	type_t	*y_type;
 	tnode_t	*y_tnode;
 	range_t	y_range;
@@ -166,6 +167,9 @@ is_either(const char *s, const char *a, 
 %printer { fprintf(yyo, "%s", scl_name($$)); } 
 %printer { fprintf(yyo, "%s", tspec_name($$)); } 
 %printer { fprintf(yyo, "%s", tqual_name($$)); } 
+%printer {
+	fprintf(yyo, "%s", function_specifier_name($$));
+} 
 %printer { fprintf(yyo, "%s", type_name($$)); } 
 %printer {
 	if ($$ == NULL)
@@ -223,6 +227,7 @@ is_either(const char *s, const char *a, 
 
 /* storage classes (extern, static, auto, register and typedef) */
 %token			T_SCLASS
+%token	 T_FUNCTION_SPECIFIER
 
 /*
  * predefined type keywords (char, int, short, long, unsigned, signed,
@@ -847,6 +852,9 @@ begin_type_declmods:		/* see C99 6.7 */
 |	begin_type T_SCLASS {
 		dcs_add_storage_class($2);
 	}
+|	begin_type T_FUNCTION_SPECIFIER {
+		dcs_add_function_specifier($2);
+	}
 |	begin_type_declmods declmod
 ;
 
@@ -896,6 +904,9 @@ declmod:
 |	T_SCLASS {
 		dcs_add_storage_class($1);
 	}
+|	T_FUNCTION_SPECIFIER {
+		dcs_add_function_specifier($1);
+	}
 |	type_attribute_list
 ;
 
@@ -2251,6 +2262,8 @@ cgram_to_string(int token, YYSTYPE val)
 		return tspec_name(val.y_tspec);
 	case T_QUAL:
 		return tqual_name(val.y_tqual);
+	case T_FUNCTION_SPECIFIER:
+		return function_specifier_name(val.y_function_specifier);
 	case T_NAME:
 		return val.y_name->sb_name;
 	default:

Index: src/usr.bin/xlint/lint1/debug.c
diff -u src/usr.bin/xlint/lint1/debug.c:1.49 src/usr.bin/xlint/lint1/debug.c:1.50
--- src/usr.bin/xlint/lint1/debug.c:1.49	Mon Jul 10 19:47:12 2023
+++ src/usr.bin/xlint/lint1/debug.c	Wed Jul 12 16:07:35 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.49 2023/07/10 19:47:12 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.50 2023/07/12 16:07:35 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: debug.c,v 1.49 2023/07/10 19:47:12 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.50 2023/07/12 16:07:35 rillig Exp $");
 #endif
 
 #include 
@@ -227,7 +227,7 @@ debug_node(const tnode_t *tn) // NOLINT(
 		debug_node(tn->tn_left);
 		if (op != INCBEF && op != INCAFT
 		&& op != DECBEF && op != DECAFT
-		&& op != PUSH)
+		&& op != CALL && op != PUSH)
 			lint_assert(is_binary(tn) == (tn->tn_right != NULL));
 		if (tn->tn_right != NULL)
 			debug_node(tn->tn_right);
@@ -283,7 +283,6 @@ scl_name(scl_t scl)
 		"abstract",
 		"old-style-function-argument",
 		"prototype-argument",
-		"inline",
 	};
 
 	return name[scl];
@@ -316,6 +315,16 @@ tqual_name(tqual_t qual)
 	return name[qual];
 }
 
+const char *
+function_specifier_name(function_specifier spec)
+{
+	static const char *const name[] = {
+		"inline",
+	};
+
+	return name[spec];
+}
+
 static void
 debug_word(bool flag, const char *name)
 {
@@ -380,10 +389,13 @@ debug_sym(const char *prefix, const sym_
 		int t = sym->u.s_keyword.sk_token;
 		if (t == T_TYPE || t == T_STRUCT_OR_UNION)
 			debug_printf(" %s",
-			tspec_name(sym->u.s_keyword.sk_tspec));
+			

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

2023-07-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 12 16:07:35 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: cgram.y debug.c decl.c externs1.h lex.c
lint1.h

Log Message:
lint: don't treat 'inline' as a storage class

The additional conflict in the grammar is in the same place as the other
conflicts, as T_SCLASS and T_FUNCTION_SPECIFIER are now separate tokens.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.455 -r1.456 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.348 -r1.349 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.190 -r1.191 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.175 -r1.176 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.185 -r1.186 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

2023-07-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 12 13:00:09 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: indent grammar using tabs instead of spaces

Manually indenting the grammar rules using two spaces was too
cumbersome.


To generate a diff of this commit:
cvs rdiff -u -r1.454 -r1.455 src/usr.bin/xlint/lint1/cgram.y

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/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.454 src/usr.bin/xlint/lint1/cgram.y:1.455
--- src/usr.bin/xlint/lint1/cgram.y:1.454	Tue Jul 11 21:13:36 2023
+++ src/usr.bin/xlint/lint1/cgram.y	Wed Jul 12 13:00:09 2023
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.454 2023/07/11 21:13:36 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.455 2023/07/12 13:00:09 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.454 2023/07/11 21:13:36 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.455 2023/07/12 13:00:09 rillig Exp $");
 #endif
 
 #include 
@@ -425,7 +425,7 @@ is_either(const char *s, const char *a, 
 %%
 
 program:
-	  /* empty */ {
+	/* empty */ {
 		/* TODO: Make this an error in C99 mode as well. */
 		if (!allow_trad && !allow_c99) {
 			/* empty translation unit */
@@ -434,43 +434,43 @@ program:
 			/* empty translation unit */
 			warning(272);
 		}
-	  }
-	| translation_unit
-	;
+	}
+|	translation_unit
+;
 
 identifier_sym:			/* helper for struct/union/enum */
-	  identifier {
+	identifier {
 		$$ = getsym($1);
-	  }
-	;
+	}
+;
 
 /* K ???, C90 ???, C99 6.4.2.1, C11 ??? */
 identifier:
-	  T_NAME {
+	T_NAME {
 		debug_step("cgram: name '%s'", $1->sb_name);
 		$$ = $1;
-	  }
-	| T_TYPENAME {
+	}
+|	T_TYPENAME {
 		debug_step("cgram: typename '%s'", $1->sb_name);
 		$$ = $1;
-	  }
-	;
+	}
+;
 
 /* see C99 6.4.5, string literals are joined by 5.1.1.2 */
 string:
-	  T_STRING
-	| string T_STRING {
+	T_STRING
+|	string T_STRING {
 		if (!allow_c90) {
 			/* concatenated strings are illegal in traditional C */
 			warning(219);
 		}
 		$$ = cat_strings($1, $2);
-	  }
-	;
+	}
+;
 
 /* K 7.1, C90 ???, C99 6.5.1, C11 6.5.1 */
 primary_expression:
-	  T_NAME {
+	T_NAME {
 		bool sys_name, sys_next;
 		sys_name = in_system_header;
 		if (yychar < 0)
@@ -479,102 +479,102 @@ primary_expression:
 		in_system_header = sys_name;
 		$$ = build_name(getsym($1), yychar == T_LPAREN);
 		in_system_header = sys_next;
-	  }
-	| T_CON {
+	}
+|	T_CON {
 		$$ = build_constant(gettyp($1->v_tspec), $1);
-	  }
-	| string {
+	}
+|	string {
 		$$ = build_string($1);
-	  }
-	| T_LPAREN expression T_RPAREN {
+	}
+|	T_LPAREN expression T_RPAREN {
 		if ($2 != NULL)
 			$2->tn_parenthesized = true;
 		$$ = $2;
-	  }
-	| generic_selection
+	}
+|	generic_selection
 	/* GCC primary-expression, see c_parser_postfix_expression */
 	/* TODO: C99 7.17p3 allows not only an identifier but a designator. */
-	| T_BUILTIN_OFFSETOF T_LPAREN type_name T_COMMA identifier T_RPAREN {
+|	T_BUILTIN_OFFSETOF T_LPAREN type_name T_COMMA identifier T_RPAREN {
 		set_symtyp(FMEMBER);
 		$$ = build_offsetof($3, getsym($5));
-	  }
-	;
+	}
+;
 
 /* K ---, C90 ---, C99 ---, C11 6.5.1.1 */
 generic_selection:
-	  T_GENERIC T_LPAREN assignment_expression T_COMMA
+	T_GENERIC T_LPAREN assignment_expression T_COMMA
 	generic_assoc_list T_RPAREN {
 		/* generic selection requires C11 or later */
 		c11ism(345);
 		$$ = build_generic_selection($3, $5);
-	  }
-	;
+	}
+;
 
 /* K ---, C90 ---, C99 ---, C11 6.5.1.1 */
 generic_assoc_list:
-	  generic_association
-	| generic_assoc_list T_COMMA generic_association {
+	generic_association
+|	generic_assoc_list T_COMMA generic_association {
 		$3->ga_prev = $1;
 		$$ = $3;
-	  }
-	;
+	}
+;
 
 /* K ---, C90 ---, C99 ---, C11 6.5.1.1 */
 generic_association:
-	  type_name T_COLON assignment_expression {
+	type_name T_COLON assignment_expression {
 		$$ = block_zero_alloc(sizeof(*$$));
 		$$->ga_arg = $1;
 		$$->ga_result = $3;
-	  }
-	| T_DEFAULT T_COLON assignment_expression {
+	}
+|	T_DEFAULT T_COLON assignment_expression {
 		$$ = block_zero_alloc(sizeof(*$$));
 		$$->ga_arg = NULL;
 		$$->ga_result = $3;
-	  }
-	;
+	}
+;
 
 /* K 7.1, C90 ???, C99 6.5.2, C11 6.5.2, C23 6.5.2 */
 postfix_expression:
-	  primary_expression
-	| postfix_expression T_LBRACK sys expression T_RBRACK {
+	primary_expression
+|	postfix_expression T_LBRACK sys expression T_RBRACK {
 		$$ = build_unary(INDIR, $3, build_binary($1, PLUS, $3, $4));
-	  }
-	| postfix_expression T_LPAREN sys T_RPAREN {
+	}
+|	postfix_expression T_LPAREN sys T_RPAREN {
 		$$ = build_function_call($1, $3, NULL);
-	  }
-	| postfix_expression T_LPAREN sys argument_expression_list T_RPAREN {
+	}
+|	postfix_expression T_LPAREN sys argument_expression_list T_RPAREN {
 		$$ = build_function_call($1, $3, $4);
-	  }
-	| 

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

2023-07-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 12 13:00:09 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: indent grammar using tabs instead of spaces

Manually indenting the grammar rules using two spaces was too
cumbersome.


To generate a diff of this commit:
cvs rdiff -u -r1.454 -r1.455 src/usr.bin/xlint/lint1/cgram.y

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



CVS commit: src/sys/ddb

2023-07-12 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 12 12:50:46 UTC 2023

Modified Files:
src/sys/ddb: db_syncobj.c

Log Message:
ddb: Cast pointer to uintptr_t, then to db_expr_t.

Avoids warnings about conversion between pointer and integer of
different size on some architectures.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/ddb/db_syncobj.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/ddb/db_syncobj.c
diff -u src/sys/ddb/db_syncobj.c:1.1 src/sys/ddb/db_syncobj.c:1.2
--- src/sys/ddb/db_syncobj.c:1.1	Sun Jul  9 17:10:47 2023
+++ src/sys/ddb/db_syncobj.c	Wed Jul 12 12:50:46 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_syncobj.c,v 1.1 2023/07/09 17:10:47 riastradh Exp $	*/
+/*	$NetBSD: db_syncobj.c,v 1.2 2023/07/12 12:50:46 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
 #define	__RWLOCK_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_syncobj.c,v 1.1 2023/07/09 17:10:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_syncobj.c,v 1.2 2023/07/12 12:50:46 riastradh Exp $");
 
 #include 
 
@@ -48,7 +48,7 @@ db_syncobj_owner(struct syncobj *sobj, w
 	db_expr_t rw_syncobj_;
 
 	if (db_value_of_name("mutex_syncobj", _syncobj_) &&
-	(db_expr_t)sobj == mutex_syncobj_) {
+	(db_expr_t)(uintptr_t)sobj == mutex_syncobj_) {
 		volatile const struct kmutex *mtx = wchan;
 		uintptr_t owner;
 
@@ -57,7 +57,7 @@ db_syncobj_owner(struct syncobj *sobj, w
 		return (struct lwp *)(owner & MUTEX_THREAD);
 
 	} else if (db_value_of_name("rw_syncobj", _syncobj_) &&
-	(db_expr_t)sobj == rw_syncobj_) {
+	(db_expr_t)(uintptr_t)sobj == rw_syncobj_) {
 		volatile const struct krwlock *rw = wchan;
 		uintptr_t owner;
 



CVS commit: src/sys/ddb

2023-07-12 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 12 12:50:46 UTC 2023

Modified Files:
src/sys/ddb: db_syncobj.c

Log Message:
ddb: Cast pointer to uintptr_t, then to db_expr_t.

Avoids warnings about conversion between pointer and integer of
different size on some architectures.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/ddb/db_syncobj.c

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



CVS commit: src/sys/arch

2023-07-12 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 12 12:50:13 UTC 2023

Modified Files:
src/sys/arch/alpha/include: mutex.h
src/sys/arch/arm/include: mutex.h
src/sys/arch/hppa/include: mutex.h
src/sys/arch/ia64/include: mutex.h
src/sys/arch/m68k/include: mutex.h
src/sys/arch/mips/include: mutex.h
src/sys/arch/or1k/include: mutex.h
src/sys/arch/powerpc/include: mutex.h
src/sys/arch/riscv/include: mutex.h
src/sys/arch/sh3/include: mutex.h
src/sys/arch/sparc/include: mutex.h
src/sys/arch/sparc64/include: mutex.h
src/sys/arch/usermode/include: mutex.h
src/sys/arch/vax/include: mutex.h
src/sys/arch/x86/include: mutex.h

Log Message:
machine/mutex.h: Sprinkle sys/types.h, omit machine/lock.h.

Turns out machine/lock.h is not needed for __cpu_simple_lock_t, which
always comes from sys/types.h.  And, really, sys/types.h (or at least
sys/stdint.h) is needed for uintN_t and uintptr_t.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/include/mutex.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/include/mutex.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hppa/include/mutex.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/ia64/include/mutex.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/m68k/include/mutex.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/include/mutex.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/or1k/include/mutex.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/include/mutex.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/include/mutex.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sh3/include/mutex.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/include/mutex.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc64/include/mutex.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/include/mutex.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/vax/include/mutex.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/include/mutex.h

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

Modified files:

Index: src/sys/arch/alpha/include/mutex.h
diff -u src/sys/arch/alpha/include/mutex.h:1.12 src/sys/arch/alpha/include/mutex.h:1.13
--- src/sys/arch/alpha/include/mutex.h:1.12	Sun Jul  9 17:03:09 2023
+++ src/sys/arch/alpha/include/mutex.h	Wed Jul 12 12:50:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.12 2023/07/09 17:03:09 riastradh Exp $	*/
+/*	$NetBSD: mutex.h,v 1.13 2023/07/12 12:50:12 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007 The NetBSD Foundation, Inc.
@@ -32,6 +32,8 @@
 #ifndef _ALPHA_MUTEX_H_
 #define	_ALPHA_MUTEX_H_
 
+#include 
+
 #ifndef __MUTEX_PRIVATE
 
 struct kmutex {
@@ -41,7 +43,6 @@ struct kmutex {
 #else	/* __MUTEX_PRIVATE */
 
 #include 
-#include 
 
 struct kmutex {
 	union {

Index: src/sys/arch/arm/include/mutex.h
diff -u src/sys/arch/arm/include/mutex.h:1.28 src/sys/arch/arm/include/mutex.h:1.29
--- src/sys/arch/arm/include/mutex.h:1.28	Tue Jul 11 10:41:58 2023
+++ src/sys/arch/arm/include/mutex.h	Wed Jul 12 12:50:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.28 2023/07/11 10:41:58 riastradh Exp $	*/
+/*	$NetBSD: mutex.h,v 1.29 2023/07/12 12:50:12 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -32,9 +32,10 @@
 #ifndef _ARM_MUTEX_H_
 #define	_ARM_MUTEX_H_
 
+#include 
+
 #ifdef _KERNEL
 #include 
-#include 
 #endif
 
 /*

Index: src/sys/arch/hppa/include/mutex.h
diff -u src/sys/arch/hppa/include/mutex.h:1.17 src/sys/arch/hppa/include/mutex.h:1.18
--- src/sys/arch/hppa/include/mutex.h:1.17	Wed Jul 12 06:45:24 2023
+++ src/sys/arch/hppa/include/mutex.h	Wed Jul 12 12:50:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.17 2023/07/12 06:45:24 mrg Exp $	*/
+/*	$NetBSD: mutex.h,v 1.18 2023/07/12 12:50:12 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -42,9 +42,10 @@
 
 #ifndef __ASSEMBLER__
 
+#include 
+
 #ifdef __MUTEX_PRIVATE
 #include 
-#include 
 #endif
 
 struct kmutex {

Index: src/sys/arch/ia64/include/mutex.h
diff -u src/sys/arch/ia64/include/mutex.h:1.8 src/sys/arch/ia64/include/mutex.h:1.9
--- src/sys/arch/ia64/include/mutex.h:1.8	Sun Jul  9 17:03:09 2023
+++ src/sys/arch/ia64/include/mutex.h	Wed Jul 12 12:50:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.8 2023/07/09 17:03:09 riastradh Exp $	*/
+/*	$NetBSD: mutex.h,v 1.9 2023/07/12 12:50:12 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -32,6 +32,8 @@
 #ifndef _IA64_MUTEX_H_
 #define	_IA64_MUTEX_H_
 
+#include 
+
 #ifndef __MUTEX_PRIVATE
 
 struct kmutex {
@@ -42,7 +44,6 @@ struct kmutex {
 #else
 
 #include 
-#include 
 
 struct kmutex {
 	volatile uintptr_t	mtx_owner;

Index: src/sys/arch/m68k/include/mutex.h
diff -u src/sys/arch/m68k/include/mutex.h:1.12 src/sys/arch/m68k/include/mutex.h:1.13
--- src/sys/arch/m68k/include/mutex.h:1.12	Sun Jul  9 17:03:09 2023
+++ src/sys/arch/m68k/include/mutex.h	Wed Jul 12 12:50:12 2023
@@ 

CVS commit: src/sys/arch

2023-07-12 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul 12 12:50:13 UTC 2023

Modified Files:
src/sys/arch/alpha/include: mutex.h
src/sys/arch/arm/include: mutex.h
src/sys/arch/hppa/include: mutex.h
src/sys/arch/ia64/include: mutex.h
src/sys/arch/m68k/include: mutex.h
src/sys/arch/mips/include: mutex.h
src/sys/arch/or1k/include: mutex.h
src/sys/arch/powerpc/include: mutex.h
src/sys/arch/riscv/include: mutex.h
src/sys/arch/sh3/include: mutex.h
src/sys/arch/sparc/include: mutex.h
src/sys/arch/sparc64/include: mutex.h
src/sys/arch/usermode/include: mutex.h
src/sys/arch/vax/include: mutex.h
src/sys/arch/x86/include: mutex.h

Log Message:
machine/mutex.h: Sprinkle sys/types.h, omit machine/lock.h.

Turns out machine/lock.h is not needed for __cpu_simple_lock_t, which
always comes from sys/types.h.  And, really, sys/types.h (or at least
sys/stdint.h) is needed for uintN_t and uintptr_t.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/include/mutex.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/include/mutex.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hppa/include/mutex.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/ia64/include/mutex.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/m68k/include/mutex.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/include/mutex.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/or1k/include/mutex.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/include/mutex.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/include/mutex.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sh3/include/mutex.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/include/mutex.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc64/include/mutex.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/include/mutex.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/vax/include/mutex.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/include/mutex.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

2023-07-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 12 10:08:12 UTC 2023

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

Log Message:
lint: condense keyword table

This prepares for modelling 'inline' not as a storage class, but more
correctly as a function specifier.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 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.174 src/usr.bin/xlint/lint1/lex.c:1.175
--- src/usr.bin/xlint/lint1/lex.c:1.174	Mon Jul 10 19:00:33 2023
+++ src/usr.bin/xlint/lint1/lex.c	Wed Jul 12 10:08:11 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.174 2023/07/10 19:00:33 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.175 2023/07/12 10:08:11 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: lex.c,v 1.174 2023/07/10 19:00:33 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.175 2023/07/12 10:08:11 rillig Exp $");
 #endif
 
 #include 
@@ -75,33 +75,36 @@ bool in_system_header;
  * not defined, it would be interpreted as an implicit function call, leading
  * to a parse error.
  */
-#define kwdef(name, token, scl, tspec, tqual,	since, gcc, deco) \
+#define kwdef(name, token, detail,	since, gcc, deco) \
 	{ \
-		name, token, scl, tspec, tqual, \
+		name, token, detail, \
 		(since) == 90, \
 		/* CONSTCOND */ (since) == 99 || (since) == 11, \
 		(gcc) > 0, \
 		((deco) & 1) != 0, ((deco) & 2) != 0, ((deco) & 4) != 0, \
 	}
 #define kwdef_token(name, token,		since, gcc, deco) \
-	kwdef(name, token, 0, 0, 0,		since, gcc, deco)
+	kwdef(name, token, {false},		since, gcc, deco)
 #define kwdef_sclass(name, sclass,		since, gcc, deco) \
-	kwdef(name, T_SCLASS, sclass, 0, 0,	since, gcc, deco)
+	kwdef(name, T_SCLASS, .u.kw_scl = (sclass), since, gcc, deco)
 #define kwdef_type(name, tspec,			since) \
-	kwdef(name, T_TYPE, 0, tspec, 0,	since, 0, 1)
+	kwdef(name, T_TYPE, .u.kw_tspec = (tspec), since, 0, 1)
 #define kwdef_tqual(name, tqual,		since, gcc, deco) \
-	kwdef(name, T_QUAL, 0, 0, tqual,	since, gcc, deco)
+	kwdef(name, T_QUAL, .u.kw_tqual = (tqual), since, gcc, deco)
 #define kwdef_keyword(name, token) \
-	kwdef(name, token, 0, 0, 0,		78, 0, 1)
+	kwdef(name, token, {false},		78, 0, 1)
 
 /* During initialization, these keywords are written to the symbol table. */
 static const struct keyword {
 	const	char *kw_name;
 	int	kw_token;	/* token returned by yylex() */
-	scl_t	kw_scl;		/* storage class if kw_token is T_SCLASS */
-	tspec_t	kw_tspec;	/* type specifier if kw_token is T_TYPE or
- * T_STRUCT_OR_UNION */
-	tqual_t	kw_tqual;	/* type qualifier if kw_token is T_QUAL */
+	union {
+		bool kw_dummy;
+		scl_t kw_scl;		/* if kw_token is T_SCLASS */
+		tspec_t kw_tspec;	/* if kw_token is T_TYPE or
+	 * T_STRUCT_OR_UNION */
+		tqual_t kw_tqual;	/* if kw_token is T_QUAL */
+	} u;
 	bool	kw_c90:1;	/* available in C90 mode */
 	bool	kw_c99_or_c11:1; /* available in C99 or C11 mode */
 	bool	kw_gcc:1;	/* available in GCC mode */
@@ -150,11 +153,11 @@ static const struct keyword {
 	kwdef_tqual(	"restrict",	RESTRICT,		99,0,7),
 	kwdef_keyword(	"return",	T_RETURN),
 	kwdef_type(	"short",	SHORT,			78),
-	kwdef(		"signed",	T_TYPE, 0, SIGNED, 0,	90,0,3),
+	kwdef(		"signed", T_TYPE, .u.kw_tspec = SIGNED,	90,0,3),
 	kwdef_keyword(	"sizeof",	T_SIZEOF),
 	kwdef_sclass(	"static",	STATIC,			78,0,1),
 	kwdef_keyword(	"_Static_assert",	T_STATIC_ASSERT),
-	kwdef("struct",	T_STRUCT_OR_UNION, 0,	STRUCT,	0,	78,0,1),
+	kwdef("struct",	T_STRUCT_OR_UNION, .u.kw_tspec = STRUCT, 78,0,1),
 	kwdef_keyword(	"switch",	T_SWITCH),
 	kwdef_token(	"__symbolrename",	T_SYMBOLRENAME,	78,0,1),
 	kwdef_tqual(	"__thread",	THREAD,			78,1,1),
@@ -165,7 +168,7 @@ static const struct keyword {
 #ifdef INT128_SIZE
 	kwdef_type(	"__uint128_t",	UINT128,		99),
 #endif
-	kwdef("union",	T_STRUCT_OR_UNION, 0,	UNION,	0,	78,0,1),
+	kwdef("union",	T_STRUCT_OR_UNION, .u.kw_tspec = UNION,	78,0,1),
 	kwdef_type(	"unsigned",	UNSIGN,			78),
 	kwdef_type(	"void",		VOID,			78),
 	kwdef_tqual(	"volatile",	VOLATILE,		90,0,7),
@@ -345,11 +348,11 @@ add_keyword(const struct keyword *kw, bo
 	int tok = kw->kw_token;
 	sym->u.s_keyword.sk_token = tok;
 	if (tok == T_TYPE || tok == T_STRUCT_OR_UNION)
-		sym->u.s_keyword.sk_tspec = kw->kw_tspec;
+		sym->u.s_keyword.sk_tspec = kw->u.kw_tspec;
 	if (tok == T_SCLASS)
-		sym->s_scl = kw->kw_scl;
+		sym->s_scl = kw->u.kw_scl;
 	if (tok == T_QUAL)
-		sym->u.s_keyword.sk_qualifier = kw->kw_tqual;
+		sym->u.s_keyword.sk_qualifier = kw->u.kw_tqual;
 
 	symtab_add(sym);
 }



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

2023-07-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 12 10:08:12 UTC 2023

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

Log Message:
lint: condense keyword table

This prepares for modelling 'inline' not as a storage class, but more
correctly as a function specifier.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 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/external/gpl3/gcc/usr.bin

2023-07-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jul 12 07:35:15 UTC 2023

Modified Files:
src/external/gpl3/gcc/usr.bin: Makefile.inc

Log Message:
don't force gnu++98 here.

fixes build issues seen with GCC 10.5, as well as hopefully ones reported
by Andrew Cagney on current-users.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/external/gpl3/gcc/usr.bin/Makefile.inc

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

Modified files:

Index: src/external/gpl3/gcc/usr.bin/Makefile.inc
diff -u src/external/gpl3/gcc/usr.bin/Makefile.inc:1.35 src/external/gpl3/gcc/usr.bin/Makefile.inc:1.36
--- src/external/gpl3/gcc/usr.bin/Makefile.inc:1.35	Wed Feb  1 19:38:20 2023
+++ src/external/gpl3/gcc/usr.bin/Makefile.inc	Wed Jul 12 07:35:15 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.35 2023/02/01 19:38:20 mrg Exp $
+#	$NetBSD: Makefile.inc,v 1.36 2023/07/12 07:35:15 mrg Exp $
 
 .ifndef _EXTERNAL_GPL3_GCC_USR_BIN_MAKEFILE_INC_
 _EXTERNAL_GPL3_GCC_USR_BIN_MAKEFILE_INC_=1
@@ -41,8 +41,6 @@ FRONTENDOBJ!=		cd ${.CURDIR}/../frontend
 NBCOMPATLIB=   -L${TOOLDIR}/lib -lnbcompat
 .endif
 
-CXXFLAGS+=	-std=gnu++98
-
 # Reduce debugging for these extremely large objects.
 .if ${MKDEBUG:Uno} != "no"
 CXXFLAGS+=  -g1



CVS commit: src/external/gpl3/gcc/usr.bin

2023-07-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jul 12 07:35:15 UTC 2023

Modified Files:
src/external/gpl3/gcc/usr.bin: Makefile.inc

Log Message:
don't force gnu++98 here.

fixes build issues seen with GCC 10.5, as well as hopefully ones reported
by Andrew Cagney on current-users.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/external/gpl3/gcc/usr.bin/Makefile.inc

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



CVS commit: src/sys/arch

2023-07-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jul 12 06:45:24 UTC 2023

Modified Files:
src/sys/arch/hppa/include: intr.h mutex.h
src/sys/arch/vax/include: mutex.h

Log Message:
fix hppa and vax builds.

machine/lock.h isn't necessary for __cpu_simple_lock_t, it's in
sys/types.h.  avoids cpu_data.h vs sched.h include order issues.

move the hppa ipl_t typedef with the moved usage of it.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/include/intr.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hppa/include/mutex.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/vax/include/mutex.h

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

Modified files:

Index: src/sys/arch/hppa/include/intr.h
diff -u src/sys/arch/hppa/include/intr.h:1.3 src/sys/arch/hppa/include/intr.h:1.4
--- src/sys/arch/hppa/include/intr.h:1.3	Tue Jul 11 11:05:09 2023
+++ src/sys/arch/hppa/include/intr.h	Wed Jul 12 06:45:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.3 2023/07/11 11:05:09 riastradh Exp $	*/
+/*	$NetBSD: intr.h,v 1.4 2023/07/12 06:45:24 mrg Exp $	*/
 /*	$OpenBSD: intr.h,v 1.26 2009/12/29 13:11:40 jsing Exp $	*/
 
 /*-
@@ -41,6 +41,7 @@
 #ifndef _LOCORE
 
 #if defined(_KERNEL) || defined(_KMEMUSER)
+typedef int ipl_t;
 typedef struct {
 	ipl_t _ipl;
 } ipl_cookie_t;
@@ -162,8 +163,6 @@ void spllower(int);
 #define	spl0()		spllower(0)
 #define	splx(x)		spllower(x)
 
-typedef int ipl_t;
-
 static inline ipl_cookie_t
 makeiplcookie(ipl_t ipl)
 {

Index: src/sys/arch/hppa/include/mutex.h
diff -u src/sys/arch/hppa/include/mutex.h:1.16 src/sys/arch/hppa/include/mutex.h:1.17
--- src/sys/arch/hppa/include/mutex.h:1.16	Sun Jul  9 17:03:09 2023
+++ src/sys/arch/hppa/include/mutex.h	Wed Jul 12 06:45:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.16 2023/07/09 17:03:09 riastradh Exp $	*/
+/*	$NetBSD: mutex.h,v 1.17 2023/07/12 06:45:24 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -85,7 +85,7 @@ struct kmutex {
 #define	MUTEX_SPIN_FLAG			0xff10
 #define	MUTEX_UNOWNED_OR_SPIN(x)	(((x) & 0xffef) == 0xff00)
 
-#ifndef __ASSEMBLER__
+#if !defined(__ASSEMBLER__) && defined(_KERNEL)
 
 static inline uintptr_t
 MUTEX_OWNER(uintptr_t owner)
@@ -180,7 +180,7 @@ MUTEX_CLEAR_WAITERS(struct kmutex *mtx)
 	mtx->mtx_waiters = 0;
 }
 
-#endif	/* __ASSEMBLER__ */
+#endif	/* !__ASSEMBLER__ && _KERNEL */
 
 #endif	/* __MUTEX_PRIVATE */
 

Index: src/sys/arch/vax/include/mutex.h
diff -u src/sys/arch/vax/include/mutex.h:1.18 src/sys/arch/vax/include/mutex.h:1.19
--- src/sys/arch/vax/include/mutex.h:1.18	Sun Jul  9 17:03:10 2023
+++ src/sys/arch/vax/include/mutex.h	Wed Jul 12 06:45:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.18 2023/07/09 17:03:10 riastradh Exp $	*/
+/*	$NetBSD: mutex.h,v 1.19 2023/07/12 06:45:24 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -49,7 +49,6 @@ struct kmutex {
 #else	/* __MUTEX_PRIVATE */
 
 #include 
-#include 
 
 struct kmutex {
 	union {



CVS commit: src/sys/arch

2023-07-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jul 12 06:45:24 UTC 2023

Modified Files:
src/sys/arch/hppa/include: intr.h mutex.h
src/sys/arch/vax/include: mutex.h

Log Message:
fix hppa and vax builds.

machine/lock.h isn't necessary for __cpu_simple_lock_t, it's in
sys/types.h.  avoids cpu_data.h vs sched.h include order issues.

move the hppa ipl_t typedef with the moved usage of it.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/include/intr.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hppa/include/mutex.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/vax/include/mutex.h

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