Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/indent tests/indent: add more tests for preprocessin...



details:   https://anonhg.NetBSD.org/src/rev/1bfa9b2fdb13
branches:  trunk
changeset: 374769:1bfa9b2fdb13
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu May 11 18:44:14 2023 +0000

description:
tests/indent: add more tests for preprocessing directives

diffstat:

 tests/usr.bin/indent/lsym_preprocessing.c |  21 ++++++++++++++++++++-
 usr.bin/indent/io.c                       |   8 ++------
 2 files changed, 22 insertions(+), 7 deletions(-)

diffs (69 lines):

diff -r c906b0d55ccf -r 1bfa9b2fdb13 tests/usr.bin/indent/lsym_preprocessing.c
--- a/tests/usr.bin/indent/lsym_preprocessing.c Thu May 11 18:36:36 2023 +0000
+++ b/tests/usr.bin/indent/lsym_preprocessing.c Thu May 11 18:44:14 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_preprocessing.c,v 1.6 2023/05/11 18:36:36 rillig Exp $ */
+/* $NetBSD: lsym_preprocessing.c,v 1.7 2023/05/11 18:44:14 rillig Exp $ */
 
 /*
  * Tests for the token lsym_preprocessing, which represents a '#' that starts
@@ -230,6 +230,9 @@ int         unary_plus =
                                 * line 2
                                 * line 3
                                 */
+
+#define two_comments /* 1 */ /* 2 */ /*3*/
+#define three_comments         /* first */ /* second */ /*third*/
 //indent end
 
 //indent run
@@ -242,4 +245,20 @@ int                unary_plus =
                                                                 * line 2
                                                                 * line 3
                                                                 */
+
+#define two_comments /* 1 */ /* 2 */   /* 3 */
+#define three_comments         /* first */ /* second */        /* third */
 //indent end
+
+
+/*
+ * Do not touch multi-line macro definitions.
+ */
+//indent input
+#define do_once(stmt)          \
+do {                           \
+       stmt;                   \
+} while (/* constant condition */ false)
+//indent end
+
+//indent run-equals-input
diff -r c906b0d55ccf -r 1bfa9b2fdb13 usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Thu May 11 18:36:36 2023 +0000
+++ b/usr.bin/indent/io.c       Thu May 11 18:44:14 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: io.c,v 1.151 2023/05/11 18:26:56 rillig Exp $  */
+/*     $NetBSD: io.c,v 1.152 2023/05/11 18:44:14 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.151 2023/05/11 18:26:56 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.152 2023/05/11 18:44:14 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -198,10 +198,6 @@ inp_comment_init_preproc(void)
 {
     if (inbuf.save_com_e == NULL) {    /* if this is the first comment, we
                                         * must set up the buffer */
-       /*
-        * XXX: No space is reserved for a potential '{' here, unlike in
-        * inp_comment_init_comment.
-        */
        inbuf.save_com_s = inbuf.save_com_buf;
        inbuf.save_com_e = inbuf.save_com_s;
     } else {



Home | Main Index | Thread Index | Old Index