1d6fc9fcbSMasahiro Yamada# SPDX-License-Identifier: GPL-2.0-only 2d6fc9fcbSMasahiro Yamada 3d6fc9fcbSMasahiro Yamada# Unlike the kernel space, exported headers are written in standard C. 4d6fc9fcbSMasahiro Yamada# - Forbid C++ style comments 5d6fc9fcbSMasahiro Yamada# - Use '__inline__', '__asm__' instead of 'inline', 'asm' 6d6fc9fcbSMasahiro Yamada# 7d6fc9fcbSMasahiro Yamada# -std=c90 (equivalent to -ansi) catches the violation of those. 8d6fc9fcbSMasahiro Yamada# We cannot go as far as adding -Wpedantic since it emits too many warnings. 9d6fc9fcbSMasahiro YamadaUAPI_CFLAGS := -std=c90 -Wall -Werror=implicit-function-declaration 10d6fc9fcbSMasahiro Yamada 11d6fc9fcbSMasahiro Yamadaoverride c_flags = $(UAPI_CFLAGS) -Wp,-MD,$(depfile) -I$(objtree)/usr/include 12d6fc9fcbSMasahiro Yamada 13d6fc9fcbSMasahiro Yamada# The following are excluded for now because they fail to build. 14d6fc9fcbSMasahiro Yamada# 15d6fc9fcbSMasahiro Yamada# Do not add a new header to the blacklist without legitimate reason. 16d6fc9fcbSMasahiro Yamada# Please consider to fix the header first. 17d6fc9fcbSMasahiro Yamada# 18d6fc9fcbSMasahiro Yamada# Sorted alphabetically. 19*0186b126SMasahiro Yamadano-header-test += asm/shmbuf.h 20*0186b126SMasahiro Yamadano-header-test += asm/signal.h 21*0186b126SMasahiro Yamadano-header-test += asm/ucontext.h 22*0186b126SMasahiro Yamadano-header-test += drm/vmwgfx_drm.h 23*0186b126SMasahiro Yamadano-header-test += linux/am437x-vpfe.h 24*0186b126SMasahiro Yamadano-header-test += linux/android/binder.h 25*0186b126SMasahiro Yamadano-header-test += linux/android/binderfs.h 26*0186b126SMasahiro Yamadano-header-test += linux/coda.h 27*0186b126SMasahiro Yamadano-header-test += linux/elfcore.h 28*0186b126SMasahiro Yamadano-header-test += linux/errqueue.h 29*0186b126SMasahiro Yamadano-header-test += linux/fsmap.h 30*0186b126SMasahiro Yamadano-header-test += linux/hdlc/ioctl.h 31*0186b126SMasahiro Yamadano-header-test += linux/ivtv.h 32*0186b126SMasahiro Yamadano-header-test += linux/kexec.h 33*0186b126SMasahiro Yamadano-header-test += linux/matroxfb.h 34*0186b126SMasahiro Yamadano-header-test += linux/nfc.h 35*0186b126SMasahiro Yamadano-header-test += linux/omap3isp.h 36*0186b126SMasahiro Yamadano-header-test += linux/omapfb.h 37*0186b126SMasahiro Yamadano-header-test += linux/patchkey.h 38*0186b126SMasahiro Yamadano-header-test += linux/phonet.h 39*0186b126SMasahiro Yamadano-header-test += linux/reiserfs_xattr.h 40*0186b126SMasahiro Yamadano-header-test += linux/sctp.h 41*0186b126SMasahiro Yamadano-header-test += linux/signal.h 42*0186b126SMasahiro Yamadano-header-test += linux/sysctl.h 43*0186b126SMasahiro Yamadano-header-test += linux/usb/audio.h 44*0186b126SMasahiro Yamadano-header-test += linux/v4l2-mediabus.h 45*0186b126SMasahiro Yamadano-header-test += linux/v4l2-subdev.h 46*0186b126SMasahiro Yamadano-header-test += linux/videodev2.h 47*0186b126SMasahiro Yamadano-header-test += linux/vm_sockets.h 48*0186b126SMasahiro Yamadano-header-test += sound/asequencer.h 49*0186b126SMasahiro Yamadano-header-test += sound/asoc.h 50*0186b126SMasahiro Yamadano-header-test += sound/asound.h 51*0186b126SMasahiro Yamadano-header-test += sound/compress_offload.h 52*0186b126SMasahiro Yamadano-header-test += sound/emu10k1.h 53*0186b126SMasahiro Yamadano-header-test += sound/sfnt_info.h 54*0186b126SMasahiro Yamadano-header-test += xen/evtchn.h 55*0186b126SMasahiro Yamadano-header-test += xen/gntdev.h 56*0186b126SMasahiro Yamadano-header-test += xen/privcmd.h 57d6fc9fcbSMasahiro Yamada 58d6fc9fcbSMasahiro Yamada# More headers are broken in some architectures 59d6fc9fcbSMasahiro Yamada 60d6fc9fcbSMasahiro Yamadaifeq ($(SRCARCH),arc) 61*0186b126SMasahiro Yamadano-header-test += linux/bpf_perf_event.h 62d6fc9fcbSMasahiro Yamadaendif 63d6fc9fcbSMasahiro Yamada 64d6fc9fcbSMasahiro Yamadaifeq ($(SRCARCH),ia64) 65*0186b126SMasahiro Yamadano-header-test += asm/setup.h 66*0186b126SMasahiro Yamadano-header-test += asm/sigcontext.h 67*0186b126SMasahiro Yamadano-header-test += asm/perfmon.h 68*0186b126SMasahiro Yamadano-header-test += asm/perfmon_default_smpl.h 69*0186b126SMasahiro Yamadano-header-test += linux/if_bonding.h 70d6fc9fcbSMasahiro Yamadaendif 71d6fc9fcbSMasahiro Yamada 72d6fc9fcbSMasahiro Yamadaifeq ($(SRCARCH),mips) 73*0186b126SMasahiro Yamadano-header-test += asm/stat.h 74d6fc9fcbSMasahiro Yamadaendif 75d6fc9fcbSMasahiro Yamada 76d6fc9fcbSMasahiro Yamadaifeq ($(SRCARCH),powerpc) 77*0186b126SMasahiro Yamadano-header-test += asm/stat.h 78*0186b126SMasahiro Yamadano-header-test += linux/bpf_perf_event.h 79d6fc9fcbSMasahiro Yamadaendif 80d6fc9fcbSMasahiro Yamada 81d6fc9fcbSMasahiro Yamadaifeq ($(SRCARCH),riscv) 82*0186b126SMasahiro Yamadano-header-test += linux/bpf_perf_event.h 83d6fc9fcbSMasahiro Yamadaendif 84d6fc9fcbSMasahiro Yamada 85d6fc9fcbSMasahiro Yamadaifeq ($(SRCARCH),sparc) 86*0186b126SMasahiro Yamadano-header-test += asm/stat.h 87*0186b126SMasahiro Yamadano-header-test += asm/uctx.h 88*0186b126SMasahiro Yamadano-header-test += asm/fbio.h 89d6fc9fcbSMasahiro Yamadaendif 90d6fc9fcbSMasahiro Yamada 91d6fc9fcbSMasahiro Yamada# asm-generic/*.h is used by asm/*.h, and should not be included directly 92*0186b126SMasahiro Yamadano-header-test += asm-generic/% 93d6fc9fcbSMasahiro Yamada 94cf6b58abSMasahiro Yamadaextra-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/dev/null)) 95fcbb8461SMasahiro Yamada 9655119786SMasahiro Yamada# Include the header to detect missing include guard. 97fcbb8461SMasahiro Yamadaquiet_cmd_hdrtest = HDRTEST $< 987ecaf069SMasahiro Yamada cmd_hdrtest = \ 997ecaf069SMasahiro Yamada $(CC) $(c_flags) -S -o /dev/null -x c /dev/null \ 100*0186b126SMasahiro Yamada $(if $(filter-out $(no-header-test), $*.h), -include $< -include $<); \ 1017ecaf069SMasahiro Yamada $(PERL) $(srctree)/scripts/headers_check.pl $(obj) $(SRCARCH) $<; \ 1027ecaf069SMasahiro Yamada touch $@ 103fcbb8461SMasahiro Yamada 104fcbb8461SMasahiro Yamada$(obj)/%.hdrtest: $(obj)/%.h FORCE 105fcbb8461SMasahiro Yamada $(call if_changed_dep,hdrtest) 106d6fc9fcbSMasahiro Yamada 1071634f2bfSMasahiro Yamadaclean-files += $(filter-out Makefile, $(notdir $(wildcard $(obj)/*))) 108