Module Name: src
Committed By: rillig
Date: Mon Jun 5 20:56:18 UTC 2023
Modified Files:
src/usr.bin/indent: indent.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.335 -r1.336 src/usr.bin/indent/indent.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.335 src/usr.bin/indent/indent.c:1.336
--- src/usr.bin/indent/indent.c:1.335 Mon Jun 5 12:05:01 2023
+++ src/usr.bin/indent/indent.c Mon Jun 5 20:56:18 2023
@@ -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;