lkml.org 
[lkml]   [2020]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v7] Makefile: Add clang-tidy and static analyzer support to makefile
On Wed, Aug 12, 2020 at 10:24 AM 'Nathan Huckleberry' via Clang Built
Linux <clang-built-linux@googlegroups.com> wrote:
>
> Sounds good. Do you think this patch is ready to land then?


I do not think so.

I pointed out the CC=clang check was not working.
I see false positive errors from GCC commands.



This patch does not use the benefit of Makefile.

Makefile is used to describe the dependency
between a target and its prerequisites,
and how to update the target.

Make compares the timestamps between the
targets and prerequisites, then determines
which targets need updating.


See your code.


clang-tidy:
ifdef CONFIG_CC_IS_CLANG
$(PYTHON3) scripts/clang-tools/gen_compile_commands.py
$(PYTHON3) scripts/clang-tools/run-clang-tools.py clang-tidy
compile_commands.json
else
$(error clang-tidy requires CC=clang)
endif


This always runs two commands sequentially.
It rebuilds compile_commands.json even if
nothing in the source tree has been changed.

If you do this, there is no strong reason to use Make,
and actually you can rewrite it in a shell script:


clang_tidy () {
if [ "$CONFIG_CC_IS_CLANG = "y" ]; then
$PYTHON3 scripts/clang-tools/gen_compile_commands.py
$PYTHON3 scripts/clang-tools/run-clang-tools.py clang-tidy
compile_commands.json
else
echo "clang-tidy requires CC=clang"
exit 1
fi
}




I changed the rules to Makefile-ish style.

https://patchwork.kernel.org/project/linux-kbuild/list/?series=331893


I will wait for comments for the new version.


--
Best Regards
Masahiro Yamada

\
 
 \ /
  Last update: 2020-08-12 19:49    [W:0.070 / U:3.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site