Module Name:    src
Committed By:   rillig
Date:           Wed Jun 14 11:18:09 UTC 2023

Modified Files:
        src/tests/usr.bin/indent: lsym_switch.c
        src/usr.bin/indent: indent.c

Log Message:
indent: fix formatting of comment after 'switch (expr)'


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/lsym_switch.c
cvs rdiff -u -r1.361 -r1.362 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/tests/usr.bin/indent/lsym_switch.c
diff -u src/tests/usr.bin/indent/lsym_switch.c:1.4 src/tests/usr.bin/indent/lsym_switch.c:1.5
--- src/tests/usr.bin/indent/lsym_switch.c:1.4	Sat Jun 10 16:43:56 2023
+++ src/tests/usr.bin/indent/lsym_switch.c	Wed Jun 14 11:18:09 2023
@@ -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

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.361 src/usr.bin/indent/indent.c:1.362
--- src/usr.bin/indent/indent.c:1.361	Wed Jun 14 10:29:52 2023
+++ src/usr.bin/indent/indent.c	Wed Jun 14 11:18:09 2023
@@ -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;
 	}

Reply via email to