[coreboot-gerrit] Change in ...coreboot[master]: util/lint: Allow non-option carrying named choices

Patrick Georgi (Code Review) gerrit at coreboot.org
Fri Nov 23 15:58:25 CET 2018


Patrick Georgi has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/29813


Change subject: util/lint: Allow non-option carrying named choices
......................................................................

util/lint: Allow non-option carrying named choices

named choices can be overridden with a default later-on:

choice FOO
  config A
  config B
  config C
endchoice

...

if BOARD_FOO
choice FOO
  default A
endchoice
endif

Reflect that.

Change-Id: I6662e19685f6ab0b84c78b30aedc266c0e176039
Signed-off-by: Patrick Georgi <pgeorgi at google.com>
---
M util/lint/kconfig_lint
1 file changed, 6 insertions(+), 2 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/29813/1

diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint
index eddd8de..4b0a77a 100755
--- a/util/lint/kconfig_lint
+++ b/util/lint/kconfig_lint
@@ -539,6 +539,7 @@
     my $inside_config = "";    # set to symbol name of the config section
     my @inside_menu   = ();    # stack of menu names
     my $inside_choice = "";
+    my $choice_symbol = "";
     my $configs_inside_choice;
     my %fileinfo;
 
@@ -626,6 +627,7 @@
                 my $symbol = $1;
                 add_symbol( $symbol, \@inside_menu, $filename, $line_no, \@inside_if );
                 handle_type( "bool", $symbol, $filename, $line_no );
+		$choice_symbol = $symbol;
             }
             $inside_config         = "";
             $inside_choice         = "$filename $line_no";
@@ -642,10 +644,12 @@
             }
 
             $inside_choice = "";
-            if ( $configs_inside_choice == 0 ) {
-                show_error("choice block has no symbols at $filename:$line_no.");
+            if (( $configs_inside_choice == 0 ) &&
+	        ( $choice_symbol eq "" )) {
+                show_error("unnamed choice block has no symbols at $filename:$line_no.");
             }
             $configs_inside_choice = 0;
+	    $choice_symbol="";
         }
 
         # [optional]

-- 
To view, visit https://review.coreboot.org/c/coreboot/+/29813
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I6662e19685f6ab0b84c78b30aedc266c0e176039
Gerrit-Change-Number: 29813
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Georgi <pgeorgi at google.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181123/0c40d747/attachment.html>


More information about the coreboot-gerrit mailing list