./scripts/checkincludes.pl 这个工具是用来检查代码里是否重复包含头文件,算是一个 warning 的检查工具,当然,你也可以提交到上游社区。
看个例子:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.17&id=1958e5aef5098e28b7d6e6a2972649901ebecace
riscv: xip: Fix duplicate included asm/pgtable.h
Clean up the following includecheck warning:
./arch/riscv/kernel/vmlinux-xip.lds.S: asm/pgtable.h is included more
than once.
No functional change.
Reported-by: Abaci Robot <abaci@linux.alibaba.com> ----------------------------- - -!!
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
国内的大厂都开始用 Robot 来常规发掘 warning patch 批量提交到上游社区刷 kpi,现在的内核编译甚至连一个 warning 都找到,何等神奇啊。
来吧,卷起来:
$ fd “.c” -x ./scripts/checkincludes.pl > checkincludes.log