aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rwxr-xr-xutil/lint/kconfig_lint22
1 files changed, 7 insertions, 15 deletions
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint
index 7fa0d8858b..4315768709 100755
--- a/util/lint/kconfig_lint
+++ b/util/lint/kconfig_lint
@@ -4,7 +4,7 @@
# This file is part of the coreboot project.
#
# Copyright (C) 2015 Martin L Roth <gaumless@gmail.com>
-# Copyright (C) 2015 Google, Inc.
+# Copyright (C) 2015-2016 Google, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,11 +38,10 @@ my $top_dir = "."; # Directory where Kconfig is run
my $root_dir = "src"; # Directory of the top level Kconfig file
my $errors_found = 0; # count of errors
my $warnings_found = 0;
-my $exclude_dirs =
- '--exclude-dir="build" --exclude-dir="coreboot-builds" '
- . '--exclude-dir="payloads" --exclude-dir="configs" '
- . '--exclude-dir="util"'; # directories to exclude when searching for used symbols - NOT USED FOR GIT GREP (TODO)
-my @exclude_files = ( '\.txt$', '\.tex$', 'config', '\.tags' ); #files to exclude when looking for symbols
+my $exclude_dirs_and_files =
+ '^build/\|^coreboot-builds/\|^payloads/libpayload\|^payloads/coreinfo\|^configs/\|^util/\|^\.git/'
+ . '\|' . # directories to exclude when searching for used symbols
+ '\.txt$\|\.tex$\|\.tags'; #files to exclude when looking for symbols
my $config_file = ""; # name of config file to load symbol values from.
my @wholeconfig; # document the entire kconfig structure
my %loaded_files; # list of each Kconfig file loaded
@@ -345,10 +344,10 @@ sub collect_used_symbols {
# find all references to CONFIG_ statements in the tree
if ($dont_use_git_grep) {
- @collected_symbols = `grep -Irn $exclude_dirs -- "CONFIG_"`;
+ @collected_symbols = `grep -Irn -- "CONFIG_" | grep -v '$exclude_dirs_and_files'`;
}
else {
- @collected_symbols = `git grep -In -- "CONFIG_"`;
+ @collected_symbols = `git grep -In -- "CONFIG_" | grep -v '$exclude_dirs_and_files'`;
}
my @used_symbols = @collected_symbols;
@@ -362,13 +361,6 @@ sub collect_used_symbols {
$filename = $1;
}
- my $skip = 0;
- foreach my $exfile (@exclude_files) {
- $skip = ( $filename =~ /$exfile/ );
- last if $skip;
- }
- last if $skip;
-
if ( exists $used_symbols{$symbol}{count} ) {
$used_symbols{$symbol}{count}++;
}