threads / patch / 35750

patchMakefile: add cppcheck target

Subject: [PATCH] Makefile: add cppcheck target

## tl;dr

2 messages between Jan 29, 2014 and Jan 29, 2014. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Elia Pinto· Jan 29, 2014, 11:02 UTC · lore

Add cppcheck target to Makefile. Cppcheck is a static analysis tool for C/C++ code. Cppcheck primarily detects the types of bugs that the compilers normally do not detect. It is an useful target for doing QA analysis.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 Makefile      |    6 ++++++
 config.mak.in |    1 +
 2 files changed, 7 insertions(+)
Show changes to 2 files +7 −0

Makefile, config.mak.in

diff --git a/Makefile b/Makefile
index dddaf4f..1d25a70 100644
--- a/Makefile
+++ b/Makefile
@@ -2602,3 +2602,9 @@ cover_db: coverage-report
 cover_db_html: cover_db
 	cover -report html -outputdir cover_db_html cover_db
 
+### cppcheck static coverage analysis
+#
+.PHONY: cppcheck
+
+cppcheck:
+	cppcheck --enable=all -q $(top_srcdir)
diff --git a/config.mak.in b/config.mak.in
index e6a6d0f..86b95fb 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -22,3 +22,4 @@ docdir = @docdir@
 
 mandir = @mandir@
 htmldir = @htmldir@
+top_srcdir = @top_srcdir@
-- 
1.7.10.4
Junio C Hamano· Jan 29, 2014, 18:26 UTC · re: Elia Pinto · lore

Re: [PATCH] Makefile: add cppcheck target

Elia Pinto <gitter.spiros@gmail.com> writes:
Show 25 quoted lines
> Add cppcheck target to Makefile. Cppcheck is a static
> analysis tool for C/C++ code. Cppcheck primarily detects
> the types of bugs that the compilers normally do not detect.
> It is an useful target for doing QA analysis.
>
> Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
> ---
>  Makefile      |    6 ++++++
>  config.mak.in |    1 +
>  2 files changed, 7 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index dddaf4f..1d25a70 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2602,3 +2602,9 @@ cover_db: coverage-report
>  cover_db_html: cover_db
>  	cover -report html -outputdir cover_db_html cover_db
>  
> +### cppcheck static coverage analysis
> +#
> +.PHONY: cppcheck
> +
> +cppcheck:
> +	cppcheck --enable=all -q $(top_srcdir)
Why isn't this "."?
In other words, why is the change to config.mak.in even necessary?
Show 9 quoted lines
> diff --git a/config.mak.in b/config.mak.in
> index e6a6d0f..86b95fb 100644
> --- a/config.mak.in
> +++ b/config.mak.in
> @@ -22,3 +22,4 @@ docdir = @docdir@
>  
>  mandir = @mandir@
>  htmldir = @htmldir@
> +top_srcdir = @top_srcdir@

← back to recent threads