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 indentation of local variable dec...
details: https://anonhg.NetBSD.org/src/rev/685897859a4d
branches: trunk
changeset: 990427:685897859a4d
user: rillig <rillig%NetBSD.org@localhost>
date: Wed Oct 27 00:04:51 2021 +0000
description:
indent: fix indentation of local variable declarations
This had been broken since the import of FreeBSD indent in 2019.
diffstat:
tests/usr.bin/indent/fmt_decl.c | 19 ++++++++++---------
usr.bin/indent/io.c | 9 +++------
2 files changed, 13 insertions(+), 15 deletions(-)
diffs (76 lines):
diff -r 947f919d3db7 -r 685897859a4d tests/usr.bin/indent/fmt_decl.c
--- a/tests/usr.bin/indent/fmt_decl.c Tue Oct 26 23:58:40 2021 +0000
+++ b/tests/usr.bin/indent/fmt_decl.c Wed Oct 27 00:04:51 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fmt_decl.c,v 1.5 2021/10/26 23:58:40 rillig Exp $ */
+/* $NetBSD: fmt_decl.c,v 1.6 2021/10/27 00:04:51 rillig Exp $ */
/* $FreeBSD: head/usr.bin/indent/tests/declarations.0 334478 2018-06-01 09:41:15Z pstef $ */
/* See FreeBSD r303570 */
@@ -365,15 +365,18 @@
}
#indent end
+/*
+ * Before NetBSD io.c 1.103 from 2021-10-27, indent wrongly placed the second
+ * and third variable declaration in column 1. This bug has been introduced
+ * to NetBSD when FreeBSD indent was imported in 2019.
+ */
#indent run -ldi0
int
main(void)
{
char (*f1)() = NULL;
-/* $ FIXME: The following declaration must be indented. */
-char *(*f1)() = NULL;
-/* $ FIXME: The following declaration must be indented. */
-char *(*f2)();
+ char *(*f1)() = NULL;
+ char *(*f2)();
}
#indent end
@@ -383,11 +386,9 @@
{
/* $ XXX: Not really pretty, the name 'f1' should be aligned, if at all. */
char (*f1)() = NULL;
-/* $ FIXME: The following declaration must be indented. */
/* $ XXX: Not really pretty, the name 'f1' should be aligned, if at all. */
-char *(* f1)() = NULL;
-/* $ FIXME: The following declaration must be indented. */
+ char *(* f1)() = NULL;
/* $ XXX: Not really pretty, the name 'f2' should be aligned, if at all. */
-char *(* f2)();
+ char *(* f2)();
}
#indent end
diff -r 947f919d3db7 -r 685897859a4d usr.bin/indent/io.c
--- a/usr.bin/indent/io.c Tue Oct 26 23:58:40 2021 +0000
+++ b/usr.bin/indent/io.c Wed Oct 27 00:04:51 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.102 2021/10/24 17:19:48 rillig Exp $ */
+/* $NetBSD: io.c,v 1.103 2021/10/27 00:04:51 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
#include <sys/cdefs.h>
#if defined(__NetBSD__)
-__RCSID("$NetBSD: io.c,v 1.102 2021/10/24 17:19:48 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.103 2021/10/27 00:04:51 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
#endif
@@ -212,10 +212,7 @@
{
static bool first_line = true;
- if (ps.procname[0] != '\0') {
- ps.ind_level = 0;
- ps.procname[0] = '\0';
- }
+ ps.procname[0] = '\0';
if (code.s == code.e && lab.s == lab.e && com.s == com.e) {
if (suppress_blanklines)
Home |
Main Index |
Thread Index |
Old Index