indent: fix trailing whitespace after comment
This commit is contained in:
parent
452673c116
commit
b33c0a568f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lsym_comment.c,v 1.15 2023/05/21 10:18:44 rillig Exp $ */
|
||||
/* $NetBSD: lsym_comment.c,v 1.16 2023/06/05 08:22:00 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_comment, which starts a comment.
|
||||
|
@ -734,11 +734,10 @@ while(cond)/*comment*/;
|
|||
void
|
||||
loop(void)
|
||||
{
|
||||
while (cond) /* comment */ ;
|
||||
while (cond) /* comment */;
|
||||
|
||||
while (cond)
|
||||
/* $ XXX: The space after the comment looks unintentional. */
|
||||
/* comment */ ;
|
||||
/* comment */;
|
||||
}
|
||||
//indent end
|
||||
|
||||
|
@ -937,7 +936,7 @@ f(void)
|
|||
/*
|
||||
* 12 1234 123 123456 1234 1234567 123
|
||||
* 1234.
|
||||
*/ ;
|
||||
*/;
|
||||
}
|
||||
//indent end
|
||||
|
||||
|
@ -947,7 +946,7 @@ int
|
|||
f(void)
|
||||
{
|
||||
if (0)
|
||||
/* 12 1234 123 123456 1234 1234567 123 1234. */ ;
|
||||
/* 12 1234 123 123456 1234 1234567 123 1234. */;
|
||||
}
|
||||
//indent end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lsym_do.c,v 1.8 2023/06/05 08:10:25 rillig Exp $ */
|
||||
/* $NetBSD: lsym_do.c,v 1.9 2023/06/05 08:22:00 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Tests for the token lsym_do, which represents the keyword 'do' that starts
|
||||
|
@ -125,8 +125,7 @@ variants(void)
|
|||
|
||||
//indent run
|
||||
{
|
||||
// $ FIXME: Trailing whitespace.
|
||||
/* */
|
||||
/* */
|
||||
do {
|
||||
} while (false);
|
||||
|
||||
|
@ -141,8 +140,7 @@ label: do {
|
|||
|
||||
//indent run -sob
|
||||
{
|
||||
// $ FIXME: Trailing whitespace.
|
||||
/* */
|
||||
/* */
|
||||
do {
|
||||
} while (false);
|
||||
// $ FIXME: This blank line is not optional and must be preserved.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#! /bin/sh
|
||||
# $NetBSD: t_errors.sh,v 1.32 2023/06/04 22:20:04 rillig Exp $
|
||||
# $NetBSD: t_errors.sh,v 1.33 2023/06/05 08:22:00 rillig Exp $
|
||||
#
|
||||
# Copyright (c) 2021 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
|
@ -468,7 +468,7 @@ crash_comment_after_controlling_expression_body()
|
|||
cat <<\EOF > code.exp
|
||||
{
|
||||
if (expr
|
||||
) /* c */ ;
|
||||
) /* c */;
|
||||
}
|
||||
EOF
|
||||
|
||||
|
@ -499,7 +499,7 @@ f(void)
|
|||
if (0)
|
||||
/*
|
||||
* 0123456789012345678901
|
||||
*/ ;
|
||||
*/;
|
||||
}
|
||||
EOF
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: indent.c,v 1.329 2023/06/05 07:35:05 rillig Exp $ */
|
||||
/* $NetBSD: indent.c,v 1.330 2023/06/05 08:22:00 rillig Exp $ */
|
||||
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-4-Clause
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: indent.c,v 1.329 2023/06/05 07:35:05 rillig Exp $");
|
||||
__RCSID("$NetBSD: indent.c,v 1.330 2023/06/05 08:22:00 rillig Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <err.h>
|
||||
|
@ -423,10 +423,8 @@ move_com_to_code(lexer_symbol lsym)
|
|||
if (ps.want_blank)
|
||||
buf_add_char(&code, ' ');
|
||||
buf_add_buf(&code, &com);
|
||||
if (lsym != lsym_rparen && lsym != lsym_rbracket)
|
||||
buf_add_char(&code, ' ');
|
||||
com.len = 0;
|
||||
ps.want_blank = false;
|
||||
ps.want_blank = lsym != lsym_rparen && lsym != lsym_rbracket;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue