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: indent multi-line conditions



details:   https://anonhg.NetBSD.org/src/rev/e3796fdd3521
branches:  trunk
changeset: 375349:e3796fdd3521
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon May 15 13:37:16 2023 +0000

description:
indent: indent multi-line conditions

No functional change.

diffstat:

 usr.bin/indent/debug.c  |   8 ++++----
 usr.bin/indent/indent.c |  24 ++++++++++++------------
 usr.bin/indent/io.c     |   6 +++---
 usr.bin/indent/lexi.c   |   8 ++++----
 4 files changed, 23 insertions(+), 23 deletions(-)

diffs (165 lines):

diff -r 83a906425057 -r e3796fdd3521 usr.bin/indent/debug.c
--- a/usr.bin/indent/debug.c    Mon May 15 13:33:19 2023 +0000
+++ b/usr.bin/indent/debug.c    Mon May 15 13:37:16 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: debug.c,v 1.7 2023/05/15 09:00:51 rillig Exp $ */
+/*     $NetBSD: debug.c,v 1.8 2023/05/15 13:37:16 rillig Exp $ */
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: debug.c,v 1.7 2023/05/15 09:00:51 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.8 2023/05/15 13:37:16 rillig Exp $");
 
 #include <stdarg.h>
 
@@ -210,8 +210,8 @@ ps_paren_has_changed(const struct parser
 
     for (int i = 0; i < ps.nparen; i++) {
        if (curr[i].indent != prev[i].indent ||
-           curr[i].maybe_cast != prev[i].maybe_cast ||
-           curr[i].no_cast != prev[i].no_cast)
+               curr[i].maybe_cast != prev[i].maybe_cast ||
+               curr[i].no_cast != prev[i].no_cast)
            return true;
     }
     return false;
diff -r 83a906425057 -r e3796fdd3521 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Mon May 15 13:33:19 2023 +0000
+++ b/usr.bin/indent/indent.c   Mon May 15 13:37:16 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.276 2023/05/15 13:33:19 rillig Exp $      */
+/*     $NetBSD: indent.c,v 1.277 2023/05/15 13:37:16 rillig Exp $      */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: indent.c,v 1.276 2023/05/15 13:33:19 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.277 2023/05/15 13:37:16 rillig Exp $");
 
 #include <sys/param.h>
 #include <err.h>
@@ -372,8 +372,8 @@ static void
 process_newline(void)
 {
     if (ps.prev_token == lsym_comma && ps.nparen == 0 && !ps.block_init &&
-       !opt.break_after_comma && break_comma &&
-       com.len == 0)
+           !opt.break_after_comma && break_comma &&
+           com.len == 0)
        goto stay_in_line;
 
     output_line();
@@ -465,7 +465,7 @@ process_rparen_or_rbracket(void)
     }
 
     if (ps.paren[ps.nparen - 1].maybe_cast &&
-       !ps.paren[ps.nparen - 1].no_cast) {
+           !ps.paren[ps.nparen - 1].no_cast) {
        ps.next_unary = true;
        ps.paren[ps.nparen - 1].maybe_cast = false;
        ps.want_blank = opt.space_after_cast;
@@ -508,7 +508,7 @@ static void
 process_unary_op(void)
 {
     if (!ps.decl_indent_done && ps.in_decl && !ps.block_init &&
-       !ps.is_function_definition && ps.line_start_nparen == 0) {
+           !ps.is_function_definition && ps.line_start_nparen == 0) {
        /* pointer declarations */
        code_add_decl_indent(ps.decl_ind - (int)token.len, ps.tabs_to_var);
        ps.decl_indent_done = true;
@@ -598,7 +598,7 @@ process_semicolon(void)
     ps.declaration = ps.declaration == decl_begin ? decl_end : decl_no;
 
     if (ps.in_decl && code.len == 0 && !ps.block_init &&
-       !ps.decl_indent_done && ps.line_start_nparen == 0) {
+           !ps.decl_indent_done && ps.line_start_nparen == 0) {
        /* indent stray semicolons in declarations */
        code_add_decl_indent(ps.decl_ind - 1, ps.tabs_to_var);
        ps.decl_indent_done = true;
@@ -958,11 +958,11 @@ process_preprocessing(void)
 
     } else {
        if (!substring_equals(dir, "pragma") &&
-           !substring_equals(dir, "error") &&
-           !substring_equals(dir, "line") &&
-           !substring_equals(dir, "undef") &&
-           !substring_equals(dir, "define") &&
-           !substring_equals(dir, "include")) {
+               !substring_equals(dir, "error") &&
+               !substring_equals(dir, "line") &&
+               !substring_equals(dir, "undef") &&
+               !substring_equals(dir, "define") &&
+               !substring_equals(dir, "include")) {
            diag(1, "Unrecognized cpp directive \"%.*s\"",
                (int)(dir.e - dir.s), dir.s);
            return;
diff -r 83a906425057 -r e3796fdd3521 usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Mon May 15 13:33:19 2023 +0000
+++ b/usr.bin/indent/io.c       Mon May 15 13:37:16 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: io.c,v 1.169 2023/05/15 13:33:19 rillig Exp $  */
+/*     $NetBSD: io.c,v 1.170 2023/05/15 13:37:16 rillig Exp $  */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: io.c,v 1.169 2023/05/15 13:33:19 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.170 2023/05/15 13:37:16 rillig Exp $");
 
 #include <stdio.h>
 #include <string.h>
@@ -255,7 +255,7 @@ output_complete_line(char line_terminato
            ps.in_stmt_cont = false;    /* this is a class A kludge */
 
        if (opt.blank_line_after_decl && ps.declaration == decl_end
-           && ps.tos > 1) {
+               && ps.tos > 1) {
            ps.declaration = decl_no;
            ps.blank_line_after_decl = true;
        }
diff -r 83a906425057 -r e3796fdd3521 usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Mon May 15 13:33:19 2023 +0000
+++ b/usr.bin/indent/lexi.c     Mon May 15 13:37:16 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lexi.c,v 1.188 2023/05/15 09:22:53 rillig Exp $        */
+/*     $NetBSD: lexi.c,v 1.189 2023/05/15 13:37:16 rillig Exp $        */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: lexi.c,v 1.188 2023/05/15 09:22:53 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.189 2023/05/15 13:37:16 rillig Exp $");
 
 #include <stdlib.h>
 #include <string.h>
@@ -295,7 +295,7 @@ static bool
 is_typename(void)
 {
     if (opt.auto_typedefs &&
-       token.len >= 2 && memcmp(token.mem + token.len - 2, "_t", 2) == 0)
+           token.len >= 2 && memcmp(token.mem + token.len - 2, "_t", 2) == 0)
        return true;
 
     return bsearch_typenames(token.st) >= 0;
@@ -414,7 +414,7 @@ found_typename:
     }
 
     if (inp_peek() == '(' && ps.tos <= 1 && ps.ind_level == 0 &&
-       !ps.in_func_def_params && !ps.block_init) {
+           !ps.in_func_def_params && !ps.block_init) {
 
        if (ps.nparen == 0 && probably_looking_at_definition()) {
            ps.is_function_definition = true;



Home | Main Index | Thread Index | Old Index