[libvirt PATCH 019/351] meson: add static analysis detection

Pavel Hrdina phrdina at redhat.com
Thu Jul 16 09:54:15 UTC 2020


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 configure.ac | 15 ---------------
 meson.build  | 13 +++++++++++++
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index d76c2d22fc2..8f16b364de6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -722,21 +722,6 @@ if test "$want_ifconfig" = "yes"; then
      AC_DEFINE_UNQUOTED([IFCONFIG_PATH], "$IFCONFIG_PATH", [path to ifconfig binary])
 fi
 
-# 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 "x$lv_cv_static_analysis" = xyes && t=1
-AC_DEFINE_UNQUOTED([STATIC_ANALYSIS], [$t],
-  [Define to 1 when performing static analysis.])
-
 GNUmakefile=GNUmakefile
 m4_if(m4_version_compare([2.61a.100],
         m4_defn([m4_PACKAGE_VERSION])), [1], [],
diff --git a/meson.build b/meson.build
index e91d664a77a..be5e64fc6d2 100644
--- a/meson.build
+++ b/meson.build
@@ -143,6 +143,19 @@ if get_option('test_coverage')
 endif
 
 
+# Detect when running under the
+
+rc = run_command(
+  'sh', '-c',
+  'test -n "${CCC_ANALYZER_HTML}"' +
+    ' -o -n "${CCC_ANALYZER_ANALYSIS+set}"' +
+    ' -o -n "$COVERITY_BUILD_COMMAND$COVERITY_LD_PRELOAD"',
+)
+if rc.returncode() == 0
+  conf.set('STATIC_ANALYSIS', 1)
+endif
+
+
 # figure out libvirt version strings
 
 arr_version = meson.project_version().split('.')
-- 
2.26.2




More information about the libvir-list mailing list