Module Name:    src
Committed By:   rillig
Date:           Sat Nov 27 19:21:42 UTC 2021

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

Log Message:
tests/indent: demonstrate strange formatting (since 2021-11-25)


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/tests/usr.bin/indent/fmt_decl.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/fmt_decl.c
diff -u src/tests/usr.bin/indent/fmt_decl.c:1.30 src/tests/usr.bin/indent/fmt_decl.c:1.31
--- src/tests/usr.bin/indent/fmt_decl.c:1.30	Thu Nov 25 20:02:06 2021
+++ src/tests/usr.bin/indent/fmt_decl.c	Sat Nov 27 19:21:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fmt_decl.c,v 1.30 2021/11/25 20:02:06 rillig Exp $	*/
+/*	$NetBSD: fmt_decl.c,v 1.31 2021/11/27 19:21:42 rillig Exp $	*/
 /* $FreeBSD: head/usr.bin/indent/tests/declarations.0 334478 2018-06-01 09:41:15Z pstef $ */
 
 /*
@@ -828,3 +828,56 @@ char str[sizeof(*ptr)];
 char str[sizeof(type * *)];
 char str[sizeof(**ptr)];
 #indent end
+
+
+/*
+ * FIXME: Whether or not the function 'a' is a declaration or a definition
+ * depends on the preceding struct, in particular the length of the 'pn'
+ * line. This doesn't make sense at all and looks like an out-of-bounds memory
+ * access.
+ *
+ * Since lexi.c 1.158 from 2021-11-25.
+ * Seen amongst others in args.c 1.72, function add_typedefs_from_file.
+ */
+#indent input
+struct {
+} v = {
+    pn("ta"),
+};
+
+static void
+a(char *fe)
+{
+}
+
+struct {
+} v = {
+    pn("t"),
+};
+
+static void
+a(char *fe)
+{
+}
+#indent end
+
+#indent run -di0
+struct {
+} v = {
+	pn("ta"),
+};
+
+static void
+     a(char *fe){
+}
+
+struct {
+} v = {
+	pn("t"),
+};
+
+static void
+a(char *fe)
+{
+}
+#indent end

Reply via email to