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 spacing between postfix operator ...
details: https://anonhg.NetBSD.org/src/rev/ed4f16e3d0b0
branches: trunk
changeset: 376415:ed4f16e3d0b0
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Jun 16 23:07:52 2023 +0000
description:
indent: fix spacing between postfix operator and left parenthesis
diffstat:
tests/usr.bin/indent/lsym_lparen_or_lbracket.c | 4 ++--
tests/usr.bin/indent/opt_pcs.c | 5 ++---
usr.bin/indent/indent.c | 15 ++++++++-------
3 files changed, 12 insertions(+), 12 deletions(-)
diffs (75 lines):
diff -r 1e4f82499931 -r ed4f16e3d0b0 tests/usr.bin/indent/lsym_lparen_or_lbracket.c
--- a/tests/usr.bin/indent/lsym_lparen_or_lbracket.c Fri Jun 16 22:30:35 2023 +0000
+++ b/tests/usr.bin/indent/lsym_lparen_or_lbracket.c Fri Jun 16 23:07:52 2023 +0000
@@ -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): ;
diff -r 1e4f82499931 -r ed4f16e3d0b0 tests/usr.bin/indent/opt_pcs.c
--- a/tests/usr.bin/indent/opt_pcs.c Fri Jun 16 22:30:35 2023 +0000
+++ b/tests/usr.bin/indent/opt_pcs.c Fri Jun 16 23:07:52 2023 +0000
@@ -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
diff -r 1e4f82499931 -r ed4f16e3d0b0 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c Fri Jun 16 22:30:35 2023 +0000
+++ b/usr.bin/indent/indent.c Fri Jun 16 23:07:52 2023 +0000
@@ -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;
}
Home |
Main Index |
Thread Index |
Old Index