kconfig_lint: use just one variable for keeping track of choices

Instead of using two variables, one for the boolean value and one for
the path, use just one with the path. Since an empty string evalutes to
false, this simplification does not change behaviour.

Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Change-Id: I2f1171789af6815094446f107f3c634332a3427e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58401
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Michael Niewöhner 2021-10-17 17:48:50 +02:00 committed by Felix Held
parent 70fb5cb514
commit 4396358fd3
1 changed files with 3 additions and 10 deletions

View File

@ -374,7 +374,7 @@ sub check_defaults {
# Symbols created/used inside a choice must not have a default set. The default is set by the choice itself. # Symbols created/used inside a choice must not have a default set. The default is set by the choice itself.
if ($symbols{$sym}{choice}) { if ($symbols{$sym}{choice}) {
show_error("Defining a default for symbol '$sym' at $filename:$line_no, used inside choice at " show_error("Defining a default for symbol '$sym' at $filename:$line_no, used inside choice at "
. "$symbols{$sym}{choice_loc}, is not allowed."); . "$symbols{$sym}{choice}, is not allowed.");
} }
# skip good defaults # skip good defaults
@ -802,15 +802,8 @@ sub add_symbol {
#initialize the symbol or increment the use count. #initialize the symbol or increment the use count.
if ( ( !exists $symbols{$symbol} ) || ( !exists $symbols{$symbol}{count} ) ) { if ( ( !exists $symbols{$symbol} ) || ( !exists $symbols{$symbol}{count} ) ) {
$symbols{$symbol}{count} = 0; $symbols{$symbol}{count} = 0;
if ($inside_choice) { # remember the location of the choice (or "")
$symbols{$symbol}{choice} = 1; $symbols{$symbol}{choice} = $inside_choice;
# remember the location of the choice
$symbols{$symbol}{choice_loc} = $inside_choice;
}
else {
$symbols{$symbol}{choice} = 0;
}
} }
else { else {
$symbols{$symbol}{count}++; $symbols{$symbol}{count}++;