[U-Boot] Whitelist scripting

Adam Ford aford173 at gmail.com
Mon Mar 5 20:08:20 UTC 2018


I went through my boards to look for junk #defines in the header that
do nothing and/or are dead.
I then created a pretty poor script that runs through and scans the
whitelist and greps the code searching for C code that uses the
defines.

I started isolating sections and found that in some places we have C
code that does the check for a #define, but it never gets defined
anywhere, and in other places, we have #defines that aren't used.

What I was hoping to do was help clean the whitelist table by first
searching for #defines that are never used anywhere and/or are dead.I
will be the first person to admit that I am not very good with shell
scripts, so I thought I'd solicit a favor.

Does someone have any cool scripts that we can use the scan through
the and look for #defines that have no #ifdef, Makefile dependancy, or
linker script attachment?  These seem like they'd be obvious chunks of
code to eliminate.

Conversely, does anyone have any cool scripts that we can scan through
the code and look for #ifdefs that are never defined?  Those seem like
other low-hanging fruit but possible still useful.

As people are going through and using moveconfig to migrate to Kconfig
it seems like there might be a lot of work saved by eliminating a junk
from the whitelist.

adam


More information about the U-Boot mailing list