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: fix formatting of comment after 'swit...
details: https://anonhg.NetBSD.org/src/rev/8f685290f781
branches: trunk
changeset: 376373:8f685290f781
user: rillig <rillig%NetBSD.org@localhost>
date: Wed Jun 14 11:18:09 2023 +0000
description:
indent: fix formatting of comment after 'switch (expr)'
diffstat:
tests/usr.bin/indent/lsym_switch.c | 12 +++---------
usr.bin/indent/indent.c | 7 ++++---
2 files changed, 7 insertions(+), 12 deletions(-)
diffs (56 lines):
diff -r b817e0169d43 -r 8f685290f781 tests/usr.bin/indent/lsym_switch.c
--- a/tests/usr.bin/indent/lsym_switch.c Wed Jun 14 10:30:34 2023 +0000
+++ b/tests/usr.bin/indent/lsym_switch.c Wed Jun 14 11:18:09 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_switch.c,v 1.4 2023/06/10 16:43:56 rillig Exp $ */
+/* $NetBSD: lsym_switch.c,v 1.5 2023/06/14 11:18:09 rillig Exp $ */
/*
* Tests for the token lsym_switch, which represents the keyword 'switch' that
@@ -16,16 +16,10 @@
*/
//indent input
{
- switch (expr) // comment
+ switch (expr) // comment
{
}
}
//indent end
-//indent run
-{
-// $ FIXME: The '{' has moved to the comment.
- switch (expr) // comment {
- }
-}
-//indent end
+//indent run-equals-input
diff -r b817e0169d43 -r 8f685290f781 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c Wed Jun 14 10:30:34 2023 +0000
+++ b/usr.bin/indent/indent.c Wed Jun 14 11:18:09 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: indent.c,v 1.361 2023/06/14 10:29:52 rillig Exp $ */
+/* $NetBSD: indent.c,v 1.362 2023/06/14 11:18:09 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: indent.c,v 1.361 2023/06/14 10:29:52 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.362 2023/06/14 11:18:09 rillig Exp $");
#include <sys/param.h>
#include <err.h>
@@ -492,7 +492,8 @@ process_newline(void)
&& com.len == 0)
goto stay_in_line;
if (ps.psyms.sym[ps.psyms.top] == psym_switch_expr
- && opt.brace_same_line) {
+ && opt.brace_same_line
+ && com.len == 0) {
ps.force_nl = true;
goto stay_in_line;
}
Home |
Main Index |
Thread Index |
Old Index