Module Name: src
Committed By: rillig
Date: Sun Jun 18 07:32:33 UTC 2023
Modified Files:
src/tests/usr.bin/indent: opt_bbb.c
src/usr.bin/indent: pr_comment.c
Log Message:
indent: only add blank lines before actual block comments
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/opt_bbb.c
cvs rdiff -u -r1.169 -r1.170 src/usr.bin/indent/pr_comment.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/opt_bbb.c
diff -u src/tests/usr.bin/indent/opt_bbb.c:1.10 src/tests/usr.bin/indent/opt_bbb.c:1.11
--- src/tests/usr.bin/indent/opt_bbb.c:1.10 Sun Jun 18 07:29:36 2023
+++ src/tests/usr.bin/indent/opt_bbb.c Sun Jun 18 07:32:33 2023
@@ -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. */
Index: src/usr.bin/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.169 src/usr.bin/indent/pr_comment.c:1.170
--- src/usr.bin/indent/pr_comment.c:1.169 Sun Jun 18 07:10:24 2023
+++ src/usr.bin/indent/pr_comment.c Sun Jun 18 07:32:33 2023
@@ -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)