diff options
author | TingPing <tingping@tingping.se> | 2014-12-02 01:06:25 -0500 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2014-12-02 01:06:25 -0500 |
commit | e38f00775f31102a696418b59e88b1586706a359 (patch) | |
tree | 5332f76a6da8ea436131bd65d8b849b18ed053b7 | |
parent | 05a6097dc659e6567e2d081061a44a585ddc5f67 (diff) |
configure: Add option to run clang static analysis
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | configure.ac | 16 | ||||
-rw-r--r-- | m4/clang-analyze.am | 8 | ||||
-rw-r--r-- | src/common/Makefile.am | 8 | ||||
-rw-r--r-- | src/fe-gtk/Makefile.am | 9 |
5 files changed, 42 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index 137204b8..2f0697a6 100644 --- a/.gitignore +++ b/.gitignore @@ -69,6 +69,7 @@ stamp-h1 *.po~ *.pot *.patch +src/**/*.plist # Win32 generated files plugins/wmpa/wmpa_h.h plugins/wmpa/wmpa_i.c diff --git a/configure.ac b/configure.ac index 2177e747..eeb22b53 100644 --- a/configure.ac +++ b/configure.ac @@ -159,6 +159,10 @@ AC_ARG_ENABLE(minimal-flags, [AS_HELP_STRING([--enable-minimal-flags],[only add those CFLAGS that are really needed or not intrusive (default: no)])], minimalflags=$enableval, minimalflags=no) +AC_ARG_ENABLE(static-analysis, + [AS_HELP_STRING([--enable-static-analysis],[if using clang run static analysis during build (default: no)])], + analyze=$enableval, analyze=no) + AC_ARG_WITH(theme-manager, [AS_HELP_STRING([--with-theme-manager],[compile theme manager (needs monodevelop, default: off)])], theme_manager=$withval, theme_manager=no) @@ -588,6 +592,17 @@ if test "x$isocodes" = "xyes" ; then fi dnl ********************************************************************* +dnl ** Static Analysis ************************************************** +dnl ********************************************************************* + +if test "x$analyze" = "xyes"; then + if test "$CC" != "clang"; then + AC_MSG_WARN(CC is not clang for static analysis) + analyze=no + fi +fi + +dnl ********************************************************************* dnl ** CONDITIONALS ***************************************************** dnl ********************************************************************* @@ -604,6 +619,7 @@ AM_CONDITIONAL(DO_CHECKSUM, test "x$checksum" = "xyes") AM_CONDITIONAL(DO_DOAT, test "x$doat" = "xyes") AM_CONDITIONAL(DO_FISHLIM, test "x$fishlim" = "xyes") AM_CONDITIONAL(DO_SYSINFO, test "x$sysinfo" = "xyes") +AM_CONDITIONAL(DO_STATIC_ANALYSIS, test "x$analyze" = "xyes") AM_CONDITIONAL(USE_DBUS, test "x$dbus" = "xyes") AM_CONDITIONAL(HAVE_ISO_CODES, test "x$isocodes" = "xyes") AM_CONDITIONAL(WITH_TM, test "x$theme_manager" != "xno") diff --git a/m4/clang-analyze.am b/m4/clang-analyze.am new file mode 100644 index 00000000..a5765774 --- /dev/null +++ b/m4/clang-analyze.am @@ -0,0 +1,8 @@ +analysis_verbose = $(analysis_verbose_$(V)) +analysis_verbose_ = $(analysis_verbose_$(AM_DEFAULT_VERBOSITY)) +analysis_verbose_0 = @echo " CCSA " $@; $(COMPILE) --analyze $< -o $@; +analysis_verbose_1 = $(COMPILE) --analyze $< -o $@; + +%.plist: %.c + $(analysis_verbose) + diff --git a/src/common/Makefile.am b/src/common/Makefile.am index e9255d0c..744630c4 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -1,5 +1,7 @@ ## Process this file with automake to produce Makefile.in +include $(top_srcdir)/m4/clang-analyze.am + noinst_LIBRARIES = libhexchatcommon.a AM_CPPFLAGS = $(COMMON_CFLAGS) -I$(top_srcdir) @@ -79,6 +81,12 @@ marshal.c: $(srcdir)/marshalers.list $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_hexchat_marshal --body $< > $@ +if DO_STATIC_ANALYSIS +analyze_plists = $(libhexchatcommon_a_SOURCES:%.c=%.plist) +all-local: $(analyze_plists) +MOSTLYCLEANFILES = $(analyze_plists) +endif + BUILT_SOURCES = textenums.h textevents.h marshal.c marshal.h CLEANFILES = $(BUILT_SOURCES) diff --git a/src/fe-gtk/Makefile.am b/src/fe-gtk/Makefile.am index a8f43ac5..78ca1e45 100644 --- a/src/fe-gtk/Makefile.am +++ b/src/fe-gtk/Makefile.am @@ -1,3 +1,6 @@ + +include $(top_srcdir)/m4/clang-analyze.am + localedir = $(datadir)/locale bin_PROGRAMS = hexchat @@ -35,3 +38,9 @@ hexchat_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/src/common resources.c: $(top_srcdir)/data/hexchat.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(top_srcdir)/data --generate-dependencies $(top_srcdir)/data/hexchat.gresource.xml) $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(top_srcdir)/data --generate-source $< + +if DO_STATIC_ANALYSIS +analyze_plists = $(hexchat_SOURCES:%.c=%.plist) +all-local: $(analyze_plists) +MOSTLYCLEANFILES = $(analyze_plists) +endif |