Module Name: src
Committed By: rillig
Date: Fri Nov 26 14:27:19 UTC 2021
Modified Files:
src/tests/usr.bin/indent: token_preprocessing.c
src/usr.bin/indent: io.c
Log Message:
indent: remove code that fixes malformed preprocessor directives
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/token_preprocessing.c
cvs rdiff -u -r1.134 -r1.135 src/usr.bin/indent/io.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/token_preprocessing.c
diff -u src/tests/usr.bin/indent/token_preprocessing.c:1.1 src/tests/usr.bin/indent/token_preprocessing.c:1.2
--- src/tests/usr.bin/indent/token_preprocessing.c:1.1 Mon Oct 18 22:30:34 2021
+++ src/tests/usr.bin/indent/token_preprocessing.c Fri Nov 26 14:27:19 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token_preprocessing.c,v 1.1 2021/10/18 22:30:34 rillig Exp $ */
+/* $NetBSD: token_preprocessing.c,v 1.2 2021/11/26 14:27:19 rillig Exp $ */
/* $FreeBSD$ */
/*-
@@ -136,8 +136,9 @@ int unary_plus =
/*
- * Preprocessing lines that don't expect an argument but have one are fixed.
- * They are indented with a single tab.
+ * Before io.c 1.135 from 2021-11-26, indent fixed malformed preprocessing
+ * lines that had arguments even though they shouldn't. It is not the task of
+ * an indenter to fix code, that's what a linter is for.
*/
#indent input
#if 0
@@ -146,12 +147,7 @@ int unary_plus =
#endif 0
#indent end
-#indent run
-#if 0
-#elif 1
-#else /* if 3 */
-#endif /* 0 */
-#indent end
+#indent run-equals-input
/*
Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.134 src/usr.bin/indent/io.c:1.135
--- src/usr.bin/indent/io.c:1.134 Fri Nov 26 14:17:01 2021
+++ src/usr.bin/indent/io.c Fri Nov 26 14:27:19 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.134 2021/11/26 14:17:01 rillig Exp $ */
+/* $NetBSD: io.c,v 1.135 2021/11/26 14:27:19 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)io.c 8.1 (Be
#include <sys/cdefs.h>
#if defined(__NetBSD__)
-__RCSID("$NetBSD: io.c,v 1.134 2021/11/26 14:17:01 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.135 2021/11/26 14:27:19 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
#endif
@@ -342,31 +342,7 @@ dump_line_label(void)
*lab.e = '\0';
ind = output_indent(0, compute_label_indent());
-
- if (lab.s[0] == '#' && (strncmp(lab.s, "#else", 5) == 0
- || strncmp(lab.s, "#endif", 6) == 0)) {
- const char *s = lab.s;
- if (lab.e[-1] == '\n')
- lab.e--;
- do {
- output_char(*s++);
- } while (s < lab.e && 'a' <= *s && *s <= 'z');
-
- while (s < lab.e && ch_isblank(*s))
- s++;
-
- if (s < lab.e) {
- if (s[0] == '/' && s[1] == '*') {
- output_char('\t');
- output_range(s, lab.e);
- } else {
- output_string("\t/* ");
- output_range(s, lab.e);
- output_string(" */");
- }
- }
- } else
- output_range(lab.s, lab.e);
+ output_range(lab.s, lab.e);
ind = ind_add(ind, lab.s, lab.e);
ps.is_case_label = false;