kconfig_lint: add comments and whitespace fixes.

No functional changes.

Change-Id: I40284b68ddda7e19741c5306a8c74761c00e4b35
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/13463
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Martin Roth 2016-01-25 19:54:16 -07:00
parent ab2d777360
commit 08cf90f860
1 changed files with 15 additions and 12 deletions

View File

@ -419,7 +419,6 @@ sub build_and_parse_kconfig_tree {
#start the tree off by loading the top level kconfig #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 );
while ( ( @parseline = shift(@config_to_parse) ) && ( exists $parseline[0]{text} ) ) { while ( ( @parseline = shift(@config_to_parse) ) && ( exists $parseline[0]{text} ) ) {
my $line = $parseline[0]{text}; my $line = $parseline[0]{text};
my $filename = $parseline[0]{filename}; my $filename = $parseline[0]{filename};
@ -504,6 +503,8 @@ sub build_and_parse_kconfig_tree {
$inside_config = ""; $inside_config = "";
$inside_choice = "$filename $line_no"; $inside_choice = "$filename $line_no";
$configs_inside_choice = 0; $configs_inside_choice = 0;
# Kconfig verifies that choice blocks have a prompt
} }
# endchoice # endchoice
@ -535,6 +536,10 @@ sub build_and_parse_kconfig_tree {
# mainmenu <prompt> # mainmenu <prompt>
elsif ( $line =~ /^\s*mainmenu/ ) { elsif ( $line =~ /^\s*mainmenu/ ) {
$inside_config = ""; $inside_config = "";
# Kconfig alread checks for multiple 'mainmenu' entries and mainmenu entries with no prompt
# Possible check: look for 'mainmenu ""'
# Possible check: verify that a mainmenu has been specified
} }
# menu <prompt> # menu <prompt>
@ -564,7 +569,6 @@ sub build_and_parse_kconfig_tree {
my $expr = $1; my $expr = $1;
push( @inside_if, $expr ); push( @inside_if, $expr );
handle_expressions( $expr, $inside_config, $filename, $line_no ); handle_expressions( $expr, $inside_config, $filename, $line_no );
} }
# endif # endif
@ -679,7 +683,6 @@ sub add_symbol {
} }
} }
# add the location of this instance # add the location of this instance
my $symcount = $symbols{$symbol}{count}; my $symcount = $symbols{$symbol}{count};
$symbols{$symbol}{$symcount}{file} = $filename; $symbols{$symbol}{$symcount}{file} = $filename;
@ -987,6 +990,7 @@ sub handle_prompt {
$prompt = $1; $prompt = $1;
} }
#display an error if there's a prompt at the top menu level
if ( !defined @$menu_array_ref[0] ) { if ( !defined @$menu_array_ref[0] ) {
show_error( "Symbol '$inside_config' with prompt '$prompt' appears outside of a menu" show_error( "Symbol '$inside_config' with prompt '$prompt' appears outside of a menu"
. " at $filename:$line_no." ); . " at $filename:$line_no." );
@ -1145,7 +1149,6 @@ sub load_kconfig_file {
return @dir_file_data; return @dir_file_data;
} }
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# print_wholeconfig - prints out the parsed Kconfig file # print_wholeconfig - prints out the parsed Kconfig file
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------