Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/indent indent: only add blank lines before actual bl...
details: https://anonhg.NetBSD.org/src/rev/6604f930c8e2
branches: trunk
changeset: 376446:6604f930c8e2
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jun 18 07:32:33 2023 +0000
description:
indent: only add blank lines before actual block comments
diffstat:
tests/usr.bin/indent/opt_bbb.c | 6 +-----
usr.bin/indent/pr_comment.c | 8 ++++----
2 files changed, 5 insertions(+), 9 deletions(-)
diffs (55 lines):
diff -r 0bd32604073a -r 6604f930c8e2 tests/usr.bin/indent/opt_bbb.c
--- a/tests/usr.bin/indent/opt_bbb.c Sun Jun 18 07:29:36 2023 +0000
+++ b/tests/usr.bin/indent/opt_bbb.c Sun Jun 18 07:32:33 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bbb.c,v 1.10 2023/06/18 07:29:36 rillig Exp $ */
+/* $NetBSD: opt_bbb.c,v 1.11 2023/06/18 07:32:33 rillig Exp $ */
/*
* Tests for the options '-bbb' and '-nbbb'.
@@ -88,12 +88,8 @@ label: /*
{
label: /* not a block comment */
stmt; /* not a block comment */
-
-// $ TODO: No blank line before this comment.
label: /* This is not a block comment, as it goes to
* the right. */
-
-// $ TODO: No blank line before this comment.
stmt; /* This is not a block comment, as it goes to
* the right. */
diff -r 0bd32604073a -r 6604f930c8e2 usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c Sun Jun 18 07:29:36 2023 +0000
+++ b/usr.bin/indent/pr_comment.c Sun Jun 18 07:32:33 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pr_comment.c,v 1.169 2023/06/18 07:10:24 rillig Exp $ */
+/* $NetBSD: pr_comment.c,v 1.170 2023/06/18 07:32:33 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pr_comment.c,v 1.169 2023/06/18 07:10:24 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.170 2023/06/18 07:32:33 rillig Exp $");
#include <string.h>
@@ -100,12 +100,12 @@ analyze_comment(bool *p_may_wrap, bool *
token.s[token.len - 1] == '/' ||
(inp_p[0] == '\n' && !opt.format_block_comments))
may_wrap = false;
- if (is_block_comment())
- out.line_kind = lk_block_comment;
if (com.len > 0)
output_line();
if (lab.len == 0 && code.len == 0) {
+ if (is_block_comment())
+ out.line_kind = lk_block_comment;
ind = (ps.ind_level - opt.unindent_displace)
* opt.indent_size;
if (ind <= 0)
Home |
Main Index |
Thread Index |
Old Index