Module Name:    src
Committed By:   rillig
Date:           Sat Oct  9 10:56:13 UTC 2021

Modified Files:
        src/tests/usr.bin/indent: token-preprocessing.0
            token-preprocessing.0.stdout

Log Message:
tests/indent: test fixing of invalid preprocessor directives


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/token-preprocessing.0
cvs rdiff -u -r1.7 -r1.8 \
    src/tests/usr.bin/indent/token-preprocessing.0.stdout

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/token-preprocessing.0
diff -u src/tests/usr.bin/indent/token-preprocessing.0:1.5 src/tests/usr.bin/indent/token-preprocessing.0:1.6
--- src/tests/usr.bin/indent/token-preprocessing.0:1.5	Fri Oct  8 21:32:28 2021
+++ src/tests/usr.bin/indent/token-preprocessing.0	Sat Oct  9 10:56:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token-preprocessing.0,v 1.5 2021/10/08 21:32:28 rillig Exp $ */
+/* $NetBSD: token-preprocessing.0,v 1.6 2021/10/09 10:56:13 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*-
@@ -68,3 +68,27 @@ int binary_plus = 3
 int unary_plus =
 #define intermediate 1
 	+ 4;
+
+/*
+ * Preprocessing lines that don't expect an argument but have one are fixed.
+ * They are indented with a single tab.
+ */
+#if 0
+#elif 1
+#else if 3
+#endif 0
+
+/*
+ * Existing comments are indented just like code comments.
+ *
+ * This means that the above wrong preprocessing lines need to be fed through
+ * indent twice until they become stable. Since compilers issue warnings about
+ * these invalid lines, not much code still has these.
+ */
+#if 0		/* comment */
+#else		/* comment */
+#endif		/* comment */
+
+#if 0/* comment */
+#else/* comment */
+#endif/* comment */

Index: src/tests/usr.bin/indent/token-preprocessing.0.stdout
diff -u src/tests/usr.bin/indent/token-preprocessing.0.stdout:1.7 src/tests/usr.bin/indent/token-preprocessing.0.stdout:1.8
--- src/tests/usr.bin/indent/token-preprocessing.0.stdout:1.7	Fri Oct  8 21:32:28 2021
+++ src/tests/usr.bin/indent/token-preprocessing.0.stdout	Sat Oct  9 10:56:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token-preprocessing.0.stdout,v 1.7 2021/10/08 21:32:28 rillig Exp $ */
+/* $NetBSD: token-preprocessing.0.stdout,v 1.8 2021/10/09 10:56:13 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*-
@@ -69,3 +69,27 @@ int		binary_plus = 3
 int		unary_plus =
 #define intermediate 1
 +4;
+
+/*
+ * Preprocessing lines that don't expect an argument but have one are fixed.
+ * They are indented with a single tab.
+ */
+#if 0
+#elif 1
+#else	/* if 3 */
+#endif	/* 0 */
+
+/*
+ * Existing comments are indented just like code comments.
+ *
+ * This means that the above wrong preprocessing lines need to be fed through
+ * indent twice until they become stable. Since compilers issue warnings about
+ * these invalid lines, not much code still has these.
+ */
+#if 0				/* comment */
+#else				/* comment */
+#endif				/* comment */
+
+#if 0				/* comment */
+#else				/* comment */
+#endif				/* comment */

Reply via email to