Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/indent indent: remove dead code for printing comment...



details:   https://anonhg.NetBSD.org/src/rev/5d9f05c98cf9
branches:  trunk
changeset: 1023762:5d9f05c98cf9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 25 20:23:42 2021 +0000

description:
indent: remove dead code for printing comments after empty lines

This code has been commented out for at least 29 years.

No functional change.

diffstat:

 usr.bin/indent/indent.c       |   5 ++---
 usr.bin/indent/indent_globs.h |   3 +--
 usr.bin/indent/io.c           |   9 +++------
 usr.bin/indent/pr_comment.c   |  11 +++--------
 4 files changed, 9 insertions(+), 19 deletions(-)

diffs (108 lines):

diff -r c470f65c1602 -r 5d9f05c98cf9 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Sat Sep 25 20:16:17 2021 +0000
+++ b/usr.bin/indent/indent.c   Sat Sep 25 20:23:42 2021 +0000
@@ -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 @@
 
 #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 @@
     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;
diff -r c470f65c1602 -r 5d9f05c98cf9 usr.bin/indent/indent_globs.h
--- a/usr.bin/indent/indent_globs.h     Sat Sep 25 20:16:17 2021 +0000
+++ b/usr.bin/indent/indent_globs.h     Sat Sep 25 20:23:42 2021 +0000
@@ -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 @@
                                 * 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
diff -r c470f65c1602 -r 5d9f05c98cf9 usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Sat Sep 25 20:16:17 2021 +0000
+++ b/usr.bin/indent/io.c       Sat Sep 25 20:23:42 2021 +0000
@@ -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 @@
 
 #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 @@
     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)
diff -r c470f65c1602 -r 5d9f05c98cf9 usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Sat Sep 25 20:16:17 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Sat Sep 25 20:23:42 2021 +0000
@@ -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 @@
 
 #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 @@
                                 * 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)



Home | Main Index | Thread Index | Old Index