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 strange forma...



details:   https://anonhg.NetBSD.org/src/rev/b52f5b2d3732
branches:  trunk
changeset: 1026518:b52f5b2d3732
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 27 19:21:42 2021 +0000

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

diffstat:

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

diffs (66 lines):

diff -r 2f8740a51d23 -r b52f5b2d3732 tests/usr.bin/indent/fmt_decl.c
--- a/tests/usr.bin/indent/fmt_decl.c   Sat Nov 27 18:39:15 2021 +0000
+++ b/tests/usr.bin/indent/fmt_decl.c   Sat Nov 27 19:21:42 2021 +0000
@@ -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(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



Home | Main Index | Thread Index | Old Index