]> xenbits.xensource.com Git - libvirt.git/commitdiff
src: rework static analysis detection
authorPavel Hrdina <phrdina@redhat.com>
Mon, 16 Nov 2020 09:57:56 +0000 (10:57 +0100)
committerPavel Hrdina <phrdina@redhat.com>
Thu, 19 Nov 2020 13:38:13 +0000 (14:38 +0100)
Inspired by QEMU code.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
meson.build
src/internal.h

index 3bc92b0dd5ee7f2580555a8c5102930c4f28c4c9..01e7fbd40977c9b185b09a59a422c292fb9a387f 100644 (file)
@@ -142,20 +142,6 @@ if get_option('test_coverage')
 endif
 
 
-# Detect when running under the clang static analyzer's scan-build driver
-# or Coverity-prevent's cov-build. Define STATIC_ANALYSIS accordingly.
-
-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
-
-
 # Add RPATH information when building for a non-standard prefix, or
 # when explicitly requested to do so
 
index d167e56b4897bcd0c8ad6d97c3316a470d2c9efe..ff94e7e53e0fb85b4d2ce3438572de5691b819a7 100644 (file)
 #include <stdlib.h>
 #include "glibcompat.h"
 
+#if defined __clang_analyzer__ || defined __COVERITY__
+# define STATIC_ANALYSIS 1
+#endif
+
 #if STATIC_ANALYSIS
 # undef NDEBUG /* Don't let a prior NDEBUG definition cause trouble.  */
 # include <assert.h>