CVS commit: src/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 22:52:21 UTC 2023

Modified Files:
src/usr.bin/indent: debug.c indent.c indent.h lexi.c

Log Message:
indent: clean up detection of whether parentheses form a cast

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.285 -r1.286 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.141 -r1.142 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.191 -r1.192 src/usr.bin/indent/lexi.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 22:52:21 UTC 2023

Modified Files:
src/usr.bin/indent: debug.c indent.c indent.h lexi.c

Log Message:
indent: clean up detection of whether parentheses form a cast

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.285 -r1.286 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.141 -r1.142 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.191 -r1.192 src/usr.bin/indent/lexi.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/indent/debug.c
diff -u src/usr.bin/indent/debug.c:1.8 src/usr.bin/indent/debug.c:1.9
--- src/usr.bin/indent/debug.c:1.8	Mon May 15 13:37:16 2023
+++ src/usr.bin/indent/debug.c	Mon May 15 22:52:21 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: debug.c,v 1.8 2023/05/15 13:37:16 rillig Exp $	*/
+/*	$NetBSD: debug.c,v 1.9 2023/05/15 22:52:21 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: debug.c,v 1.8 2023/05/15 13:37:16 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.9 2023/05/15 22:52:21 rillig Exp $");
 
 #include 
 
@@ -99,19 +99,25 @@ const char *const psym_name[] = {
 "while_expr",
 };
 
-static const char *declaration_name[] = {
+static const char *const declaration_name[] = {
 "no",
 "begin",
 "end",
 };
 
-static const char *in_enum_name[] = {
+static const char *const in_enum_name[] = {
 "no",
 "enum",
 "type",
 "brace",
 };
 
+const char *const paren_level_cast_name[] = {
+"(unknown cast)",
+"(maybe cast)",
+"(no cast)",
+};
+
 void
 debug_printf(const char *fmt, ...)
 {
@@ -208,12 +214,9 @@ ps_paren_has_changed(const struct parser
 if (prev_ps->nparen != ps.nparen)
 	return true;
 
-for (int i = 0; i < ps.nparen; i++) {
-	if (curr[i].indent != prev[i].indent ||
-		curr[i].maybe_cast != prev[i].maybe_cast ||
-		curr[i].no_cast != prev[i].no_cast)
+for (int i = 0; i < ps.nparen; i++)
+	if (curr[i].indent != prev[i].indent || curr[i].cast != prev[i].cast)
 	return true;
-}
 return false;
 }
 
@@ -225,11 +228,8 @@ debug_ps_paren(const struct parser_state
 
 debug_printf("   ps.paren:");
 for (int i = 0; i < ps.nparen; i++) {
-	const paren_level_props *props = ps.paren + i;
-	const char *cast = props->no_cast ? "(no cast)"
-	: props->maybe_cast ? "(cast)"
-	: "";
-	debug_printf(" %s%d", cast, props->indent);
+	debug_printf(" %s%d",
+	paren_level_cast_name[ps.paren[i].cast], ps.paren[i].indent);
 }
 if (ps.nparen == 0)
 	debug_printf(" none");

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.285 src/usr.bin/indent/indent.c:1.286
--- src/usr.bin/indent/indent.c:1.285	Mon May 15 22:35:41 2023
+++ src/usr.bin/indent/indent.c	Mon May 15 22:52:21 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.285 2023/05/15 22:35:41 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.286 2023/05/15 22:52:21 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.285 2023/05/15 22:35:41 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.286 2023/05/15 22:52:21 rillig Exp $");
 
 #include 
 #include 
@@ -443,7 +443,7 @@ process_lparen_or_lbracket(void)
 buf_add_char(, token.st[0]);
 
 int indent = ind_add(0, code.st, code.len);
-bool no_cast = false;
+enum paren_level_cast cast = cast_unknown;
 
 if (opt.extra_expr_indent && !opt.lineup_to_parens
 	&& ps.spaced_expr_psym != psym_0 && ps.nparen == 1
@@ -465,13 +465,12 @@ process_lparen_or_lbracket(void)
 
 if (ps.prev_token == lsym_offsetof || ps.prev_token == lsym_sizeof
 	|| ps.is_function_definition)
-	no_cast = true;
+	cast = cast_no;
 
 ps.paren[ps.nparen - 1].indent = (short)indent;
-ps.paren[ps.nparen - 1].maybe_cast = false;
-ps.paren[ps.nparen - 1].no_cast = no_cast;
+ps.paren[ps.nparen - 1].cast = cast;
 debug_println("paren_indents[%d] is now %s%d",
-	ps.nparen - 1, no_cast ? "(no cast)" : "", indent);
+	ps.nparen - 1, paren_level_cast_name[cast], indent);
 }
 
 static void
@@ -482,13 +481,11 @@ process_rparen_or_rbracket(void)
 	goto unbalanced;
 }
 
-bool maybe_cast = ps.paren[ps.nparen - 1].maybe_cast;
-bool no_cast = ps.paren[ps.nparen - 1].no_cast;
+enum paren_level_cast cast = ps.paren[--ps.nparen].cast;
 if (ps.decl_on_line && !ps.block_init)
-	no_cast = true;
-ps.nparen--;
+	cast = cast_no;
 
-if (maybe_cast && !no_cast) {
+if (cast == cast_maybe) {
 	ps.next_unary = true;
 	ps.want_blank = opt.space_after_cast;
 } else

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.141 src/usr.bin/indent/indent.h:1.142
--- src/usr.bin/indent/indent.h:1.141	Mon May 15 20:30:20 2023
+++ src/usr.bin/indent/indent.h	Mon May 15 22:52:21 2023
@@ -1,4 

CVS commit: src/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 22:35:41 UTC 2023

Modified Files:
src/usr.bin/indent: indent.c io.c

Log Message:
indent: fix cast detection

In process_lparen_or_lbracket, ps.paren[...].maybe_cast was not
initialized, which may have been the cause for seemingly random spacing
around binary operators.

While here, clean up the code by reducing the number of accesses to the
parser state.


To generate a diff of this commit:
cvs rdiff -u -r1.284 -r1.285 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.170 -r1.171 src/usr.bin/indent/io.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 22:35:41 UTC 2023

Modified Files:
src/usr.bin/indent: indent.c io.c

Log Message:
indent: fix cast detection

In process_lparen_or_lbracket, ps.paren[...].maybe_cast was not
initialized, which may have been the cause for seemingly random spacing
around binary operators.

While here, clean up the code by reducing the number of accesses to the
parser state.


To generate a diff of this commit:
cvs rdiff -u -r1.284 -r1.285 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.170 -r1.171 src/usr.bin/indent/io.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/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.284 src/usr.bin/indent/indent.c:1.285
--- src/usr.bin/indent/indent.c:1.284	Mon May 15 21:51:45 2023
+++ src/usr.bin/indent/indent.c	Mon May 15 22:35:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.284 2023/05/15 21:51:45 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.285 2023/05/15 22:35:41 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.284 2023/05/15 21:51:45 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.285 2023/05/15 22:35:41 rillig Exp $");
 
 #include 
 #include 
@@ -442,9 +442,8 @@ process_lparen_or_lbracket(void)
 ps.want_blank = false;
 buf_add_char(, token.st[0]);
 
-ps.paren[ps.nparen - 1].indent = (short)ind_add(0, code.st, code.len);
-debug_println("paren_indents[%d] is now %d",
-	ps.nparen - 1, ps.paren[ps.nparen - 1].indent);
+int indent = ind_add(0, code.st, code.len);
+bool no_cast = false;
 
 if (opt.extra_expr_indent && !opt.lineup_to_parens
 	&& ps.spaced_expr_psym != psym_0 && ps.nparen == 1
@@ -452,10 +451,8 @@ process_lparen_or_lbracket(void)
 	ps.extra_expr_indent = eei_yes;
 
 if (opt.extra_expr_indent && ps.spaced_expr_psym != psym_0
-	&& ps.nparen == 1 && ps.paren[0].indent < 2 * opt.indent_size) {
-	ps.paren[0].indent = (short)(2 * opt.indent_size);
-	debug_println("paren_indents[0] is now %d", ps.paren[0].indent);
-}
+	&& ps.nparen == 1 && indent < 2 * opt.indent_size)
+	indent = 2 * opt.indent_size;
 
 if (ps.init_or_struct && *token.st == '(' && ps.tos <= 2) {
 	/*
@@ -467,9 +464,14 @@ process_lparen_or_lbracket(void)
 }
 
 if (ps.prev_token == lsym_offsetof || ps.prev_token == lsym_sizeof
-	|| ps.prev_token == lsym_word
 	|| ps.is_function_definition)
-	ps.paren[ps.nparen - 1].no_cast = true;
+	no_cast = true;
+
+ps.paren[ps.nparen - 1].indent = (short)indent;
+ps.paren[ps.nparen - 1].maybe_cast = false;
+ps.paren[ps.nparen - 1].no_cast = no_cast;
+debug_println("paren_indents[%d] is now %s%d",
+	ps.nparen - 1, no_cast ? "(no cast)" : "", indent);
 }
 
 static void
@@ -477,23 +479,20 @@ process_rparen_or_rbracket(void)
 {
 if (ps.nparen == 0) {
 	diag(0, "Extra '%c'", *token.st);
-	goto unbalanced;	/* TODO: better exit immediately */
+	goto unbalanced;
 }
 
-if (ps.nparen > 0 && ps.decl_on_line && !ps.block_init)
-	ps.paren[ps.nparen - 1].no_cast = true;
+bool maybe_cast = ps.paren[ps.nparen - 1].maybe_cast;
+bool no_cast = ps.paren[ps.nparen - 1].no_cast;
+if (ps.decl_on_line && !ps.block_init)
+	no_cast = true;
+ps.nparen--;
 
-if (ps.paren[ps.nparen - 1].maybe_cast &&
-	!ps.paren[ps.nparen - 1].no_cast) {
+if (maybe_cast && !no_cast) {
 	ps.next_unary = true;
-	ps.paren[ps.nparen - 1].maybe_cast = false;
 	ps.want_blank = opt.space_after_cast;
 } else
 	ps.want_blank = true;
-ps.paren[ps.nparen - 1].no_cast = false;
-
-if (ps.nparen > 0)
-	ps.nparen--;
 
 if (code.len == 0)		/* if the paren starts the line */
 	ps.line_start_nparen = ps.nparen;	/* then indent it */

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.170 src/usr.bin/indent/io.c:1.171
--- src/usr.bin/indent/io.c:1.170	Mon May 15 13:37:16 2023
+++ src/usr.bin/indent/io.c	Mon May 15 22:35:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.170 2023/05/15 13:37:16 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.171 2023/05/15 22:35:41 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: io.c,v 1.170 2023/05/15 13:37:16 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.171 2023/05/15 22:35:41 rillig Exp $");
 
 #include 
 #include 
@@ -177,8 +177,8 @@ output_line_code(int ind)
 
 int target_ind = compute_code_indent();
 for (int i = 0; i < ps.nparen; i++) {
-	if (ps.paren[i].indent >= 0) {
-	int paren_ind = ps.paren[i].indent;
+	int paren_ind = ps.paren[i].indent;
+	if (paren_ind >= 0) {
 	ps.paren[i].indent = (short)(-1 - (paren_ind + target_ind));
 	debug_println(
 		"setting paren_indents[%d] from %d to %d for column %d",



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 21:55:26 UTC 2023

Added Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/riscv64: ec.inc
Removed Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/riskv64: ec.inc

Log Message:
fix typo


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/riscv64/ec.inc
cvs rdiff -u -r1.1 -r0 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/riskv64/ec.inc

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



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 21:55:26 UTC 2023

Added Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/riscv64: ec.inc
Removed Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/riskv64: ec.inc

Log Message:
fix typo


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/riscv64/ec.inc
cvs rdiff -u -r1.1 -r0 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/riskv64/ec.inc

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

Added files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/riscv64/ec.inc
diff -u /dev/null src/crypto/external/bsd/openssl/lib/libcrypto/arch/riscv64/ec.inc:1.1
--- /dev/null	Mon May 15 17:55:26 2023
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/riscv64/ec.inc	Mon May 15 17:55:26 2023
@@ -0,0 +1,3 @@
+ECCPPFLAGS+= -DOPENSSL_NO_EC_NISTP_64_GCC_128
+
+.include "../../ec.inc"



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 21:51:46 UTC 2023

Modified Files:
src/tests/usr.bin/indent: fmt_decl.c
src/usr.bin/indent: indent.c

Log Message:
indent: fix detection of casts

A word followed by a '(' does not start a cast expression.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/tests/usr.bin/indent/fmt_decl.c
cvs rdiff -u -r1.283 -r1.284 src/usr.bin/indent/indent.c

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



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 21:51:46 UTC 2023

Modified Files:
src/tests/usr.bin/indent: fmt_decl.c
src/usr.bin/indent: indent.c

Log Message:
indent: fix detection of casts

A word followed by a '(' does not start a cast expression.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/tests/usr.bin/indent/fmt_decl.c
cvs rdiff -u -r1.283 -r1.284 src/usr.bin/indent/indent.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/indent/fmt_decl.c
diff -u src/tests/usr.bin/indent/fmt_decl.c:1.41 src/tests/usr.bin/indent/fmt_decl.c:1.42
--- src/tests/usr.bin/indent/fmt_decl.c:1.41	Mon May 15 20:50:37 2023
+++ src/tests/usr.bin/indent/fmt_decl.c	Mon May 15 21:51:46 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fmt_decl.c,v 1.41 2023/05/15 20:50:37 rillig Exp $	*/
+/*	$NetBSD: fmt_decl.c,v 1.42 2023/05/15 21:51:46 rillig Exp $	*/
 
 /*
  * Tests for declarations of global variables, external functions, and local
@@ -919,3 +919,44 @@ is_identifier_start(char ch)
 	return ch_isalpha(ch) || ch == '_';
 }
 //indent end
+
+
+//indent input
+void buf_add_chars(struct buffer *, const char *, size_t);
+
+static inline bool
+ch_isalnum(char ch)
+{
+return isalnum((unsigned char)ch) != 0;
+}
+
+static inline bool
+ch_isalpha(char ch)
+{
+return isalpha((unsigned char)ch) != 0;
+}
+//indent end
+
+//indent run -i4 -di0
+// $ FIXME: 'buffer' is classified as 'word'.
+// $
+// $ XXX: 'char' is classified as 'type_in_parentheses'; check whether this
+// $ XXX: lexer symbol should only be used for types in cast expressions.
+// $
+// $ FIXME: 'size_t' is classified as 'word'.
+void buf_add_chars(struct buffer *, const char *, size_t);
+
+static inline bool
+ch_isalnum(char ch)
+{
+return isalnum((unsigned char)ch) != 0;
+}
+
+static inline bool
+ch_isalpha(char ch)
+{
+return isalpha((unsigned char)ch) != 0;
+}
+//indent end
+
+//indent run-equals-input -i4 -di0

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.283 src/usr.bin/indent/indent.c:1.284
--- src/usr.bin/indent/indent.c:1.283	Mon May 15 20:50:37 2023
+++ src/usr.bin/indent/indent.c	Mon May 15 21:51:45 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.283 2023/05/15 20:50:37 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.284 2023/05/15 21:51:45 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.283 2023/05/15 20:50:37 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.284 2023/05/15 21:51:45 rillig Exp $");
 
 #include 
 #include 
@@ -467,6 +467,7 @@ process_lparen_or_lbracket(void)
 }
 
 if (ps.prev_token == lsym_offsetof || ps.prev_token == lsym_sizeof
+	|| ps.prev_token == lsym_word
 	|| ps.is_function_definition)
 	ps.paren[ps.nparen - 1].no_cast = true;
 }



CVS commit: src/tools

2023-05-15 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Mon May 15 21:24:56 UTC 2023

Modified Files:
src/tools: Makefile.gnuhost

Log Message:
tools: if MAKEVERBOSE >=2, noisy automake builds

Explicitly build with V=1 for MAKEVERBOSE >= 2
so that Makefile.gnuhost (automake) consumers
are more consistent with native builds.

(If the upstream is using AM_SILENT_RULES(yes)
then the default is V=0).


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/tools/Makefile.gnuhost

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

Modified files:

Index: src/tools/Makefile.gnuhost
diff -u src/tools/Makefile.gnuhost:1.54 src/tools/Makefile.gnuhost:1.55
--- src/tools/Makefile.gnuhost:1.54	Sun Aug 29 08:36:00 2021
+++ src/tools/Makefile.gnuhost	Mon May 15 21:24:56 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.gnuhost,v 1.54 2021/08/29 08:36:00 rillig Exp $
+#	$NetBSD: Makefile.gnuhost,v 1.55 2023/05/15 21:24:56 lukem Exp $
 #
 # Rules used when building a GNU host package.  Expects MODULE to be set.
 #
@@ -109,6 +109,8 @@ MAKE_ARGS+=	BISON=true DESTDIR= INSTALL=
 
 .if ${MAKEVERBOSE} < 2
 MAKE_ARGS+=	-s V=0
+.else
+MAKE_ARGS+=	V=1
 .endif
 
 ALL_TARGET?=	all



CVS commit: src/tools

2023-05-15 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Mon May 15 21:24:56 UTC 2023

Modified Files:
src/tools: Makefile.gnuhost

Log Message:
tools: if MAKEVERBOSE >=2, noisy automake builds

Explicitly build with V=1 for MAKEVERBOSE >= 2
so that Makefile.gnuhost (automake) consumers
are more consistent with native builds.

(If the upstream is using AM_SILENT_RULES(yes)
then the default is V=0).


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/tools/Makefile.gnuhost

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



CVS commit: src/etc/mtree

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 21:13:07 UTC 2023

Modified Files:
src/etc/mtree: NetBSD.compat.riscv64

Log Message:
add more OpenSSL-3.x


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/etc/mtree/NetBSD.compat.riscv64

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

Modified files:

Index: src/etc/mtree/NetBSD.compat.riscv64
diff -u src/etc/mtree/NetBSD.compat.riscv64:1.1 src/etc/mtree/NetBSD.compat.riscv64:1.2
--- src/etc/mtree/NetBSD.compat.riscv64:1.1	Sat Feb  9 16:43:23 2019
+++ src/etc/mtree/NetBSD.compat.riscv64	Mon May 15 17:13:07 2023
@@ -1,4 +1,7 @@
-# $NetBSD: NetBSD.compat.riscv64,v 1.1 2019/02/09 21:43:23 mrg Exp $
+# $NetBSD: NetBSD.compat.riscv64,v 1.2 2023/05/15 21:13:07 christos Exp $
 
 ./usr/include/g++/bits/riscv32
 ./usr/include/g++/bits/riscv64
+./usr/lib/rv32/openssl
+./usr/lib/rv32/openssl/engines
+./usr/lib/rv32/openssl/modules



CVS commit: src/etc/mtree

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 21:13:07 UTC 2023

Modified Files:
src/etc/mtree: NetBSD.compat.riscv64

Log Message:
add more OpenSSL-3.x


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/etc/mtree/NetBSD.compat.riscv64

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



CVS commit: src/distrib/sets/lists/base

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 21:12:11 UTC 2023

Added Files:
src/distrib/sets/lists/base: md.riskv64

Log Message:
add compat files


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/distrib/sets/lists/base/md.riskv64

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



CVS commit: src/distrib/sets/lists/base

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 21:12:11 UTC 2023

Added Files:
src/distrib/sets/lists/base: md.riskv64

Log Message:
add compat files


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/distrib/sets/lists/base/md.riskv64

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

Added files:

Index: src/distrib/sets/lists/base/md.riskv64
diff -u /dev/null src/distrib/sets/lists/base/md.riskv64:1.1
--- /dev/null	Mon May 15 17:12:11 2023
+++ src/distrib/sets/lists/base/md.riskv64	Mon May 15 17:12:11 2023
@@ -0,0 +1,5 @@
+# $NetBSD: md.riskv64,v 1.1 2023/05/15 21:12:11 christos Exp $
+./usr/lib/rv32/opensslbase-crypto-usr
+./usr/lib/rv32/openssl/engines			base-crypto-usr
+./usr/lib/rv32/openssl/modules			base-crypto-usr
+./usr/lib/rv32/openssl/modules/legacy.so	base-crypto-usr		compat,pic,openssl=30



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/riskv64

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 21:09:11 UTC 2023

Added Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/riskv64: ec.inc

Log Message:
add riskv64 from Robert Swindells


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/riskv64/ec.inc

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

Added files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/riskv64/ec.inc
diff -u /dev/null src/crypto/external/bsd/openssl/lib/libcrypto/arch/riskv64/ec.inc:1.1
--- /dev/null	Mon May 15 17:09:11 2023
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/riskv64/ec.inc	Mon May 15 17:09:10 2023
@@ -0,0 +1,3 @@
+ECCPPFLAGS+= -DOPENSSL_NO_EC_NISTP_64_GCC_128
+
+.include "../../ec.inc"



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/riskv64

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 21:09:11 UTC 2023

Added Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/riskv64: ec.inc

Log Message:
add riskv64 from Robert Swindells


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/riskv64/ec.inc

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



CVS commit: src/share/misc

2023-05-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon May 15 20:54:53 UTC 2023

Modified Files:
src/share/misc: acronyms.comp

Log Message:
+LRO Large Receive Offload, +RSC Receive Segment Coalescing (win counterpart)
PR 57408


To generate a diff of this commit:
cvs rdiff -u -r1.351 -r1.352 src/share/misc/acronyms.comp

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

Modified files:

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.351 src/share/misc/acronyms.comp:1.352
--- src/share/misc/acronyms.comp:1.351	Tue Apr  4 20:13:02 2023
+++ src/share/misc/acronyms.comp	Mon May 15 20:54:53 2023
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.351 2023/04/04 20:13:02 jschauma Exp $
+$NetBSD: acronyms.comp,v 1.352 2023/05/15 20:54:53 andvar Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -909,6 +909,7 @@ LPC	low pin count
 LPS	local positioning system
 LRC	longitudinal redundancy check
 LRM	left-to-right mark
+LRO	Large Receive Offload
 LRO	left-to-right override
 LRU	least recently used
 LS	link state
@@ -1407,6 +1408,7 @@ RR	random replacement
 RR	round robin
 RS	relay station
 RSA	Rivest, Shamir, [and] Adleman
+RSC	Receive Segment Coalescing
 RSIP	Realm Specific IP
 RSN	Robust Secure Network
 RSS	really simple syndication



CVS commit: src/share/misc

2023-05-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon May 15 20:54:53 UTC 2023

Modified Files:
src/share/misc: acronyms.comp

Log Message:
+LRO Large Receive Offload, +RSC Receive Segment Coalescing (win counterpart)
PR 57408


To generate a diff of this commit:
cvs rdiff -u -r1.351 -r1.352 src/share/misc/acronyms.comp

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



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 20:50:37 UTC 2023

Modified Files:
src/tests/usr.bin/indent: fmt_decl.c opt_pcs.c opt_ta.c
src/usr.bin/indent: indent.c

Log Message:
indent: fix type cast in function definition


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/tests/usr.bin/indent/fmt_decl.c
cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/indent/opt_pcs.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/opt_ta.c
cvs rdiff -u -r1.282 -r1.283 src/usr.bin/indent/indent.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/indent/fmt_decl.c
diff -u src/tests/usr.bin/indent/fmt_decl.c:1.40 src/tests/usr.bin/indent/fmt_decl.c:1.41
--- src/tests/usr.bin/indent/fmt_decl.c:1.40	Mon May 15 15:04:48 2023
+++ src/tests/usr.bin/indent/fmt_decl.c	Mon May 15 20:50:37 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fmt_decl.c,v 1.40 2023/05/15 15:04:48 rillig Exp $	*/
+/*	$NetBSD: fmt_decl.c,v 1.41 2023/05/15 20:50:37 rillig Exp $	*/
 
 /*
  * Tests for declarations of global variables, external functions, and local
@@ -890,8 +890,8 @@ char *(*fn)(int, int) = NULL;
 
 
 /*
- * Depending on the line break in the function header, the spaces around the
- * '||' operator were removed.
+ * Depending on whether there was a line break in the function header, the
+ * spaces around the '||' operator were erroneously removed.
  */
 //indent input
 bool is_identifier_start(char ch)
@@ -916,6 +916,6 @@ is_identifier_start(char ch)
 bool
 is_identifier_start(char ch)
 {
-	return ch_isalpha(ch)||ch == '_';
+	return ch_isalpha(ch) || ch == '_';
 }
 //indent end

Index: src/tests/usr.bin/indent/opt_pcs.c
diff -u src/tests/usr.bin/indent/opt_pcs.c:1.14 src/tests/usr.bin/indent/opt_pcs.c:1.15
--- src/tests/usr.bin/indent/opt_pcs.c:1.14	Mon May 15 14:55:47 2023
+++ src/tests/usr.bin/indent/opt_pcs.c	Mon May 15 20:50:37 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_pcs.c,v 1.14 2023/05/15 14:55:47 rillig Exp $ */
+/* $NetBSD: opt_pcs.c,v 1.15 2023/05/15 20:50:37 rillig Exp $ */
 
 /*
  * Tests for the options '-pcs' and '-npcs'.
@@ -49,7 +49,7 @@ int var = (function)(arg);
 //indent run -di0 -pcs
 void (*signal (void (*handler) (int))) (int);
 // $ This may be a function call or a cast, depending on the context.
-int var = (function)(arg);
+int var = (function) (arg);
 //indent end
 
 //indent run -di0 -npcs

Index: src/tests/usr.bin/indent/opt_ta.c
diff -u src/tests/usr.bin/indent/opt_ta.c:1.5 src/tests/usr.bin/indent/opt_ta.c:1.6
--- src/tests/usr.bin/indent/opt_ta.c:1.5	Mon May 15 14:55:47 2023
+++ src/tests/usr.bin/indent/opt_ta.c	Mon May 15 20:50:37 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_ta.c,v 1.5 2023/05/15 14:55:47 rillig Exp $ */
+/* $NetBSD: opt_ta.c,v 1.6 2023/05/15 20:50:37 rillig Exp $ */
 
 /*
  * Tests for the option '-ta', which assumes that all identifiers that end in
@@ -20,7 +20,7 @@ example(void *arg)
 void
 example(void *arg)
 {
-	int		mult = (unknown_type_name)*arg;
+	int		mult = (unknown_type_name) * arg;
 
 	int		cast = (unknown_type_name_t)*arg;
 }

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.282 src/usr.bin/indent/indent.c:1.283
--- src/usr.bin/indent/indent.c:1.282	Mon May 15 20:30:20 2023
+++ src/usr.bin/indent/indent.c	Mon May 15 20:50:37 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.282 2023/05/15 20:30:20 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.283 2023/05/15 20:50:37 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.282 2023/05/15 20:30:20 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.283 2023/05/15 20:50:37 rillig Exp $");
 
 #include 
 #include 
@@ -466,7 +466,8 @@ process_lparen_or_lbracket(void)
 	ps.init_or_struct = false;
 }
 
-if (ps.prev_token == lsym_offsetof || ps.prev_token == lsym_sizeof)
+if (ps.prev_token == lsym_offsetof || ps.prev_token == lsym_sizeof
+	|| ps.is_function_definition)
 	ps.paren[ps.nparen - 1].no_cast = true;
 }
 



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 20:50:37 UTC 2023

Modified Files:
src/tests/usr.bin/indent: fmt_decl.c opt_pcs.c opt_ta.c
src/usr.bin/indent: indent.c

Log Message:
indent: fix type cast in function definition


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/tests/usr.bin/indent/fmt_decl.c
cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/indent/opt_pcs.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/opt_ta.c
cvs rdiff -u -r1.282 -r1.283 src/usr.bin/indent/indent.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 20:35:56 UTC 2023

Modified Files:
src/usr.bin/indent: .indent.pro

Log Message:
indent: clean up local indentation profile

The -eei option now works, the type hints are no longer necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/indent/.indent.pro

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/indent/.indent.pro
diff -u src/usr.bin/indent/.indent.pro:1.4 src/usr.bin/indent/.indent.pro:1.5
--- src/usr.bin/indent/.indent.pro:1.4	Mon May 15 09:22:53 2023
+++ src/usr.bin/indent/.indent.pro	Mon May 15 20:35:56 2023
@@ -1,16 +1,10 @@
-/* $NetBSD: .indent.pro,v 1.4 2023/05/15 09:22:53 rillig Exp $ */
+/* $NetBSD: .indent.pro,v 1.5 2023/05/15 20:35:56 rillig Exp $ */
 
 -l78		/* Keep 2 columns distance from the 80-column margin. */
 -di0		/* Do not indent variable names in global declarations. */
-/* XXX: -eei does not work; the expressions are indented only a single level. */
 -eei		/* Indent expressions in 'if' and 'while' once more. */
 -nfc1		/* Do not format CVS Id comments. */
 -i4		/* Indent by 4 spaces, for traditional reasons. */
 -ldi0		/* Do not indent variable names in local declarations. */
 -nlp		/* Do not indent function arguments. */
--ta		/* Identifiers ending in '_t' are considered type names. */
--TFILE		/* Additional types, for proper formatting of '*'. */
--Tlexer_symbol
--Tparen_level_props
--Tparser_symbol
--Tkeyword_kind
+-ta		/* For proper formatting of type casts. */



CVS commit: src/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 20:35:56 UTC 2023

Modified Files:
src/usr.bin/indent: .indent.pro

Log Message:
indent: clean up local indentation profile

The -eei option now works, the type hints are no longer necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/indent/.indent.pro

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



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 20:30:20 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_comment.c
src/usr.bin/indent: indent.c indent.h

Log Message:
indent: fix duplicate space between comment and binary operator


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/lsym_comment.c
cvs rdiff -u -r1.281 -r1.282 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.140 -r1.141 src/usr.bin/indent/indent.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/indent/lsym_comment.c
diff -u src/tests/usr.bin/indent/lsym_comment.c:1.11 src/tests/usr.bin/indent/lsym_comment.c:1.12
--- src/tests/usr.bin/indent/lsym_comment.c:1.11	Mon May 15 19:55:51 2023
+++ src/tests/usr.bin/indent/lsym_comment.c	Mon May 15 20:30:20 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_comment.c,v 1.11 2023/05/15 19:55:51 rillig Exp $ */
+/* $NetBSD: lsym_comment.c,v 1.12 2023/05/15 20:30:20 rillig Exp $ */
 
 /*
  * Tests for the token lsym_comment, which starts a comment.
@@ -1078,3 +1078,22 @@ error*/
   * error
   */
 //indent end
+
+
+/*
+ * Ensure that there is exactly one space between the comment and the
+ * following binary operator.
+ */
+//indent input
+{
+a /* */ > b;
+a>b;
+}
+//indent end
+
+//indent run
+{
+	a /* */ > b;
+	a > b;
+}
+//indent end

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.281 src/usr.bin/indent/indent.c:1.282
--- src/usr.bin/indent/indent.c:1.281	Mon May 15 20:12:28 2023
+++ src/usr.bin/indent/indent.c	Mon May 15 20:30:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.281 2023/05/15 20:12:28 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.282 2023/05/15 20:30:20 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.281 2023/05/15 20:12:28 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.282 2023/05/15 20:30:20 rillig Exp $");
 
 #include 
 #include 
@@ -539,7 +539,7 @@ process_unary_op(void)
 static void
 process_binary_op(void)
 {
-if (code.len > 0)
+if (code.len > 0 && ps.want_blank)
 	buf_add_char(, ' ');
 buf_add_buf(, );
 ps.want_blank = true;

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.140 src/usr.bin/indent/indent.h:1.141
--- src/usr.bin/indent/indent.h:1.140	Mon May 15 20:12:28 2023
+++ src/usr.bin/indent/indent.h	Mon May 15 20:30:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.140 2023/05/15 20:12:28 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.141 2023/05/15 20:30:20 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -358,8 +358,8 @@ extern struct parser_state {
 
 /* Vertical spacing */
 
-bool force_nl;		/* whether the next token is forced to go to
- * a new line; used after 'if (expr)' and
+bool force_nl;		/* whether the next token is forced to go to a
+ * new line; used after 'if (expr)' and in
  * similar situations; tokens like '{' may
  * ignore this */
 



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 20:30:20 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_comment.c
src/usr.bin/indent: indent.c indent.h

Log Message:
indent: fix duplicate space between comment and binary operator


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/lsym_comment.c
cvs rdiff -u -r1.281 -r1.282 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.140 -r1.141 src/usr.bin/indent/indent.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 20:12:28 UTC 2023

Modified Files:
src/usr.bin/indent: indent.c indent.h parse.c

Log Message:
indent: format its own code, extend some comments

With manual corrections, as there are still some bugs left.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.139 -r1.140 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/indent/parse.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/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.280 src/usr.bin/indent/indent.c:1.281
--- src/usr.bin/indent/indent.c:1.280	Mon May 15 18:22:40 2023
+++ src/usr.bin/indent/indent.c	Mon May 15 20:12:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.280 2023/05/15 18:22:40 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.281 2023/05/15 20:12:28 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.280 2023/05/15 18:22:40 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.281 2023/05/15 20:12:28 rillig Exp $");
 
 #include 
 #include 
@@ -269,7 +269,8 @@ main_parse_command_line(int argc, char *
 }
 
 if (opt.comment_column <= 1)
-	opt.comment_column = 2;	/* don't put normal comments before column 2 */
+	opt.comment_column = 2;	/* don't put normal comments in column 1, see
+ * opt.format_col1_comments */
 if (opt.block_comment_max_line_length <= 0)
 	opt.block_comment_max_line_length = opt.max_line_length;
 if (opt.local_decl_indent < 0)
@@ -605,8 +606,8 @@ process_semicolon(void)
 {
 if (ps.decl_level == 0)
 	ps.init_or_struct = false;
-ps.seen_case = false;	/* these will only need resetting in an error */
-ps.quest_level = 0;
+ps.seen_case = false;	/* only needs to be reset on error */
+ps.quest_level = 0;		/* only needs to be reset on error */
 if (ps.prev_token == lsym_rparen_or_rbracket)
 	ps.in_func_def_params = false;
 ps.block_init = false;
@@ -718,7 +719,7 @@ process_rbrace(void)
 ps.declaration = decl_no;
 ps.block_init_level--;
 
-if (code.len > 0 && !ps.block_init) {	/* '}' must be first on line */
+if (code.len > 0 && !ps.block_init) {
 	if (opt.verbose)
 	diag(0, "Line broken");
 	output_line();

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.139 src/usr.bin/indent/indent.h:1.140
--- src/usr.bin/indent/indent.h:1.139	Mon May 15 13:33:19 2023
+++ src/usr.bin/indent/indent.h	Mon May 15 20:12:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.139 2023/05/15 13:33:19 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.140 2023/05/15 20:12:28 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -139,7 +139,8 @@ extern struct buffer token;	/* the curre
  * in some cases to 'lab'. */
 
 extern struct buffer lab;	/* the label or preprocessor directive */
-extern struct buffer code;	/* the main part of the current line of code */
+extern struct buffer code;	/* the main part of the current line of code,
+ * containing declarations or statements */
 extern struct buffer com;	/* the trailing comment of the line, or the
  * start or end of a multi-line comment, or
  * while in process_comment, a single line of
@@ -157,7 +158,8 @@ extern struct options {
 bool blank_line_after_decl;
 bool blanklines_after_procs;
 bool blanklines_before_block_comments;
-bool break_after_comma;	/* whether to break declarations after commas */
+bool break_after_comma;	/* whether to add a line break after each
+ * declarator */
 bool brace_same_line;	/* whether brace should be on same line as if,
  * while, etc */
 bool blank_after_sizeof;	/* whether a blank should always be inserted
@@ -208,7 +210,7 @@ extern struct options {
  * procedure and its name) */
 bool space_after_cast;	/* "b = (int) a" vs "b = (int)a" */
 bool star_comment_cont;	/* whether comment continuation lines should
- * have stars at the beginning of each line. */
+ * have stars at the beginning of each line */
 bool swallow_optional_blanklines;
 bool auto_typedefs;		/* whether to recognize identifiers ending in
  * "_t" like typedefs */
@@ -335,9 +337,9 @@ extern struct parser_state {
  * prefixed by a blank. (Said prefixing is
  * ignored in some cases.) */
 int line_start_nparen;	/* the number of parentheses or brackets that
- * were already open at the beginning of the
- * current line; used to indent within
- * statements, initializers and declarations */
+ * were open at the beginning of the current
+ * line; used to indent within statements,
+ * initializers and declarations */
 int nparen;			/* the number of parentheses or brackets that
  * are currently open; used to indent the
  * remaining lines 

CVS commit: src/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 20:12:28 UTC 2023

Modified Files:
src/usr.bin/indent: indent.c indent.h parse.c

Log Message:
indent: format its own code, extend some comments

With manual corrections, as there are still some bugs left.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.139 -r1.140 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/indent/parse.c

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



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 19:55:51 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_comment.c
src/usr.bin/indent: pr_comment.c

Log Message:
indent: fix line wrapping of comments to the right of code


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/lsym_comment.c
cvs rdiff -u -r1.141 -r1.142 src/usr.bin/indent/pr_comment.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/indent/lsym_comment.c
diff -u src/tests/usr.bin/indent/lsym_comment.c:1.10 src/tests/usr.bin/indent/lsym_comment.c:1.11
--- src/tests/usr.bin/indent/lsym_comment.c:1.10	Mon May 15 07:28:45 2023
+++ src/tests/usr.bin/indent/lsym_comment.c	Mon May 15 19:55:51 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_comment.c,v 1.10 2023/05/15 07:28:45 rillig Exp $ */
+/* $NetBSD: lsym_comment.c,v 1.11 2023/05/15 19:55:51 rillig Exp $ */
 
 /*
  * Tests for the token lsym_comment, which starts a comment.
@@ -584,7 +584,12 @@ function(void)
 			{
 int decl;	/* indented declaration */
 {
-	int decl;	/* indented declaration */
+// $ This comment is indented so far to the right that it may overshoot the
+// $ right margin.  The allowed line length is increased to the starting
+// $ indentation of 56 plus a fixed amount of 25 columns, resulting in 81.
+// $ The trailing '*' would fit, but the trailing '/' is too much.
+	int decl;	/* indented declaration
+			 */
 }
 			}
 		}
@@ -641,23 +646,29 @@ function(void)
 }
 //indent end
 
-//indent run
+//indent run -l78
 void
 function(void)
 {
 	code();			/* code comment */
 	code();			/* code comment _ to line length 78 */
-	code();			/* code comment __ to line length 79 */
-	code();			/* code comment ___ to line length 80 */
-	code();			/* code comment  to line length 81 */
+	code();			/* code comment __ to line length 79
+ */
+	code();			/* code comment ___ to line length 80
+ */
+	code();			/* code comment  to line length 81
+ */
 	code();			/* code comment _ to line length
  * 82 */
 
 /* $ In the following comments, the line length is measured after formatting. */
 	code();			/* code comment _ to line length 78 */
-	code();			/* code comment __ to line length 79 */
-	code();			/* code comment ___ to line length 80 */
-	code();			/* code comment  to line length 81 */
+	code();			/* code comment __ to line length 79
+ */
+	code();			/* code comment ___ to line length 80
+ */
+	code();			/* code comment  to line length 81
+ */
 	code();			/* code comment _ to line length
  * 82 */
 

Index: src/usr.bin/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.141 src/usr.bin/indent/pr_comment.c:1.142
--- src/usr.bin/indent/pr_comment.c:1.141	Mon May 15 09:22:53 2023
+++ src/usr.bin/indent/pr_comment.c	Mon May 15 19:55:51 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pr_comment.c,v 1.141 2023/05/15 09:22:53 rillig Exp $	*/
+/*	$NetBSD: pr_comment.c,v 1.142 2023/05/15 19:55:51 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pr_comment.c,v 1.141 2023/05/15 09:22:53 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.142 2023/05/15 19:55:51 rillig Exp $");
 
 #include 
 
@@ -225,6 +225,13 @@ copy_comment_wrap(int line_length, bool 
 		else
 			com.len = 0;
 		com_add_char(' ');
+		} else {
+		size_t trimmed_len = com.len;
+		while (ch_isblank(com.mem[trimmed_len - 1]))
+			trimmed_len--;
+		int now_len = ind_add(ps.com_ind, com.st, trimmed_len);
+		if (now_len + 3 /* ' ' '*' '/' */ > line_length)
+			output_line();
 		}
 
 		if (!(com.len > 0 && ch_isblank(com.mem[com.len - 1])))



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 19:55:51 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_comment.c
src/usr.bin/indent: pr_comment.c

Log Message:
indent: fix line wrapping of comments to the right of code


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/lsym_comment.c
cvs rdiff -u -r1.141 -r1.142 src/usr.bin/indent/pr_comment.c

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



CVS commit: src/etc/mtree

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 19:03:23 UTC 2023

Modified Files:
src/etc/mtree: NetBSD.compat.powerpc64

Log Message:
Add openssl files


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/etc/mtree/NetBSD.compat.powerpc64

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



CVS commit: src/etc/mtree

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 19:03:23 UTC 2023

Modified Files:
src/etc/mtree: NetBSD.compat.powerpc64

Log Message:
Add openssl files


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/etc/mtree/NetBSD.compat.powerpc64

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

Modified files:

Index: src/etc/mtree/NetBSD.compat.powerpc64
diff -u src/etc/mtree/NetBSD.compat.powerpc64:1.1 src/etc/mtree/NetBSD.compat.powerpc64:1.2
--- src/etc/mtree/NetBSD.compat.powerpc64:1.1	Sat Feb  9 16:43:23 2019
+++ src/etc/mtree/NetBSD.compat.powerpc64	Mon May 15 15:03:23 2023
@@ -1,4 +1,6 @@
-#	$NetBSD: NetBSD.compat.powerpc64,v 1.1 2019/02/09 21:43:23 mrg Exp $
+#	$NetBSD: NetBSD.compat.powerpc64,v 1.2 2023/05/15 19:03:23 christos Exp $
 
 ./usr/include/g++/bits/powerpc
 ./usr/include/g++/bits/powerpc64
+./usr/lib/powerpc/openssl
+./usr/lib/powerpc/openssl/modules



CVS commit: src/etc/mtree

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 19:02:34 UTC 2023

Modified Files:
src/etc/mtree: NetBSD.compat.mips64

Log Message:
add openssl files


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/etc/mtree/NetBSD.compat.mips64

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

Modified files:

Index: src/etc/mtree/NetBSD.compat.mips64
diff -u src/etc/mtree/NetBSD.compat.mips64:1.1 src/etc/mtree/NetBSD.compat.mips64:1.2
--- src/etc/mtree/NetBSD.compat.mips64:1.1	Sun Feb 17 00:29:08 2019
+++ src/etc/mtree/NetBSD.compat.mips64	Mon May 15 15:02:34 2023
@@ -1,5 +1,9 @@
-#	$NetBSD: NetBSD.compat.mips64,v 1.1 2019/02/17 05:29:08 mrg Exp $
+#	$NetBSD: NetBSD.compat.mips64,v 1.2 2023/05/15 19:02:34 christos Exp $
 
 ./usr/include/g++/bits/mips64
 ./usr/include/g++/bits/mips32
 ./usr/include/g++/bits/mipso32
+./usr/lib/n32/openssl
+./usr/lib/n32/openssl/modules
+./usr/lib/o32/openssl
+./usr/lib/o32/openssl/modules



CVS commit: src/etc/mtree

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 19:02:34 UTC 2023

Modified Files:
src/etc/mtree: NetBSD.compat.mips64

Log Message:
add openssl files


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/etc/mtree/NetBSD.compat.mips64

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



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 18:22:40 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_type_outside_parentheses.c
src/usr.bin/indent: indent.c lexi.c

Log Message:
indent: improve type guessing, fix formatting of declarations


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/tests/usr.bin/indent/lsym_type_outside_parentheses.c
cvs rdiff -u -r1.279 -r1.280 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.190 -r1.191 src/usr.bin/indent/lexi.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/indent/lsym_type_outside_parentheses.c
diff -u src/tests/usr.bin/indent/lsym_type_outside_parentheses.c:1.4 src/tests/usr.bin/indent/lsym_type_outside_parentheses.c:1.5
--- src/tests/usr.bin/indent/lsym_type_outside_parentheses.c:1.4	Mon May 15 17:51:49 2023
+++ src/tests/usr.bin/indent/lsym_type_outside_parentheses.c	Mon May 15 18:22:40 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_type_outside_parentheses.c,v 1.4 2023/05/15 17:51:49 rillig Exp $ */
+/* $NetBSD: lsym_type_outside_parentheses.c,v 1.5 2023/05/15 18:22:40 rillig Exp $ */
 
 /*
  * Tests for the token lsym_type_outside_parentheses, which represents a type
@@ -6,6 +6,7 @@
  * function.
  *
  * See also:
+ *	fmt_decl
  *	lex_ident
  *	lsym_type_in_parentheses
  *	lsym_word
@@ -19,11 +20,12 @@
 //indent input
 t1		   *no_init_ptr;
 t2		   *init_ptr = 0;
-/* $ FIXME: Assume that an identifier after 'const' is a type name. */
-const			t3 * const_no_init_ptr;
+const t3	   *const_no_init_ptr;
 static t4	   *static_no_init_ptr;
-/* $ FIXME: Assume that an identifier after 'typedef' is a type name. */
-typedef t5 * typedef_no_init_ptr;
+typedef t5 *typedef_no_init_ptr;
+
+// $ XXX: There's no point aligning the word 'const' with the other names.
+const char	   *const names[3];
 //indent end
 
 //indent run-equals-input -di24

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.279 src/usr.bin/indent/indent.c:1.280
--- src/usr.bin/indent/indent.c:1.279	Mon May 15 14:55:47 2023
+++ src/usr.bin/indent/indent.c	Mon May 15 18:22:40 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.279 2023/05/15 14:55:47 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.280 2023/05/15 18:22:40 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.279 2023/05/15 14:55:47 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.280 2023/05/15 18:22:40 rillig Exp $");
 
 #include 
 #include 
@@ -411,6 +411,18 @@ want_blank_before_lparen(void)
 return true;
 }
 
+static bool
+want_blank_before_lbracket(void)
+{
+if (code.len == 0)
+	return false;
+if (ps.prev_token == lsym_comma)
+	return true;
+if (ps.prev_token == lsym_binary_op)
+	return true;
+return false;
+}
+
 static void
 process_lparen_or_lbracket(void)
 {
@@ -423,7 +435,8 @@ process_lparen_or_lbracket(void)
 if (is_function_pointer_declaration()) {
 	code_add_decl_indent(ps.decl_ind, ps.tabs_to_var);
 	ps.decl_indent_done = true;
-} else if (want_blank_before_lparen())
+} else if (token.st[0] == '('
+	? want_blank_before_lparen() : want_blank_before_lbracket())
 	buf_add_char(, ' ');
 ps.want_blank = false;
 buf_add_char(, token.st[0]);

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.190 src/usr.bin/indent/lexi.c:1.191
--- src/usr.bin/indent/lexi.c:1.190	Mon May 15 17:28:14 2023
+++ src/usr.bin/indent/lexi.c	Mon May 15 18:22:40 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.190 2023/05/15 17:28:14 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.191 2023/05/15 18:22:40 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: lexi.c,v 1.190 2023/05/15 17:28:14 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.191 2023/05/15 18:22:40 rillig Exp $");
 
 #include 
 #include 
@@ -47,6 +47,7 @@ __RCSID("$NetBSD: lexi.c,v 1.190 2023/05
 
 /* In lexi_alnum, this constant marks a type, independent of parentheses. */
 #define lsym_type lsym_type_outside_parentheses
+#define lsym_type_modifier lsym_storage_class
 
 /* must be sorted alphabetically, is used in binary search */
 static const struct keyword {
@@ -62,7 +63,7 @@ static const struct keyword {
 {"case", lsym_case_label},
 {"char", lsym_type},
 {"complex", lsym_type},
-{"const", lsym_type},
+{"const", lsym_type_modifier},
 {"continue", lsym_word},
 {"default", lsym_case_label},
 {"do", lsym_do},
@@ -92,7 +93,7 @@ static const struct keyword {
 {"union", lsym_tag},
 {"unsigned", lsym_type},
 {"void", lsym_type},
-{"volatile", lsym_type},
+{"volatile", lsym_type_modifier},
 {"while", lsym_while}
 };
 
@@ -371,7 +372,8 @@ lexi_alnum(void)
 while (ch_isblank(inp_peek()))
 	inp_skip();
 
-ps.next_unary = ps.prev_token == lsym_tag;	/* for 

CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 18:22:40 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_type_outside_parentheses.c
src/usr.bin/indent: indent.c lexi.c

Log Message:
indent: improve type guessing, fix formatting of declarations


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/tests/usr.bin/indent/lsym_type_outside_parentheses.c
cvs rdiff -u -r1.279 -r1.280 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.190 -r1.191 src/usr.bin/indent/lexi.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 17:51:49 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_type_outside_parentheses.c

Log Message:
tests/indent: test type detection


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/tests/usr.bin/indent/lsym_type_outside_parentheses.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 17:51:49 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_type_outside_parentheses.c

Log Message:
tests/indent: test type detection


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/tests/usr.bin/indent/lsym_type_outside_parentheses.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/indent/lsym_type_outside_parentheses.c
diff -u src/tests/usr.bin/indent/lsym_type_outside_parentheses.c:1.3 src/tests/usr.bin/indent/lsym_type_outside_parentheses.c:1.4
--- src/tests/usr.bin/indent/lsym_type_outside_parentheses.c:1.3	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/lsym_type_outside_parentheses.c	Mon May 15 17:51:49 2023
@@ -1,13 +1,29 @@
-/* $NetBSD: lsym_type_outside_parentheses.c,v 1.3 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: lsym_type_outside_parentheses.c,v 1.4 2023/05/15 17:51:49 rillig Exp $ */
 
 /*
  * Tests for the token lsym_type_outside_parentheses, which represents a type
  * name outside parentheses, such as in a declaration that is not for a
  * function.
+ *
+ * See also:
+ *	lex_ident
+ *	lsym_type_in_parentheses
+ *	lsym_word
+ *	opt_ta
+ *	opt_T
  */
 
+/*
+ * Indent has to guess which identifiers are types and which are variables.
+ */
 //indent input
-// TODO: add input
+t1		   *no_init_ptr;
+t2		   *init_ptr = 0;
+/* $ FIXME: Assume that an identifier after 'const' is a type name. */
+const			t3 * const_no_init_ptr;
+static t4	   *static_no_init_ptr;
+/* $ FIXME: Assume that an identifier after 'typedef' is a type name. */
+typedef t5 * typedef_no_init_ptr;
 //indent end
 
-//indent run-equals-input
+//indent run-equals-input -di24



CVS commit: src/tests/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 17:38:56 UTC 2023

Modified Files:
src/tests/usr.bin/indent: t_misc.sh t_options.awk

Log Message:
indent: remove accidental space before tab


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/tests/usr.bin/indent/t_misc.sh
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/t_options.awk

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/indent/t_misc.sh
diff -u src/tests/usr.bin/indent/t_misc.sh:1.24 src/tests/usr.bin/indent/t_misc.sh:1.25
--- src/tests/usr.bin/indent/t_misc.sh:1.24	Sat May 13 08:33:39 2023
+++ src/tests/usr.bin/indent/t_misc.sh	Mon May 15 17:38:56 2023
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: t_misc.sh,v 1.24 2023/05/13 08:33:39 rillig Exp $
+# $NetBSD: t_misc.sh,v 1.25 2023/05/15 17:38:56 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -311,7 +311,7 @@ opt_U_body()
 
 		size_t			from stddef.h
 		off_t			for file offsets
- 		 ignored_t		is ignored since it is indented
+		 ignored_t		is ignored since it is indented
 	EOF
 
 	cat <<-\EOF > code.c

Index: src/tests/usr.bin/indent/t_options.awk
diff -u src/tests/usr.bin/indent/t_options.awk:1.11 src/tests/usr.bin/indent/t_options.awk:1.12
--- src/tests/usr.bin/indent/t_options.awk:1.11	Thu May 11 09:28:53 2023
+++ src/tests/usr.bin/indent/t_options.awk	Mon May 15 17:38:56 2023
@@ -1,4 +1,4 @@
-# $NetBSD: t_options.awk,v 1.11 2023/05/11 09:28:53 rillig Exp $
+# $NetBSD: t_options.awk,v 1.12 2023/05/15 17:38:56 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -93,7 +93,7 @@ function quote(s)
 function check_empty_lines_block(n)
 {
 	if (max_empty_lines != n && seen_input_section)
-	 	warn(NR, "expecting " n " empty " (n != 1 ? "lines" : "line") ", got " max_empty_lines)
+		warn(NR, "expecting " n " empty " (n != 1 ? "lines" : "line") ", got " max_empty_lines)
 }
 
 function check_unused_input()



CVS commit: src/tests/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 17:38:56 UTC 2023

Modified Files:
src/tests/usr.bin/indent: t_misc.sh t_options.awk

Log Message:
indent: remove accidental space before tab


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/tests/usr.bin/indent/t_misc.sh
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/t_options.awk

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



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 17:28:14 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lex_ident.c
src/usr.bin/indent: lexi.c

Log Message:
indent: remove backslash line continuation outside preprocessing

The indenter did not handle these backslashes well, interpreting them as
unary operators, and they are an edge case anyway.  Line continuations
in string literals and character constants are kept.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/lex_ident.c
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/indent/lexi.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/indent/lex_ident.c
diff -u src/tests/usr.bin/indent/lex_ident.c:1.5 src/tests/usr.bin/indent/lex_ident.c:1.6
--- src/tests/usr.bin/indent/lex_ident.c:1.5	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/lex_ident.c	Mon May 15 17:28:14 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lex_ident.c,v 1.5 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: lex_ident.c,v 1.6 2023/05/15 17:28:14 rillig Exp $ */
 
 /*
  * Test lexing of word-like tokens, such as keywords, identifiers, numeric
@@ -43,9 +43,7 @@ struct long_tag_name_to_overflow_the_tok
 //indent end
 
 //indent run
-/* $ XXX: The indentation of the backslash is one short of a tab. */
-int	   \
-		variable;
+int		variable;
 
 int
 		no_backslash;

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.189 src/usr.bin/indent/lexi.c:1.190
--- src/usr.bin/indent/lexi.c:1.189	Mon May 15 13:37:16 2023
+++ src/usr.bin/indent/lexi.c	Mon May 15 17:28:14 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.189 2023/05/15 13:37:16 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.190 2023/05/15 17:28:14 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: lexi.c,v 1.189 2023/05/15 13:37:16 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.190 2023/05/15 17:28:14 rillig Exp $");
 
 #include 
 #include 
@@ -476,9 +476,16 @@ lexi(void)
 ps.curr_col_1 = ps.next_col_1;
 ps.next_col_1 = false;
 
-while (ch_isblank(inp_peek())) {
-	ps.curr_col_1 = false;
-	inp_skip();
+for (;;) {
+	if (ch_isblank(inp_peek())) {
+	ps.curr_col_1 = false;
+	inp_skip();
+	} else if (inp_peek() == '\\' && inp_lookahead(1) == '\n') {
+	inp_skip();
+	inp_skip();
+	line_no++;
+	} else
+	break;
 }
 
 lexer_symbol alnum_lsym = lexi_alnum();



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 17:28:14 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lex_ident.c
src/usr.bin/indent: lexi.c

Log Message:
indent: remove backslash line continuation outside preprocessing

The indenter did not handle these backslashes well, interpreting them as
unary operators, and they are an edge case anyway.  Line continuations
in string literals and character constants are kept.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/lex_ident.c
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/indent/lexi.c

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



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 17:06:05 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc: crypto.inc

Log Message:
32bit sparc needs the atomic hack too


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/crypto.inc

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/crypto.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/crypto.inc:1.13 src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/crypto.inc:1.14
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/crypto.inc:1.13	Sun Jun 21 22:16:08 2020
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/crypto.inc	Mon May 15 17:06:05 2023
@@ -12,4 +12,8 @@ AFLAGS.sparcv9a-mont.S+= -Wa,-Av9a
 AFLAGS.sparct4-mont.S+= -Wa,-Av9a
 AFLAGS.vis3-mont.S+= -Wa,-Av9a
 
+.if ${MACHINE} == "sparc"
+COPTS.threads_pthread.c += -DBROKEN_CLANG_ATOMICS   # no atomic 64 bit ops
+.endif
+
 .include "../../crypto.inc"



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 17:06:05 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc: crypto.inc

Log Message:
32bit sparc needs the atomic hack too


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc/crypto.inc

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



CVS commit: src/share/mk

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 16:12:39 UTC 2023

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
switch everyone to OpenSSL-3.x


To generate a diff of this commit:
cvs rdiff -u -r1.1323 -r1.1324 src/share/mk/bsd.own.mk

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



CVS commit: src/share/mk

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 16:12:39 UTC 2023

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
switch everyone to OpenSSL-3.x


To generate a diff of this commit:
cvs rdiff -u -r1.1323 -r1.1324 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1323 src/share/mk/bsd.own.mk:1.1324
--- src/share/mk/bsd.own.mk:1.1323	Sun May 14 18:44:53 2023
+++ src/share/mk/bsd.own.mk	Mon May 15 12:12:39 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1323 2023/05/14 22:44:53 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.1324 2023/05/15 16:12:39 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -131,20 +131,7 @@ EXTERNAL_GDB_SUBDIR=		/does/not/exist
 #
 # What OpenSSL is used?
 #
-.if ${MACHINE} == "amd64" || \
-${MACHINE} == "alpha" || \
-${MACHINE_ARCH:Maarch64*} || \
-${MACHINE_ARCH:M*arm*} || \
-${MACHINE_ARCH} == "powerpc" || \
-${MACHINE_ARCH} == "sparc64" || \
-${MACHINE} == "hppa" || \
-${MACHINE} == "i386" || \
-${MACHINE_ARCH} == "m68k" || \
-${MACHINE} == "vax"
 HAVE_OPENSSL?=	30
-.else
-HAVE_OPENSSL?=  11
-.endif
 
 .if ${HAVE_OPENSSL} == 30
 EXTERNAL_OPENSSL_SUBDIR=openssl



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 16:12:03 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3: crypto.inc
Added Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc: ec.inc
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3: ec.inc

Log Message:
fix ppc, sh3


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ec.inc
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3/crypto.inc
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3/ec.inc

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



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 16:12:03 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3: crypto.inc
Added Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc: ec.inc
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3: ec.inc

Log Message:
fix ppc, sh3


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ec.inc
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3/crypto.inc
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3/ec.inc

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3/crypto.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3/crypto.inc:1.2 src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3/crypto.inc:1.3
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3/crypto.inc:1.2	Mon Sep 24 07:03:40 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3/crypto.inc	Mon May 15 12:12:03 2023
@@ -1,3 +1,4 @@
 
-#CRYPTO_SRCS += libc-memequal.c
+COPTS.threads_pthread.c += -DBROKEN_CLANG_ATOMICS   # no atomic 64 bit ops
+
 .include "../../crypto.inc"

Added files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ec.inc
diff -u /dev/null src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ec.inc:1.1
--- /dev/null	Mon May 15 12:12:03 2023
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ec.inc	Mon May 15 12:12:03 2023
@@ -0,0 +1,3 @@
+ECCPPFLAGS+= -DOPENSSL_NO_EC_NISTP_64_GCC_128
+
+.include "../../ec.inc"

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3/ec.inc
diff -u /dev/null src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3/ec.inc:1.1
--- /dev/null	Mon May 15 12:12:03 2023
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/sh3/ec.inc	Mon May 15 12:12:03 2023
@@ -0,0 +1,3 @@
+ECCPPFLAGS+= -DOPENSSL_NO_EC_NISTP_64_GCC_128
+
+.include "../../ec.inc"



CVS commit: src/tests/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 15:04:48 UTC 2023

Modified Files:
src/tests/usr.bin/indent: fmt_decl.c

Log Message:
tests/indent: demonstrate wrong spacing after function prototype


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/tests/usr.bin/indent/fmt_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/tests/usr.bin/indent/fmt_decl.c
diff -u src/tests/usr.bin/indent/fmt_decl.c:1.39 src/tests/usr.bin/indent/fmt_decl.c:1.40
--- src/tests/usr.bin/indent/fmt_decl.c:1.39	Mon May 15 14:55:47 2023
+++ src/tests/usr.bin/indent/fmt_decl.c	Mon May 15 15:04:48 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fmt_decl.c,v 1.39 2023/05/15 14:55:47 rillig Exp $	*/
+/*	$NetBSD: fmt_decl.c,v 1.40 2023/05/15 15:04:48 rillig Exp $	*/
 
 /*
  * Tests for declarations of global variables, external functions, and local
@@ -887,3 +887,35 @@ char *(*fn)(int, int) = NULL;
 /* XXX: The parameter '(int)' is wrongly interpreted as a type cast. */
 /* XXX: The parameter '(int, int)' is wrongly interpreted as a type cast. */
 //indent run-equals-input -di0
+
+
+/*
+ * Depending on the line break in the function header, the spaces around the
+ * '||' operator were removed.
+ */
+//indent input
+bool is_identifier_start(char ch)
+{
+	return ch_isalpha(ch) || ch == '_';
+}
+
+bool
+is_identifier_start(char ch)
+{
+	return ch_isalpha(ch) || ch == '_';
+}
+//indent end
+
+//indent run
+bool
+is_identifier_start(char ch)
+{
+	return ch_isalpha(ch) || ch == '_';
+}
+
+bool
+is_identifier_start(char ch)
+{
+	return ch_isalpha(ch)||ch == '_';
+}
+//indent end



CVS commit: src/tests/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 15:04:48 UTC 2023

Modified Files:
src/tests/usr.bin/indent: fmt_decl.c

Log Message:
tests/indent: demonstrate wrong spacing after function prototype


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/tests/usr.bin/indent/fmt_decl.c

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



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 14:55:47 UTC 2023

Modified Files:
src/tests/usr.bin/indent: fmt_decl.c opt_pcs.c opt_ta.c ps_ind_level.c
src/usr.bin/indent: indent.c

Log Message:
indent: fix spacing between function prototype and attributes


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/tests/usr.bin/indent/fmt_decl.c
cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/indent/opt_pcs.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/opt_ta.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/indent/ps_ind_level.c
cvs rdiff -u -r1.278 -r1.279 src/usr.bin/indent/indent.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/indent/fmt_decl.c
diff -u src/tests/usr.bin/indent/fmt_decl.c:1.38 src/tests/usr.bin/indent/fmt_decl.c:1.39
--- src/tests/usr.bin/indent/fmt_decl.c:1.38	Sat May 13 06:52:48 2023
+++ src/tests/usr.bin/indent/fmt_decl.c	Mon May 15 14:55:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fmt_decl.c,v 1.38 2023/05/13 06:52:48 rillig Exp $	*/
+/*	$NetBSD: fmt_decl.c,v 1.39 2023/05/15 14:55:47 rillig Exp $	*/
 
 /*
  * Tests for declarations of global variables, external functions, and local
@@ -164,17 +164,18 @@ MAXALIGN(offsetof(int, test)) + MAXIMUM_
  * sensible way.
  */
 //indent input
-void function(const char *, ...) __attribute__((format(printf, 1, 2)));
+void single_param(int) __attribute__((__noreturn__)) ;
+void function(const char *, ...) __attribute__((format(printf, 1, 2))) ;
 //indent end
 
-/* FIXME: missing space before '__attribute__' */
 //indent run -di0
-void function(const char *, ...)__attribute__((format(printf, 1, 2)));
+void single_param(int) __attribute__((__noreturn__));
+void function(const char *, ...) __attribute__((format(printf, 1, 2)));
 //indent end
 
-/* FIXME: missing space before '__attribute__' */
 //indent run
-void		function(const char *, ...)__attribute__((format(printf, 1, 2)));
+void		single_param(int) __attribute__((__noreturn__));
+void		function(const char *, ...) __attribute__((format(printf, 1, 2)));
 //indent end
 
 
@@ -734,8 +735,7 @@ static void JobRestartJobs(void);
 //indent end
 
 //indent run
-/* $ FIXME: Missing space before 'MAKE_ATTR_DEAD'. */
-static void	JobInterrupt(bool, int)MAKE_ATTR_DEAD;
+static void	JobInterrupt(bool, int) MAKE_ATTR_DEAD;
 static void	JobRestartJobs(void);
 //indent end
 

Index: src/tests/usr.bin/indent/opt_pcs.c
diff -u src/tests/usr.bin/indent/opt_pcs.c:1.13 src/tests/usr.bin/indent/opt_pcs.c:1.14
--- src/tests/usr.bin/indent/opt_pcs.c:1.13	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/opt_pcs.c	Mon May 15 14:55:47 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_pcs.c,v 1.13 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: opt_pcs.c,v 1.14 2023/05/15 14:55:47 rillig Exp $ */
 
 /*
  * Tests for the options '-pcs' and '-npcs'.
@@ -48,7 +48,8 @@ int var = (function)(arg);
 
 //indent run -di0 -pcs
 void (*signal (void (*handler) (int))) (int);
-int var = (function) (arg);
+// $ This may be a function call or a cast, depending on the context.
+int var = (function)(arg);
 //indent end
 
 //indent run -di0 -npcs

Index: src/tests/usr.bin/indent/opt_ta.c
diff -u src/tests/usr.bin/indent/opt_ta.c:1.4 src/tests/usr.bin/indent/opt_ta.c:1.5
--- src/tests/usr.bin/indent/opt_ta.c:1.4	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/opt_ta.c	Mon May 15 14:55:47 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_ta.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: opt_ta.c,v 1.5 2023/05/15 14:55:47 rillig Exp $ */
 
 /*
  * Tests for the option '-ta', which assumes that all identifiers that end in
@@ -20,7 +20,7 @@ example(void *arg)
 void
 example(void *arg)
 {
-	int		mult = (unknown_type_name) * arg;
+	int		mult = (unknown_type_name)*arg;
 
 	int		cast = (unknown_type_name_t)*arg;
 }

Index: src/tests/usr.bin/indent/ps_ind_level.c
diff -u src/tests/usr.bin/indent/ps_ind_level.c:1.6 src/tests/usr.bin/indent/ps_ind_level.c:1.7
--- src/tests/usr.bin/indent/ps_ind_level.c:1.6	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/ps_ind_level.c	Mon May 15 14:55:47 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ps_ind_level.c,v 1.6 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: ps_ind_level.c,v 1.7 2023/05/15 14:55:47 rillig Exp $ */
 
 /*
  * The indentation of the very first line of a file determines the
@@ -24,18 +24,9 @@ void function_in_column_1(void){}
 //indent run -i5 -ts8
 		int		indented_by_24;
 
-		void	function_in_column_1(void){
+		void	function_in_column_1(void) {
 		}
 //indent end
-/*
- * In the above function declaration, the space between '){' is missing. This
- * is because the tokenizer only recognizes function definitions if they start
- * at indentation level 0, but this declaration starts at indentation level 4,
- * due to the indentation in line 1. It's an edge case that is probably not
- * worth fixing.
- *
- * See 'in_func_def_params = 

CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 14:55:47 UTC 2023

Modified Files:
src/tests/usr.bin/indent: fmt_decl.c opt_pcs.c opt_ta.c ps_ind_level.c
src/usr.bin/indent: indent.c

Log Message:
indent: fix spacing between function prototype and attributes


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/tests/usr.bin/indent/fmt_decl.c
cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/indent/opt_pcs.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/opt_ta.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/indent/ps_ind_level.c
cvs rdiff -u -r1.278 -r1.279 src/usr.bin/indent/indent.c

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



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 14:27:29 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm: crypto.inc

Log Message:
armv4 also needs the atomic hack


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc

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



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 14:27:29 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm: crypto.inc

Log Message:
armv4 also needs the atomic hack


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc:1.12 src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc:1.13
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc:1.12	Mon May 15 14:08:17 2023
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc	Mon May 15 14:27:29 2023
@@ -5,7 +5,7 @@ CPUID = yes
 CPPFLAGS += -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m
 CPPFLAGS += -DOPENSSL_CPUID_OBJ
 
-.if ${MACHINE_ARCH:Nearmv5*} == ""
+.if ${MACHINE_ARCH:Nearmv[4,5]*} == ""
 COPTS.threads_pthread.c += -DBROKEN_CLANG_ATOMICS   # no atomic 64 bit ops
 .endif
 



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 14:12:03 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_tag.c
src/usr.bin/indent: indent.c

Log Message:
indent: fix indentation of struct member names


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/indent/lsym_tag.c
cvs rdiff -u -r1.277 -r1.278 src/usr.bin/indent/indent.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/indent/lsym_tag.c
diff -u src/tests/usr.bin/indent/lsym_tag.c:1.6 src/tests/usr.bin/indent/lsym_tag.c:1.7
--- src/tests/usr.bin/indent/lsym_tag.c:1.6	Mon May 15 13:53:32 2023
+++ src/tests/usr.bin/indent/lsym_tag.c	Mon May 15 14:12:03 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_tag.c,v 1.6 2023/05/15 13:53:32 rillig Exp $ */
+/* $NetBSD: lsym_tag.c,v 1.7 2023/05/15 14:12:03 rillig Exp $ */
 
 /*
  * Tests for the token lsym_tag, which represents one of the keywords
@@ -118,28 +118,19 @@ struct /* comment */ tag var;
 
 /*
  * Ensure that the names of struct members are all indented the same.
- * Before -XX-XX, the indentation depended on their type name.
+ * Before 2023-05-15, the indentation depended on their type name.
  */
 //indent input
-struct {
+struct outer {
 	enum {
 		untagged_constant,
-	} untagged_member;
+	} untagged_member,
+	  second_untagged_member;
 	enum tag_name {
 		tagged_constant,
-	} tagged_member;
+	} tagged_member,
+	  second_tagged_member;
 };
 //indent end
 
-//indent run -di0
-struct {
-	enum {
-		untagged_constant,
-	}untagged_member;
-	/* $ FIXME: 4 spaces above, should be 1. */
-	enum tag_name {
-		tagged_constant,
-	}tagged_member;
-	/* $ FIXME: 8 spaces above, should be 1. */
-};
-//indent end
+//indent run-equals-input -di0

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.277 src/usr.bin/indent/indent.c:1.278
--- src/usr.bin/indent/indent.c:1.277	Mon May 15 13:37:16 2023
+++ src/usr.bin/indent/indent.c	Mon May 15 14:12:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.277 2023/05/15 13:37:16 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.278 2023/05/15 14:12:03 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.277 2023/05/15 13:37:16 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.278 2023/05/15 14:12:03 rillig Exp $");
 
 #include 
 #include 
@@ -799,6 +799,9 @@ process_ident(lexer_symbol lsym)
 
 	} else if (!ps.block_init && !ps.decl_indent_done &&
 		ps.line_start_nparen == 0) {
+	if (opt.decl_indent == 0
+		&& code.len > 0 && code.mem[code.len - 1] == '}')
+		ps.decl_ind = ind_add(0, code.st, code.len) + 1;
 	code_add_decl_indent(ps.decl_ind, ps.tabs_to_var);
 	ps.decl_indent_done = true;
 	ps.want_blank = false;



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 14:12:03 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_tag.c
src/usr.bin/indent: indent.c

Log Message:
indent: fix indentation of struct member names


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/indent/lsym_tag.c
cvs rdiff -u -r1.277 -r1.278 src/usr.bin/indent/indent.c

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



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 14:08:17 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm: crypto.inc

Log Message:
Fix armv5


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc

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



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 14:08:17 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm: crypto.inc

Log Message:
Fix armv5


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc:1.11 src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc:1.12
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc:1.11	Sat May  9 13:16:42 2020
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/arm/crypto.inc	Mon May 15 14:08:17 2023
@@ -5,5 +5,9 @@ CPUID = yes
 CPPFLAGS += -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m
 CPPFLAGS += -DOPENSSL_CPUID_OBJ
 
+.if ${MACHINE_ARCH:Nearmv5*} == ""
+COPTS.threads_pthread.c += -DBROKEN_CLANG_ATOMICS   # no atomic 64 bit ops
+.endif
+
 .include "../../crypto.inc"
 



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 14:04:38 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64: bn.inc
chacha.inc ec.inc

Log Message:
fix build


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/bn.inc \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/chacha.inc
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/ec.inc

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



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 14:04:38 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64: bn.inc
chacha.inc ec.inc

Log Message:
fix build


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/bn.inc \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/chacha.inc
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/ec.inc

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/bn.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/bn.inc:1.1 src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/bn.inc:1.2
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/bn.inc:1.1	Sat Oct 15 08:19:02 2016
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/bn.inc	Mon May 15 10:04:38 2023
@@ -1,4 +1,4 @@
 .PATH.S: ${.PARSEDIR}
-BN_SRCS = ppc.S ppc-mont.S ppc64-mont.S
+BN_SRCS = ppc.S ppc-mont.S ppc64-mont.S bn_ppc.c
 CPPFLAGS += -DOPENSSL_BN_ASM_MONT
 .include "../../bn.inc"
Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/chacha.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/chacha.inc:1.1 src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/chacha.inc:1.2
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/chacha.inc:1.1	Sun Mar  4 11:45:12 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/chacha.inc	Mon May 15 10:04:38 2023
@@ -1,5 +1,5 @@
 .PATH.S: ${.PARSEDIR}
 
-CHACHA_SRCS = chacha-ppc.S
+CHACHA_SRCS = chacha-ppc.S chacha_ppc.c
 
 .include "../../chacha.inc"

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/ec.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/ec.inc:1.2 src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/ec.inc:1.3
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/ec.inc:1.2	Fri Sep 28 13:28:01 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/ec.inc	Mon May 15 10:04:38 2023
@@ -1,8 +1,11 @@
 .PATH.S: ${.PARSEDIR}
 EC_SRCS += \
 ecp_nistz256-ppc64.S \
+ecp_nistp521-ppc64.S \
+ecp_ppc.c \
 x25519-ppc64.S 
 
 ECCPPFLAGS+= -DX25519_ASM
+ECNI=yes
 
 .include "../../ec.inc"



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 13:54:12 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips: crypto.inc
Added Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips: ec.inc

Log Message:
fix mips


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/ec.inc

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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 13:53:32 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_tag.c

Log Message:
tests/indent: demonstrate wrong indentation of struct members


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/lsym_tag.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/indent/lsym_tag.c
diff -u src/tests/usr.bin/indent/lsym_tag.c:1.5 src/tests/usr.bin/indent/lsym_tag.c:1.6
--- src/tests/usr.bin/indent/lsym_tag.c:1.5	Sun Apr 24 10:36:37 2022
+++ src/tests/usr.bin/indent/lsym_tag.c	Mon May 15 13:53:32 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_tag.c,v 1.5 2022/04/24 10:36:37 rillig Exp $ */
+/* $NetBSD: lsym_tag.c,v 1.6 2023/05/15 13:53:32 rillig Exp $ */
 
 /*
  * Tests for the token lsym_tag, which represents one of the keywords
@@ -114,3 +114,32 @@ struct   /* comment */   tag var;
 //indent run -di0
 struct /* comment */ tag var;
 //indent end
+
+
+/*
+ * Ensure that the names of struct members are all indented the same.
+ * Before -XX-XX, the indentation depended on their type name.
+ */
+//indent input
+struct {
+	enum {
+		untagged_constant,
+	} untagged_member;
+	enum tag_name {
+		tagged_constant,
+	} tagged_member;
+};
+//indent end
+
+//indent run -di0
+struct {
+	enum {
+		untagged_constant,
+	}untagged_member;
+	/* $ FIXME: 4 spaces above, should be 1. */
+	enum tag_name {
+		tagged_constant,
+	}tagged_member;
+	/* $ FIXME: 8 spaces above, should be 1. */
+};
+//indent end



CVS commit: src/tests/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 13:53:32 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_tag.c

Log Message:
tests/indent: demonstrate wrong indentation of struct members


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/lsym_tag.c

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



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips

2023-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 15 13:54:12 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips: crypto.inc
Added Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips: ec.inc

Log Message:
fix mips


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/ec.inc

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc:1.8 src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc:1.9
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc:1.8	Mon Apr 26 14:06:09 2021
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/crypto.inc	Mon May 15 09:54:12 2023
@@ -6,4 +6,8 @@
 CRYPTO_SRCS += mips-mont${MIPS_64}.S
 .endif
 
+.if ${MIPS_64} == ""
+COPTS.threads_pthread.c += -DBROKEN_CLANG_ATOMICS   # no atomic 64 bit ops
+.endif
+
 .include "../../crypto.inc"

Added files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/ec.inc
diff -u /dev/null src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/ec.inc:1.1
--- /dev/null	Mon May 15 09:54:12 2023
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/mips/ec.inc	Mon May 15 09:54:12 2023
@@ -0,0 +1,3 @@
+ECCPPFLAGS+= -DOPENSSL_NO_EC_NISTP_64_GCC_128
+
+.include "../../ec.inc"



CVS commit: src/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 13:37:16 UTC 2023

Modified Files:
src/usr.bin/indent: debug.c indent.c io.c lexi.c

Log Message:
indent: indent multi-line conditions

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.276 -r1.277 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.169 -r1.170 src/usr.bin/indent/io.c
cvs rdiff -u -r1.188 -r1.189 src/usr.bin/indent/lexi.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 13:37:16 UTC 2023

Modified Files:
src/usr.bin/indent: debug.c indent.c io.c lexi.c

Log Message:
indent: indent multi-line conditions

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.276 -r1.277 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.169 -r1.170 src/usr.bin/indent/io.c
cvs rdiff -u -r1.188 -r1.189 src/usr.bin/indent/lexi.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/indent/debug.c
diff -u src/usr.bin/indent/debug.c:1.7 src/usr.bin/indent/debug.c:1.8
--- src/usr.bin/indent/debug.c:1.7	Mon May 15 09:00:51 2023
+++ src/usr.bin/indent/debug.c	Mon May 15 13:37:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: debug.c,v 1.7 2023/05/15 09:00:51 rillig Exp $	*/
+/*	$NetBSD: debug.c,v 1.8 2023/05/15 13:37:16 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: debug.c,v 1.7 2023/05/15 09:00:51 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.8 2023/05/15 13:37:16 rillig Exp $");
 
 #include 
 
@@ -210,8 +210,8 @@ ps_paren_has_changed(const struct parser
 
 for (int i = 0; i < ps.nparen; i++) {
 	if (curr[i].indent != prev[i].indent ||
-	curr[i].maybe_cast != prev[i].maybe_cast ||
-	curr[i].no_cast != prev[i].no_cast)
+		curr[i].maybe_cast != prev[i].maybe_cast ||
+		curr[i].no_cast != prev[i].no_cast)
 	return true;
 }
 return false;

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.276 src/usr.bin/indent/indent.c:1.277
--- src/usr.bin/indent/indent.c:1.276	Mon May 15 13:33:19 2023
+++ src/usr.bin/indent/indent.c	Mon May 15 13:37:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.276 2023/05/15 13:33:19 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.277 2023/05/15 13:37:16 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.276 2023/05/15 13:33:19 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.277 2023/05/15 13:37:16 rillig Exp $");
 
 #include 
 #include 
@@ -372,8 +372,8 @@ static void
 process_newline(void)
 {
 if (ps.prev_token == lsym_comma && ps.nparen == 0 && !ps.block_init &&
-	!opt.break_after_comma && break_comma &&
-	com.len == 0)
+	!opt.break_after_comma && break_comma &&
+	com.len == 0)
 	goto stay_in_line;
 
 output_line();
@@ -465,7 +465,7 @@ process_rparen_or_rbracket(void)
 }
 
 if (ps.paren[ps.nparen - 1].maybe_cast &&
-	!ps.paren[ps.nparen - 1].no_cast) {
+	!ps.paren[ps.nparen - 1].no_cast) {
 	ps.next_unary = true;
 	ps.paren[ps.nparen - 1].maybe_cast = false;
 	ps.want_blank = opt.space_after_cast;
@@ -508,7 +508,7 @@ static void
 process_unary_op(void)
 {
 if (!ps.decl_indent_done && ps.in_decl && !ps.block_init &&
-	!ps.is_function_definition && ps.line_start_nparen == 0) {
+	!ps.is_function_definition && ps.line_start_nparen == 0) {
 	/* pointer declarations */
 	code_add_decl_indent(ps.decl_ind - (int)token.len, ps.tabs_to_var);
 	ps.decl_indent_done = true;
@@ -598,7 +598,7 @@ process_semicolon(void)
 ps.declaration = ps.declaration == decl_begin ? decl_end : decl_no;
 
 if (ps.in_decl && code.len == 0 && !ps.block_init &&
-	!ps.decl_indent_done && ps.line_start_nparen == 0) {
+	!ps.decl_indent_done && ps.line_start_nparen == 0) {
 	/* indent stray semicolons in declarations */
 	code_add_decl_indent(ps.decl_ind - 1, ps.tabs_to_var);
 	ps.decl_indent_done = true;
@@ -958,11 +958,11 @@ process_preprocessing(void)
 
 } else {
 	if (!substring_equals(dir, "pragma") &&
-	!substring_equals(dir, "error") &&
-	!substring_equals(dir, "line") &&
-	!substring_equals(dir, "undef") &&
-	!substring_equals(dir, "define") &&
-	!substring_equals(dir, "include")) {
+		!substring_equals(dir, "error") &&
+		!substring_equals(dir, "line") &&
+		!substring_equals(dir, "undef") &&
+		!substring_equals(dir, "define") &&
+		!substring_equals(dir, "include")) {
 	diag(1, "Unrecognized cpp directive \"%.*s\"",
 		(int)(dir.e - dir.s), dir.s);
 	return;

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.169 src/usr.bin/indent/io.c:1.170
--- src/usr.bin/indent/io.c:1.169	Mon May 15 13:33:19 2023
+++ src/usr.bin/indent/io.c	Mon May 15 13:37:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.169 2023/05/15 13:33:19 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.170 2023/05/15 13:37:16 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: io.c,v 1.169 2023/05/15 13:33:19 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.170 2023/05/15 13:37:16 rillig Exp $");
 
 #include 
 #include 
@@ -255,7 +255,7 @@ output_complete_line(char line_terminato
 	ps.in_stmt_cont = false;	/* this is a class A kludge */
 
 	if 

CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 13:33:20 UTC 2023

Modified Files:
src/tests/usr.bin/indent: opt_eei.c
src/usr.bin/indent: indent.c indent.h io.c

Log Message:
indent: fix indentation of statements after controlling expression


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/opt_eei.c
cvs rdiff -u -r1.275 -r1.276 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.138 -r1.139 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.168 -r1.169 src/usr.bin/indent/io.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/indent/opt_eei.c
diff -u src/tests/usr.bin/indent/opt_eei.c:1.11 src/tests/usr.bin/indent/opt_eei.c:1.12
--- src/tests/usr.bin/indent/opt_eei.c:1.11	Mon May 15 13:28:05 2023
+++ src/tests/usr.bin/indent/opt_eei.c	Mon May 15 13:33:19 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_eei.c,v 1.11 2023/05/15 13:28:05 rillig Exp $ */
+/* $NetBSD: opt_eei.c,v 1.12 2023/05/15 13:33:19 rillig Exp $ */
 
 /*
  * Tests for the options '-eei' and '-neei'.
@@ -183,7 +183,7 @@ b)
 	cond
 	)
 	stmt(
-		arg
+	arg
 	);
 }
 //indent end

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.275 src/usr.bin/indent/indent.c:1.276
--- src/usr.bin/indent/indent.c:1.275	Mon May 15 12:59:43 2023
+++ src/usr.bin/indent/indent.c	Mon May 15 13:33:19 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.275 2023/05/15 12:59:43 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.276 2023/05/15 13:33:19 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.275 2023/05/15 12:59:43 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.276 2023/05/15 13:33:19 rillig Exp $");
 
 #include 
 #include 
@@ -348,7 +348,6 @@ maybe_break_line(lexer_symbol lsym)
 	diag(0, "Line broken");
 output_line();
 ps.force_nl = false;
-ps.extra_expr_indent = false;
 }
 
 static void
@@ -436,7 +435,7 @@ process_lparen_or_lbracket(void)
 if (opt.extra_expr_indent && !opt.lineup_to_parens
 	&& ps.spaced_expr_psym != psym_0 && ps.nparen == 1
 	&& opt.continuation_indent == opt.indent_size)
-	ps.extra_expr_indent = true;
+	ps.extra_expr_indent = eei_yes;
 
 if (opt.extra_expr_indent && ps.spaced_expr_psym != psym_0
 	&& ps.nparen == 1 && ps.paren[0].indent < 2 * opt.indent_size) {
@@ -484,6 +483,8 @@ unbalanced:
 buf_add_char(, token.st[0]);
 
 if (ps.spaced_expr_psym != psym_0 && ps.nparen == 0) {
+	if (ps.extra_expr_indent == eei_yes)
+	ps.extra_expr_indent = eei_last;
 	ps.force_nl = true;
 	ps.next_unary = true;
 	ps.in_stmt_or_decl = false;

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.138 src/usr.bin/indent/indent.h:1.139
--- src/usr.bin/indent/indent.h:1.138	Mon May 15 12:59:43 2023
+++ src/usr.bin/indent/indent.h	Mon May 15 13:33:19 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.138 2023/05/15 12:59:43 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.139 2023/05/15 13:33:19 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -308,7 +308,11 @@ extern struct parser_state {
 int di_stack[20];		/* a stack of structure indentation levels */
 bool tabs_to_var;		/* true if using tabs to indent to var name */
 
-bool extra_expr_indent;
+enum {
+	eei_no,
+	eei_yes,
+	eei_last
+} extra_expr_indent;
 
 enum {
 	in_enum_no,		/* outside any 'enum { ... }' */

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.168 src/usr.bin/indent/io.c:1.169
--- src/usr.bin/indent/io.c:1.168	Mon May 15 12:59:43 2023
+++ src/usr.bin/indent/io.c	Mon May 15 13:33:19 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.168 2023/05/15 12:59:43 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.169 2023/05/15 13:33:19 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: io.c,v 1.168 2023/05/15 12:59:43 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.169 2023/05/15 13:33:19 rillig Exp $");
 
 #include 
 #include 
@@ -274,6 +274,8 @@ output_complete_line(char line_terminato
 ps.decl_on_line = ps.in_decl;	/* for proper comment indentation */
 ps.in_stmt_cont = ps.in_stmt_or_decl && !ps.in_decl;
 ps.decl_indent_done = false;
+if (ps.extra_expr_indent == eei_last)
+	ps.extra_expr_indent = eei_no;
 
 lab.len = 0;
 code.len = 0;
@@ -338,7 +340,7 @@ compute_code_indent(void)
 	return compute_code_indent_lineup(base_ind);
 }
 
-if (ps.extra_expr_indent)
+if (ps.extra_expr_indent != eei_no)
 	return base_ind + 2 * opt.continuation_indent;
 
 if (2 * opt.continuation_indent == opt.indent_size)



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 13:33:20 UTC 2023

Modified Files:
src/tests/usr.bin/indent: opt_eei.c
src/usr.bin/indent: indent.c indent.h io.c

Log Message:
indent: fix indentation of statements after controlling expression


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/opt_eei.c
cvs rdiff -u -r1.275 -r1.276 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.138 -r1.139 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.168 -r1.169 src/usr.bin/indent/io.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 13:28:05 UTC 2023

Modified Files:
src/tests/usr.bin/indent: opt_eei.c

Log Message:
tests/indent: add another test for -eei -nlp


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/opt_eei.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/indent/opt_eei.c
diff -u src/tests/usr.bin/indent/opt_eei.c:1.10 src/tests/usr.bin/indent/opt_eei.c:1.11
--- src/tests/usr.bin/indent/opt_eei.c:1.10	Mon May 15 12:59:43 2023
+++ src/tests/usr.bin/indent/opt_eei.c	Mon May 15 13:28:05 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_eei.c,v 1.10 2023/05/15 12:59:43 rillig Exp $ */
+/* $NetBSD: opt_eei.c,v 1.11 2023/05/15 13:28:05 rillig Exp $ */
 
 /*
  * Tests for the options '-eei' and '-neei'.
@@ -160,3 +160,30 @@ b)
 	stmt();
 }
 //indent end
+
+
+/*
+ * Ensure that after a condition with extra indentation, the following
+ * statements are not affected.
+ */
+//indent input
+{
+	if (
+		cond
+	)
+		stmt(
+			arg
+		);
+}
+//indent end
+
+//indent run -eei -nlp -i4
+{
+if (
+	cond
+	)
+	stmt(
+		arg
+	);
+}
+//indent end



CVS commit: src/tests/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 13:28:05 UTC 2023

Modified Files:
src/tests/usr.bin/indent: opt_eei.c

Log Message:
tests/indent: add another test for -eei -nlp


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/opt_eei.c

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



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 12:59:44 UTC 2023

Modified Files:
src/tests/usr.bin/indent: opt_eei.c
src/usr.bin/indent: indent.c indent.h io.c

Log Message:
indent: fix indentation of expressions in -nlp -eei mode


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/indent/opt_eei.c
cvs rdiff -u -r1.274 -r1.275 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.137 -r1.138 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.167 -r1.168 src/usr.bin/indent/io.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/indent/opt_eei.c
diff -u src/tests/usr.bin/indent/opt_eei.c:1.9 src/tests/usr.bin/indent/opt_eei.c:1.10
--- src/tests/usr.bin/indent/opt_eei.c:1.9	Mon May 15 12:11:07 2023
+++ src/tests/usr.bin/indent/opt_eei.c	Mon May 15 12:59:43 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_eei.c,v 1.9 2023/05/15 12:11:07 rillig Exp $ */
+/* $NetBSD: opt_eei.c,v 1.10 2023/05/15 12:59:43 rillig Exp $ */
 
 /*
  * Tests for the options '-eei' and '-neei'.
@@ -127,22 +127,17 @@ b)
 //indent run -eei -i4 -nlp
 {
 if (a <
-/* $ FIXME: Needs extra indentation. */
-	b)
+	b)
 	stmt();
 if (a
-/* $ FIXME: Needs extra indentation. */
-	<
-/* $ FIXME: Needs extra indentation. */
-	b)
+	<
+	b)
 	stmt();
 while (a
-/* $ FIXME: Needs extra indentation. */
-	< b)
+	< b)
 	stmt();
 switch (
-/* $ FIXME: Needs extra indentation. */
-	a)
+	a)
 	stmt();
 }
 //indent end

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.274 src/usr.bin/indent/indent.c:1.275
--- src/usr.bin/indent/indent.c:1.274	Mon May 15 10:13:40 2023
+++ src/usr.bin/indent/indent.c	Mon May 15 12:59:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.274 2023/05/15 10:13:40 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.275 2023/05/15 12:59:43 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.274 2023/05/15 10:13:40 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.275 2023/05/15 12:59:43 rillig Exp $");
 
 #include 
 #include 
@@ -348,6 +348,7 @@ maybe_break_line(lexer_symbol lsym)
 	diag(0, "Line broken");
 output_line();
 ps.force_nl = false;
+ps.extra_expr_indent = false;
 }
 
 static void
@@ -432,6 +433,11 @@ process_lparen_or_lbracket(void)
 debug_println("paren_indents[%d] is now %d",
 	ps.nparen - 1, ps.paren[ps.nparen - 1].indent);
 
+if (opt.extra_expr_indent && !opt.lineup_to_parens
+	&& ps.spaced_expr_psym != psym_0 && ps.nparen == 1
+	&& opt.continuation_indent == opt.indent_size)
+	ps.extra_expr_indent = true;
+
 if (opt.extra_expr_indent && ps.spaced_expr_psym != psym_0
 	&& ps.nparen == 1 && ps.paren[0].indent < 2 * opt.indent_size) {
 	ps.paren[0].indent = (short)(2 * opt.indent_size);

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.137 src/usr.bin/indent/indent.h:1.138
--- src/usr.bin/indent/indent.h:1.137	Mon May 15 10:13:40 2023
+++ src/usr.bin/indent/indent.h	Mon May 15 12:59:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.137 2023/05/15 10:13:40 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.138 2023/05/15 12:59:43 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -308,6 +308,8 @@ extern struct parser_state {
 int di_stack[20];		/* a stack of structure indentation levels */
 bool tabs_to_var;		/* true if using tabs to indent to var name */
 
+bool extra_expr_indent;
+
 enum {
 	in_enum_no,		/* outside any 'enum { ... }' */
 	in_enum_enum,		/* after keyword 'enum' */

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.167 src/usr.bin/indent/io.c:1.168
--- src/usr.bin/indent/io.c:1.167	Mon May 15 08:11:27 2023
+++ src/usr.bin/indent/io.c	Mon May 15 12:59:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.167 2023/05/15 08:11:27 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.168 2023/05/15 12:59:43 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: io.c,v 1.167 2023/05/15 08:11:27 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.168 2023/05/15 12:59:43 rillig Exp $");
 
 #include 
 #include 
@@ -338,6 +338,9 @@ compute_code_indent(void)
 	return compute_code_indent_lineup(base_ind);
 }
 
+if (ps.extra_expr_indent)
+	return base_ind + 2 * opt.continuation_indent;
+
 if (2 * opt.continuation_indent == opt.indent_size)
 	return base_ind + opt.continuation_indent;
 else



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 12:59:44 UTC 2023

Modified Files:
src/tests/usr.bin/indent: opt_eei.c
src/usr.bin/indent: indent.c indent.h io.c

Log Message:
indent: fix indentation of expressions in -nlp -eei mode


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/indent/opt_eei.c
cvs rdiff -u -r1.274 -r1.275 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.137 -r1.138 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.167 -r1.168 src/usr.bin/indent/io.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 12:11:07 UTC 2023

Modified Files:
src/tests/usr.bin/indent: opt_eei.c

Log Message:
tests/indent: test extra indentation with fixed continuation indentation


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/indent/opt_eei.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 12:11:07 UTC 2023

Modified Files:
src/tests/usr.bin/indent: opt_eei.c

Log Message:
tests/indent: test extra indentation with fixed continuation indentation


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/indent/opt_eei.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/indent/opt_eei.c
diff -u src/tests/usr.bin/indent/opt_eei.c:1.8 src/tests/usr.bin/indent/opt_eei.c:1.9
--- src/tests/usr.bin/indent/opt_eei.c:1.8	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/opt_eei.c	Mon May 15 12:11:07 2023
@@ -1,156 +1,167 @@
-/* $NetBSD: opt_eei.c,v 1.8 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: opt_eei.c,v 1.9 2023/05/15 12:11:07 rillig Exp $ */
 
 /*
  * Tests for the options '-eei' and '-neei'.
  *
  * The option '-eei' enables extra indentation on continuation lines of the
  * expression part of 'if' and 'while' statements. These continuation lines
- * are indented one extra level.
+ * are indented one extra level to avoid being confused for the first
+ * statement of the body, even if the condition line starts with an operator
+ * such as '&&' or '<' that could not start a statement.
  *
  * The option '-neei' indents these conditions in the same way as all other
  * continued statements.
  */
 
 //indent input
-bool
-less(int a, int b)
+{
+	if (a <
+b)
+		stmt();
+	if (a
+<
+b)
+		stmt();
+	while (a
+< b)
+		stmt();
+	switch (
+		a)
+		stmt();
+}
+//indent end
+
+/*
+ * By default, continuation lines are aligned on parentheses, and only a
+ * multi-line switch statement would have ambiguous indentation.
+ */
+//indent run
 {
 	if (a <
 	b)
-		return true;
+		stmt();
 	if (a
 	<
 	b)
-		return true;
+		stmt();
+	while (a
+	   < b)
+		stmt();
+	switch (
+		a)
+		stmt();
 }
 //indent end
 
+//indent run-equals-prev-output -neei
+
+/*
+ * For indentation 8, the only expression that needs to be disambiguated is
+ * the one from the switch statement.
+ */
 //indent run -eei
-bool
-less(int a, int b)
 {
 	if (a <
+/* $ XXX: No extra indentation necessary. */
 			b)
-		return true;
+		stmt();
 	if (a
+/* $ XXX: No extra indentation necessary. */
 			<
+/* $ XXX: No extra indentation necessary. */
 			b)
-		return true;
+		stmt();
+	while (a
+/* $ XXX: No extra indentation necessary. */
+			< b)
+		stmt();
+	switch (
+			a)
+		stmt();
 }
 //indent end
 
-//indent run-equals-input -neei
-
-/*
- * When a single indentation level is the same as the continuation
- * indentation, the code does not clearly show whether the 'b' belongs to the
- * condition or the body statement.
- */
+/* For indentation 4, the expressions from the 'if' are ambiguous. */
 //indent run -neei -i4
-bool
-less(int a, int b)
 {
 if (a <
 	b)
-	return true;
+	stmt();
 if (a
 	<
 	b)
-	return true;
+	stmt();
+while (a
+	   < b)
+	stmt();
+switch (
+	a)
+	stmt();
 }
 //indent end
 
-/*
- * Adding the extra level of indentation is useful when the standard
- * indentation is the same as the indentation of statement continuations. In
- * such a case, the continued condition would have the same indentation as the
- * following statement, which would be confusing.
- */
 //indent run -eei -i4
-bool
-less(int a, int b)
 {
 if (a <
 	b)
-	return true;
+	stmt();
 if (a
 	<
 	b)
-	return true;
+	stmt();
+while (a
+/* $ XXX: No extra indentation necessary. */
+	< b)
+	stmt();
+switch (
+/* $ XXX: No extra indentation necessary. */
+	a)
+	stmt();
 }
 //indent end
 
 /*
- * With an indentation size of 4, the width of the code 'if (' is exactly one
- * indentation level. With the option '-nlp', the option '-eei' has no effect.
- *
- * XXX: This is unexpected since this creates the exact ambiguity that the
- * option '-eei' is supposed to prevent.
+ * The -nlp option uses a fixed indentation for continuation lines. The if
+ * statements are disambiguated.
  */
 //indent run -eei -i4 -nlp
-bool
-less(int a, int b)
 {
 if (a <
+/* $ FIXME: Needs extra indentation. */
 	b)
-	return true;
+	stmt();
 if (a
+/* $ FIXME: Needs extra indentation. */
 	<
+/* $ FIXME: Needs extra indentation. */
 	b)
-	return true;
-}
-//indent end
-
-
-/*
- * The option '-eei' applies no matter whether the continued expression starts
- * with a word or an operator like '&&'. The latter cannot start a statement,
- * so there would be no ambiguity.
- */
-//indent input
-{
-	if (a
-&& b)
-	stmt();
-}
-//indent end
-
-/*
- * XXX: The extra indentation is unnecessary since there is no possible
- * confusion: the standard indentation is 8, the indentation of the continued
- * condition could have stayed at 4.
- */
-//indent run -eei
-{
-	if (a
-			&& b)
-		stmt();
-}
-//indent end
-
-/*
- * The extra indentation is necessary here since otherwise the '&&' and the
- * 'stmt()' would start at 

CVS commit: [netbsd-10] src/doc

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:40:13 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Tickets #166 - #169


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.63 -r1.1.2.64 src/doc/CHANGES-10.0

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-10.0
diff -u src/doc/CHANGES-10.0:1.1.2.63 src/doc/CHANGES-10.0:1.1.2.64
--- src/doc/CHANGES-10.0:1.1.2.63	Sat May 13 14:06:13 2023
+++ src/doc/CHANGES-10.0	Mon May 15 10:40:13 2023
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-10.0,v 1.1.2.63 2023/05/13 14:06:13 martin Exp $
+# $NetBSD: CHANGES-10.0,v 1.1.2.64 2023/05/15 10:40:13 martin Exp $
 
 A complete list of changes from the initial NetBSD 10.0 branch on 2022-12-16
 until the 10.0 release:
@@ -1850,3 +1850,26 @@ distrib/notes/common/main			(manually ed
 
 	Add dedication to Ryo Shimizu.
 	[from board]
+
+sys/arch/x68k/stand/boot_ufs/Makefile		1.39
+
+	Add udivdi3/umoddi3 (and ashldi3) that were required by recent
+	UFS change.
+	[chs, ticket #166]
+
+sys/uvm/uvm_map.c1.406
+
+	uvm: PR 56952: avoid a deadlock in uvm_map_clean().
+	[chs, ticket #167]
+
+sys/arch/hppa/stand/xxboot/Makefile		1.4
+sys/sys/types.h	1.106
+
+	hppa: avoid 64bit math in the first stage bootloader.
+	[chs, ticket #168]
+
+sys/arch/mips/include/vmparam.h			1.67
+
+	mips: bump MAXTSIZ from 64MB to 128MB also for the o32 ABI.
+	[he, ticket #169]
+



CVS commit: [netbsd-10] src/sys/arch/mips/include

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:37:24 UTC 2023

Modified Files:
src/sys/arch/mips/include [netbsd-10]: vmparam.h

Log Message:
Pull up following revision(s) (requested by he in ticket #169):

sys/arch/mips/include/vmparam.h: revision 1.67

Bump MAXTSIZ from 64MB to 128MB also for o32.

This so that the rather large cc1 from gcc12 can be run.

OK'ed by simonb@


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.66.10.1 src/sys/arch/mips/include/vmparam.h

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

Modified files:

Index: src/sys/arch/mips/include/vmparam.h
diff -u src/sys/arch/mips/include/vmparam.h:1.66 src/sys/arch/mips/include/vmparam.h:1.66.10.1
--- src/sys/arch/mips/include/vmparam.h:1.66	Wed Jun 23 15:11:40 2021
+++ src/sys/arch/mips/include/vmparam.h	Mon May 15 10:37:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.66 2021/06/23 15:11:40 simonb Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.66.10.1 2023/05/15 10:37:24 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -88,7 +88,7 @@
  */
 #if defined(__mips_o32)
 #ifndef MAXTSIZ
-#define	MAXTSIZ		(64*1024*1024)		/* max text size */
+#define	MAXTSIZ		(128*1024*1024)		/* max text size */
 #endif
 #ifndef DFLDSIZ
 #define	DFLDSIZ		(128*1024*1024)		/* initial data size limit */



CVS commit: [netbsd-10] src/doc

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:40:13 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Tickets #166 - #169


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.63 -r1.1.2.64 src/doc/CHANGES-10.0

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



CVS commit: [netbsd-10] src/sys/arch/mips/include

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:37:24 UTC 2023

Modified Files:
src/sys/arch/mips/include [netbsd-10]: vmparam.h

Log Message:
Pull up following revision(s) (requested by he in ticket #169):

sys/arch/mips/include/vmparam.h: revision 1.67

Bump MAXTSIZ from 64MB to 128MB also for o32.

This so that the rather large cc1 from gcc12 can be run.

OK'ed by simonb@


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.66.10.1 src/sys/arch/mips/include/vmparam.h

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



CVS commit: [netbsd-10] src/sys

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:34:58 UTC 2023

Modified Files:
src/sys/arch/hppa/stand/xxboot [netbsd-10]: Makefile
src/sys/sys [netbsd-10]: types.h

Log Message:
Pull up following revision(s) (requested by chs in ticket #168):

sys/sys/types.h: revision 1.106
sys/arch/hppa/stand/xxboot/Makefile: revision 1.4

Avoid 64bit math in the hppa first stage bootloader. Ok chs@


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.30.1 src/sys/arch/hppa/stand/xxboot/Makefile
cvs rdiff -u -r1.105 -r1.105.20.1 src/sys/sys/types.h

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

Modified files:

Index: src/sys/arch/hppa/stand/xxboot/Makefile
diff -u src/sys/arch/hppa/stand/xxboot/Makefile:1.3 src/sys/arch/hppa/stand/xxboot/Makefile:1.3.30.1
--- src/sys/arch/hppa/stand/xxboot/Makefile:1.3	Tue Nov 13 21:22:38 2018
+++ src/sys/arch/hppa/stand/xxboot/Makefile	Mon May 15 10:34:58 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2018/11/13 21:22:38 skrll Exp $
+#	$NetBSD: Makefile,v 1.3.30.1 2023/05/15 10:34:58 martin Exp $
 
 NODEBUG=yes
 PROG=	xxboot
@@ -11,7 +11,7 @@ CPPFLAGS+=	-I${.CURDIR}/../../../.. -I. 
 # configuration for readufs module
 CPPFLAGS+=	-DUSE_LFS -DUSE_FFS -DUSE_UFS1 -DUSE_UFS2
 # IODC can handle only 2GB, so this is enough
-CPPFLAGS+=	-D__daddr_t=int32_t
+CPPFLAGS+=	-D__daddr_t=int32_t -D__ino_t=uint32_t
 # ANSI C feature prevents from being relocatable
 #CPPFLAGS+=	-traditional	# would be best
 CPPFLAGS+=	-Dconst=

Index: src/sys/sys/types.h
diff -u src/sys/sys/types.h:1.105 src/sys/sys/types.h:1.105.20.1
--- src/sys/sys/types.h:1.105	Sat May 16 18:31:53 2020
+++ src/sys/sys/types.h	Mon May 15 10:34:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.105 2020/05/16 18:31:53 christos Exp $	*/
+/*	$NetBSD: types.h,v 1.105.20.1 2023/05/15 10:34:58 martin Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993, 1994
@@ -163,7 +163,17 @@ typedef	__gid_t		gid_t;		/* group id */
 #endif
 
 typedef	uint32_t	id_t;		/* group id, process id or user id */
+#ifdef __ino_t
+/*
+ * Some first stage bootloaders may want to avoid 64bit math, especially
+ * when the firmware can only access small disks/partitions anyway.
+ * Example: hppa/stand/xxboot
+ */
+typedef	__ino_t		ino_t;
+#undef __ino_t
+#else
 typedef	uint64_t	ino_t;		/* inode number */
+#endif
 typedef	long		key_t;		/* IPC key (for Sys V IPC) */
 
 #ifndef	mode_t



CVS commit: [netbsd-10] src/sys

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:34:58 UTC 2023

Modified Files:
src/sys/arch/hppa/stand/xxboot [netbsd-10]: Makefile
src/sys/sys [netbsd-10]: types.h

Log Message:
Pull up following revision(s) (requested by chs in ticket #168):

sys/sys/types.h: revision 1.106
sys/arch/hppa/stand/xxboot/Makefile: revision 1.4

Avoid 64bit math in the hppa first stage bootloader. Ok chs@


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.30.1 src/sys/arch/hppa/stand/xxboot/Makefile
cvs rdiff -u -r1.105 -r1.105.20.1 src/sys/sys/types.h

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



CVS commit: [netbsd-10] src/sys/uvm

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:32:53 UTC 2023

Modified Files:
src/sys/uvm [netbsd-10]: uvm_map.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #167):

sys/uvm/uvm_map.c: revision 1.406

uvm: avoid a deadlock in uvm_map_clean()

The locking order between map locks and page "busy" locks
is that the page "busy" lock comes first, but uvm_map_clean()
breaks this rule by holding a map locked (as reader) while
waiting for page "busy" locks.

If another thread is in the page-fault path holding a page
"busy" lock while waiting for the map lock (as a reader)
and at the same time a third thread is blocked waiting for
the map lock as a writer (which blocks the page-fault thread),
then these three threads will all deadlock with each other.

Fix this by marking the map "busy" (to block any modifications)
and unlocking the map lock before possibly waiting for any
page "busy" locks.

Martin Pieuchot reported that the same problem existed in OpenBSD
he applied this fix there after several people tested it.

fixes PR 56952


To generate a diff of this commit:
cvs rdiff -u -r1.403 -r1.403.2.1 src/sys/uvm/uvm_map.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/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.403 src/sys/uvm/uvm_map.c:1.403.2.1
--- src/sys/uvm/uvm_map.c:1.403	Wed Nov 23 23:53:53 2022
+++ src/sys/uvm/uvm_map.c	Mon May 15 10:32:53 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.403 2022/11/23 23:53:53 riastradh Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.403.2.1 2023/05/15 10:32:53 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.403 2022/11/23 23:53:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.403.2.1 2023/05/15 10:32:53 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pax.h"
@@ -3884,8 +3884,7 @@ uvm_map_pageable_all(struct vm_map *map,
  * => never a need to flush amap layer since the anonymous memory has
  *	no permanent home, but may deactivate pages there
  * => called from sys_msync() and sys_madvise()
- * => caller must not write-lock map (read OK).
- * => we may sleep while cleaning if SYNCIO [with map read-locked]
+ * => caller must not have map locked
  */
 
 int
@@ -3907,10 +3906,10 @@ uvm_map_clean(struct vm_map *map, vaddr_
 	KASSERT((flags & (PGO_FREE|PGO_DEACTIVATE)) !=
 		(PGO_FREE|PGO_DEACTIVATE));
 
-	vm_map_lock_read(map);
+	vm_map_lock(map);
 	VM_MAP_RANGE_CHECK(map, start, end);
-	if (uvm_map_lookup_entry(map, start, ) == false) {
-		vm_map_unlock_read(map);
+	if (!uvm_map_lookup_entry(map, start, )) {
+		vm_map_unlock(map);
 		return EFAULT;
 	}
 
@@ -3920,22 +3919,24 @@ uvm_map_clean(struct vm_map *map, vaddr_
 
 	for (current = entry; current->start < end; current = current->next) {
 		if (UVM_ET_ISSUBMAP(current)) {
-			vm_map_unlock_read(map);
+			vm_map_unlock(map);
 			return EINVAL;
 		}
 		if ((flags & PGO_FREE) != 0 && VM_MAPENT_ISWIRED(entry)) {
-			vm_map_unlock_read(map);
+			vm_map_unlock(map);
 			return EBUSY;
 		}
 		if (end <= current->end) {
 			break;
 		}
 		if (current->end != current->next->start) {
-			vm_map_unlock_read(map);
+			vm_map_unlock(map);
 			return EFAULT;
 		}
 	}
 
+	vm_map_busy(map);
+	vm_map_unlock(map);
 	error = 0;
 	for (current = entry; start < end; current = current->next) {
 		amap = current->aref.ar_amap;	/* upper layer */
@@ -4041,8 +4042,8 @@ uvm_map_clean(struct vm_map *map, vaddr_
 		}
 		start += size;
 	}
-	vm_map_unlock_read(map);
-	return (error);
+	vm_map_unbusy(map);
+	return error;
 }
 
 



CVS commit: [netbsd-10] src/sys/uvm

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:32:53 UTC 2023

Modified Files:
src/sys/uvm [netbsd-10]: uvm_map.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #167):

sys/uvm/uvm_map.c: revision 1.406

uvm: avoid a deadlock in uvm_map_clean()

The locking order between map locks and page "busy" locks
is that the page "busy" lock comes first, but uvm_map_clean()
breaks this rule by holding a map locked (as reader) while
waiting for page "busy" locks.

If another thread is in the page-fault path holding a page
"busy" lock while waiting for the map lock (as a reader)
and at the same time a third thread is blocked waiting for
the map lock as a writer (which blocks the page-fault thread),
then these three threads will all deadlock with each other.

Fix this by marking the map "busy" (to block any modifications)
and unlocking the map lock before possibly waiting for any
page "busy" locks.

Martin Pieuchot reported that the same problem existed in OpenBSD
he applied this fix there after several people tested it.

fixes PR 56952


To generate a diff of this commit:
cvs rdiff -u -r1.403 -r1.403.2.1 src/sys/uvm/uvm_map.c

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



CVS commit: [netbsd-10] src/sys/arch/x68k/stand/boot_ufs

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:31:10 UTC 2023

Modified Files:
src/sys/arch/x68k/stand/boot_ufs [netbsd-10]: Makefile

Log Message:
Pull up following revision(s) (requested by chs in ticket #166):

sys/arch/x68k/stand/boot_ufs/Makefile: revision 1.39

Add udivdi3/umoddi3 (and ashldi3) that were required by recent UFS change.

This increases xxboot_ufs from about 4.5KB to 5.5KB (The upper limit is 8KB).

Thanks tsutsui@ for advices.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.4.1 src/sys/arch/x68k/stand/boot_ufs/Makefile

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



CVS commit: [netbsd-10] src/sys/arch/x68k/stand/boot_ufs

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:31:10 UTC 2023

Modified Files:
src/sys/arch/x68k/stand/boot_ufs [netbsd-10]: Makefile

Log Message:
Pull up following revision(s) (requested by chs in ticket #166):

sys/arch/x68k/stand/boot_ufs/Makefile: revision 1.39

Add udivdi3/umoddi3 (and ashldi3) that were required by recent UFS change.

This increases xxboot_ufs from about 4.5KB to 5.5KB (The upper limit is 8KB).

Thanks tsutsui@ for advices.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.4.1 src/sys/arch/x68k/stand/boot_ufs/Makefile

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

Modified files:

Index: src/sys/arch/x68k/stand/boot_ufs/Makefile
diff -u src/sys/arch/x68k/stand/boot_ufs/Makefile:1.38 src/sys/arch/x68k/stand/boot_ufs/Makefile:1.38.4.1
--- src/sys/arch/x68k/stand/boot_ufs/Makefile:1.38	Wed Dec 15 13:22:34 2021
+++ src/sys/arch/x68k/stand/boot_ufs/Makefile	Mon May 15 10:31:10 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.38 2021/12/15 13:22:34 christos Exp $
+#	$NetBSD: Makefile,v 1.38.4.1 2023/05/15 10:31:10 martin Exp $
 
 NOMAN=		# defined
 
@@ -30,6 +30,12 @@ LIBIOCS=	$M/stand/libiocs
 SRCS=	boot.S bootmain.c readufs.c readufs_ffs.c readufs_lfs.c
 SRCS+=	exec_image.S memset.S strcmp.S
 
+.PATH:	${S}/../common/lib/libc/quad
+SRCS+=	udivdi3.c umoddi3.c qdivrem.c
+
+.PATH:	${.CURDIR}/../xxboot
+SRCS+=	ashldi3.S
+
 .include "${S}/conf/newvers_stand.mk"
 
 CFLAGS=	-Os -fomit-frame-pointer -fno-unwind-tables



CVS commit: [netbsd-9] src/doc

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:26:43 UTC 2023

Modified Files:
src/doc [netbsd-9]: CHANGES-9.4

Log Message:
Ammend entry for ticket #1632


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.65 -r1.1.2.66 src/doc/CHANGES-9.4

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



CVS commit: [netbsd-9] src/doc

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:26:43 UTC 2023

Modified Files:
src/doc [netbsd-9]: CHANGES-9.4

Log Message:
Ammend entry for ticket #1632


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.65 -r1.1.2.66 src/doc/CHANGES-9.4

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-9.4
diff -u src/doc/CHANGES-9.4:1.1.2.65 src/doc/CHANGES-9.4:1.1.2.66
--- src/doc/CHANGES-9.4:1.1.2.65	Sat May 13 12:24:46 2023
+++ src/doc/CHANGES-9.4	Mon May 15 10:26:43 2023
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.4,v 1.1.2.65 2023/05/13 12:24:46 martin Exp $
+# $NetBSD: CHANGES-9.4,v 1.1.2.66 2023/05/15 10:26:43 martin Exp $
 
 A complete list of changes from the NetBSD 9.3 release to the NetBSD 9.4
 release:
@@ -1414,6 +1414,7 @@ sys/arch/i386/stand/efiboot/efiboot.c		1
 sys/arch/i386/stand/efiboot/efiboot.h		1.12
 sys/arch/i386/stand/efiboot/version		1.3
 sys/arch/i386/stand/lib/exec.c			1.79
+sys/arch/xen/conf/files.xen			(apply patch)
 
 	x86: add a "reloc" keyword to the EFI bootstrap to allow loading
 	kernels at different addresses.



CVS commit: [netbsd-9] src/sys/arch/xen/conf

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:25:31 UTC 2023

Modified Files:
src/sys/arch/xen/conf [netbsd-9]: files.xen

Log Message:
Apply patch, requested by manu in ticket #1632:

sys/arch/xen/conf/files.xen (apply patch)

Build fix to define the SELFRELOC option for XEN kernels.
This is not needed in newer branches as those include amd64/conf/files.amd64
from x86/conf/files.x86 (and get the definition via that path)


To generate a diff of this commit:
cvs rdiff -u -r1.178.4.1 -r1.178.4.2 src/sys/arch/xen/conf/files.xen

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/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.178.4.1 src/sys/arch/xen/conf/files.xen:1.178.4.2
--- src/sys/arch/xen/conf/files.xen:1.178.4.1	Wed Jul 15 17:25:08 2020
+++ src/sys/arch/xen/conf/files.xen	Mon May 15 10:25:31 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.178.4.1 2020/07/15 17:25:08 martin Exp $
+#	$NetBSD: files.xen,v 1.178.4.2 2023/05/15 10:25:31 martin Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -12,6 +12,9 @@ maxusers 2 16 128
 
 defparam opt_kernbase.h	KERNBASE
 
+# This options is of no use to Xen, but building requires its definition
+defflag opt_selfreloc.h SELFRELOC
+
 # options for MP configuration through the MP spec
 defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI
 



CVS commit: [netbsd-9] src/sys/arch/xen/conf

2023-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 15 10:25:31 UTC 2023

Modified Files:
src/sys/arch/xen/conf [netbsd-9]: files.xen

Log Message:
Apply patch, requested by manu in ticket #1632:

sys/arch/xen/conf/files.xen (apply patch)

Build fix to define the SELFRELOC option for XEN kernels.
This is not needed in newer branches as those include amd64/conf/files.amd64
from x86/conf/files.x86 (and get the definition via that path)


To generate a diff of this commit:
cvs rdiff -u -r1.178.4.1 -r1.178.4.2 src/sys/arch/xen/conf/files.xen

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



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 10:13:40 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_question.c
src/usr.bin/indent: indent.c indent.h

Log Message:
indent: fix indentation of multi-line '?:' expressions in functions


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/lsym_question.c
cvs rdiff -u -r1.273 -r1.274 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.136 -r1.137 src/usr.bin/indent/indent.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/indent/lsym_question.c
diff -u src/tests/usr.bin/indent/lsym_question.c:1.4 src/tests/usr.bin/indent/lsym_question.c:1.5
--- src/tests/usr.bin/indent/lsym_question.c:1.4	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/lsym_question.c	Mon May 15 10:13:40 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_question.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: lsym_question.c,v 1.5 2023/05/15 10:13:40 rillig Exp $ */
 
 /*
  * Tests for the token lsym_question, which represents the '?' in a '?:'
@@ -56,11 +56,18 @@ void
 function(void)
 {
 	const char *branch = cond
-	// $ TODO: Indent these continuation lines as they are part of the
-	// $ TODO: initializer expression, not of the declarator part to the
-	// $ TODO: left of the '='.
-	? "then"
-	: "else";
+		? "then"
+		: "else";
+
+	const char *multiple_branches = cond1
+		? "then 1"
+		: cond2
+		? "then 2"
+		: "else";
+
+	const char *condensed = cond1 ? "condensed 1"
+		: cond2 ? "condensed 2"
+		: "condensed else";
 }
 //indent end
 

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.273 src/usr.bin/indent/indent.c:1.274
--- src/usr.bin/indent/indent.c:1.273	Mon May 15 09:22:53 2023
+++ src/usr.bin/indent/indent.c	Mon May 15 10:13:40 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.273 2023/05/15 09:22:53 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.274 2023/05/15 10:13:40 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.273 2023/05/15 09:22:53 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.274 2023/05/15 10:13:40 rillig Exp $");
 
 #include 
 #include 
@@ -532,6 +532,11 @@ static void
 process_question(void)
 {
 ps.quest_level++;
+if (code.len == 0) {
+	ps.in_stmt_cont = true;
+	ps.in_stmt_or_decl = true;
+	ps.in_decl = false;
+}
 if (ps.want_blank)
 	buf_add_char(, ' ');
 buf_add_char(, '?');
@@ -543,6 +548,11 @@ process_colon(void)
 {
 if (ps.quest_level > 0) {	/* part of a '?:' operator */
 	ps.quest_level--;
+	if (code.len == 0) {
+	ps.in_stmt_cont = true;
+	ps.in_stmt_or_decl = true;
+	ps.in_decl = false;
+	}
 	if (ps.want_blank)
 	buf_add_char(, ' ');
 	buf_add_char(, ':');

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.136 src/usr.bin/indent/indent.h:1.137
--- src/usr.bin/indent/indent.h:1.136	Mon May 15 09:53:32 2023
+++ src/usr.bin/indent/indent.h	Mon May 15 10:13:40 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.136 2023/05/15 09:53:32 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.137 2023/05/15 10:13:40 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -297,9 +297,9 @@ extern struct parser_state {
  * currently prepared for output */
 int ind_level_follow;	/* the level to which ind_level should be set
  * after the current line is printed */
-bool in_stmt_cont;		/* whether the next line should have an extra
- * indentation level because we are in the
- * middle of a statement */
+bool in_stmt_cont;		/* whether the current line should have an
+ * extra indentation level because we are in
+ * the middle of a statement */
 int decl_level;		/* current nesting level for a structure
  * declaration or an initializer */
 bool decl_indent_done;	/* whether the indentation for a declaration



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 10:13:40 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_question.c
src/usr.bin/indent: indent.c indent.h

Log Message:
indent: fix indentation of multi-line '?:' expressions in functions


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/lsym_question.c
cvs rdiff -u -r1.273 -r1.274 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.136 -r1.137 src/usr.bin/indent/indent.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 09:53:32 UTC 2023

Modified Files:
src/usr.bin/indent: indent.h

Log Message:
indent: group parser state by topic

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/usr.bin/indent/indent.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/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.135 src/usr.bin/indent/indent.h:1.136
--- src/usr.bin/indent/indent.h:1.135	Mon May 15 08:02:01 2023
+++ src/usr.bin/indent/indent.h	Mon May 15 09:53:32 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.135 2023/05/15 08:02:01 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.136 2023/05/15 09:53:32 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -260,22 +260,74 @@ typedef struct paren_level_props {
 extern struct parser_state {
 lexer_symbol prev_token;	/* the previous token, but never comment,
  * newline or preprocessing line */
-bool curr_col_1;		/* whether the current token started in column
- * 1 of the original input */
-bool next_col_1;
-bool next_unary;		/* whether the following operator should be
- * unary; is used in declarations for '*', as
- * well as in expressions */
 
+/* Token classification */
+
+int quest_level;		/* when this is positive, we have seen a '?'
+ * without the matching ':' in a '?:'
+ * expression */
 bool is_function_definition;
+bool block_init;		/* whether inside a block initialization */
+int block_init_level;	/* the level of brace nesting in an
+ * initialization */
+bool init_or_struct;	/* whether there has been a type name and no
+ * left parenthesis since the last semicolon.
+ * When true, a '{' starts a structure
+ * definition or an initialization list */
+bool decl_on_line;		/* whether this line of code has part of a
+ * declaration on it */
+bool in_stmt_or_decl;	/* whether in a statement or a struct
+ * declaration or a plain declaration */
+bool in_decl;		/* whether we are in a declaration. The
+ * processing of braces is then slightly
+ * different */
+bool in_func_def_params;
+bool seen_case;		/* set to true when we see a 'case', so we
+ * know what to do with the following colon */
+bool is_case_label;		/* 'case' and 'default' labels are indented
+ * differently from regular labels */
+parser_symbol spaced_expr_psym;	/* the parser symbol to be shifted
+	 * after the parenthesized expression
+	 * from a 'for', 'if', 'switch' or
+	 * 'while'; or psym_0 */
 
+/* Indentation of statements and declarations */
+
+int ind_level;		/* the indentation level for the line that is
+ * currently prepared for output */
+int ind_level_follow;	/* the level to which ind_level should be set
+ * after the current line is printed */
+bool in_stmt_cont;		/* whether the next line should have an extra
+ * indentation level because we are in the
+ * middle of a statement */
+int decl_level;		/* current nesting level for a structure
+ * declaration or an initializer */
+bool decl_indent_done;	/* whether the indentation for a declaration
+ * has been added to the code buffer. */
+int decl_ind;		/* current indentation for declarations */
+int di_stack[20];		/* a stack of structure indentation levels */
+bool tabs_to_var;		/* true if using tabs to indent to var name */
+
+enum {
+	in_enum_no,		/* outside any 'enum { ... }' */
+	in_enum_enum,		/* after keyword 'enum' */
+	in_enum_type,		/* after 'enum' or 'enum tag' */
+	in_enum_brace		/* between '{' and '}' */
+} in_enum;			/* enum { . } */
+
+int tos;			/* pointer to top of stack */
+parser_symbol s_sym[STACKSIZE];
+int s_ind_level[STACKSIZE];
+float s_case_ind_level[STACKSIZE];
+
+/* Spacing inside a statement or declaration */
+
+bool next_unary;		/* whether the following operator should be
+ * unary; is used in declarations for '*', as
+ * well as in expressions */
 bool want_blank;		/* whether the following token should be
  * prefixed by a blank. (Said prefixing is
  * ignored in some cases.) */
-
-bool force_nl;		/* whether the next token goes to a new
- * line */
-
 int line_start_nparen;	/* the number of parentheses or brackets that
  * were already open at the beginning of the
  * current line; used to indent within
@@ -286,6 +338,8 @@ extern struct parser_state {
  * initializer or declaration */
 paren_level_props paren[20];
 
+/* Horizontal spacing for comments */
+
 int comment_delta;		/* used to set up indentation for all lines of
  * a boxed comment after the first one */
 int n_comment_delta;	/* remembers how many columns there were
@@ -294,26 +348,10 @@ extern struct parser_state {
  * indented 

CVS commit: src/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 09:53:32 UTC 2023

Modified Files:
src/usr.bin/indent: indent.h

Log Message:
indent: group parser state by topic

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/usr.bin/indent/indent.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 09:22:53 UTC 2023

Modified Files:
src/usr.bin/indent: .indent.pro indent.c lexi.c pr_comment.c

Log Message:
indent: let indent format its own code

With manual corrections, as indent does not properly indent multi-line
'?:' expressions nor multi-line controlling expressions.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/indent/.indent.pro
cvs rdiff -u -r1.272 -r1.273 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.187 -r1.188 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.140 -r1.141 src/usr.bin/indent/pr_comment.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 09:22:53 UTC 2023

Modified Files:
src/usr.bin/indent: .indent.pro indent.c lexi.c pr_comment.c

Log Message:
indent: let indent format its own code

With manual corrections, as indent does not properly indent multi-line
'?:' expressions nor multi-line controlling expressions.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/indent/.indent.pro
cvs rdiff -u -r1.272 -r1.273 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.187 -r1.188 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.140 -r1.141 src/usr.bin/indent/pr_comment.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/indent/.indent.pro
diff -u src/usr.bin/indent/.indent.pro:1.3 src/usr.bin/indent/.indent.pro:1.4
--- src/usr.bin/indent/.indent.pro:1.3	Tue Oct 26 19:36:30 2021
+++ src/usr.bin/indent/.indent.pro	Mon May 15 09:22:53 2023
@@ -1,5 +1,6 @@
-/* $NetBSD: .indent.pro,v 1.3 2021/10/26 19:36:30 rillig Exp $ */
+/* $NetBSD: .indent.pro,v 1.4 2023/05/15 09:22:53 rillig Exp $ */
 
+-l78		/* Keep 2 columns distance from the 80-column margin. */
 -di0		/* Do not indent variable names in global declarations. */
 /* XXX: -eei does not work; the expressions are indented only a single level. */
 -eei		/* Indent expressions in 'if' and 'while' once more. */
@@ -10,5 +11,6 @@
 -ta		/* Identifiers ending in '_t' are considered type names. */
 -TFILE		/* Additional types, for proper formatting of '*'. */
 -Tlexer_symbol
+-Tparen_level_props
 -Tparser_symbol
 -Tkeyword_kind

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.272 src/usr.bin/indent/indent.c:1.273
--- src/usr.bin/indent/indent.c:1.272	Mon May 15 08:56:39 2023
+++ src/usr.bin/indent/indent.c	Mon May 15 09:22:53 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.272 2023/05/15 08:56:39 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.273 2023/05/15 09:22:53 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.272 2023/05/15 08:56:39 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.273 2023/05/15 09:22:53 rillig Exp $");
 
 #include 
 #include 
@@ -608,7 +608,7 @@ process_semicolon(void)
 ps.in_stmt_or_decl = ps.nparen > 0;
 
 if (ps.spaced_expr_psym == psym_0) {
-	parse(psym_0);	/* let parser know about end of stmt */
+	parse(psym_0);		/* let parser know about end of stmt */
 	ps.force_nl = true;
 }
 }
@@ -653,7 +653,7 @@ process_lbrace(void)
 	ps.di_stack[ps.decl_level] = ps.decl_ind;
 	if (++ps.decl_level == (int)array_length(ps.di_stack)) {
 	diag(0, "Reached internal limit of %d struct levels",
-		 (int)array_length(ps.di_stack));
+		(int)array_length(ps.di_stack));
 	ps.decl_level--;
 	}
 } else {
@@ -714,7 +714,7 @@ process_do(void)
 {
 ps.in_stmt_or_decl = false;
 
-if (code.len > 0) {	/* make sure this starts a line */
+if (code.len > 0) {		/* make sure this starts a line */
 	if (opt.verbose)
 	diag(0, "Line broken");
 	output_line();
@@ -947,7 +947,7 @@ process_preprocessing(void)
 	!substring_equals(dir, "define") &&
 	!substring_equals(dir, "include")) {
 	diag(1, "Unrecognized cpp directive \"%.*s\"",
-		 (int)(dir.e - dir.s), dir.s);
+		(int)(dir.e - dir.s), dir.s);
 	return;
 	}
 }

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.187 src/usr.bin/indent/lexi.c:1.188
--- src/usr.bin/indent/lexi.c:1.187	Mon May 15 08:02:01 2023
+++ src/usr.bin/indent/lexi.c	Mon May 15 09:22:53 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.187 2023/05/15 08:02:01 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.188 2023/05/15 09:22:53 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: lexi.c,v 1.187 2023/05/15 08:02:01 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.188 2023/05/15 09:22:53 rillig Exp $");
 
 #include 
 #include 
@@ -626,7 +626,7 @@ register_typename(const char *name)
 if (typenames.len >= typenames.cap) {
 	typenames.cap = 16 + 2 * typenames.cap;
 	typenames.items = nonnull(realloc(typenames.items,
-	sizeof(typenames.items[0]) * typenames.cap));
+		sizeof(typenames.items[0]) * typenames.cap));
 }
 
 int pos = bsearch_typenames(name);

Index: src/usr.bin/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.140 src/usr.bin/indent/pr_comment.c:1.141
--- src/usr.bin/indent/pr_comment.c:1.140	Mon May 15 07:28:45 2023
+++ src/usr.bin/indent/pr_comment.c	Mon May 15 09:22:53 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pr_comment.c,v 1.140 2023/05/15 07:28:45 rillig Exp $	*/
+/*	$NetBSD: pr_comment.c,v 1.141 2023/05/15 09:22:53 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pr_comment.c,v 1.140 2023/05/15 07:28:45 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.141 2023/05/15 09:22:53 rillig 

CVS commit: src/tests/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 09:05:08 UTC 2023

Modified Files:
src/tests/usr.bin/indent: opt_badp.c

Log Message:
tests/indent: -badp should not add blank lines in initializers


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/opt_badp.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/indent/opt_badp.c
diff -u src/tests/usr.bin/indent/opt_badp.c:1.10 src/tests/usr.bin/indent/opt_badp.c:1.11
--- src/tests/usr.bin/indent/opt_badp.c:1.10	Thu May 11 18:13:55 2023
+++ src/tests/usr.bin/indent/opt_badp.c	Mon May 15 09:05:08 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_badp.c,v 1.10 2023/05/11 18:13:55 rillig Exp $ */
+/* $NetBSD: opt_badp.c,v 1.11 2023/05/15 09:05:08 rillig Exp $ */
 
 /*
  * Tests for the options '-badp' and '-nbadp'.
@@ -111,3 +111,23 @@ declaration_blank_blank_statement(void)
 //indent run-equals-input -badp
 
 //indent run-equals-input -nbadp
+
+
+/*
+ * A struct declaration or an initializer are not function bodies, so don't
+ * add a blank line after them.
+ */
+//indent input
+struct {
+	int member[2];
+} s = {
+	{
+		0,
+		0,
+	}
+};
+//indent end
+
+//indent run-equals-input -di0 -badp
+
+//indent run-equals-input -di0 -nbadp



CVS commit: src/tests/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 09:05:08 UTC 2023

Modified Files:
src/tests/usr.bin/indent: opt_badp.c

Log Message:
tests/indent: -badp should not add blank lines in initializers


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/opt_badp.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 09:00:51 UTC 2023

Modified Files:
src/usr.bin/indent: debug.c

Log Message:
indent: document feature toggle for debugging output


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/indent/debug.c

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

Modified files:

Index: src/usr.bin/indent/debug.c
diff -u src/usr.bin/indent/debug.c:1.6 src/usr.bin/indent/debug.c:1.7
--- src/usr.bin/indent/debug.c:1.6	Mon May 15 07:57:22 2023
+++ src/usr.bin/indent/debug.c	Mon May 15 09:00:51 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: debug.c,v 1.6 2023/05/15 07:57:22 rillig Exp $	*/
+/*	$NetBSD: debug.c,v 1.7 2023/05/15 09:00:51 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,13 +30,20 @@
  */
 
 #include 
-__RCSID("$NetBSD: debug.c,v 1.6 2023/05/15 07:57:22 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.7 2023/05/15 09:00:51 rillig Exp $");
 
 #include 
 
 #include "indent.h"
 
 #ifdef debug
+
+/*
+ * false	show only the changes to the parser state
+ * true		show unchanged parts of the parser state as well
+ */
+static bool debug_full_parser_state = true;
+
 const char *const lsym_name[] = {
 "eof",
 "preprocessing",
@@ -105,8 +112,6 @@ static const char *in_enum_name[] = {
 "brace",
 };
 
-static bool debug_full_parser_state = true;
-
 void
 debug_printf(const char *fmt, ...)
 {



CVS commit: src/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 09:00:51 UTC 2023

Modified Files:
src/usr.bin/indent: debug.c

Log Message:
indent: document feature toggle for debugging output


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/indent/debug.c

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



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 08:56:39 UTC 2023

Modified Files:
src/tests/usr.bin/indent: psym_for_exprs.c
src/usr.bin/indent: indent.c

Log Message:
indent: fix spacing in for loop with declaration (since 2022-02-13)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/psym_for_exprs.c
cvs rdiff -u -r1.271 -r1.272 src/usr.bin/indent/indent.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/indent/psym_for_exprs.c
diff -u src/tests/usr.bin/indent/psym_for_exprs.c:1.5 src/tests/usr.bin/indent/psym_for_exprs.c:1.6
--- src/tests/usr.bin/indent/psym_for_exprs.c:1.5	Mon May 15 08:22:23 2023
+++ src/tests/usr.bin/indent/psym_for_exprs.c	Mon May 15 08:56:39 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: psym_for_exprs.c,v 1.5 2023/05/15 08:22:23 rillig Exp $ */
+/* $NetBSD: psym_for_exprs.c,v 1.6 2023/05/15 08:56:39 rillig Exp $ */
 
 /*
  * Tests for the parser state psym_for_exprs, which represents the state after
@@ -10,41 +10,20 @@
 void
 for_loops(void)
 {
-	for (int i = 0; i < 10; i++)
-		printf("%d * %d = %d\n", i, 7, i * 7);
-
-	for (int i = 0; i < 10; i++) {
-		printf("%d * %d = %d\n", i, 7, i * 7);
-	}
-}
-//indent end
+	int i;
 
-//indent run
-void
-for_loops(void)
-{
-	for (int i = 0; i < 10; i++)
+	for (i = 0; i < 10; i++)
 		printf("%d * %d = %d\n", i, 7, i * 7);
-
-	/* $ FIXME: Add space between ')' and '{'. */
-	for (int i = 0; i < 10; i++){
+	for (i = 0; i < 10; i++) {
 		printf("%d * %d = %d\n", i, 7, i * 7);
 	}
-}
-//indent end
-
 
-/*
- * Since C99, the first expression of a 'for' loop may be a declaration, not
- * only an expression.
- */
-//indent input
-void
-small_scope(void)
-{
-	for (int i = 0; i < 3; i++)
-		stmt();
+	for (int j = 0; j < 10; j++)
+		printf("%d * %d = %d\n", j, 7, j * 7);
+	for (int j = 0; j < 10; j++) {
+		printf("%d * %d = %d\n", j, 7, j * 7);
+	}
 }
 //indent end
 
-//indent run-equals-input
+//indent run-equals-input -ldi0

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.271 src/usr.bin/indent/indent.c:1.272
--- src/usr.bin/indent/indent.c:1.271	Mon May 15 08:11:27 2023
+++ src/usr.bin/indent/indent.c	Mon May 15 08:56:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.271 2023/05/15 08:11:27 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.272 2023/05/15 08:56:39 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.271 2023/05/15 08:11:27 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.272 2023/05/15 08:56:39 rillig Exp $");
 
 #include 
 #include 
@@ -483,6 +483,7 @@ unbalanced:
 	ps.in_stmt_or_decl = false;
 	parse(ps.spaced_expr_psym);
 	ps.spaced_expr_psym = psym_0;
+	ps.want_blank = true;
 }
 }
 



CVS commit: src

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 08:56:39 UTC 2023

Modified Files:
src/tests/usr.bin/indent: psym_for_exprs.c
src/usr.bin/indent: indent.c

Log Message:
indent: fix spacing in for loop with declaration (since 2022-02-13)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/psym_for_exprs.c
cvs rdiff -u -r1.271 -r1.272 src/usr.bin/indent/indent.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/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 08:22:23 UTC 2023

Modified Files:
src/tests/usr.bin/indent: psym_for_exprs.c

Log Message:
tests/indent: demonstrate wrong spacing in for loops


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/psym_for_exprs.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/indent/psym_for_exprs.c
diff -u src/tests/usr.bin/indent/psym_for_exprs.c:1.4 src/tests/usr.bin/indent/psym_for_exprs.c:1.5
--- src/tests/usr.bin/indent/psym_for_exprs.c:1.4	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/psym_for_exprs.c	Mon May 15 08:22:23 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: psym_for_exprs.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: psym_for_exprs.c,v 1.5 2023/05/15 08:22:23 rillig Exp $ */
 
 /*
  * Tests for the parser state psym_for_exprs, which represents the state after
@@ -7,10 +7,31 @@
  */
 
 //indent input
-// TODO: add input
+void
+for_loops(void)
+{
+	for (int i = 0; i < 10; i++)
+		printf("%d * %d = %d\n", i, 7, i * 7);
+
+	for (int i = 0; i < 10; i++) {
+		printf("%d * %d = %d\n", i, 7, i * 7);
+	}
+}
 //indent end
 
-//indent run-equals-input
+//indent run
+void
+for_loops(void)
+{
+	for (int i = 0; i < 10; i++)
+		printf("%d * %d = %d\n", i, 7, i * 7);
+
+	/* $ FIXME: Add space between ')' and '{'. */
+	for (int i = 0; i < 10; i++){
+		printf("%d * %d = %d\n", i, 7, i * 7);
+	}
+}
+//indent end
 
 
 /*
@@ -19,7 +40,7 @@
  */
 //indent input
 void
-function(void)
+small_scope(void)
 {
 	for (int i = 0; i < 3; i++)
 		stmt();



CVS commit: src/tests/usr.bin/indent

2023-05-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May 15 08:22:23 UTC 2023

Modified Files:
src/tests/usr.bin/indent: psym_for_exprs.c

Log Message:
tests/indent: demonstrate wrong spacing in for loops


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

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



  1   2   >