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: in 'if (expr)', the parentheses do no...



details:   https://anonhg.NetBSD.org/src/rev/c67025b71278
branches:  trunk
changeset: 376241:c67025b71278
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jun 05 20:56:18 2023 +0000

description:
indent: in 'if (expr)', the parentheses do not form a cast expression

No functional change.  When stepping through the code in debug mode, it
was just too confusing that indent would log an 'unknown cast' in this
situation.

diffstat:

 usr.bin/indent/indent.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 92f1115ca684 -r c67025b71278 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Mon Jun 05 18:16:07 2023 +0000
+++ b/usr.bin/indent/indent.c   Mon Jun 05 20:56:18 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.335 2023/06/05 12:05:01 rillig Exp $      */
+/*     $NetBSD: indent.c,v 1.336 2023/06/05 20:56:18 rillig Exp $      */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: indent.c,v 1.335 2023/06/05 12:05:01 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.336 2023/06/05 20:56:18 rillig Exp $");
 
 #include <sys/param.h>
 #include <err.h>
@@ -489,7 +489,12 @@ process_lparen(void)
                indent = 2 * opt.indent_size;
 
        enum paren_level_cast cast = cast_unknown;
-       if (ps.prev_lsym == lsym_offsetof || ps.prev_lsym == lsym_sizeof
+       if (ps.prev_lsym == lsym_offsetof
+           || ps.prev_lsym == lsym_sizeof
+           || ps.prev_lsym == lsym_for
+           || ps.prev_lsym == lsym_if
+           || ps.prev_lsym == lsym_switch
+           || ps.prev_lsym == lsym_while
            || ps.is_function_definition)
                cast = cast_no;
 



Home | Main Index | Thread Index | Old Index