From 967730f5656e433094d97e65ce6927734d7112c7 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sat, 17 Jul 2021 11:43:44 +0200 Subject: [PATCH] kconfig_lint: Drop overly restrictive rule about choice configs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This rule was creating trouble: * A symbol may only be declared inside or outside a choice. The linter treats every occurence of a `config` entry as a symbol declaration, even when it's just setting a default or adding selects. This is not easy to fix as the symbol objects are not created first and then added to the $symbols array when we know what kind of decla- ration we have, but are created incrementally inside this global list. Change-Id: I48a17f6403470251be6b6d44bb82a8bdcbefe9f6 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/coreboot/+/56410 Reviewed-by: Michael Niewöhner Reviewed-by: Angel Pons Reviewed-by: Martin Roth Tested-by: build bot (Jenkins) --- util/lint/kconfig_lint | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint index 7f26ef298f..76dd78764c 100755 --- a/util/lint/kconfig_lint +++ b/util/lint/kconfig_lint @@ -814,16 +814,7 @@ sub add_symbol { } else { $symbols{$symbol}{count}++; - - if ( $inside_choice && !$symbols{$symbol}{choice} ) { - show_error( "$symbol entry at $filename:$line_no has already been created inside a choice block " - . "at $symbols{$symbol}{0}{file}:$symbols{$symbol}{0}{line_no}." ); - } - elsif ( !$inside_choice && $symbols{$symbol}{choice} ) { - show_error( "$symbol entry at $filename:$line_no has already been created outside a choice block " - . "at $symbols{$symbol}{0}{file}:$symbols{$symbol}{0}{line_no}." ); - } - elsif ( $inside_choice && $symbols{$symbol}{choice} ) { + if ( $inside_choice && $symbols{$symbol}{choice} ) { 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}." ); }