aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-09-01 07:51:16 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-10-04 18:36:23 +0200
commitdeb62371fe311cefd8a6f58e2da42b15d7e2a356 (patch)
tree0d0e6a6265026fbefa75049a75d43fb683105cef /meson.build
parentfa73168b08f37c8e5f2a7180b139808846d36d40 (diff)
meson: move sparse detection to Meson and rewrite check_sparse.py
Pass the path to the program to scripts/check_sparse.py, which previously was not included in config-host.mak. Change scripts/check_sparse.py to work with cgcc, which seems to work better with sparse 0.6.x. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build10
1 files changed, 6 insertions, 4 deletions
diff --git a/meson.build b/meson.build
index 9a90d19113..1dd3f49011 100644
--- a/meson.build
+++ b/meson.build
@@ -102,11 +102,13 @@ if host_machine.system() == 'darwin'
add_languages('objc', required: false, native: false)
endif
-if 'SPARSE_CFLAGS' in config_host
+sparse = find_program('cgcc', required: get_option('sparse'))
+if sparse.found()
run_target('sparse',
command: [find_program('scripts/check_sparse.py'),
- config_host['SPARSE_CFLAGS'].split(),
- 'compile_commands.json'])
+ 'compile_commands.json', sparse.full_path(), '-Wbitwise',
+ '-Wno-transparent-union', '-Wno-old-initializer',
+ '-Wno-non-pointer-null'])
endif
###########################################
@@ -1557,7 +1559,7 @@ summary_info += {'host CPU': cpu}
summary_info += {'host endianness': build_machine.endian()}
summary_info += {'target list': ' '.join(target_dirs)}
summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')}
-summary_info += {'sparse enabled': meson.get_compiler('c').cmd_array().contains('cgcc')}
+summary_info += {'sparse enabled': sparse.found()}
summary_info += {'strip binaries': get_option('strip')}
summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}