Module Name: src
Committed By: rillig
Date: Sat Sep 25 20:23:42 UTC 2021
Modified Files:
src/usr.bin/indent: indent.c indent_globs.h io.c pr_comment.c
Log Message:
indent: remove dead code for printing comments after empty lines
This code has been commented out for at least 29 years.
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/indent/indent_globs.h
cvs rdiff -u -r1.62 -r1.63 src/usr.bin/indent/io.c
cvs rdiff -u -r1.44 -r1.45 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.c
diff -u src/usr.bin/indent/indent.c:1.77 src/usr.bin/indent/indent.c:1.78
--- src/usr.bin/indent/indent.c:1.77 Sat Sep 25 19:49:13 2021
+++ src/usr.bin/indent/indent.c Sat Sep 25 20:23:42 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: indent.c,v 1.77 2021/09/25 19:49:13 rillig Exp $ */
+/* $NetBSD: indent.c,v 1.78 2021/09/25 20:23:42 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.77 2021/09/25 19:49:13 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.78 2021/09/25 20:23:42 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
#endif
@@ -398,7 +398,6 @@ main_init_globals(void)
line_no = 1;
had_eof = ps.in_decl = ps.decl_on_line = (break_comma = false);
ps.in_or_st = false;
- ps.bl_line = true;
ps.want_blank = ps.in_stmt = ps.ind_stmt = false;
ps.pcase = false;
Index: src/usr.bin/indent/indent_globs.h
diff -u src/usr.bin/indent/indent_globs.h:1.33 src/usr.bin/indent/indent_globs.h:1.34
--- src/usr.bin/indent/indent_globs.h:1.33 Sat Sep 25 18:49:03 2021
+++ src/usr.bin/indent/indent_globs.h Sat Sep 25 20:23:42 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: indent_globs.h,v 1.33 2021/09/25 18:49:03 rillig Exp $ */
+/* $NetBSD: indent_globs.h,v 1.34 2021/09/25 20:23:42 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -217,7 +217,6 @@ extern struct parser_state {
* paren since the last semicolon. When true,
* a '{' is starting a structure definition or
* an initialization list */
- bool bl_line; /* set to 1 by dump_line if the line is blank */
bool col_1; /* set to true if the last token started in
* column 1 */
int com_col; /* this is the column in which the current
Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.62 src/usr.bin/indent/io.c:1.63
--- src/usr.bin/indent/io.c:1.62 Sat Sep 25 17:36:51 2021
+++ src/usr.bin/indent/io.c Sat Sep 25 20:23:42 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.62 2021/09/25 17:36:51 rillig Exp $ */
+/* $NetBSD: io.c,v 1.63 2021/09/25 20:23:42 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.62 2021/09/25 17:36:51 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.63 2021/09/25 20:23:42 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
#endif
@@ -122,13 +122,10 @@ dump_line(void)
if (code.s == code.e && lab.s == lab.e && com.s == com.e) {
if (suppress_blanklines > 0)
suppress_blanklines--;
- else {
- ps.bl_line = true;
+ else
n_real_blanklines++;
- }
} else if (!inhibit_formatting) {
suppress_blanklines = 0;
- ps.bl_line = false;
if (prefix_blankline_requested && not_first_line) {
if (opt.swallow_optional_blanklines) {
if (n_real_blanklines == 1)
Index: src/usr.bin/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.44 src/usr.bin/indent/pr_comment.c:1.45
--- src/usr.bin/indent/pr_comment.c:1.44 Sat Sep 25 17:36:51 2021
+++ src/usr.bin/indent/pr_comment.c Sat Sep 25 20:23:42 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pr_comment.c,v 1.44 2021/09/25 17:36:51 rillig Exp $ */
+/* $NetBSD: pr_comment.c,v 1.45 2021/09/25 20:23:42 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.44 2021/09/25 17:36:51 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.45 2021/09/25 20:23:42 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
#endif
@@ -124,12 +124,7 @@ process_comment(void)
* is nonzero (the default). */
break_delim = false;
}
- if ( /* ps.bl_line && */ lab.s == lab.e && code.s == code.e) {
- /* klg: check only if this line is blank */
- /*
- * If this (*and previous lines are*) blank, dont put comment way
- * out at left
- */
+ if (lab.s == lab.e && code.s == code.e) {
ps.com_col = (ps.ind_level - opt.unindent_displace) * opt.indent_size + 1;
adj_max_line_length = opt.block_comment_max_line_length;
if (ps.com_col <= 1)