Martin Roth has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/48905 )
Change subject: util/lint/kconfig_lint: Add 'osource' keyword ......................................................................
util/lint/kconfig_lint: Add 'osource' keyword
The 'osource' kconfig keyword is for sourcing files that may or may not exist. To this point, Kconfig just ignored sourced files that weren't present. This will be changed in the future, and any files that don't exist will give an error.
Signed-off-by: Martin Roth martin@coreboot.org Change-Id: I7921801760fab409889951d9464e79f69ea49edf --- M util/lint/kconfig_lint 1 file changed, 15 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/05/48905/1
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint index 2341976..ecc8e7c 100755 --- a/util/lint/kconfig_lint +++ b/util/lint/kconfig_lint @@ -336,7 +336,7 @@ . " A 'bool' Kconfig should always be accessed through CONFIG($symbol)." ); } } else { - show_warning( "Unknown config option CONFIG_$symbol used at $file:$lineno." ); + show_warning( "Unknown config symbol CONFIG_$symbol used at $file:$lineno." ); } } } @@ -522,7 +522,7 @@ my %fileinfo;
#start the tree off by loading the top level kconfig - @config_to_parse = load_kconfig_file( $top_level_kconfig, "", 0, 0, "", 0 ); + @config_to_parse = load_kconfig_file( $top_level_kconfig, "", 0, 0, "", 0, 0 );
while ( ( @parseline = shift(@config_to_parse) ) && ( exists $parseline[0]{text} ) ) { my $line = $parseline[0]{text}; @@ -717,9 +717,14 @@ } }
- # source <prompt> + # osource and source <prompt> + elsif ( $line =~ /^\s*osource\s+"?([^"\s]+)"?\s*(?>#.*)?$/ ) { + my @newfile = load_kconfig_file( $1, $filename, $line_no, 0, $filename, $line_no, 1 ); + unshift( @config_to_parse, @newfile ); + $parseline[0]{text} = "# '$line'\n"; + } elsif ( $line =~ /^\s*source\s+"?([^"\s]+)"?\s*(?>#.*)?$/ ) { - my @newfile = load_kconfig_file( $1, $filename, $line_no, 0, $filename, $line_no ); + my @newfile = load_kconfig_file( $1, $filename, $line_no, 0, $filename, $line_no, 0 ); unshift( @config_to_parse, @newfile ); $parseline[0]{text} = "# '$line'\n"; } @@ -1199,7 +1204,7 @@ # load_kconfig_file - Loads a single Kconfig file or expands * wildcard #------------------------------------------------------------------------------- sub load_kconfig_file { - my ( $input_file, $loadfile, $loadline, $expanded, $topfile, $topline ) = @_; + my ( $input_file, $loadfile, $loadline, $expanded, $topfile, $topline, $optional ) = @_; my @file_data; my @dir_file_data;
@@ -1222,14 +1227,16 @@ && ( $directory =~ /\Q$dir_glob_prefix\E.*\Q$dir_glob_suffix\E/ ) ) { push @dir_file_data, load_kconfig_file( "$dir_prefix/$directory/$dir_suffix", - $input_file, $loadline, 1, $loadfile, $loadline ); + $input_file, $loadline, 1, $loadfile, $loadline, $optional ); } } }
#the directory should exist when using a glob else { - show_error("Could not find dir '$dir_prefix'"); + if ($optional == 0) { + show_error("Could not find dir '$dir_prefix'"); + } } }
@@ -1249,7 +1256,7 @@ }
# if the file isn't being loaded from a glob, it should exist. - elsif ( $expanded == 0 ) { + elsif ( $expanded == 0 && $optional == 0) { show_warning("Could not find file '$input_file' sourced at $loadfile:$loadline"); }
Jack Rosenthal has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48905 )
Change subject: util/lint/kconfig_lint: Add 'osource' keyword ......................................................................
Patch Set 1: Code-Review+1
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48905 )
Change subject: util/lint/kconfig_lint: Add 'osource' keyword ......................................................................
Patch Set 1: Code-Review+1
Attention is currently required from: Martin Roth. Stefan Reinauer has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48905 )
Change subject: util/lint/kconfig_lint: Add 'osource' keyword ......................................................................
Patch Set 1: Code-Review+2
Attention is currently required from: Martin Roth. Stefan Reinauer has removed Stefan Reinauer from this change. ( https://review.coreboot.org/c/coreboot/+/48905 )
Change subject: util/lint/kconfig_lint: Add 'osource' keyword ......................................................................
Removed reviewer Stefan Reinauer.
Martin Roth has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/48905 )
Change subject: util/lint/kconfig_lint: Add 'osource' keyword ......................................................................
Abandoned
meh