Module Name:    src
Committed By:   rillig
Date:           Thu May 11 18:13:55 UTC 2023

Modified Files:
        src/tests/usr.bin/indent: indent_off_on.c lsym_form_feed.c
            lsym_lparen_or_lbracket.c opt_bacc.c opt_bad.c opt_badp.c
            opt_bap_sob.c opt_bbb.c opt_v.c
        src/usr.bin/indent: indent.c indent.h io.c pr_comment.c

Log Message:
indent: remove broken code for handling blank lines

This fixes several bugs where blank lines were erroneously added or
removed, treating these old bugs for new bugs in different places.
These new bugs are expected to be easier to fix, as the old bugs will
not interfere anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/indent/indent_off_on.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/lsym_form_feed.c
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/opt_bacc.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/indent/opt_bad.c \
    src/tests/usr.bin/indent/opt_bbb.c
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/indent/opt_badp.c \
    src/tests/usr.bin/indent/opt_v.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/opt_bap_sob.c
cvs rdiff -u -r1.250 -r1.251 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.116 -r1.117 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.149 -r1.150 src/usr.bin/indent/io.c
cvs rdiff -u -r1.128 -r1.129 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/indent_off_on.c
diff -u src/tests/usr.bin/indent/indent_off_on.c:1.8 src/tests/usr.bin/indent/indent_off_on.c:1.9
--- src/tests/usr.bin/indent/indent_off_on.c:1.8	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/indent_off_on.c	Thu May 11 18:13:55 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: indent_off_on.c,v 1.8 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: indent_off_on.c,v 1.9 2023/05/11 18:13:55 rillig Exp $ */
 
 /*
  * Tests for the comments 'INDENT OFF' and 'INDENT ON', which temporarily
@@ -24,6 +24,8 @@
 }
 /* $ FIXME: This empty line must stay. */
 /*INDENT OFF*/
+/* $ FIXME: The empty line below must be above the 'OFF' comment. */
+
 /* INDENT ON */
 
 {
@@ -42,9 +44,10 @@
 //indent run
 {
 }
-/* $ FIXME: This empty line must stay. */
-/* $ FIXME: This empty line must stay. */
+
 /*INDENT OFF*/
+/* $ FIXME: The empty line below must be above the 'OFF' comment. */
+
 /* INDENT ON */
 //indent end
 
@@ -64,6 +67,8 @@
 {
 }
  /* INDENT OFF */
+/* $ FIXME: The empty line below must be removed. */
+
 /* INDENT ON */
 {
 }
@@ -85,6 +90,8 @@
 {
 }
 	/* INDENT OFF */
+/* $ FIXME: The empty line below must be removed. */
+
 /* INDENT ON */
 {
 }
@@ -107,6 +114,8 @@ int   decl   ;
 int decl;
 /*INDENTOFF*/
 int   decl   ;
+/* $ FIXME: The empty line below must be removed. */
+
 /* INDENTON */
 int decl;
 //indent end
@@ -132,6 +141,8 @@ int   decl   ;
 int decl;
 /*		INDENT		OFF		*/
 int   decl   ;
+/* $ FIXME: The empty line below must be removed. */
+
 /* INDENT		ON		*/
 int decl;
 //indent end
@@ -151,6 +162,8 @@ int format( void ) {{{
 int format( void ) {{{
 /* $ XXX: Why is the INDENT ON comment indented? */
 /* $ XXX: Why does the INDENT ON comment get spaces, but not the OFF comment? */
+/* $ FIXME: The empty line below must be removed. */
+
 			/* INDENT ON */
 }
 }
@@ -184,6 +197,8 @@ void indent_still_on ( void ) ;	/* due t
 //indent run
 /* INDENT OFF */
 void indent_off ( void ) ;
+/* $ FIXME: The empty line below must be removed. */
+
 /* $ XXX: The double space from the below comment got merged to a single */
 /* $ XXX: space even though the comment might be regarded to be still in */
 /* $ XXX: the OFF section. */
@@ -191,6 +206,8 @@ void indent_off ( void ) ;
 void		indent_on(void);
 /* INDENT OFF */
 void indent_off ( void ) ;
+/* $ FIXME: The empty line below must be removed. */
+
 /* $ XXX: The below comment got moved from column 9 to column 1. */
 /* INDENT ON */
 void		indent_on(void);	/* the comment may be indented */
@@ -200,6 +217,8 @@ void indent_off ( void ) ;
 void indent_still_off ( void ) ;	/* due to the word 'INDENTATION' */
 /* INDENT ON * */
 void indent_still_off ( void ) ;	/* due to the extra '*' at the end */
+/* $ FIXME: The empty line below must be removed. */
+
 /* INDENT ON */
 void		indent_on(void);
 /* INDENT: OFF */

Index: src/tests/usr.bin/indent/lsym_form_feed.c
diff -u src/tests/usr.bin/indent/lsym_form_feed.c:1.5 src/tests/usr.bin/indent/lsym_form_feed.c:1.6
--- src/tests/usr.bin/indent/lsym_form_feed.c:1.5	Thu May 11 09:28:53 2023
+++ src/tests/usr.bin/indent/lsym_form_feed.c	Thu May 11 18:13:55 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_form_feed.c,v 1.5 2023/05/11 09:28:53 rillig Exp $ */
+/* $NetBSD: lsym_form_feed.c,v 1.6 2023/05/11 18:13:55 rillig Exp $ */
 
 /*
  * Tests for the token lsym_form_feed, which represents a form feed, a special
@@ -13,14 +13,7 @@ void function_1(void);
 void function_2(void);
 //indent end
 
-//indent run -di0
-void function_1(void);
-
-/* $ XXX: The form feed is not preserved. */
-/* $ XXX: Why 2 empty lines? */
-
-void function_2(void);
-//indent end
+//indent run-equals-input -di0
 
 
 /*
@@ -41,9 +34,7 @@ void
 function(void)
 {
 	if (expr)
-		/* $ XXX: The form feed has disappeared. */
-
-		/* <-- form feed */
+		/* <-- form feed */
 	{
 	}
 }

Index: src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c
diff -u src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.7 src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.8
--- src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.7	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c	Thu May 11 18:13:55 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.7 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.8 2023/05/11 18:13:55 rillig Exp $ */
 
 /*
  * Tests for the token lsym_lparen_or_lbracket, which represents a '(' or '['
@@ -297,9 +297,7 @@ cover_want_blank_before_lparen(void)
 	}
 #define preprocessing
 	(preprocessing)();
-
-/* $ XXX: Where has the '\f' gone? It should have been preserved. */
-	(lsym_form_feed)();	/* XXX: should be skipped */
+	(lsym_form_feed)();	/* XXX: should be skipped */
 	for (;;);
 	do
 		(lsym_do) = 3;

Index: src/tests/usr.bin/indent/opt_bacc.c
diff -u src/tests/usr.bin/indent/opt_bacc.c:1.10 src/tests/usr.bin/indent/opt_bacc.c:1.11
--- src/tests/usr.bin/indent/opt_bacc.c:1.10	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/opt_bacc.c	Thu May 11 18:13:55 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bacc.c,v 1.10 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: opt_bacc.c,v 1.11 2023/05/11 18:13:55 rillig Exp $ */
 
 /*
  * Tests for the options '-bacc' and '-nbacc' ("blank line around conditional
@@ -55,17 +55,7 @@ int		space_b;
 int		space_c;
 //indent end
 
-//indent run -bacc
-int		space_a;
-/* $ FIXME: expecting a blank line here */
-#if 0
-
-/* $ FIXME: expecting NO blank line here */
-int		space_b;
-#endif
-
-int		space_c;
-//indent end
+//indent run-equals-input -bacc
 
 /* The option '-nbacc' does not remove anything. */
 //indent run-equals-input -nbacc
@@ -92,12 +82,8 @@ os_name(void)
 {
 /* $ FIXME: expecting a blank line here. */
 #if defined(__NetBSD__) || defined(__FreeBSD__)
-/* $ FIXME: expecting NO blank line here. */
-
 	return "BSD";
 #else
-/* $ FIXME: expecting NO blank line here. */
-
 	return "unknown";
 #endif
 /* $ FIXME: expecting a blank line here. */
@@ -118,15 +104,7 @@ int decl;
 #endif
 //indent end
 
-//indent run -di0 -bacc
-#if outer
-
-#if inner
-int decl;
-#endif
-
-#endif
-//indent end
+//indent run-equals-input -di0 -bacc
 
 //indent run-equals-input -di0 -nbacc
 

Index: src/tests/usr.bin/indent/opt_bad.c
diff -u src/tests/usr.bin/indent/opt_bad.c:1.6 src/tests/usr.bin/indent/opt_bad.c:1.7
--- src/tests/usr.bin/indent/opt_bad.c:1.6	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/opt_bad.c	Thu May 11 18:13:55 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bad.c,v 1.6 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: opt_bad.c,v 1.7 2023/05/11 18:13:55 rillig Exp $ */
 
 /*
  * Tests for the options '-bad' and '-nbad'.
@@ -67,10 +67,10 @@ void
 function_definition(void)
 {
 	int		local_variable;
-
+/* $ TODO: add empty line */
 	function_call();
 	int		local_variable_after_statement;
-
+/* $ TODO: add empty line */
 	function_call();
 }
 //indent end
Index: src/tests/usr.bin/indent/opt_bbb.c
diff -u src/tests/usr.bin/indent/opt_bbb.c:1.6 src/tests/usr.bin/indent/opt_bbb.c:1.7
--- src/tests/usr.bin/indent/opt_bbb.c:1.6	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/opt_bbb.c	Thu May 11 18:13:55 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bbb.c,v 1.6 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: opt_bbb.c,v 1.7 2023/05/11 18:13:55 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/tests/usr.bin/indent/opt_badp.c
diff -u src/tests/usr.bin/indent/opt_badp.c:1.9 src/tests/usr.bin/indent/opt_badp.c:1.10
--- src/tests/usr.bin/indent/opt_badp.c:1.9	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/opt_badp.c	Thu May 11 18:13:55 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_badp.c,v 1.9 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: opt_badp.c,v 1.10 2023/05/11 18:13:55 rillig Exp $ */
 
 /*
  * Tests for the options '-badp' and '-nbadp'.
@@ -53,14 +53,8 @@ statement(void)
 }
 //indent end
 
-//indent run -badp
-void
-statement(void)
-{
-
-	stmt();
-}
-//indent end
+/* TODO: add blank line */
+//indent run-equals-input -badp
 
 //indent run-equals-input -nbadp
 
Index: src/tests/usr.bin/indent/opt_v.c
diff -u src/tests/usr.bin/indent/opt_v.c:1.9 src/tests/usr.bin/indent/opt_v.c:1.10
--- src/tests/usr.bin/indent/opt_v.c:1.9	Thu May 11 09:28:53 2023
+++ src/tests/usr.bin/indent/opt_v.c	Thu May 11 18:13:55 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_v.c,v 1.9 2023/05/11 09:28:53 rillig Exp $ */
+/* $NetBSD: opt_v.c,v 1.10 2023/05/11 18:13:55 rillig Exp $ */
 
 /*
  * Tests for the options '-v' and '-nv'.
@@ -41,7 +41,7 @@ example(void)
 #define macro1 /* prefix */ suffix
 
 #define macro2 prefix		/* suffix */
-There were 10 output lines and 2 comments
+There were 12 output lines and 2 comments
 (Lines with comments)/(Lines with code):  0.571
 //indent end
 
@@ -82,7 +82,7 @@ int *
 function(void)
 {
 }
-There were 5 output lines and 1 comments
+There were 6 output lines and 1 comments
 (Lines with comments)/(Lines with code):  0.250
 //indent end
 /* In the above output, the '5' means 5 non-empty lines. */

Index: src/tests/usr.bin/indent/opt_bap_sob.c
diff -u src/tests/usr.bin/indent/opt_bap_sob.c:1.4 src/tests/usr.bin/indent/opt_bap_sob.c:1.5
--- src/tests/usr.bin/indent/opt_bap_sob.c:1.4	Sun Apr 24 09:04:12 2022
+++ src/tests/usr.bin/indent/opt_bap_sob.c	Thu May 11 18:13:55 2023
@@ -1,8 +1,8 @@
-/* $NetBSD: opt_bap_sob.c,v 1.4 2022/04/24 09:04:12 rillig Exp $ */
+/* $NetBSD: opt_bap_sob.c,v 1.5 2023/05/11 18:13:55 rillig Exp $ */
 
 /*
- * As of 2021-03-08, the combination of -bap and -sob, which occurs in the
- * example indent.pro from NetBSD, removes the empty line above the
+ * Before 2023-05-11, the combination of -bap and -sob, which occurs in the
+ * example indent.pro from NetBSD, removed the empty line above the
  * separator.  Seen in games/cgram/cgram.c.
  */
 
@@ -27,26 +27,7 @@ function3(void)
 }
 //indent end
 
-//indent run -bap -sob
-void
-function1(void)
-{
-}
-/* $ FIXME: Keep the empty line between the '}' and the '//'. */
-///// C99 separator /////
-
-void
-function2(void)
-{
-}
-/* $ FIXME: Keep the empty line. */
-/* C block separator */
-
-void
-function3(void)
-{
-}
-//indent end
+//indent run-equals-input -bap -sob
 
 /*
  * XXX: Strangely, the option '-nbap' keeps the empty lines after the

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.250 src/usr.bin/indent/indent.c:1.251
--- src/usr.bin/indent/indent.c:1.250	Thu May 11 11:25:47 2023
+++ src/usr.bin/indent/indent.c	Thu May 11 18:13:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.250 2023/05/11 11:25:47 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.251 2023/05/11 18:13:55 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c	5.1
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.250 2023/05/11 11:25:47 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.251 2023/05/11 18:13:55 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -101,7 +101,6 @@ static struct parser_state state_stack[5
 
 FILE *input;
 FILE *output;
-struct output_control out;
 
 static const char *in_name = "Standard Input";
 static const char *out_name = "Standard Output";
@@ -703,9 +702,6 @@ process_lbrace(void)
 	}
     }
 
-    if (ps.in_func_def_params)
-	out.blank_line_before = false;
-
     if (ps.nparen > 0) {
 	diag(1, "Unbalanced parentheses");
 	ps.nparen = 0;
@@ -729,8 +725,6 @@ process_lbrace(void)
 	ps.decl_on_line = false;	/* we can't be in the middle of a
 					 * declaration, so don't do special
 					 * indentation of comments */
-	if (opt.blanklines_after_decl_at_top && ps.in_func_def_params)
-	    out.blank_line_after = true;
 	ps.in_func_def_params = false;
 	ps.in_decl = false;
     }
@@ -782,11 +776,7 @@ process_rbrace(void)
 	ps.in_decl = true;
     }
 
-    out.blank_line_before = false;
     parse(psym_rbrace);
-
-    if (ps.tos <= 1 && opt.blanklines_after_procs && ps.decl_level <= 0)
-	out.blank_line_after = true;
 }
 
 static void
@@ -844,8 +834,6 @@ process_type(void)
     if (ps.decl_level <= 0)
 	ps.just_saw_decl = 2;
 
-    out.blank_line_before = false;
-
     int len = (int)buf_len(&token) + 1;
     int ind = ps.ind_level == 0 || ps.decl_level > 0
 	? opt.decl_indent	/* global variable or local member */
@@ -1036,14 +1024,6 @@ process_preprocessing(void)
 	}
     }
 
-    if (opt.blanklines_around_conditional_compilation) {
-	out.blank_line_after = true;
-	out.blank_lines_to_output = 0;
-    } else {
-	out.blank_line_after = false;
-	out.blank_line_before = false;
-    }
-
     /*
      * subsequent processing of the newline character will cause the line to
      * be printed
@@ -1164,7 +1144,6 @@ main_loop(void)
 
 	case lsym_typedef:
 	case lsym_storage_class:
-	    out.blank_line_before = false;
 	    goto copy_token;
 
 	case lsym_tag:

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.116 src/usr.bin/indent/indent.h:1.117
--- src/usr.bin/indent/indent.h:1.116	Thu May 11 17:22:56 2023
+++ src/usr.bin/indent/indent.h	Thu May 11 18:13:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.116 2023/05/11 17:22:56 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.117 2023/05/11 18:13:55 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -143,13 +143,6 @@ struct buffer {
     char *l;			/* end of the allocated memory */
 };
 
-extern struct output_control {
-    int blank_lines_to_output;
-    bool blank_line_before;
-    bool blank_line_after;
-    bool suppress_blanklines;
-} out;
-
 extern FILE *input;
 extern FILE *output;
 

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.149 src/usr.bin/indent/io.c:1.150
--- src/usr.bin/indent/io.c:1.149	Thu May 11 17:22:56 2023
+++ src/usr.bin/indent/io.c	Thu May 11 18:13:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.149 2023/05/11 17:22:56 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.150 2023/05/11 18:13:55 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)io.c	8.1 (Be
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: io.c,v 1.149 2023/05/11 17:22:56 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.150 2023/05/11 18:13:55 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -510,39 +510,9 @@ output_line_comment(int ind)
 static void
 output_complete_line(char line_terminator)
 {
-    static bool first_line = true;
-
     ps.is_function_definition = false;
 
-    debug_println("%s: %d %s%s%s%s",
-	__func__,
-	out.blank_lines_to_output,
-	out.blank_lines_to_output == 1 ? "line" : "lines",
-	out.blank_line_before ? ", before" : "",
-	out.blank_line_after ? ", after" : "",
-	out.suppress_blanklines ? ", suppress" : "");
-
-    if (code.s == code.e && lab.s == lab.e && com.s == com.e) {
-	if (out.suppress_blanklines)
-	    out.suppress_blanklines = false;
-	else
-	    out.blank_lines_to_output++;
-
-    } else if (!inhibit_formatting) {
-	out.suppress_blanklines = false;
-	if (out.blank_line_before && !first_line) {
-	    if (opt.swallow_optional_blanklines) {
-		if (out.blank_lines_to_output == 1)
-		    out.blank_lines_to_output = 0;
-	    } else {
-		if (out.blank_lines_to_output == 0)
-		    out.blank_lines_to_output = 1;
-	    }
-	}
-
-	for (; out.blank_lines_to_output > 0; out.blank_lines_to_output--)
-	    output_char('\n');
-
+    if (!inhibit_formatting) {
 	if (ps.ind_level == 0)
 	    ps.in_stmt_cont = false;	/* this is a class A kludge */
 
@@ -561,12 +531,8 @@ output_complete_line(char line_terminato
 	ps.stats.lines++;
 
 	/* TODO: rename to blank_line_after_decl */
-	if (ps.just_saw_decl == 1 && opt.blanklines_after_decl) {
-	    out.blank_line_before = true;
+	if (ps.just_saw_decl == 1 && opt.blanklines_after_decl)
 	    ps.just_saw_decl = 0;
-	} else
-	    out.blank_line_before = out.blank_line_after;
-	out.blank_line_after = false;
     }
 
     ps.decl_on_line = ps.in_decl;	/* for proper comment indentation */
@@ -585,8 +551,6 @@ output_complete_line(char line_terminato
 	paren_indent = -1 - ps.paren[ps.nparen - 1].indent;
 	debug_println("paren_indent is now %d", paren_indent);
     }
-
-    first_line = false;
 }
 
 void
@@ -700,16 +664,6 @@ parse_indent_comment(void)
 	output_line();
 
     inhibit_formatting = !on;
-    if (on) {
-	/*
-	 * XXX: Does this make sense? Is the handling of blank lines above
-	 * INDENT OFF comments essentially the same?
-	 */
-	out.blank_lines_to_output = 0;
-	out.blank_line_after = false;
-	out.blank_line_before = false;
-	out.suppress_blanklines = true;
-    }
 }
 
 void

Index: src/usr.bin/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.128 src/usr.bin/indent/pr_comment.c:1.129
--- src/usr.bin/indent/pr_comment.c:1.128	Mon May  9 21:41:49 2022
+++ src/usr.bin/indent/pr_comment.c	Thu May 11 18:13:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pr_comment.c,v 1.128 2022/05/09 21:41:49 rillig Exp $	*/
+/*	$NetBSD: pr_comment.c,v 1.129 2023/05/11 18:13:55 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.128 2022/05/09 21:41:49 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.129 2023/05/11 18:13:55 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -175,9 +175,6 @@ analyze_comment(bool *p_may_wrap, bool *
 	break_delim = false;
 
     if (break_delim) {
-	if (opt.blanklines_before_block_comments &&
-		ps.prev_token != lsym_lbrace)
-	    out.blank_line_before = true;
 	output_line();
 	com_add_delim();
     }

Reply via email to