Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/indent tests/indent: demonstrate wrong indenta...



details:   https://anonhg.NetBSD.org/src/rev/79f76025b708
branches:  trunk
changeset: 1024506:79f76025b708
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Oct 26 23:37:40 2021 +0000

description:
tests/indent: demonstrate wrong indentation of local declarations

Reported by RVP via private mail. Importing FreeBSD indent in 2019 fixed
the trailing space in line 1, at the cost of lots of other bugs.

indent-2000.10.11.14.46.04
| int                           <-- trailing space
| main(void)
| {
|       char            (*f1) () = NULL;
|       char           *(*f1) () = NULL;
|       char           *(*f2) ();
| }
indent-2019.02.03.03.19.29

indent-2019.04.04.15.27.35
| int
| main(void)
| {
|       char            (*f1) () = NULL;
| char *(*      f1) () = NULL;
| char *(*      f2) ();
| }
indent-2021.09.30.21.38.43

indent-2021.09.30.21.48.12
| int
| main(void)
| {
|       char            (*f1)() = NULL;
| char *(*      f1)() = NULL;
| char *(*      f2)();
| }

diffstat:

 tests/usr.bin/indent/fmt_decl.c |  23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diffs (34 lines):

diff -r 7a26f5f49d02 -r 79f76025b708 tests/usr.bin/indent/fmt_decl.c
--- a/tests/usr.bin/indent/fmt_decl.c   Tue Oct 26 22:00:38 2021 +0000
+++ b/tests/usr.bin/indent/fmt_decl.c   Tue Oct 26 23:37:40 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fmt_decl.c,v 1.3 2021/10/23 20:07:03 rillig Exp $      */
+/*     $NetBSD: fmt_decl.c,v 1.4 2021/10/26 23:37:40 rillig Exp $      */
 /* $FreeBSD: head/usr.bin/indent/tests/declarations.0 334478 2018-06-01 09:41:15Z pstef $ */
 
 /* See FreeBSD r303570 */
@@ -355,3 +355,24 @@
 int           *y;
 int        ****z;
 #indent end
+
+
+#indent input
+int main(void) {
+    char (*f1)() = NULL;
+    char *(*f1)() = NULL;
+    char *(*f2)();
+}
+#indent end
+
+#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)();
+}
+#indent end



Home | Main Index | Thread Index | Old Index