[coreboot-gerrit] New patch to review for coreboot: kconfig_line: Fix check_is_enabled for 2 symbols on the same line

Martin Roth (martinroth@google.com) gerrit at coreboot.org
Sat Nov 28 02:52:37 CET 2015


Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12562

-gerrit

commit 372e46c4c4a838252c79e98bf7ed9aa973e6618f
Author: Martin Roth <martinroth at google.com>
Date:   Fri Nov 27 18:51:19 2015 -0700

    kconfig_line: Fix check_is_enabled for 2 symbols on the same line
    
    The previous code would miss the first of two IS_ENABLED(CONFIG_symbol)
    sequences on a line.  This patch saves the rest of the line and loops
    to check any other entries on the same line of text.
    
    Change-Id: If4e66d5b393cc5703a502887e18f0ac11adff012
    Signed-off-by: Martin Roth <martinroth at google.com>
---
 util/lint/kconfig_lint | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint
index 9bad31e..c99a4c9 100755
--- a/util/lint/kconfig_lint
+++ b/util/lint/kconfig_lint
@@ -191,25 +191,31 @@ sub check_for_def {
 # this seems like a bad plan.  Using it on strings is dead out.
 #-------------------------------------------------------------------------------
 sub check_is_enabled {
-    my @is_enabled_symbols = `grep -Grn 'IS_ENABLED\\s*(\\s*CONFIG_' -- "$root_dir"`;
+    my @is_enabled_symbols = @collected_symbols;
 
     #sort through symbols found by grep and store them in a hash for easy access
     while ( my $line = shift @is_enabled_symbols ) {
-        if ( $line =~ /^([^:]+):(\d+):.+IS_ENABLED\s*\(\s*CONFIG_(\w+)/ ) {
+        if ( $line =~ /^([^:]+):(\d+):(.+IS_ENABLED.*)/ ) {
             my $file = $1;
             my $lineno = $2;
-            my $symbol = $3;
-
-            #make sure that
-            if (exists $symbols{$symbol}) {
-                if ($symbols{$symbol}{type} ne "bool") {
-                    show_error("IS_ENABLED(CONFIG_$symbol) used in $file at line $lineno.  IS_ENABLED is only valid for type 'bool', not '$symbols{$symbol}{type}'.");
-                }
-            } else {
-                show_error("IS_ENABLED() used on unknown value CONFIG_$symbol in $file at line $lineno.");
+            $line = $3;
+             if ( $line !~ /(.*)IS_ENABLED\s*\(\s*CONFIG_(\w+)(.*)/ ){
+                show_warning("# uninterpreted IS_ENABLED at $file:$lineno: $line");
+                next;
             }
-        } else {
-            show_error("# uninterpreted IS_ENABLED line: $line");
+            while ( $line =~ /(.*)IS_ENABLED\s*\(\s*CONFIG_(\w+)(.*)/ ) {
+                my $symbol = $2;
+                $line = $1.$3;
+
+                #make sure that
+                if (exists $symbols{$symbol}) {
+                    if ($symbols{$symbol}{type} ne "bool") {
+                        show_error("IS_ENABLED(CONFIG_$symbol) used at $file:$lineno.  IS_ENABLED is only valid for type 'bool', not '$symbols{$symbol}{type}'.");
+                    }
+                } else {
+                    show_error("IS_ENABLED() used on unknown value CONFIG_$symbol at $file:$lineno.");
+                }
+            } 
         }
     }
 }



More information about the coreboot-gerrit mailing list