mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
UPSTREAM: 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.
BUG=none
BRANCH=none
TEST=none
Change-Id: I5d564165c3842bb64f16db1ee85d24d4bd2dfc52
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Original-Commit-Id: 811d93af39
Original-Change-Id: I46375738a18903b266ea9fff3102a1a91235e609
Original-Signed-off-by: Martin Roth <gaumless@gmail.com>
Original-Reviewed-on: https://review.coreboot.org/19155
Original-Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Original-Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: https://chromium-review.googlesource.com/528268
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
This commit is contained in:
parent
f5af05a552
commit
e76cd0eb9c
1 changed files with 8 additions and 2 deletions
|
@ -520,6 +520,7 @@ sub build_and_parse_kconfig_tree {
|
||||||
my $line_no = $parseline[0]{file_line_no};
|
my $line_no = $parseline[0]{file_line_no};
|
||||||
|
|
||||||
#handle help - help text: "help" or "---help---"
|
#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 );
|
$inside_help = handle_help( $line, $inside_help, $inside_config, $inside_choice, $filename, $line_no );
|
||||||
$parseline[0]{inside_help} = $inside_help;
|
$parseline[0]{inside_help} = $inside_help;
|
||||||
|
|
||||||
|
@ -535,7 +536,7 @@ sub build_and_parse_kconfig_tree {
|
||||||
}
|
}
|
||||||
|
|
||||||
#handle config
|
#handle config
|
||||||
elsif ( $line =~ /^\s*config/ ) {
|
elsif ( $line =~ /^\s*config\s+/ ) {
|
||||||
$line =~ /^\s*config\s+([^"\s]+)\s*(?>#.*)?$/;
|
$line =~ /^\s*config\s+([^"\s]+)\s*(?>#.*)?$/;
|
||||||
my $symbol = $1;
|
my $symbol = $1;
|
||||||
$inside_config = $symbol;
|
$inside_config = $symbol;
|
||||||
|
@ -710,7 +711,12 @@ sub build_and_parse_kconfig_tree {
|
||||||
# do nothing
|
# do nothing
|
||||||
}
|
}
|
||||||
else {
|
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] ) {
|
if ( defined $inside_menu[0] ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue