[gjs: 3/7] build: Port cppcheck target to use compilation database
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 3/7] build: Port cppcheck target to use compilation database
- Date: Sun, 13 Oct 2019 04:40:03 +0000 (UTC)
commit 07b568c5b8d889bbb63c54331efee81d17c7b584
Author: Philip Chimento <philip chimento gmail com>
Date: Mon Sep 2 21:56:08 2019 -0700
build: Port cppcheck target to use compilation database
Using Meson, we get a compilation database in the build directory, which
makes it much easier to run cppcheck. We remove the 'make cppcheck'
target from the Autotools makefile and instead add a new
tools/run_cppcheck.sh script to use the compilation database generated
by Meson.
Makefile.am | 9 ---------
doc/Hacking.md | 2 +-
tools/run_cppcheck.sh | 6 ++++++
3 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 9d532ed5..f2504950 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -248,13 +248,4 @@ upload-release: $(DISTNAME) Makefile
scp $(DISTNAME) master.gnome.org:
ssh master.gnome.org install-module $(DISTNAME)
-
-CPPCHECK=cppcheck
-### cppcheck static code analysis
-#
-cppcheck:
- $(CPPCHECK) --inline-suppr \
- --enable=warning,performance,portability,information,missingInclude \
- --force -q $(top_srcdir) -I $(top_builddir)
-
-include $(top_srcdir)/git.mk
diff --git a/doc/Hacking.md b/doc/Hacking.md
index ce516169..6a8f6279 100644
--- a/doc/Hacking.md
+++ b/doc/Hacking.md
@@ -123,7 +123,7 @@ LSan executes faster than Valgrind, however.
To execute cppcheck, a static code analysis tool for the C and C++, run:
```sh
-jhbuild make cppcheck
+tools/run_cppcheck.sh
```
It is a versatile tool that can check non-standard code, including: variable
checking, bounds checking, leaks, etc. It can detect the types of bugs that
diff --git a/tools/run_cppcheck.sh b/tools/run_cppcheck.sh
new file mode 100755
index 00000000..68c8c8a5
--- /dev/null
+++ b/tools/run_cppcheck.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+ninja -C _build
+cppcheck --project=_build/compile_commands.json --inline-suppr \
+ --enable=warning,performance,portability,missingInclude \
+ --force --quiet $@
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]