tests/indent: fix comments

This commit is contained in:
rillig 2023-06-23 20:44:51 +00:00
parent 1fe8cbaafa
commit f7b95e49e6
3 changed files with 14 additions and 11 deletions

View File

@ -1,10 +1,11 @@
/* $NetBSD: fmt_else_comment.c,v 1.5 2023/05/11 09:28:53 rillig Exp $ */
/* $NetBSD: fmt_else_comment.c,v 1.6 2023/06/23 20:44:51 rillig Exp $ */
/*
* Tests for comments after 'if (expr)' and 'else'. If the option '-br' is
* given (or rather, if '-bl' is not given), indent looks ahead to the
* following significant token to see whether it is a '{', it then moves the
* comments after the '{'.
* Tests for comments after 'if (expr)' and 'else'. Before 2023-05-11, if the
* option '-br' was given (or rather, if '-bl' was not given), indent looked
* ahead to the following significant token to see whether it was a '{', it
* then moved the comments after the '{'. This token swapping was error-prone
* and thus removed.
*
* See also:
* FreeBSD r303484
@ -12,8 +13,8 @@
*/
/*
* The two 'if' statements below exercise two different code paths, even
* though they look very similar.
* Before 2023-05-11, the two 'if' statements below exercised two different
* code paths, even though they look very similar.
*/
//indent input
void t(void) {
@ -52,6 +53,7 @@ void t(void) {
/* Old indent would remove the 3 blank lines above, awaiting "else". */
// $ 'Old' means something before 2019.
if (1) {
int a;
@ -68,6 +70,7 @@ void t(void) {
if (1)
;
else /* Old indent would get very confused here */
// $ 'Old' means something before 2019.
/* We also mustn't assume that there's only one comment */
/* before the left brace. */
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: opt_bap.c,v 1.10 2023/06/16 11:48:32 rillig Exp $ */
/* $NetBSD: opt_bap.c,v 1.11 2023/06/23 20:44:51 rillig Exp $ */
/*
* Tests for the options '-bap' and '-nbap' ("blank line after procedure
@ -115,7 +115,7 @@ example(void)
/*
* A preprocessing line after the end of a function body does not force a blank
* line, as these lines are not a different syntactic layer.
* line, as these lines are from a different syntactic layer.
*/
//indent input
#if 0

View File

@ -1,4 +1,4 @@
/* $NetBSD: psym_switch_expr.c,v 1.5 2023/06/06 04:37:27 rillig Exp $ */
/* $NetBSD: psym_switch_expr.c,v 1.6 2023/06/23 20:44:51 rillig Exp $ */
/*
* Tests for the parser symbol psym_switch_expr, which represents the keyword
@ -12,7 +12,7 @@
/*
* In all practical cases, a 'switch (expr)' is followed by a block, but the
* C syntax allows an arbitrary statement. Unless such a statement has a
* label, it is unreachable.
* label or is a loop, its beginning is unreachable.
*/
//indent input
void