This patch definitely indicates the correct position for misaligned
stuff.
Signed-off-by: Shi Lei <shi_lei(a)massclouds.com>
---
build-aux/check-spacing.pl | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/build-aux/check-spacing.pl b/build-aux/check-spacing.pl
index 64a5dac..478e7ab 100755
--- a/build-aux/check-spacing.pl
+++ b/build-aux/check-spacing.pl
@@ -277,11 +277,22 @@ sub CheckMisalignment {
my $code = $$paren_stack[-1][2];
if ($pos != length($`)) {
my $pad = "";
+ my $indicator = "";
if ($. > $linenum + 1) {
$pad = " " x $pos . "...\n";
}
print "Misaligned line in parenthesis:\n";
- print "$$file:$linenum-$.:\n$code$pad$$line\n";
+ print "$$file:$linenum-$.:\n$code$pad$$line";
+ if ($pos > length($`)) {
+ $indicator = " " x length($`);
+ $indicator .= "~" x ($pos - length($`));
+ $indicator .= "^";
+ } else {
+ $indicator = " " x $pos;
+ $indicator .= "^";
+ $indicator .= "~" x (length($`) - $pos);
+ }
+ print "$indicator\n";
$ret = 1;
}
}
--
2.17.1