From fadc996fc6d68b60890ddc2468d4f3ace379b3b8 Mon Sep 17 00:00:00 2001 From: rillig Date: Tue, 23 May 2023 06:43:19 +0000 Subject: [PATCH] indent: fix spacing around '*' in declarations --- tests/usr.bin/indent/fmt_decl.c | 5 ++--- usr.bin/indent/indent.c | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/usr.bin/indent/fmt_decl.c b/tests/usr.bin/indent/fmt_decl.c index 92b49e101dce..0d1de502ffc3 100644 --- a/tests/usr.bin/indent/fmt_decl.c +++ b/tests/usr.bin/indent/fmt_decl.c @@ -1,4 +1,4 @@ -/* $NetBSD: fmt_decl.c,v 1.44 2023/05/23 06:18:00 rillig Exp $ */ +/* $NetBSD: fmt_decl.c,v 1.45 2023/05/23 06:43:19 rillig Exp $ */ /* * Tests for declarations of global variables, external functions, and local @@ -1005,8 +1005,7 @@ void //indent run -ci4 -di0 -ndj -nlp void // $ FIXME: Wrong indentation, should be 0 instead. -// $ FIXME: Wrong spacing around '*'. - (error_at)(int msgid, const pos_t * pos, ...) + (error_at)(int msgid, const pos_t *pos, ...) { } //indent end diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c index 66201a46b390..c4d6bf128f8d 100644 --- a/usr.bin/indent/indent.c +++ b/usr.bin/indent/indent.c @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.305 2023/05/23 06:35:01 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.306 2023/05/23 06:43:19 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -38,7 +38,7 @@ */ #include -__RCSID("$NetBSD: indent.c,v 1.305 2023/05/23 06:35:01 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.306 2023/05/23 06:43:19 rillig Exp $"); #include #include @@ -366,6 +366,8 @@ update_ps_decl_ptr(lexer_symbol lsym) if (lsym == lsym_lparen_or_lbracket && ps.prev_token == lsym_for) ps.decl_ptr = dp_start; + if (lsym == lsym_comma && ps.in_decl) + ps.decl_ptr = dp_start; break; } }