mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-19 17:14:40 +08:00
c93a0368aa
header-test-y does not work with headers in sub-directories.
For example, you may want to write a Makefile, like this:
include/linux/Kbuild:
header-test-y += mtd/nand.h
This entry will create a wrapper include/linux/mtd/nand.hdrtest.c
with the following content:
#include "mtd/nand.h"
To make this work, we need to add $(srctree)/include/linux to the
header search path. It would be tedious to add ccflags-y.
Instead, we could change the *.hdrtest.c rule to wrap:
#include "nand.h"
This works for in-tree build since #include "..." searches in the
relative path from the header with this directive. For O=... build,
we need to add $(srctree)/include/linux/mtd to the header search path,
which will be even more tedious.
After all, I thought it would be handier to compile headers directly
without creating wrappers.
I added a new build rule to compile %.h into %.h.s
The target is %.h.s instead of %.h.o because it is slightly faster.
Also, as for GCC, an empty assembly is smaller than an empty object.
I wrote the build rule:
$(CC) $(c_flags) -S -o $@ -x c /dev/null -include $<
instead of:
$(CC) $(c_flags) -S -o $@ -x c $<
Both work fine with GCC, but the latter is bad for Clang.
This comes down to the difference in the -Wunused-function policy.
GCC does not warn about unused 'static inline' functions at all.
Clang does not warn about the ones in included headers, but does
about the ones in the source. So, we should handle headers as
headers, not as source files.
In fact, this has been hidden since commit abb2ea7dfd
("compiler,
clang: suppress warning for unused static inline functions"), but we
should not rely on that.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Tested-by: Jani Nikula <jani.nikula@intel.com>
144 lines
1.6 KiB
Plaintext
144 lines
1.6 KiB
Plaintext
#
|
|
# NOTE! Don't add files that are generated in specific
|
|
# subdirectories here. Add them in the ".gitignore" file
|
|
# in that subdirectory instead.
|
|
#
|
|
# NOTE! Please use 'git ls-files -i --exclude-standard'
|
|
# command after changing this file, to see if there are
|
|
# any tracked files which get ignored after the change.
|
|
#
|
|
# Normal rules (sorted alphabetically)
|
|
#
|
|
.*
|
|
*.a
|
|
*.asn1.[ch]
|
|
*.bin
|
|
*.bz2
|
|
*.c.[012]*.*
|
|
*.dt.yaml
|
|
*.dtb
|
|
*.dtb.S
|
|
*.dwo
|
|
*.elf
|
|
*.gcno
|
|
*.gz
|
|
*.i
|
|
*.ko
|
|
*.lex.c
|
|
*.ll
|
|
*.lst
|
|
*.lz4
|
|
*.lzma
|
|
*.lzo
|
|
*.mod.c
|
|
*.o
|
|
*.o.*
|
|
*.order
|
|
*.patch
|
|
*.s
|
|
*.so
|
|
*.so.dbg
|
|
*.su
|
|
*.symtypes
|
|
*.tab.[ch]
|
|
*.tar
|
|
*.xz
|
|
Module.symvers
|
|
modules.builtin
|
|
|
|
#
|
|
# Top-level generic files
|
|
#
|
|
/tags
|
|
/TAGS
|
|
/linux
|
|
/vmlinux
|
|
/vmlinux.32
|
|
/vmlinux-gdb.py
|
|
/vmlinuz
|
|
/System.map
|
|
/Module.markers
|
|
/modules.builtin.modinfo
|
|
|
|
#
|
|
# RPM spec file (make rpm-pkg)
|
|
#
|
|
/*.spec
|
|
|
|
#
|
|
# Debian directory (make deb-pkg)
|
|
#
|
|
/debian/
|
|
|
|
#
|
|
# Snap directory (make snap-pkg)
|
|
#
|
|
/snap/
|
|
|
|
#
|
|
# tar directory (make tar*-pkg)
|
|
#
|
|
/tar-install/
|
|
|
|
#
|
|
# We don't want to ignore the following even if they are dot-files
|
|
#
|
|
!.clang-format
|
|
!.cocciconfig
|
|
!.get_maintainer.ignore
|
|
!.gitattributes
|
|
!.gitignore
|
|
!.mailmap
|
|
|
|
#
|
|
# Generated include files
|
|
#
|
|
/include/config/
|
|
/include/generated/
|
|
/include/ksym/
|
|
/arch/*/include/generated/
|
|
|
|
# stgit generated dirs
|
|
patches-*
|
|
|
|
# quilt's files
|
|
patches
|
|
series
|
|
|
|
# cscope files
|
|
cscope.*
|
|
ncscope.*
|
|
|
|
# gnu global files
|
|
GPATH
|
|
GRTAGS
|
|
GSYMS
|
|
GTAGS
|
|
|
|
# id-utils files
|
|
ID
|
|
|
|
*.orig
|
|
*~
|
|
\#*#
|
|
|
|
#
|
|
# Leavings from module signing
|
|
#
|
|
extra_certificates
|
|
signing_key.pem
|
|
signing_key.priv
|
|
signing_key.x509
|
|
x509.genkey
|
|
|
|
# Kconfig presets
|
|
/all.config
|
|
/alldef.config
|
|
/allmod.config
|
|
/allno.config
|
|
/allrandom.config
|
|
/allyes.config
|
|
|
|
# Kdevelop4
|
|
*.kdev4
|