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: remove newline between 'switch' and '{'
details: https://anonhg.NetBSD.org/src/rev/20588459fddb
branches: trunk
changeset: 376133:20588459fddb
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Jun 02 14:34:14 2023 +0000
description:
indent: remove newline between 'switch' and '{'
diffstat:
tests/usr.bin/indent/fmt_decl.c | 7 ++++---
tests/usr.bin/indent/label.c | 6 ++----
usr.bin/indent/indent.c | 8 ++++++--
3 files changed, 12 insertions(+), 9 deletions(-)
diffs (70 lines):
diff -r bd792b25af68 -r 20588459fddb tests/usr.bin/indent/fmt_decl.c
--- a/tests/usr.bin/indent/fmt_decl.c Fri Jun 02 14:32:04 2023 +0000
+++ b/tests/usr.bin/indent/fmt_decl.c Fri Jun 02 14:34:14 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fmt_decl.c,v 1.47 2023/06/02 14:21:55 rillig Exp $ */
+/* $NetBSD: fmt_decl.c,v 1.48 2023/06/02 14:34:14 rillig Exp $ */
/*
* Tests for declarations of global variables, external functions, and local
@@ -920,8 +920,9 @@ ch_isalpha(char ch)
//indent run -i4 -di0
// $ FIXME: 'buffer' is classified as 'word'.
// $
-// $ XXX: 'char' is classified as 'type_in_parentheses'; check whether this
-// $ XXX: lexer symbol should only be used for types in cast expressions.
+// $ XXX: 'char' is classified as 'type_in_parentheses'; check whether
+// $ XXX: lsym_type_in_parentheses should only be used for types in cast
+// $ XXX: expressions.
// $
// $ FIXME: 'size_t' is classified as 'word'.
void buf_add_chars(struct buffer *, const char *, size_t);
diff -r bd792b25af68 -r 20588459fddb tests/usr.bin/indent/label.c
--- a/tests/usr.bin/indent/label.c Fri Jun 02 14:32:04 2023 +0000
+++ b/tests/usr.bin/indent/label.c Fri Jun 02 14:34:14 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: label.c,v 1.6 2023/05/13 09:40:47 rillig Exp $ */
+/* $NetBSD: label.c,v 1.7 2023/06/02 14:34:14 rillig Exp $ */
/* See FreeBSD r303489 */
@@ -20,9 +20,7 @@ U: ;
void
t(void)
{
- switch (1)
-/* $ TODO: Move the '{' up to the ')'. */
- {
+ switch (1) {
case 1: /* test */
case 2: /* test */
}
diff -r bd792b25af68 -r 20588459fddb usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c Fri Jun 02 14:32:04 2023 +0000
+++ b/usr.bin/indent/indent.c Fri Jun 02 14:34:14 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: indent.c,v 1.313 2023/06/02 14:21:55 rillig Exp $ */
+/* $NetBSD: indent.c,v 1.314 2023/06/02 14:34:14 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: indent.c,v 1.313 2023/06/02 14:21:55 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.314 2023/06/02 14:34:14 rillig Exp $");
#include <sys/param.h>
#include <err.h>
@@ -455,6 +455,10 @@ process_newline(void)
&& lab.len == 0 /* for preprocessing lines */
&& com.len == 0)
goto stay_in_line;
+ if (ps.s_sym[ps.tos] == psym_switch_expr && opt.brace_same_line) {
+ ps.force_nl = true;
+ goto stay_in_line;
+ }
output_line();
Home |
Main Index |
Thread Index |
Old Index