diff --git a/meson.build b/meson.build index 8d36357e..9d2cb444 100644 --- a/meson.build +++ b/meson.build @@ -39,6 +39,21 @@ if cc.get_define('static_assert', prefix : prefix) == '' config_h.set('static_assert(...)', '/* */') endif +# Coverity breaks because it doesn't define _Float128 correctly, you'll end +# up with a bunch of messages in the form: +# "/usr/include/stdlib.h", line 133: error #20: identifier "_Float128" is +# undefined +# extern _Float128 strtof128 (const char *__restrict __nptr, +# ^ +# We don't use float128 ourselves, it gets pulled in from math.h or +# something, so let's just define it as uint128 and move on. +# Unfortunately we can't detect the coverity build at meson configure +# time, we only know it fails at runtime. So make this an option instead, to +# be removed when coverity fixes this again. +if get_option('coverity') + config_h.set('_Float128', '__uint128_t') +endif + # Dependencies pkgconfig = import('pkgconfig') dep_udev = dependency('libudev') diff --git a/meson_options.txt b/meson_options.txt index 144f9160..280cf49f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -18,3 +18,7 @@ option('documentation', type: 'boolean', value: true, description: 'Build the documentation [default=true]') +option('coverity', + type: 'boolean', + value: false, + description: 'Enable coverity build fixes, see meson.build for details [default=false]')