Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kbuild: detect missing include guard for exported headers

Adding an include guard to every header file is good practice in case
it is included multiple times.

Exported headers are compile-tested for the comprehensive sanity checks.
Let's include the same header twice. If an include guard is missing,
the header will fail to build due to redefinition of something.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

+2 -1
+2 -1
usr/include/Makefile
··· 93 93 94 94 extra-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/dev/null)) 95 95 96 + # Include the header to detect missing include guard. 96 97 quiet_cmd_hdrtest = HDRTEST $< 97 98 cmd_hdrtest = \ 98 99 $(CC) $(c_flags) -S -o /dev/null -x c /dev/null \ 99 - $(if $(filter-out $(header-test-), $*.h), -include $<); \ 100 + $(if $(filter-out $(header-test-), $*.h), -include $< -include $<); \ 100 101 $(PERL) $(srctree)/scripts/headers_check.pl $(obj) $(SRCARCH) $<; \ 101 102 touch $@ 102 103