Module Name:    src
Committed By:   rillig
Date:           Fri Jun 16 23:07:53 UTC 2023

Modified Files:
        src/tests/usr.bin/indent: lsym_lparen_or_lbracket.c opt_pcs.c
        src/usr.bin/indent: indent.c

Log Message:
indent: fix spacing between postfix operator and left parenthesis


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c \
    src/tests/usr.bin/indent/opt_pcs.c
cvs rdiff -u -r1.377 -r1.378 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_lparen_or_lbracket.c
diff -u src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.17 src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.18
--- src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.17	Wed Jun 14 14:11:28 2023
+++ src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c	Fri Jun 16 23:07:52 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.17 2023/06/14 14:11:28 rillig Exp $ */
+/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.18 2023/06/16 23:07:52 rillig Exp $ */
 
 /*
  * Tests for the token lsym_lparen_or_lbracket, which represents a '(' or '['
@@ -295,7 +295,7 @@ cover_want_blank_before_lparen(void)
 	int rparen_or_rbracket = a[3](5);
 	+(unary_op);
 	3 + (binary_op);
-	a++ (postfix_op);	/* unlikely to be seen in practice */
+	a++(postfix_op);	/* unlikely to be seen in practice */
 	cond ? (question) : (5);
 	switch (expr) {
 	case (case_label): ;
Index: src/tests/usr.bin/indent/opt_pcs.c
diff -u src/tests/usr.bin/indent/opt_pcs.c:1.17 src/tests/usr.bin/indent/opt_pcs.c:1.18
--- src/tests/usr.bin/indent/opt_pcs.c:1.17	Wed Jun 14 14:11:28 2023
+++ src/tests/usr.bin/indent/opt_pcs.c	Fri Jun 16 23:07:52 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_pcs.c,v 1.17 2023/06/14 14:11:28 rillig Exp $ */
+/* $NetBSD: opt_pcs.c,v 1.18 2023/06/16 23:07:52 rillig Exp $ */
 
 /*
  * Tests for the options '-pcs' and '-npcs'.
@@ -114,8 +114,7 @@ int offset = offsetof(struct s, member);
 
 //indent input
 int unary = +call();
-// $ FIXME: Unusual, but there should be no space.
-int postfix = step++ ();
+int postfix = step++();
 int binary = 1 + call();
 //indent end
 

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.377 src/usr.bin/indent/indent.c:1.378
--- src/usr.bin/indent/indent.c:1.377	Fri Jun 16 14:26:26 2023
+++ src/usr.bin/indent/indent.c	Fri Jun 16 23:07:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.377 2023/06/16 14:26:26 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.378 2023/06/16 23:07:52 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: indent.c,v 1.377 2023/06/16 14:26:26 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.378 2023/06/16 23:07:52 rillig Exp $");
 
 #include <sys/param.h>
 #include <err.h>
@@ -574,13 +574,14 @@ want_blank_before_lparen(void)
 {
 	if (opt.proc_calls_space)
 		return true;
-	if (ps.prev_lsym == lsym_rparen || ps.prev_lsym == lsym_rbracket)
-		return false;
-	if (ps.prev_lsym == lsym_offsetof)
-		return false;
 	if (ps.prev_lsym == lsym_sizeof)
 		return opt.blank_after_sizeof;
-	if (ps.prev_lsym == lsym_word || ps.prev_lsym == lsym_funcname)
+	if (ps.prev_lsym == lsym_rparen
+	    || ps.prev_lsym == lsym_rbracket
+	    || ps.prev_lsym == lsym_postfix_op
+	    || ps.prev_lsym == lsym_offsetof
+	    || ps.prev_lsym == lsym_word
+	    || ps.prev_lsym == lsym_funcname)
 		return false;
 	return true;
 }

Reply via email to