mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
src: rework static analysis detection
Inspired by QEMU code. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
912421e7b6
commit
3f2b7d3fe2
14
meson.build
14
meson.build
@ -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
|
||||
|
||||
|
@ -29,6 +29,10 @@
|
||||
#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>
|
||||
|
Loading…
Reference in New Issue
Block a user