Module Name: src Committed By: rillig Date: Thu May 11 18:44:14 UTC 2023
Modified Files: src/tests/usr.bin/indent: lsym_preprocessing.c src/usr.bin/indent: io.c Log Message: tests/indent: add more tests for preprocessing directives To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/indent/lsym_preprocessing.c cvs rdiff -u -r1.151 -r1.152 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/lsym_preprocessing.c diff -u src/tests/usr.bin/indent/lsym_preprocessing.c:1.6 src/tests/usr.bin/indent/lsym_preprocessing.c:1.7 --- src/tests/usr.bin/indent/lsym_preprocessing.c:1.6 Thu May 11 18:36:36 2023 +++ src/tests/usr.bin/indent/lsym_preprocessing.c Thu May 11 18:44:14 2023 @@ -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 Index: src/usr.bin/indent/io.c diff -u src/usr.bin/indent/io.c:1.151 src/usr.bin/indent/io.c:1.152 --- src/usr.bin/indent/io.c:1.151 Thu May 11 18:26:56 2023 +++ src/usr.bin/indent/io.c Thu May 11 18:44:14 2023 @@ -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 {