Module Name:    src
Committed By:   rillig
Date:           Thu Nov 25 16:05:07 UTC 2021

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

Log Message:
tests/indent: test '*' in function declarations


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 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.24 src/tests/usr.bin/indent/fmt_decl.c:1.25
--- src/tests/usr.bin/indent/fmt_decl.c:1.24	Thu Nov 25 08:03:08 2021
+++ src/tests/usr.bin/indent/fmt_decl.c	Thu Nov 25 16:05:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fmt_decl.c,v 1.24 2021/11/25 08:03:08 rillig Exp $	*/
+/*	$NetBSD: fmt_decl.c,v 1.25 2021/11/25 16:05:07 rillig Exp $	*/
 /* $FreeBSD: head/usr.bin/indent/tests/declarations.0 334478 2018-06-01 09:41:15Z pstef $ */
 
 /*
@@ -188,6 +188,25 @@ MAXALIGN(offsetof(int, test)) + MAXIMUM_
 #indent run-equals-input
 
 
+/*
+ * Ensure that the usual GCC-style function attributes are formatted in a
+ * sensible way.
+ */
+#indent input
+void function(const char *, ...) __attribute__((format(printf, 1, 2)));
+#indent end
+
+/* FIXME: missing space before '__attribute__' */
+#indent run -di0
+void function(const char *, ...)__attribute__((format(printf, 1, 2)));
+#indent end
+
+/* FIXME: missing space before '__attribute__' */
+#indent run
+void		function(const char *, ...)__attribute__((format(printf, 1, 2)));
+#indent end
+
+
 #indent input
 static
 _attribute_printf(1, 2)
@@ -757,3 +776,20 @@ MAKE_INLINE const char *GNode_VarTarget(
 	return GNode_ValueDirect(gn, TARGET);
 }
 #indent end
+
+
+/*
+ * Ensure that '*' in declarations is interpreted (or at least formatted) as
+ * a 'pointer to' type derivation, not as a binary or unary operator.
+ */
+#indent input
+number *var = a * b;
+
+void
+function(void)
+{
+	number *var = a * b;
+}
+#indent end
+
+#indent run-equals-input -di0

Reply via email to