[libvirt] [PATCH 4/3] build: allow caching the input to STATIC_ANALYSIS

Eric Blake eblake at redhat.com
Tue Aug 2 18:31:51 UTC 2011


Right now, every re-run of configure re-evaluates whether a
static analysis tool is in use.  But if you run configure under
coverity, make a tweak, and then do an incremental rebuild with
gcc but not coverity to test the tweak, then rerun a build under
coverity, then configure does not get rerun, and static analysis
ends up with lots of false positives.

This patch caches the static analysis result, and also makes it
easier to force static analysis even if the existing checks are
insufficient to detect newer versions of the static analyzer tools.

* configure.ac (lv_cv_static_analysis): New cache variable.
---

I _thought_ some of those false positives were looking familiar
from my last coverity run.  Turns out I inadvertantly managed
to lose my STATIC_ANALYSIS define.

 configure.ac |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7c4fb32..10487e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2404,9 +2404,16 @@ cp -f COPYING.LIB COPYING

 # Detect when running under the clang static analyzer's scan-build driver
 # or Coverity-prevent's cov-build.  Define STATIC_ANALYSIS accordingly.
+AC_CACHE_CHECK([whether this build is done by a static analysis tool],
+  [lv_cv_static_analysis], [
+    lv_cv_static_analysis=no
+    if test -n "${CCC_ANALYZER_ANALYSIS+set}" || \
+       test -n "$COVERITY_BUILD_COMMAND$COVERITY_LD_PRELOAD"; then
+      lv_cv_static_analysis=yes
+    fi
+  ])
 t=0
-test -n "${CCC_ANALYZER_ANALYSIS+set}" && t=1
-test -n "$COVERITY_BUILD_COMMAND$COVERITY_LD_PRELOAD" && t=1
+test "x$lv_cv_static_analysis" = xyes && t=1
 AC_DEFINE_UNQUOTED([STATIC_ANALYSIS], [$t],
   [Define to 1 when performing static analysis.])

-- 
1.7.4.4




More information about the libvir-list mailing list