svn commit: r321396 - in head/usr.bin/indent: . tests
Piotr Pawel Stefaniak
pstef at FreeBSD.org
Sun Jul 23 20:25:54 UTC 2017
Author: pstef
Date: Sun Jul 23 20:25:53 2017
New Revision: 321396
URL: https://svnweb.freebsd.org/changeset/base/321396
Log:
indent(1): better alignment of comments on code.
If aligning the beginning of a comment to -cn would mean no space between
code and the comment, align it to the next tab stop.
Modified:
head/usr.bin/indent/pr_comment.c
head/usr.bin/indent/tests/comments.0
head/usr.bin/indent/tests/comments.0.stdout
Modified: head/usr.bin/indent/pr_comment.c
==============================================================================
--- head/usr.bin/indent/pr_comment.c Sun Jul 23 19:54:54 2017 (r321395)
+++ head/usr.bin/indent/pr_comment.c Sun Jul 23 20:25:53 2017 (r321396)
@@ -141,7 +141,7 @@ pr_comment(void)
target_col = count_spaces(compute_label_target(), s_lab);
}
ps.com_col = ps.decl_on_line || ps.ind_level == 0 ? ps.decl_com_ind : ps.com_ind;
- if (ps.com_col < target_col)
+ if (ps.com_col <= target_col)
ps.com_col = ((target_col + 7) & ~7) + 1;
if (ps.com_col + 24 > adj_max_col)
adj_max_col = ps.com_col + 24;
Modified: head/usr.bin/indent/tests/comments.0
==============================================================================
--- head/usr.bin/indent/tests/comments.0 Sun Jul 23 19:54:54 2017 (r321395)
+++ head/usr.bin/indent/tests/comments.0 Sun Jul 23 20:25:53 2017 (r321396)
@@ -1,4 +1,11 @@
/* $FreeBSD$ */
+typedef enum x {
+ aaaaaaaaaaaaaaaaaaaaaa = 1 << 0, /* test a */
+ bbbbbbbbbbbbbbbbb = 1 << 1, /* test b */
+ cccccccccccccc = 1 << 1, /* test c */
+ dddddddddddddddddddddddddddddd = 1 << 2 /* test d */
+} x;
+
/* See r303597, r303598, r309219, and r309343 */
void t(void) {
/*
Modified: head/usr.bin/indent/tests/comments.0.stdout
==============================================================================
--- head/usr.bin/indent/tests/comments.0.stdout Sun Jul 23 19:54:54 2017 (r321395)
+++ head/usr.bin/indent/tests/comments.0.stdout Sun Jul 23 20:25:53 2017 (r321396)
@@ -1,4 +1,11 @@
/* $FreeBSD$ */
+typedef enum x {
+ aaaaaaaaaaaaaaaaaaaaaa = 1 << 0, /* test a */
+ bbbbbbbbbbbbbbbbb = 1 << 1, /* test b */
+ cccccccccccccc = 1 << 1, /* test c */
+ dddddddddddddddddddddddddddddd = 1 << 2 /* test d */
+} x;
+
/* See r303597, r303598, r309219, and r309343 */
void
t(void)
More information about the svn-src-head
mailing list