summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2017-04-06 11:06:00 -0600
committerMartin Roth <martinroth@google.com>2017-06-07 23:13:38 +0200
commit811d93af39142b4e18073574db69bfe36af512b1 (patch)
tree47fcf8b9d2157e19e7897c858a9fbf5ff2cad65f
parenta18353d7b72e5b7094d25fe5a6c7497993716fcd (diff)
downloadcoreboot-811d93af39142b4e18073574db69bfe36af512b1.tar.xz
util/lint: Give better warning for help spacing issue
Because the help block uses significant whitespace to determine whether or not text is inside the help block, a mixture of spaces and tabs confuses the parser. If there's an unrecognized line, and the previous line was inside a help block, it's likely that this line is too. Additionally, this was found with a line that started ' configuration', and threw a perl warning about an uninitialized value because the parser thought this was the start of a new config line, but couldn't find the symbol. Now we make sure that config statements have whitespace after the 'config' statement. Change-Id: I46375738a18903b266ea9fff3102a1a91235e609 Signed-off-by: Martin Roth <gaumless@gmail.com> Reviewed-on: https://review.coreboot.org/19155 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
-rwxr-xr-xutil/lint/kconfig_lint10
1 files changed, 8 insertions, 2 deletions
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint
index a01c6f9d10..bf8f70a33e 100755
--- a/util/lint/kconfig_lint
+++ b/util/lint/kconfig_lint
@@ -520,6 +520,7 @@ sub build_and_parse_kconfig_tree {
my $line_no = $parseline[0]{file_line_no};
#handle help - help text: "help" or "---help---"
+ my $lastline_was_help = $inside_help;
$inside_help = handle_help( $line, $inside_help, $inside_config, $inside_choice, $filename, $line_no );
$parseline[0]{inside_help} = $inside_help;
@@ -535,7 +536,7 @@ sub build_and_parse_kconfig_tree {
}
#handle config
- elsif ( $line =~ /^\s*config/ ) {
+ elsif ( $line =~ /^\s*config\s+/ ) {
$line =~ /^\s*config\s+([^"\s]+)\s*(?>#.*)?$/;
my $symbol = $1;
$inside_config = $symbol;
@@ -710,7 +711,12 @@ sub build_and_parse_kconfig_tree {
# do nothing
}
else {
- show_error("$line ($filename:$line_no unrecognized)");
+ if ($lastline_was_help) {
+ show_error("The line \"$line\" ($filename:$line_no) wasn't recognized - supposed to be inside help?");
+ }
+ else {
+ show_error("The line \"$line\" ($filename:$line_no) wasn't recognized");
+ }
}
if ( defined $inside_menu[0] ) {