Permalink
Browse files

Statically analyze source code with cppcheck on `make check`

  • Loading branch information...
1 parent a21b20e commit d6aa5d887b942c50eccd9e639f5eebea15c3f8eb @b4n b4n committed Mar 14, 2011
View
@@ -27,3 +27,5 @@ addons_la_SOURCES = \
ao_xmltagging.c
addons_la_LIBADD = $(COMMONLIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
View
@@ -0,0 +1,24 @@
+dnl GP_CHECK_CPPCHECK
+dnl Checks for cppcheck
+AC_DEFUN([GP_CHECK_CPPCHECK],
+[
+ AC_ARG_ENABLE([cppcheck],
+ AS_HELP_STRING([--enable-cppcheck],
+ [use cppcheck to check the source code
+ @<:@default=auto@:>@]),
+ [enable_cppcheck="$enableval"],
+ [enable_cppcheck="auto"])
+
+ gp_have_cppcheck=no
+ AS_IF([test "x$enable_cppcheck" != xno],
+ [AC_PATH_PROG([CPPCHECK], [cppcheck], [NONE])
+ AS_IF([test "x$CPPCHECK" != xNONE],
+ [gp_have_cppcheck=yes
+ AC_SUBST([CPPCHECK])],
+ [gp_have_cppcheck=no
+ AS_IF([test "x$enable_cppcheck" != xauto],
+ [AC_MSG_ERROR([cannot find cppcheck])])])])
+ AM_CONDITIONAL([HAVE_CPPCHECK], [test "x$gp_have_cppcheck" = xyes])
+ GP_STATUS_BUILD_FEATURE_ADD([Static code checking],
+ [$gp_have_cppcheck])
+])
View
@@ -0,0 +1,9 @@
+
+if HAVE_CPPCHECK
+
+check-cppcheck: .
+ $(CPPCHECK) -q --template gcc --error-exitcode=2 $^
+
+check-local: check-cppcheck
+
+endif
View
@@ -18,3 +18,5 @@ codenav_la_SOURCES = \
codenav_la_LIBADD = $(COMMONLIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
View
@@ -20,6 +20,7 @@ GP_I18N
dnl common checks
GP_CHECK_GEANY(0.20)
GP_CHECK_UNITTESTS(0.9.4)
+GP_CHECK_CPPCHECK
dnl plugin checks
GP_CHECK_ADDONS
View
@@ -42,3 +42,5 @@ debugger_la_SOURCES = \
debugger_la_LIBADD = $(COMMONLIBS) -lutil
debugger_la_CFLAGS = $(AM_CFLAGS) $(VTE_CFLAGS)
+
+include $(top_srcdir)/build/cppcheck.mk
View
@@ -18,3 +18,5 @@ devhelp_la_CFLAGS = \
$(DEVHELP_CFLAGS) \
-DDHPLUG_DATA_DIR=\"$(plugindatadir)\"
devhelp_la_LIBADD = $(DEVHELP_LIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
View
@@ -8,3 +8,5 @@ endif
geanycfp_la_SOURCES = geanycfp.c
geanycfp_la_LIBADD = $(COMMONLIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
View
@@ -13,3 +13,5 @@ geanydoc_la_SOURCES = \
geanydoc_la_CFLAGS = $(AM_CFLAGS)
geanydoc_la_LIBADD = $(COMMONLIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
@@ -8,3 +8,5 @@ endif
geanyextrasel_la_SOURCES = extrasel.c
geanyextrasel_la_LIBADD = $(COMMONLIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
View
@@ -32,3 +32,5 @@ geanygdb_la_CFLAGS = $(AM_CFLAGS) -DTTYHELPERDIR=\""$(geanygdbdir)"\"
geanygdb_la_LIBADD = $(COMMONLIBS)
ttyhelper_SOURCES = ttyhelper.c
+
+include $(top_srcdir)/build/cppcheck.mk
@@ -45,3 +45,5 @@ geanygendoc_la_CFLAGS = \
geanygendoc_la_LIBADD = \
$(COMMONLIBS) \
$(GEANYGENDOC_LIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
@@ -8,3 +8,5 @@ endif
geanyinsertnum_la_SOURCES = insertnum.c
geanyinsertnum_la_LIBADD = $(COMMONLIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
@@ -34,3 +34,5 @@ geanylatex_la_SOURCES = \
letters.h
geanylatex_la_LIBADD = $(COMMONLIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
@@ -8,3 +8,5 @@ endif
geanylipsum_la_SOURCES = geanylipsum.c
geanylipsum_la_LIBADD = $(COMMONLIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
View
@@ -48,3 +48,5 @@ libgeanylua_la_CFLAGS = $(geanylua_la_CFLAGS)
libgeanylua_la_LIBADD = $(geanylua_la_LIBADD)
SUBDIRS = docs examples
+
+include $(top_srcdir)/build/cppcheck.mk
View
@@ -25,3 +25,5 @@ geanypg_la_LIBADD = \
geanypg_la__CFLAGS = \
$(AM_CFLAGS) \
$(GPGME_CFLAGS)
+
+include $(top_srcdir)/build/cppcheck.mk
View
@@ -15,3 +15,5 @@ geanyprj_la_SOURCES = geanyprj.c \
geanyprj_la_CFLAGS = $(AM_CFLAGS)
geanyprj_la_LIBADD = $(COMMONLIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
@@ -8,3 +8,5 @@ endif
geanysendmail_la_SOURCES = geanysendmail.c icon.h
geanysendmail_la_LIBADD = $(COMMONLIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
View
@@ -27,3 +27,5 @@ geanyvc_la_CFLAGS += \
$(GTKSPELL_CFLAGS)
geanyvc_la_LIBADD += $(GTKSPELL_LIBS)
endif
+
+include $(top_srcdir)/build/cppcheck.mk
@@ -16,3 +16,5 @@ pretty_print_la_SOURCES = \
pretty_print_la_CFLAGS = $(AM_CFLAGS) $(LIBXML_CFLAGS)
pretty_print_la_LIBADD = $(COMMONLIBS) $(LIBXML_LIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
@@ -8,3 +8,5 @@ endif
shiftcolumn_la_SOURCES = shiftcolumn.c
shiftcolumn_la_LIBADD = $(COMMONLIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
@@ -25,3 +25,5 @@ endif
spellcheck_la_LIBADD = \
$(COMMONLIBS) \
$(ENCHANT_LIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
@@ -8,3 +8,5 @@ endif
tableconvert_la_SOURCES = tableconvert.c
tableconvert_la_LIBADD = $(COMMONLIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
@@ -9,3 +9,5 @@ endif
treebrowser_la_SOURCES = treebrowser.c
treebrowser_la_CFLAGS = $(AM_CFLAGS) $(GIO_CFLAGS)
treebrowser_la_LIBADD = $(COMMONLIBS) $(GIO_LIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
@@ -18,3 +18,5 @@ updatechecker_la_CFLAGS = \
updatechecker_la_LIBADD = \
$(COMMONLIBS) \
$(UPDATECHECKER_LIBS)
+
+include $(top_srcdir)/build/cppcheck.mk
@@ -47,3 +47,5 @@ gwh-enum-types.c: $(srcdir)/gwh-enum-types.c.tpl gwh-enum-types.h $(headers) Mak
$(AM_V_GEN)$(GLIB_MKENUMS) --template $< $(headers:%=$(srcdir)/%) > $@
gwh-enum-types.h: $(srcdir)/gwh-enum-types.h.tpl $(headers) Makefile
$(AM_V_GEN)$(GLIB_MKENUMS) --template $< $(headers:%=$(srcdir)/%) > $@
+
+include $(top_srcdir)/build/cppcheck.mk

0 comments on commit d6aa5d8

Please sign in to comment.