Nico Huber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/58397 )
Change subject: kconfig_lint: Fix rule for duplicate options in choice blocks ......................................................................
kconfig_lint: Fix rule for duplicate options in choice blocks
It's actually ok to have the same option multiple times (e.g. with different prompts) in a choice block. However, the linter missed this case when checking if an option was already declared inside another choice block. Fix that.
Change-Id: I57733ecae20558ccebe6ac800812c755ff7cb1a8 Signed-off-by: Nico Huber nico.h@gmx.de --- M util/lint/kconfig_lint 1 file changed, 6 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/97/58397/1
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint index 76dd787..da31c82 100755 --- a/util/lint/kconfig_lint +++ b/util/lint/kconfig_lint @@ -799,6 +799,10 @@ my ( $symbol, $menu_array_ref, $filename, $line_no, $ifref, $inside_choice ) = @_; my @inside_if = @{$ifref};
+ if ($inside_choice) { + $inside_choice = join(':', (split / /, $inside_choice)); + } + #initialize the symbol or increment the use count. if ( ( !exists $symbols{$symbol} ) || ( !exists $symbols{$symbol}{count} ) ) { $symbols{$symbol}{count} = 0; @@ -806,7 +810,7 @@ $symbols{$symbol}{choice} = 1;
# remember the location of the choice - $symbols{$symbol}{choice_loc} = join(':', (split / /, $inside_choice)); + $symbols{$symbol}{choice_loc} = $inside_choice; } else { $symbols{$symbol}{choice} = 0; @@ -814,7 +818,7 @@ } else { $symbols{$symbol}{count}++; - if ( $inside_choice && $symbols{$symbol}{choice} ) { + if ( $inside_choice && $inside_choice ne $symbols{$symbol}{choice_loc} ) { show_error( "$symbol entry at $filename:$line_no has already been created inside another choice block " . "at $symbols{$symbol}{0}{file}:$symbols{$symbol}{0}{line_no}." ); }