summaryrefslogtreecommitdiff
path: root/util/lint/kconfig_lint
AgeCommit message (Collapse)Author
2016-02-09kconfig_lint: demote 'always defined' errors to warningsMartin Roth
To be able to run this as a lint-stable test, demote these to warnings for now. After the current CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL issues get fixed, these can be promoted again. Change-Id: I1432980eb0c871fc61c12dcc351f8d46513a7965 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13541 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-02-09kconfig_lint: Check for IS_ENABLED used on symbols without CONFIG_Martin Roth
This looks at the coreboot codebase for the IS_ENABLED macro, and gives an error if there is a symbol used without the CONFIG_ prefix. This only works for symbols of type bool. A future check will be added for all symbols, but that will take a significant amount of time to run, because each symbol will need to be searched for individually. Change-Id: I92f2de2d231610d1a788da965f21966d89c2f25c Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13538 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: add comments and whitespace fixes.Martin Roth
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>
2016-01-30kconfig_lint: Skip temp files when looking for unused Kconfig files.Martin Roth
Don't warn on Kconfig.orig and Kconfig~ files when trying to verify that all the Kconfig files in the coreboot source tree are being loaded. Change-Id: Ie7babe60b29735e5ccc5f93f4e42ad82dfb47044 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13462 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: Update prompt structureMartin Roth
- The prompts were not getting incremented, so each prompt for a symbol would overwrite the previous. - Record the menu each prompt is in. Change-Id: Ia282a30344d5e135f4f2027be9aff0e49a4e5edb Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13461 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: Add warning if tristate type is used in corebootMartin Roth
Although there's no reason we COULDN'T use tristate types, we haven't up to this point. If there's a good reason to use them in the future, this check can be removed. Change-Id: I5f1903341f522bc957e394bc0fd288ba1adab431 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13460 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: merge 'git grep' and 'grep' exclude dir and filesMartin Roth
The code had originally been using standard grep to look through the coreboot tree for Kconfig symbols. When this was switched to git grep, the --exclude-dir options didn't work, and nothing was added to exclude the directories that shouldn't be searched for symbols. This resulted in invalid warnings as it searched directories that had Kconfig symbols for other projects. This merges the exclusion list for both the regular and git versions of grep for consistent behavior. Change-Id: I7fed8b9fa827cb14f7373e7b774acc56e43cb6ff Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13459 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: Don't look at IS_ENABLED() text in comments.Martin Roth
This fixes at least one kconfig_lint warning. Change-Id: I35edf57e90315a8372aaf3b41e923cd8dad7386a Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13458 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: Exclude some Kconfig symbols from unused symbol checksMartin Roth
The configuration that coreboot uses for setting selected symbols typically involves a structure like this: config BLEH_SPECIFIC_OPTIONS def_bool y select SYMBOL This leads to an an extra kconfig symbol BLEH_SPECIFIC_OPTIONS that is never referenced by anything else, generating a warning. Since this is currently the construct that coreboot uses, filter it out of the warnings for now. Change-Id: I85a95e4c4e8469870c7f219f2a92955819845573 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13457 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-30kconfig_lint: merge 'git grep' and 'grep' exclude dir and filesMartin Roth
The code had originally been using standard grep to look through the coreboot tree for Kconfig symbols. When this was switched to git grep, the --exclude-dir options didn't work, and nothing was added to exclude the directories that shouldn't be searched for symbols. This resulted in invalid warnings as it searched directories that had Kconfig symbols for other projects. This merges the exclusion list for both the regular and git versions of grep for consistent behavior. Change-Id: I69a1e0b30fecca152e02a511c82248b6091b3d8b Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/13456 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-18util/lint/kconfig_lint: Add 3 new checksMartin Roth
- Check that selected symbols are type bool - Check that selected symbols aren't created inside a choice - Check that symbols created inside a choice aren't created outside of a choice as well. Change-Id: I08963d637f8bdfb2413cfe831eafdc974d7674ab Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/12969 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2016-01-12util/lint/kconfig_lint: Run through perltidy to fix whitespaceMartin Roth
Change-Id: I7f04156fff0b65ea262b12961ce76ef329d358ab Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/12902 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2015-12-02kconfig_lint: Fix check_is_enabled for 2 symbols on the same lineMartin Roth
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@google.com> Reviewed-on: https://review.coreboot.org/12562 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-12-02kconfig_lint: Change from '$file at line $line' to $file:$lineMartin Roth
Combine the file and line number into a combination that editors understand when opening files. This makes it easier to edit the errors. Change-Id: Id2fae6a0a2ca8d726b95e252d80ac918f4edbe23 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/12561 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-12-02kconfig_lint: Separate errors from warningsMartin Roth
- Create subroutines for printing warnings and errors - Change all the existing warning and error routines to use subroutines - Add new command line options to suppress errors and to print notes Change-Id: I04893faffca21c5bb7b51be920cca4620dc283c3 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/12555 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-10-31tree: drop last paragraph of GPL copyright headerPatrick Georgi
It encourages users from writing to the FSF without giving an address. Linux also prefers to drop that and their checkpatch.pl (that we imported) looks out for that. This is the result of util/scripts/no-fsf-addresses.sh with no further editing. Change-Id: Ie96faea295fe001911d77dbc51e9a6789558fbd6 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: http://review.coreboot.org/11888 Tested-by: build bot (Jenkins) Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2015-10-29lint: Add Kconfig / Kconfig symbol lint toolMartin Roth
This is a tool to help identify issues in coreboot's Kconfig structure and in how the Kconfig symbols are used in the coreboot codebase. It identifies a number of issues: - #ifdef used on Kconfig symbol of type bool, hex, or int. These are always defined. - #define CONFIG_ in the coreboot code - these should be reserved for Kconfig symbols. - Redefinition of Kconfig symbols in the code. - Use of IS_ENABLED() on non-bool kconfig symbols. - Use of IS_ENABLED() on values that are not kconfig symbols. - Attempts to find default values that will not set anything because of earlier default settings. This needs to be expanded significantly. - Kconfig expressions using symbols which are not defined. - Kconfig symbols that are defined but not used anywhere in the Kconfig structure or coreboot code. - Kconfig keywords used incorrectly. - Whitespace issues - Kconfig 'source' keyword issues -- sourcing non-existant directories -- sourcing Kconfig files multiple times -- sourcing non-existent files -- Kconfig files in the codebase that are never sourced Additionally, it can be used to help debug the Kconfig tree by putting all the files together into a single file with their source locations listed. Run from the coreboot directory: util/lint/kconfig_lint Change-Id: Ia53b366461698d949f17502e99265c1f3f3b1443 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: http://review.coreboot.org/12088 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>