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 redundant comments



details:   https://anonhg.NetBSD.org/src/rev/7a1f81b3b5c2
branches:  trunk
changeset: 990533:7a1f81b3b5c2
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 29 23:03:53 2021 +0000

description:
indent: remove redundant comments

The comments only repeated what the constants for the parser symbols
already express in their names. In the past, the names of these
constants were inconsistent and misleading; back then, it made sense to
make the comments express the actual meaning of the constants.

diffstat:

 usr.bin/indent/parse.c |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (57 lines):

diff -r 967296f2e668 -r 7a1f81b3b5c2 usr.bin/indent/parse.c
--- a/usr.bin/indent/parse.c    Fri Oct 29 22:52:50 2021 +0000
+++ b/usr.bin/indent/parse.c    Fri Oct 29 23:03:53 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.45 2021/10/29 22:52:50 rillig Exp $        */
+/*     $NetBSD: parse.c,v 1.46 2021/10/29 23:03:53 rillig Exp $        */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -128,7 +128,7 @@
            ps.ind_level_follow = ps.ind_level = decl_level();
        break;
 
-    case psym_if_expr:         /* 'if' '(' <expr> ')' */
+    case psym_if_expr:
        if (ps.s_sym[ps.tos] == psym_if_expr_stmt_else && opt.else_if) {
            /*
             * Reduce "else if" to "if". This saves a lot of stack space in
@@ -138,7 +138,7 @@
        }
        /* FALLTHROUGH */
     case psym_do:
-    case psym_for_exprs:       /* 'for' (...) */
+    case psym_for_exprs:
        ps.s_sym[++ps.tos] = psym;
        ps.s_ind_level[ps.tos] = ps.ind_level = ps.ind_level_follow;
        ++ps.ind_level_follow;  /* subsequent statements should be indented 1 */
@@ -172,7 +172,7 @@
        ps.s_ind_level[ps.tos] = ps.ind_level_follow;
        break;
 
-    case psym_while_expr:      /* 'while' '(' <expr> ')' */
+    case psym_while_expr:
        if (ps.s_sym[ps.tos] == psym_do_stmt) {
            /* it is matched with do stmt */
            ps.ind_level = ps.ind_level_follow = ps.s_ind_level[ps.tos];
@@ -210,7 +210,7 @@
            diag(1, "Statement nesting error");
        break;
 
-    case psym_switch_expr:     /* had switch (...) */
+    case psym_switch_expr:
        ps.s_sym[++ps.tos] = psym_switch_expr;
        ps.s_case_ind_level[ps.tos] = case_ind;
        /* save current case indent level */
@@ -222,9 +222,8 @@
        ps.search_stmt = opt.brace_same_line;
        break;
 
-    case psym_semicolon:       /* this indicates a simple stmt */
-       break_comma = false;    /* turn off flag to break after commas in a
-                                * declaration */
+    case psym_semicolon:       /* a simple statement */
+       break_comma = false;    /* don't break after comma in a declaration */
        ps.s_sym[++ps.tos] = psym_stmt;
        ps.s_ind_level[ps.tos] = ps.ind_level;
        break;



Home | Main Index | Thread Index | Old Index