On Thu, Jul 16, 2020 at 11:54:16 +0200, Pavel Hrdina wrote:
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
m4/virt-manywarnings.m4 | 339 ----------------------------------------
meson.build | 192 +++++++++++++++++++++++
2 files changed, 192 insertions(+), 339 deletions(-)
delete mode 100644 m4/virt-manywarnings.m4
[..]
+# gcc --help=warnings outputs
+ptrdiff_max = cc.sizeof('ptrdiff_t', prefix: '#include
<stddef.h>')
+size_max = cc.sizeof('size_t', prefix: '#include <stdint.h>')
+# Compute max safe object size by checking ptrdiff_t and size_t sizes.
+# Ideally we would get PTRDIFF_MAX and SIZE_MAX values but it would
+# give us (2147483647L) and we would have to remove the () and the suffix
+# in order to convert it to numbers to be able to pick the smaller one.
+alloc_max = run_command(
+ 'python3', '-c',
+ 'print(min(2**@0@ - 1, 2**@1@ - 1))'.format(ptrdiff_max * 8 - 1, size_max *
8),
+)
Preferrably do all the math in the python you call if you already must
call it.