coreboot: Add support for include-what-you-use
The tool "include-what-you-use" analyzes each file's headers and makes recommendations for header files to add and remove. There are additional scripts as part of the package that will make these changes directly based on the recommendations, but due to the way coreboot compiles code in/out base on Kconfig options, this isn't really safe for the project to use. It is a good starting point though. To use, set the IWYU kconfig option, then build with the command: make -k Because this doesn't actually build any files, the -k option is needed or make will stop after looking at the first file. Signed-off-by: Martin Roth <martin.roth@amd.corp-partner.google.com> Change-Id: I084813f21a3c26cac1e4e134bf8a83eb8637ff63 Reviewed-on: https://review.coreboot.org/c/coreboot/+/67915 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
parent
21dc639f99
commit
461c33b226
|
@ -114,6 +114,12 @@ config CCACHE
|
||||||
|
|
||||||
For details see https://ccache.samba.org.
|
For details see https://ccache.samba.org.
|
||||||
|
|
||||||
|
config IWYU
|
||||||
|
bool "Test platform with include-what-you-use"
|
||||||
|
help
|
||||||
|
This runs each source file through the include-what-you-use tool
|
||||||
|
to check the header includes.
|
||||||
|
|
||||||
config FMD_GENPARSER
|
config FMD_GENPARSER
|
||||||
bool "Generate flashmap descriptor parser using flex and bison"
|
bool "Generate flashmap descriptor parser using flex and bison"
|
||||||
default n
|
default n
|
||||||
|
|
|
@ -32,6 +32,21 @@ HOSTCC:=CCC_CC="$(HOSTCC)" $(CC)
|
||||||
HOSTCXX:=CCC_CXX="$(HOSTCXX)" $(CXX)
|
HOSTCXX:=CCC_CXX="$(HOSTCXX)" $(CXX)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# include-what-you-use integration
|
||||||
|
ifeq ($(CONFIG_IWYU),y)
|
||||||
|
|
||||||
|
IWYU:=$(word 1,$(wildcard $(addsuffix /iwyu,$(subst :, ,$(PATH)))))
|
||||||
|
ifeq ($(IWYU),)
|
||||||
|
$(error include-what-you-use selected, but not found in PATH)
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(foreach arch,$(ARCH_SUPPORTED), \
|
||||||
|
$(eval CC_$(arch):=$(IWYU) ))
|
||||||
|
|
||||||
|
CFLAGS_common := -Xiwyu --prefix_header_includes=remove -Xiwyu --no_comments -Xiwyu --no_fwd_decls $(CFLAGS_common)
|
||||||
|
NOCOMPILE := 1
|
||||||
|
endif
|
||||||
|
|
||||||
COREBOOT_STANDARD_STAGES := decompressor bootblock verstage romstage ramstage
|
COREBOOT_STANDARD_STAGES := decompressor bootblock verstage romstage ramstage
|
||||||
MAP-decompressor := bootblock
|
MAP-decompressor := bootblock
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue