From be208141915f18d4ffae66078303fe15d717c8b5 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 23 Oct 2018 00:33:27 +0200 Subject: Makefile: add 'tidy' target that runs clang-tidy Available in the root, src and lib dirs. Closes #3163 --- Makefile.am | 6 +++++- lib/Makefile.am | 8 ++++++++ src/Makefile.am | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index dd93a383e..debec9aa3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. +# Copyright (C) 1998 - 2018, Daniel Stenberg, , et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -642,3 +642,7 @@ function gen_element(type, dir, file)\ -v src_x_srcs="$$sorted_src_x_srcs" \ -v src_x_hdrs="$$sorted_src_x_hdrs" \ "$$awk_code" $(srcdir)/$(VC15_SRCTMPL) > $(VC15_SRCVCXPROJ) || { exit 1; };) + +tidy: + (cd src && $(MAKE) tidy) + (cd lib && $(MAKE) tidy) diff --git a/lib/Makefile.am b/lib/Makefile.am index 4f3c16db4..a7b5262b9 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -144,3 +144,11 @@ if CURLDEBUG # for debug builds, we scan the sources on all regular make invokes all-local: checksrc endif + +# disable the tests that are mostly causing false positives +TIDYFLAGS=-checks=-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding,-clang-analyzer-valist.Uninitialized,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-core.NullDereference -quiet + +TIDY:=clang-tidy + +tidy: + $(TIDY) $(CSOURCES) $(TIDYFLAGS) -- $(AM_CPPFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H diff --git a/src/Makefile.am b/src/Makefile.am index 80cbce206..8fd9dc32d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -140,3 +140,11 @@ if CURLDEBUG # for debug builds, we scan the sources on all regular make invokes all-local: checksrc endif + +# disable the tests that are mostly causing false positives +TIDYFLAGS=-checks=-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding,-clang-analyzer-valist.Uninitialized,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-core.NullDereference + +TIDY:=clang-tidy + +tidy: + $(TIDY) $(CURL_CFILES) $(TIDYFLAGS) -- $(AM_CPPFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H -- cgit v1.2.3