1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-25 10:42:18 -05:00

configure: Add option to run clang static analysis

This commit is contained in:
TingPing 2014-12-02 01:06:25 -05:00
parent 05a6097dc6
commit e38f00775f
5 changed files with 42 additions and 0 deletions

1
.gitignore vendored
View File

@ -69,6 +69,7 @@ stamp-h1
*.po~ *.po~
*.pot *.pot
*.patch *.patch
src/**/*.plist
# Win32 generated files # Win32 generated files
plugins/wmpa/wmpa_h.h plugins/wmpa/wmpa_h.h
plugins/wmpa/wmpa_i.c plugins/wmpa/wmpa_i.c

View File

@ -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)])], [AS_HELP_STRING([--enable-minimal-flags],[only add those CFLAGS that are really needed or not intrusive (default: no)])],
minimalflags=$enableval, minimalflags=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, AC_ARG_WITH(theme-manager,
[AS_HELP_STRING([--with-theme-manager],[compile theme manager (needs monodevelop, default: off)])], [AS_HELP_STRING([--with-theme-manager],[compile theme manager (needs monodevelop, default: off)])],
theme_manager=$withval, theme_manager=no) theme_manager=$withval, theme_manager=no)
@ -587,6 +591,17 @@ if test "x$isocodes" = "xyes" ; then
]) ])
fi 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 *********************************************************************
dnl ** CONDITIONALS ***************************************************** dnl ** CONDITIONALS *****************************************************
dnl ********************************************************************* dnl *********************************************************************
@ -604,6 +619,7 @@ AM_CONDITIONAL(DO_CHECKSUM, test "x$checksum" = "xyes")
AM_CONDITIONAL(DO_DOAT, test "x$doat" = "xyes") AM_CONDITIONAL(DO_DOAT, test "x$doat" = "xyes")
AM_CONDITIONAL(DO_FISHLIM, test "x$fishlim" = "xyes") AM_CONDITIONAL(DO_FISHLIM, test "x$fishlim" = "xyes")
AM_CONDITIONAL(DO_SYSINFO, test "x$sysinfo" = "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(USE_DBUS, test "x$dbus" = "xyes")
AM_CONDITIONAL(HAVE_ISO_CODES, test "x$isocodes" = "xyes") AM_CONDITIONAL(HAVE_ISO_CODES, test "x$isocodes" = "xyes")
AM_CONDITIONAL(WITH_TM, test "x$theme_manager" != "xno") AM_CONDITIONAL(WITH_TM, test "x$theme_manager" != "xno")

8
m4/clang-analyze.am Normal file
View File

@ -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)

View File

@ -1,5 +1,7 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
include $(top_srcdir)/m4/clang-analyze.am
noinst_LIBRARIES = libhexchatcommon.a noinst_LIBRARIES = libhexchatcommon.a
AM_CPPFLAGS = $(COMMON_CFLAGS) -I$(top_srcdir) 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 $< > $@ $(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 BUILT_SOURCES = textenums.h textevents.h marshal.c marshal.h
CLEANFILES = $(BUILT_SOURCES) CLEANFILES = $(BUILT_SOURCES)

View File

@ -1,3 +1,6 @@
include $(top_srcdir)/m4/clang-analyze.am
localedir = $(datadir)/locale localedir = $(datadir)/locale
bin_PROGRAMS = hexchat 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) 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 $< $(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