From 157dda9549cee7cbccc93addb76ce3d3418a612d Mon Sep 17 00:00:00 2001 From: William Brown Date: Tue, 12 Apr 2016 13:33:13 +1000 Subject: [PATCH 1/7] Ticket 5 - Integrate asan support for code quality checking Bug Description: Coverity found a number of defects that could have been detected with asan use during testing. Fix Description: Include the --enable-asan flag to make it easier to run with stricter checks during development. https://pagure.io/svrcore/issue/5 Author: wibrown Review by: ??? --- configure.ac | 24 ++++++++++++++++++++++++ src/Makefile.am | 6 ++++++ 2 files changed, 30 insertions(+) diff --git a/configure.ac b/configure.ac index ec0d03a..4ca7d25 100644 --- a/configure.ac +++ b/configure.ac @@ -29,6 +29,30 @@ m4_include(m4/nss.m4) m4_include(m4/nspr.m4) m4_include(m4/systemd.m4) +AC_MSG_CHECKING(for --enable-debug) +AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debug features (default: no)]), +[ + AC_MSG_RESULT(yes) + debug_defs="-g3 -DDEBUG" +], +[ + AC_MSG_RESULT(no) + debug_defs="" +]) +AC_SUBST([debug_defs]) + +AC_MSG_CHECKING(for --enable-asan) +AC_ARG_ENABLE(asan, AS_HELP_STRING([--enable-asan], [Enable gcc address sanitizer options (default: no)]), +[ + AC_MSG_RESULT(yes) + asan_defs="-fsanitize=address -fno-omit-frame-pointer" +], +[ + AC_MSG_RESULT(no) + asan_defs="" +]) +AC_SUBST([asan_defs]) + AC_SUBST([NSPR_CFLAGS]) AC_SUBST([NSPR_LIBS]) AC_SUBST([NSPR_MIN_VER]) diff --git a/src/Makefile.am b/src/Makefile.am index 5e8d977..fba3583 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,9 @@ +ASAN_DEFINES = @asan_defs@ +DEBUG_DEFINES = @debug_defs@ + +AM_CPPFLAGS = $(ASAN_DEFINES) $(DEBUG_DEFINES) +AM_LDFLAGS = $(ASAN_DEFINES) $(DEBUG_DEFINES) + EXTRA_DIST = key.ico \ logo.ico \ manifest.mn \ -- 2.5.5