mirror of
https://github.com/torvalds/linux
synced 2024-10-08 12:22:38 +00:00
0dae776c6b
Add a very simple plugin to demonstrate the GCC plugin infrastructure. This GCC plugin computes the cyclomatic complexity of each function. The complexity M of a function's control flow graph is defined as: M = E - N + 2P where E = the number of edges N = the number of nodes P = the number of connected components (exit nodes). Signed-off-by: Emese Revfy <re.emese@gmail.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Michal Marek <mmarek@suse.com>
22 lines
665 B
Makefile
22 lines
665 B
Makefile
GCC_PLUGINS_DIR := $(shell $(CC) -print-file-name=plugin)
|
|
|
|
ifeq ($(PLUGINCC),$(HOSTCC))
|
|
HOSTLIBS := hostlibs
|
|
HOST_EXTRACFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu99 -ggdb
|
|
export HOST_EXTRACFLAGS
|
|
else
|
|
HOSTLIBS := hostcxxlibs
|
|
HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti
|
|
HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb
|
|
HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable
|
|
export HOST_EXTRACXXFLAGS
|
|
endif
|
|
|
|
export GCCPLUGINS_DIR HOSTLIBS
|
|
|
|
$(HOSTLIBS)-y := $(GCC_PLUGIN)
|
|
always := $($(HOSTLIBS)-y)
|
|
|
|
cyc_complexity_plugin-objs := cyc_complexity_plugin.o
|
|
clean-files += *.so
|