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

2023-05-20 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Sun May 21 00:35:38 UTC 2023

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
small fixes, code shuffle for ease of understanding.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/arm/sociox/if_scx.c

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

Modified files:

Index: src/sys/arch/arm/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.39 src/sys/arch/arm/sociox/if_scx.c:1.40
--- src/sys/arch/arm/sociox/if_scx.c:1.39	Tue Sep 27 06:36:43 2022
+++ src/sys/arch/arm/sociox/if_scx.c	Sun May 21 00:35:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.39 2022/09/27 06:36:43 skrll Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.40 2023/05/21 00:35:38 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -29,6 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#define NOT_MP_SAFE	0
 
 /*
  * Socionext SC2A11 SynQuacer NetSec GbE driver
@@ -41,17 +42,14 @@
  * NetSec uses Synopsys DesignWare Core EMAC.  DWC implementation
  * register (0x20) is known to have 0x10.36 and feature register (0x1058)
  * reports 0x11056f37.
- *  <24> exdesc
+ *  <24> alternative/enhanced desc format
  *  <18> receive IP type 2 checksum offload
- *  <17> (no) receive IP type 1 checksum offload
  *  <16> transmit checksum offload
  *  <11> event counter (mac management counter, MMC) 
  */
 
-#define NOT_MP_SAFE	0
-
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.39 2022/09/27 06:36:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.40 2023/05/21 00:35:38 nisimura Exp $");
 
 #include 
 #include 
@@ -81,27 +79,25 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1
 struct tdes {
 	uint32_t t0, t1, t2, t3;
 };
-
 struct rdes {
 	uint32_t r0, r1, r2, r3;
 };
-
 #define T0_OWN		(1U<<31)	/* desc is ready to Tx */
-#define T0_EOD		(1U<<30)	/* end of descriptor array */
+#define T0_LD		(1U<<30)	/* last descriptor in array */
 #define T0_DRID		(24)		/* 29:24 desc ring id */
 #define T0_PT		(1U<<21)	/* 23:21 "pass-through" */
 #define T0_TDRID	(16)		/* 20:16 target desc ring id: GMAC=15 */
+#define T0_CC		(1U<<15)	/* ??? */
 #define T0_FS		(1U<<9)		/* first segment of frame */
 #define T0_LS		(1U<<8)		/* last segment of frame */
 #define T0_CSUM		(1U<<7)		/* enable check sum offload */
 #define T0_TSO		(1U<<6)		/* enable TCP segment offload */
-#define T0_TRS		(1U<<4)		/* 5:4 "TRS" */
+#define T0_TRS		(1U<<4)		/* 5:4 "TRS" ??? */
 /* T1 frame segment address 63:32 */
 /* T2 frame segment address 31:0 */
 /* T3 31:16 TCP segment length, 15:0 frame segment length to transmit */
-
 #define R0_OWN		(1U<<31)	/* desc is empty */
-#define R0_EOD		(1U<<30)	/* end of descriptor array */
+#define R0_LD		(1U<<30)	/* last descriptor in array */
 #define R0_SDRID	(24)		/* 29:24 source desc ring id */
 #define R0_FR		(1U<<23)	/* found fragmented */
 #define R0_ER		(1U<<21)	/* Rx error indication */
@@ -131,9 +127,13 @@ struct rdes {
 #define  RPTHDERR	(1U<<1)		/* log HD error */
 #define  DROPNOMATCH	(1U<<0)		/* drop no match frames */
 #define xINTSR		0x200		/* aggregated interrupt status */
-#define  IRQ_RX		(1U<<1)		/* top level Rx interrupt */
-#define  IRQ_TX		(1U<<0)		/* top level Rx interrupt */
 #define  IRQ_UCODE	(1U<<20)	/* ucode load completed; W1C */
+#define  IRQ_MAC	(1U<<19)	/* ??? */
+#define  IRQ_PKT	(1U<<18)	/* ??? */
+#define  IRQ_BOOTCODE	(1U<<5)		/* ??? */
+#define  IRQ_XDONE	(1U<<4)		/* ??? mode change completed */
+#define  IRQ_RX		(1U<<1)		/* top level Rx interrupt */
+#define  IRQ_TX		(1U<<0)		/* top level Tx interrupt */
 #define xINTAEN		0x204		/* INT_A enable */
 #define xINTAE_SET	0x234		/* bit to set */
 #define xINTAE_CLR	0x238		/* bit to clr */
@@ -174,6 +174,7 @@ struct rdes {
 #define RXITIMER	0x460		/* coalesce timer usec, MSB to use */
 #define TXDONECNT	0x414		/* tx completed count, auto-zero */
 #define RXDONECNT	0x454		/* rx available count, auto-zero */
+#define DMACTL_TMR	0x20c		/* engine DMA timer value */
 #define UCODE_H2M	0x210		/* host2media engine ucode port */
 #define UCODE_M2H	0x21c		/* media2host engine ucode port */
 #define CORESTAT	0x218		/* engine run state */
@@ -223,9 +224,9 @@ struct rdes {
 #define  MCR_WD		(1U<<23)	/* allow long >2048 tx frame */
 #define  MCR_JE		(1U<<20)	/* allow ~9018 tx jumbo frame */
 #define  MCR_IFG	(7U<<17)	/* 19:17 IFG value 0~7 */
-#define  MCR_DRCS	(1U<<16)	/* ignore (G)MII HDX Tx error */
-#define  MCR_USEMII	(1U<<15)	/* 1: RMII/MII, 0: RGMII (_PS) */
-#define  MCR_SPD100	(1U<<14)	/* force speed 100 (_FES) */
+#define  MCR_DCRS	(1U<<16)	/* ignore (G)MII HDX Tx error */
+#define  MCR_PS		(1U<<15)	/* 1: MII 10/100, 0: GMII 1000 */
+#define  MCR_FES	(1U<<14)	/* force speed 100 */
 #define  MCR_DO		(1U<<13)	/* don't receive my own HDX Tx frames */
 #define  MCR_LOOP	(1U<<12)	/* run loop back */
 #define  MCR_USEFDX	(1U<<11)	/* force full duplex */
@@ -233,11 +234,10 @@ struct 

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

2023-05-20 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Sun May 21 00:35:38 UTC 2023

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
small fixes, code shuffle for ease of understanding.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/arm/sociox/if_scx.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-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 22:08:07 UTC 2023

Modified Files:
src/tests/usr.bin/indent: t_options.lua

Log Message:
tests/indent: prevent 'indent end' with arguments


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/t_options.lua

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_options.lua
diff -u src/tests/usr.bin/indent/t_options.lua:1.1 src/tests/usr.bin/indent/t_options.lua:1.2
--- src/tests/usr.bin/indent/t_options.lua:1.1	Sat May 20 21:32:05 2023
+++ src/tests/usr.bin/indent/t_options.lua	Sat May 20 22:08:07 2023
@@ -1,4 +1,4 @@
--- $NetBSD: t_options.lua,v 1.1 2023/05/20 21:32:05 rillig Exp $
+-- $NetBSD: t_options.lua,v 1.2 2023/05/20 22:08:07 rillig Exp $
 --
 -- Copyright (c) 2023 The NetBSD Foundation, Inc.
 -- All rights reserved.
@@ -129,7 +129,7 @@ local function run_indent(inp, args)
 	local indent_in = assert(io.open("indent.in", "w"))
 	indent_in:write(inp)
 	indent_in:close()
-	ok, kind, info = os.execute(cmd)
+	local ok, kind, info = os.execute(cmd)
 	if not ok then
 		print(kind .. " " .. info)
 	end
@@ -155,84 +155,103 @@ local function handle_empty_section(line
 	end
 end
 
-local function handle_indent_directive(line, command, args)
-	print(line)
-	expected_out:write(line .. "\n")
+local function handle_indent_input()
+	if prev_empty_lines ~= 2 and seen_input_section then
+		warn(lineno, "input section needs 2 empty lines "
+		.. "above, not " .. prev_empty_lines)
+	end
+	check_empty_lines_block(2)
+	check_unused_input()
+	section = "input"
+	section_excl_comm = ""
+	section_incl_comm = ""
+	unused_input_lineno = lineno
+	seen_input_section = true
+	output_excl_comm = ""
+	output_incl_comm = ""
+	output_lineno = 0
+end
 
-	if command == "input" then
-		if prev_empty_lines ~= 2 and seen_input_section then
-			warn(lineno, "input section needs 2 empty lines "
-			.. "above, not " .. prev_empty_lines)
-		end
-		check_empty_lines_block(2)
-		check_unused_input()
-		section = "input"
-		section_excl_comm = ""
-		section_incl_comm = ""
-		unused_input_lineno = lineno
-		seen_input_section = true
-		output_excl_comm = ""
-		output_incl_comm = ""
-		output_lineno = 0
+local function handle_indent_run(args)
+	if section ~= "" then
+		warn(lineno, "unfinished section '" .. section .. "'")
+	end
+	check_empty_lines_block(1)
+	if prev_empty_lines ~= 1 then
+		warn(lineno, "run section needs 1 empty line above, "
+		.. "not " .. prev_empty_lines)
+	end
+	section = "run"
+	output_lineno = lineno
+	section_excl_comm = ""
+	section_incl_comm = ""
 
-	elseif command == "run" then
-		if section ~= "" then
-			warn(lineno, "unfinished section '" .. section .. "'")
-		end
-		check_empty_lines_block(1)
-		if prev_empty_lines ~= 1 then
-			warn(lineno, "run section needs 1 empty line above, "
-			.. "not " .. prev_empty_lines)
-		end
-		section = "run"
-		output_lineno = lineno
-		section_excl_comm = ""
-		section_incl_comm = ""
+	run_indent(input_excl_comm, args)
+	unused_input_lineno = 0
+end
 
-		run_indent(input_excl_comm, args)
-		unused_input_lineno = 0
+local function handle_indent_run_equals_input(args)
+	check_empty_lines_block(1)
+	run_indent(input_excl_comm, args)
+	expected_out:write(input_excl_comm)
+	unused_input_lineno = 0
+	max_empty_lines = 0
+end
 
-	elseif command == "run-equals-input" then
-		check_empty_lines_block(1)
-		run_indent(input_excl_comm, args)
-		expected_out:write(input_excl_comm)
-		unused_input_lineno = 0
-		max_empty_lines = 0
+local function handle_indent_run_equals_prev_output(args)
+	check_empty_lines_block(1)
+	run_indent(input_excl_comm, args)
+	expected_out:write(output_excl_comm)
+	max_empty_lines = 0
+end
 
-	elseif command == "run-equals-prev-output" then
-		check_empty_lines_block(1)
-		run_indent(input_excl_comm, args)
-		expected_out:write(output_excl_comm)
-		max_empty_lines = 0
+local function handle_indent_end_input()
+	if section_incl_comm == input_incl_comm then
+		warn(lineno, "duplicate input; remove this section")
+	end
 
-	elseif command == "end" and section == "input" then
-		if section_incl_comm == input_incl_comm then
-			warn(lineno, "duplicate input; remove this section")
-		end
+	input_excl_comm = section_excl_comm
+	input_incl_comm = section_incl_comm
+	section = ""
+	max_empty_lines = 0
+end
 
-		input_excl_comm = section_excl_comm
-		input_incl_comm = section_incl_comm
-		section = ""
-		max_empty_lines = 0
+local function handle_indent_end_run()
+	if section_incl_comm == input_incl_comm then
+		warn(output_lineno,
+		"output == input; use run-equals-input")
+	end
+	if section_incl_comm == output_incl_comm then
+		warn(output_lineno,
+		"duplicate output; use run-equals-prev-output")
+	end
 
-	elseif command == "end" and section == "run" then
-		if section_incl_comm == input_incl_comm then
-			warn(output_lineno,
-			

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

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 22:08:07 UTC 2023

Modified Files:
src/tests/usr.bin/indent: t_options.lua

Log Message:
tests/indent: prevent 'indent end' with arguments


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/t_options.lua

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



CVS commit: src

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 21:32:06 UTC 2023

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/indent: Makefile t_options.sh
Added Files:
src/tests/usr.bin/indent: t_options.lua
Removed Files:
src/tests/usr.bin/indent: t_options.awk

Log Message:
tests/indent: migrate test driver from AWK to Lua

Lua reports more details when os.execute fails, which is useful when
running old versions of indent for comparison.  The new test driver also
supports multiple test files in the same run.


To generate a diff of this commit:
cvs rdiff -u -r1.1263 -r1.1264 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.46 -r1.47 src/tests/usr.bin/indent/Makefile
cvs rdiff -u -r1.13 -r0 src/tests/usr.bin/indent/t_options.awk
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/indent/t_options.lua
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/t_options.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1263 src/distrib/sets/lists/tests/mi:1.1264
--- src/distrib/sets/lists/tests/mi:1.1263	Sat May 13 13:24:01 2023
+++ src/distrib/sets/lists/tests/mi	Sat May 20 21:32:05 2023
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1263 2023/05/13 13:24:01 rillig Exp $
+# $NetBSD: mi,v 1.1264 2023/05/20 21:32:05 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5263,7 +5263,8 @@
 ./usr/tests/usr.bin/indent/t_indent	tests-obsolete		obsolete,atf
 ./usr/tests/usr.bin/indent/t_misc	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/indent/t_options	tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/indent/t_options.awktests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/indent/t_options.awktests-obsolete		obsolete,atf
+./usr/tests/usr.bin/indent/t_options.luatests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/indent/token-binary_op.0tests-obsolete		obsolete,atf
 ./usr/tests/usr.bin/indent/token-binary_op.0.pro			tests-obsolete		obsolete,atf
 ./usr/tests/usr.bin/indent/token-binary_op.0.stdout			tests-obsolete		obsolete,atf

Index: src/tests/usr.bin/indent/Makefile
diff -u src/tests/usr.bin/indent/Makefile:1.46 src/tests/usr.bin/indent/Makefile:1.47
--- src/tests/usr.bin/indent/Makefile:1.46	Sat May 13 13:24:01 2023
+++ src/tests/usr.bin/indent/Makefile	Sat May 20 21:32:05 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.46 2023/05/13 13:24:01 rillig Exp $
+#	$NetBSD: Makefile,v 1.47 2023/05/20 21:32:05 rillig Exp $
 
 .include 
 
@@ -112,7 +112,7 @@ FILES+=		psym_stmt.c
 FILES+=		psym_stmt_list.c
 FILES+=		psym_switch_expr.c
 FILES+=		psym_while_expr.c
-FILES+=		t_options.awk
+FILES+=		t_options.lua
 
 add-test: .PHONY
 	@set -eu; \

Index: src/tests/usr.bin/indent/t_options.sh
diff -u src/tests/usr.bin/indent/t_options.sh:1.10 src/tests/usr.bin/indent/t_options.sh:1.11
--- src/tests/usr.bin/indent/t_options.sh:1.10	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/t_options.sh	Sat May 20 21:32:05 2023
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: t_options.sh,v 1.10 2022/04/24 09:04:12 rillig Exp $
+# $NetBSD: t_options.sh,v 1.11 2023/05/20 21:32:05 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -52,7 +52,7 @@ indent=$(atf_config_get usr.bin.indent.t
 check()
 {
 	atf_check -o "file:expected.out" \
-	env INDENT="$indent" awk -f "$srcdir/t_options.awk" "$srcdir/$1.c"
+	env INDENT="$indent" lua "$srcdir/t_options.lua" "$srcdir/$1.c"
 }
 
 atf_init_test_cases()

Added files:

Index: src/tests/usr.bin/indent/t_options.lua
diff -u /dev/null src/tests/usr.bin/indent/t_options.lua:1.1
--- /dev/null	Sat May 20 21:32:06 2023
+++ src/tests/usr.bin/indent/t_options.lua	Sat May 20 21:32:05 2023
@@ -0,0 +1,307 @@
+-- $NetBSD: t_options.lua,v 1.1 2023/05/20 21:32:05 rillig Exp $
+--
+-- Copyright (c) 2023 The NetBSD Foundation, Inc.
+-- All rights reserved.
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions
+-- are met:
+-- 1. Redistributions of source code must retain the above copyright
+--notice, this list of conditions and the following disclaimer.
+-- 2. Redistributions in binary form must reproduce the above copyright
+--notice, this list of conditions and the following disclaimer in the
+--documentation and/or other materials provided with the distribution.
+--
+-- THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+-- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+-- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+-- PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+-- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+-- 

CVS commit: src

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 21:32:06 UTC 2023

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/indent: Makefile t_options.sh
Added Files:
src/tests/usr.bin/indent: t_options.lua
Removed Files:
src/tests/usr.bin/indent: t_options.awk

Log Message:
tests/indent: migrate test driver from AWK to Lua

Lua reports more details when os.execute fails, which is useful when
running old versions of indent for comparison.  The new test driver also
supports multiple test files in the same run.


To generate a diff of this commit:
cvs rdiff -u -r1.1263 -r1.1264 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.46 -r1.47 src/tests/usr.bin/indent/Makefile
cvs rdiff -u -r1.13 -r0 src/tests/usr.bin/indent/t_options.awk
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/indent/t_options.lua
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/t_options.sh

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-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 17:31:53 UTC 2023

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

Log Message:
tests/indent: clean up test driver

No functional change.


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

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 17:31:53 UTC 2023

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

Log Message:
tests/indent: clean up test driver

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 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_options.awk
diff -u src/tests/usr.bin/indent/t_options.awk:1.12 src/tests/usr.bin/indent/t_options.awk:1.13
--- src/tests/usr.bin/indent/t_options.awk:1.12	Mon May 15 17:38:56 2023
+++ src/tests/usr.bin/indent/t_options.awk	Sat May 20 17:31:53 2023
@@ -1,4 +1,4 @@
-# $NetBSD: t_options.awk,v 1.12 2023/05/15 17:38:56 rillig Exp $
+# $NetBSD: t_options.awk,v 1.13 2023/05/20 17:31:53 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -85,11 +85,6 @@ function warn(lineno, msg)
 	warned = 1
 }
 
-function quote(s)
-{
-	return "'" s "'"
-}
-
 function check_empty_lines_block(n)
 {
 	if (max_empty_lines != n && seen_input_section)
@@ -160,7 +155,7 @@ section == "" {
 
 	} else if ($2 == "run") {
 		if (section != "")
-			warn(NR, "unfinished section " quote(section))
+			warn(NR, "unfinished section '" section "'")
 		check_empty_lines_block(1)
 		if (prev_empty_lines != 1)
 			warn(NR, "run section needs 1 empty line above, " \
@@ -209,10 +204,10 @@ section == "" {
 		max_empty_lines = 0
 
 	} else if ($2 == "end") {
-		warn(NR, "misplaced " quote("//indent end"))
+		warn(NR, "misplaced '//indent end'")
 
 	} else {
-		die(NR, "invalid line " quote($0))
+		die(NR, "invalid line '" $0 "'")
 	}
 
 	prev_empty_lines = 0
@@ -235,7 +230,7 @@ section == "" && !/^$/ && !/^#/ && !/^\/
 
 END {
 	if (section != "")
-		die(NR, "still in section " quote(section))
+		die(NR, "still in section '" section "'")
 	check_unused_input()
 	if (warned)
 		exit(1)



CVS commit: src/usr.bin/indent

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 16:31:31 UTC 2023

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

Log Message:
indent: remove redundant checks in processing of '}'

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.299 -r1.300 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/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.299 src/usr.bin/indent/indent.c:1.300
--- src/usr.bin/indent/indent.c:1.299	Sat May 20 11:53:53 2023
+++ src/usr.bin/indent/indent.c	Sat May 20 16:31:31 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.299 2023/05/20 11:53:53 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.300 2023/05/20 16:31:31 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.299 2023/05/20 11:53:53 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.300 2023/05/20 16:31:31 rillig Exp $");
 
 #include 
 #include 
@@ -750,7 +750,7 @@ process_rbrace(void)
 		ps.in_decl = true;
 	}
 
-	if (ps.tos == 2 && code.len == 1 && code.st[0] == '}')
+	if (ps.tos == 2)
 		out.line_kind = lk_func_end;
 
 	parse(psym_rbrace);



CVS commit: src/usr.bin/indent

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 16:31:31 UTC 2023

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

Log Message:
indent: remove redundant checks in processing of '}'

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.299 -r1.300 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.old/lib/libcrypto/man

2023-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 20 14:44:30 UTC 2023

Removed Files:
src/crypto/external/bsd/openssl.old/lib/libcrypto/man: openssl_hmac.3
openssl_md5.3

Log Message:
remove old files that cause conflicts on case insensitive filesystems. Reported
by lukem@


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r0 \
src/crypto/external/bsd/openssl.old/lib/libcrypto/man/openssl_hmac.3 \
src/crypto/external/bsd/openssl.old/lib/libcrypto/man/openssl_md5.3

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



CVS commit: src

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 12:05:01 UTC 2023

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

Log Message:
indent: don't insert blank line between two closing lines


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

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 12:05:01 UTC 2023

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

Log Message:
indent: don't insert blank line between two closing lines


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/indent/opt_bap.c
cvs rdiff -u -r1.183 -r1.184 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_bap.c
diff -u src/tests/usr.bin/indent/opt_bap.c:1.7 src/tests/usr.bin/indent/opt_bap.c:1.8
--- src/tests/usr.bin/indent/opt_bap.c:1.7	Sat May 20 10:46:22 2023
+++ src/tests/usr.bin/indent/opt_bap.c	Sat May 20 12:05:01 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bap.c,v 1.7 2023/05/20 10:46:22 rillig Exp $ */
+/* $NetBSD: opt_bap.c,v 1.8 2023/05/20 12:05:01 rillig Exp $ */
 
 /*
  * Tests for the options '-bap' and '-nbap' ("blank line after procedure
@@ -95,3 +95,19 @@ has_several_blank_lines_below(void)
 
 int		the_end;
 //indent end
+
+
+/*
+ * Don't insert a blank line between the end of a function body and an '#endif'
+ * line, as both are closing elements.
+ */
+//indent input
+#if 0
+void
+example(void)
+{
+}
+#endif
+//indent end
+
+//indent run-equals-input -bap

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.183 src/usr.bin/indent/io.c:1.184
--- src/usr.bin/indent/io.c:1.183	Sat May 20 11:53:53 2023
+++ src/usr.bin/indent/io.c	Sat May 20 12:05:01 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.183 2023/05/20 11:53:53 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.184 2023/05/20 12:05:01 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: io.c,v 1.183 2023/05/20 11:53:53 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.184 2023/05/20 12:05:01 rillig Exp $");
 
 #include 
 
@@ -152,7 +152,8 @@ want_blank_line(void)
 		&& out.line_kind != lk_endif)
 			return true;
 	}
-	if (opt.blanklines_after_procs && out.prev_line_kind == lk_func_end)
+	if (opt.blanklines_after_procs && out.prev_line_kind == lk_func_end
+	&& out.line_kind != lk_endif)
 		return true;
 	if (opt.blanklines_before_block_comments
 	&& out.line_kind == lk_block_comment)



CVS commit: src/usr.bin/indent

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 11:53:53 UTC 2023

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

Log Message:
indent: extract the output state from the parser state

The parser state depends on the preprocessing lines, the output state
shouldn't.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.298 -r1.299 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.155 -r1.156 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.182 -r1.183 src/usr.bin/indent/io.c
cvs rdiff -u -r1.201 -r1.202 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.147 -r1.148 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

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 11:19:17 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_comment.c opt_bbb.c
src/usr.bin/indent: debug.c indent.h io.c pr_comment.c

Log Message:
indent: implement blank line above block comment


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/indent/lsym_comment.c
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/indent/opt_bbb.c
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.154 -r1.155 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.181 -r1.182 src/usr.bin/indent/io.c
cvs rdiff -u -r1.146 -r1.147 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.13 src/tests/usr.bin/indent/lsym_comment.c:1.14
--- src/tests/usr.bin/indent/lsym_comment.c:1.13	Tue May 16 11:32:02 2023
+++ src/tests/usr.bin/indent/lsym_comment.c	Sat May 20 11:19:17 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_comment.c,v 1.13 2023/05/16 11:32:02 rillig Exp $ */
+/* $NetBSD: lsym_comment.c,v 1.14 2023/05/20 11:19:17 rillig Exp $ */
 
 /*
  * Tests for the token lsym_comment, which starts a comment.
@@ -100,6 +100,7 @@ t(void) {
 void
 t(void)
 {
+
 	/*
 	 * Old indent wrapped the URL near where this sentence ends.
 	 *

Index: src/tests/usr.bin/indent/opt_bbb.c
diff -u src/tests/usr.bin/indent/opt_bbb.c:1.7 src/tests/usr.bin/indent/opt_bbb.c:1.8
--- src/tests/usr.bin/indent/opt_bbb.c:1.7	Thu May 11 18:13:55 2023
+++ src/tests/usr.bin/indent/opt_bbb.c	Sat May 20 11:19:17 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bbb.c,v 1.7 2023/05/11 18:13:55 rillig Exp $ */
+/* $NetBSD: opt_bbb.c,v 1.8 2023/05/20 11:19:17 rillig Exp $ */
 
 /*
  * Tests for the options '-bbb' and '-nbbb'.
@@ -39,22 +39,22 @@ function_definition(void)
  * This is a block comment.
  */
 /* This is not a block comment since it is single-line. */
-/* $ TODO: Add a blank line here. */
+
 /*
  * This is a second block comment.
  */
 /* This is not a block comment. */
-/* $ TODO: Add a blank line here. */
+
 /*
  * Documentation of global_variable.
  */
 int		global_variable;
-/* $ TODO: Add a blank line here. */
+
 /*
  * Documentation of function_declaration.
  */
 void		function_declaration(void);
-/* $ TODO: Add a blank line here. */
+
 /*
  * Documentation of function_definition.
  */

Index: src/usr.bin/indent/debug.c
diff -u src/usr.bin/indent/debug.c:1.17 src/usr.bin/indent/debug.c:1.18
--- src/usr.bin/indent/debug.c:1.17	Sat May 20 10:46:21 2023
+++ src/usr.bin/indent/debug.c	Sat May 20 11:19:17 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: debug.c,v 1.17 2023/05/20 10:46:21 rillig Exp $	*/
+/*	$NetBSD: debug.c,v 1.18 2023/05/20 11:19:17 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: debug.c,v 1.17 2023/05/20 10:46:21 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.18 2023/05/20 11:19:17 rillig Exp $");
 
 #include 
 
@@ -122,6 +122,7 @@ static const char *const line_kind_name[
 	"#if",
 	"#endif",
 	"}",
+	"block comment",
 };
 
 void

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.154 src/usr.bin/indent/indent.h:1.155
--- src/usr.bin/indent/indent.h:1.154	Sat May 20 10:46:21 2023
+++ src/usr.bin/indent/indent.h	Sat May 20 11:19:17 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.154 2023/05/20 10:46:21 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.155 2023/05/20 11:19:17 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -399,6 +399,7 @@ extern struct parser_state {
 		lk_if,		/* #if, #ifdef, #ifndef */
 		lk_endif,	/* #endif */
 		lk_func_end,	/* the last '}' of a function body */
+		lk_block_comment,
 	} line_kind;		/* kind of the current output line, is reset to
  * lk_other at the beginning of each output
  * line; used for inserting blank lines */

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.181 src/usr.bin/indent/io.c:1.182
--- src/usr.bin/indent/io.c:1.181	Sat May 20 10:46:21 2023
+++ src/usr.bin/indent/io.c	Sat May 20 11:19:17 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.181 2023/05/20 10:46:21 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.182 2023/05/20 11:19:17 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: io.c,v 1.181 2023/05/20 10:46:21 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.182 2023/05/20 11:19:17 rillig Exp $");
 
 #include 
 
@@ -143,17 +143,16 @@ want_blank_line(void)
 		ps.blank_line_after_decl = false;
 		return true;
 	}
-
 	if (opt.blanklines_around_conditional_compilation) {
 		if (ps.prev_line_kind != lk_if && ps.line_kind == lk_if)
 			return true;
 		if (ps.prev_line_kind == lk_endif && ps.line_kind != lk_endif)
 			return true;
 	}
-
 	if (opt.blanklines_after_procs && ps.prev_line_kind == lk_func_end)

CVS commit: src

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 11:19:17 UTC 2023

Modified Files:
src/tests/usr.bin/indent: lsym_comment.c opt_bbb.c
src/usr.bin/indent: debug.c indent.h io.c pr_comment.c

Log Message:
indent: implement blank line above block comment


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/indent/lsym_comment.c
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/indent/opt_bbb.c
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.154 -r1.155 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.181 -r1.182 src/usr.bin/indent/io.c
cvs rdiff -u -r1.146 -r1.147 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

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 10:46:22 UTC 2023

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

Log Message:
indent: implement blank line after function body


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/indent/opt_bap.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.297 -r1.298 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.153 -r1.154 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.180 -r1.181 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

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 10:46:22 UTC 2023

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

Log Message:
indent: implement blank line after function body


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/indent/opt_bap.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.297 -r1.298 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.153 -r1.154 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.180 -r1.181 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_bap.c
diff -u src/tests/usr.bin/indent/opt_bap.c:1.6 src/tests/usr.bin/indent/opt_bap.c:1.7
--- src/tests/usr.bin/indent/opt_bap.c:1.6	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/opt_bap.c	Sat May 20 10:46:22 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bap.c,v 1.6 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: opt_bap.c,v 1.7 2023/05/20 10:46:22 rillig Exp $ */
 
 /*
  * Tests for the options '-bap' and '-nbap' ("blank line after procedure
@@ -7,9 +7,6 @@
  * The option '-bap' forces a blank line after every function body.
  *
  * The option '-nbap' keeps everything as is.
- *
- * FIXME: These options don't have any effect since at least 2000.
- * TODO: Investigate how nobody could have noticed this for 20 years.
  */
 
 //indent input
@@ -39,18 +36,18 @@ static void
 one_liner(void)
 {
 }
-/* $ FIXME: needs a blank line here */
+
 static void
 several_lines(void)
 {
 	action();
 }
-/* $ FIXME: needs a blank line here */
+
 int
 main(void)
 {
 }
-/* $ FIXME: needs a blank line here */
+
 int		global_variable;
 
 void
@@ -68,4 +65,33 @@ has_several_blank_lines_below(void)
 int		the_end;
 //indent end
 
-//indent run-equals-prev-output -nbap
+//indent run -nbap
+static void
+one_liner(void)
+{
+}
+static void
+several_lines(void)
+{
+	action();
+}
+int
+main(void)
+{
+}
+int		global_variable;
+
+void
+already_has_blank_line_below(void)
+{
+}
+
+void
+has_several_blank_lines_below(void)
+{
+}
+
+
+
+int		the_end;
+//indent end

Index: src/usr.bin/indent/debug.c
diff -u src/usr.bin/indent/debug.c:1.16 src/usr.bin/indent/debug.c:1.17
--- src/usr.bin/indent/debug.c:1.16	Sat May 20 10:09:02 2023
+++ src/usr.bin/indent/debug.c	Sat May 20 10:46:21 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: debug.c,v 1.16 2023/05/20 10:09:02 rillig Exp $	*/
+/*	$NetBSD: debug.c,v 1.17 2023/05/20 10:46:21 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: debug.c,v 1.16 2023/05/20 10:09:02 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.17 2023/05/20 10:46:21 rillig Exp $");
 
 #include 
 
@@ -121,6 +121,7 @@ static const char *const line_kind_name[
 	"other",
 	"#if",
 	"#endif",
+	"}",
 };
 
 void

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.297 src/usr.bin/indent/indent.c:1.298
--- src/usr.bin/indent/indent.c:1.297	Sat May 20 10:09:02 2023
+++ src/usr.bin/indent/indent.c	Sat May 20 10:46:21 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.297 2023/05/20 10:09:02 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.298 2023/05/20 10:46:21 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.297 2023/05/20 10:09:02 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.298 2023/05/20 10:46:21 rillig Exp $");
 
 #include 
 #include 
@@ -750,6 +750,9 @@ process_rbrace(void)
 		ps.in_decl = true;
 	}
 
+	if (ps.tos == 2 && code.len == 1 && code.st[0] == '}')
+		ps.line_kind = lk_func_end;
+
 	parse(psym_rbrace);
 }
 

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.153 src/usr.bin/indent/indent.h:1.154
--- src/usr.bin/indent/indent.h:1.153	Sat May 20 10:09:02 2023
+++ src/usr.bin/indent/indent.h	Sat May 20 10:46:21 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.153 2023/05/20 10:09:02 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.154 2023/05/20 10:46:21 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -398,8 +398,10 @@ extern struct parser_state {
 		lk_other,
 		lk_if,		/* #if, #ifdef, #ifndef */
 		lk_endif,	/* #endif */
-	} line_kind;		/* kind of the current line, is reset to
- * lk_other at the beginning of each line */
+		lk_func_end,	/* the last '}' of a function body */
+	} line_kind;		/* kind of the current output line, is reset to
+ * lk_other at the beginning of each output
+ * line; used for inserting blank lines */
 	enum line_kind prev_line_kind;
 
 	/* Comments */

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.180 src/usr.bin/indent/io.c:1.181
--- src/usr.bin/indent/io.c:1.180	Sat May 20 10:25:47 2023
+++ src/usr.bin/indent/io.c	Sat May 20 10:46:21 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.180 2023/05/20 10:25:47 rillig Exp $	*/
+/*	$NetBSD: 

CVS commit: src

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 10:25:47 UTC 2023

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

Log Message:
indent: ensure that no blank lines are inserted in INDENT OFF mode

No blank lines were inserted previously, but the code looked
suspicious as if that were possible.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/indent_off_on.c
cvs rdiff -u -r1.179 -r1.180 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/indent_off_on.c
diff -u src/tests/usr.bin/indent/indent_off_on.c:1.11 src/tests/usr.bin/indent/indent_off_on.c:1.12
--- src/tests/usr.bin/indent/indent_off_on.c:1.11	Tue May 16 08:04:04 2023
+++ src/tests/usr.bin/indent/indent_off_on.c	Sat May 20 10:25:47 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: indent_off_on.c,v 1.11 2023/05/16 08:04:04 rillig Exp $ */
+/* $NetBSD: indent_off_on.c,v 1.12 2023/05/20 10:25:47 rillig Exp $ */
 
 /*
  * Tests for the comments 'INDENT OFF' and 'INDENT ON', which temporarily
@@ -236,3 +236,19 @@ int still_on;
 /* INDENT OFF */
 int   finally_off   ;
 //indent end
+
+
+/*
+ * Ensure that in 'INDENT OFF' mode, no blank line is added between lines, even
+ * when requested via the -bacc option.
+ */
+//indent input
+/* INDENT OFF */
+int declaration;
+#if 0
+#endif
+int declaration;
+/* INDENT ON */
+//indent end
+
+//indent run-equals-input -bacc

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.179 src/usr.bin/indent/io.c:1.180
--- src/usr.bin/indent/io.c:1.179	Sat May 20 10:09:02 2023
+++ src/usr.bin/indent/io.c	Sat May 20 10:25:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.179 2023/05/20 10:09:02 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.180 2023/05/20 10:25:47 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: io.c,v 1.179 2023/05/20 10:09:02 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.180 2023/05/20 10:25:47 rillig Exp $");
 
 #include 
 
@@ -136,26 +136,22 @@ output_indent(int old_ind, int new_ind)
 	return ind;
 }
 
-static void
-maybe_output_blank_line(void)
+static bool
+want_blank_line(void)
 {
-	bool want_blank_line = false;
-
 	if (ps.blank_line_after_decl && ps.declaration == decl_no) {
 		ps.blank_line_after_decl = false;
-		want_blank_line = true;
+		return true;
 	}
 
 	if (opt.blanklines_around_conditional_compilation) {
 		if (ps.prev_line_kind != lk_if && ps.line_kind == lk_if)
-			want_blank_line = true;
+			return true;
 		if (ps.prev_line_kind == lk_endif && ps.line_kind != lk_endif)
-			want_blank_line = true;
+			return true;
 	}
 
-	if (want_blank_line && wrote_newlines < 2
-	&& (lab.len > 0 || code.len > 0 || com.len > 0))
-		output_newline();
+	return false;
 }
 
 static int
@@ -248,9 +244,11 @@ output_line(void)
 
 	ps.is_function_definition = false;
 
-	maybe_output_blank_line();
-
 	if (indent_enabled == indent_on) {
+		if (want_blank_line() && wrote_newlines < 2
+		&& (lab.len > 0 || code.len > 0 || com.len > 0))
+			output_newline();
+
 		if (ps.ind_level == 0)
 			ps.in_stmt_cont = false;	/* this is a class A
 			 * kludge */



CVS commit: src

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 10:25:47 UTC 2023

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

Log Message:
indent: ensure that no blank lines are inserted in INDENT OFF mode

No blank lines were inserted previously, but the code looked
suspicious as if that were possible.


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

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 10:09:03 UTC 2023

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

Log Message:
indent: implement blank lines around conditional compilation


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/opt_bacc.c
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.296 -r1.297 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.152 -r1.153 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.178 -r1.179 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_bacc.c
diff -u src/tests/usr.bin/indent/opt_bacc.c:1.11 src/tests/usr.bin/indent/opt_bacc.c:1.12
--- src/tests/usr.bin/indent/opt_bacc.c:1.11	Thu May 11 18:13:55 2023
+++ src/tests/usr.bin/indent/opt_bacc.c	Sat May 20 10:09:03 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bacc.c,v 1.11 2023/05/11 18:13:55 rillig Exp $ */
+/* $NetBSD: opt_bacc.c,v 1.12 2023/05/20 10:09:03 rillig Exp $ */
 
 /*
  * Tests for the options '-bacc' and '-nbacc' ("blank line around conditional
@@ -8,7 +8,7 @@
  * block.  For example, in front of every #ifdef and after every #endif.
  * Other blank lines surrounding such blocks are swallowed.
  *
- * The option '-nbacc' TODO.
+ * The option '-nbacc' leaves the vertical spacing as-is.
  */
 
 
@@ -21,24 +21,17 @@ int		b;
 int		c;
 //indent end
 
-/*
- * XXX: As of 2021-11-19, the option -bacc has no effect on declarations since
- * process_type resets out.blank_line_before unconditionally.
- */
 //indent run -bacc
 int		a;
-/* $ FIXME: expecting a blank line here */
+
 #if 0
 int		b;
 #endif
-/* $ FIXME: expecting a blank line here */
+
 int		c;
 //indent end
 
-/*
- * With '-nbacc' the code is unchanged since there are no blank lines to
- * remove.
- */
+/* The option '-nbacc' does not remove anything. */
 //indent run-equals-input -nbacc
 
 
@@ -80,13 +73,13 @@ os_name(void)
 const char *
 os_name(void)
 {
-/* $ FIXME: expecting a blank line here. */
+
 #if defined(__NetBSD__) || defined(__FreeBSD__)
 	return "BSD";
 #else
 	return "unknown";
 #endif
-/* $ FIXME: expecting a blank line here. */
+
 }
 //indent end
 
@@ -122,6 +115,16 @@ int outer_below;
 #endif
 //indent end
 
-//indent run-equals-input -di0 -bacc
+//indent run -di0 -bacc
+#ifdef outer
+int outer_above;
+
+#ifdef inner
+int inner;
+#endif
+
+int outer_below;
+#endif
+//indent end
 
 //indent run-equals-input -di0 -nbacc

Index: src/usr.bin/indent/debug.c
diff -u src/usr.bin/indent/debug.c:1.15 src/usr.bin/indent/debug.c:1.16
--- src/usr.bin/indent/debug.c:1.15	Sat May 20 02:47:35 2023
+++ src/usr.bin/indent/debug.c	Sat May 20 10:09:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: debug.c,v 1.15 2023/05/20 02:47:35 rillig Exp $	*/
+/*	$NetBSD: debug.c,v 1.16 2023/05/20 10:09:02 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: debug.c,v 1.15 2023/05/20 02:47:35 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.16 2023/05/20 10:09:02 rillig Exp $");
 
 #include 
 
@@ -117,6 +117,12 @@ const char *const paren_level_cast_name[
 	"(no cast)",
 };
 
+static const char *const line_kind_name[] = {
+	"other",
+	"#if",
+	"#endif",
+};
+
 void
 debug_printf(const char *fmt, ...)
 {
@@ -320,6 +326,9 @@ debug_parser_state(lexer_symbol lsym)
 	debug_ps_enum(spaced_expr_psym, psym_name);
 	debug_ps_int(quest_level);
 
+	debug_ps_enum(line_kind, line_kind_name);
+	debug_ps_enum(prev_line_kind, line_kind_name);
+
 	prev_ps = ps;
 }
 

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.296 src/usr.bin/indent/indent.c:1.297
--- src/usr.bin/indent/indent.c:1.296	Sat May 20 02:47:35 2023
+++ src/usr.bin/indent/indent.c	Sat May 20 10:09:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.296 2023/05/20 02:47:35 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.297 2023/05/20 10:09:02 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: indent.c,v 1.296 2023/05/20 02:47:35 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.297 2023/05/20 10:09:02 rillig Exp $");
 
 #include 
 #include 
@@ -975,6 +975,7 @@ process_preprocessing(void)
 			state_stack[ifdef_level++] = ps;
 		else
 			diag(1, "#if stack overflow");
+		ps.line_kind = lk_if;
 
 	} else if (substring_starts_with(dir, "el")) {	/* else, elif */
 		if (ifdef_level <= 0)
@@ -988,6 +989,7 @@ process_preprocessing(void)
 			diag(1, "Unmatched #endif");
 		else
 			ifdef_level--;
+		ps.line_kind = lk_endif;
 
 	} else {
 		if (!substring_equals(dir, "pragma") &&

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.152 src/usr.bin/indent/indent.h:1.153
--- src/usr.bin/indent/indent.h:1.152	Sat May 20 02:47:35 2023
+++ src/usr.bin/indent/indent.h	Sat May 20 10:09:02 2023
@@ -1,4 

CVS commit: src

2023-05-20 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat May 20 10:09:03 UTC 2023

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

Log Message:
indent: implement blank lines around conditional compilation


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/opt_bacc.c
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/indent/debug.c
cvs rdiff -u -r1.296 -r1.297 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.152 -r1.153 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.178 -r1.179 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/sbin/chown

2023-05-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat May 20 09:41:34 UTC 2023

Modified Files:
src/sbin/chown: chgrp.1

Log Message:
ALso fix chgrp Synopsis to include -d option


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/chown/chgrp.1

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



CVS commit: src/sbin/chown

2023-05-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat May 20 09:41:34 UTC 2023

Modified Files:
src/sbin/chown: chgrp.1

Log Message:
ALso fix chgrp Synopsis to include -d option


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/chown/chgrp.1

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

Modified files:

Index: src/sbin/chown/chgrp.1
diff -u src/sbin/chown/chgrp.1:1.9 src/sbin/chown/chgrp.1:1.10
--- src/sbin/chown/chgrp.1:1.9	Thu May  4 17:07:56 2023
+++ src/sbin/chown/chgrp.1	Sat May 20 09:41:34 2023
@@ -29,9 +29,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\" from: @(#)chgrp.1	8.3 (Berkeley) 3/31/94
-.\"	$NetBSD: chgrp.1,v 1.9 2023/05/04 17:07:56 pgoyette Exp $
+.\"	$NetBSD: chgrp.1,v 1.10 2023/05/20 09:41:34 pgoyette Exp $
 .\"
-.Dd May 1, 2023
+.Dd May 19, 2023
 .Dt CHGRP 1
 .Os
 .Sh NAME
@@ -43,7 +43,7 @@
 .Fl R
 .Op Fl H | Fl L | Fl P
 .Oc
-.Op Fl fhv
+.Op Fl dfhv
 .Ar group
 .Ar
 .Nm
@@ -51,7 +51,7 @@
 .Fl R
 .Op Fl H | Fl L | Fl P
 .Oc
-.Op Fl fhv
+.Op Fl dfhv
 .Fl Fl reference=rfile
 .Ar
 .Sh DESCRIPTION