On Thu, Nov 12, 2020 at 09:41:39AM +0000, Daniel P. Berrangé wrote:
With CLang we're getting failures from cats in GLib macros
../dist-unpack/libvirt-6.10.0/src/util/vireventthread.c:35:1:
error: passing 'typeof (*(&g_define_type_id__volatile)) *'
(aka 'volatile unsigned long *') to parameter of type
'gsize *' (aka 'unsigned long *') discards qualifiers
[-Werror,-Wincompatible-pointer-types-discards-qualifiers]
G_DEFINE_TYPE(virEventThread, vir_event_thread, G_TYPE_OBJECT)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The cast is valid and there's no way for libvirt to workaround
the issue, so we must disable this CLang warning flag.
Can't we have the warning disabled (maybe by force casting it before the macro
or in a macro wrapper) just on those lines? Because otherwise we are silencing
whole lot of other warnings that are actually very good to have, like discarding
const qualifiers etc. in the rest of the code AFAIUI.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
meson.build | 3 +++
1 file changed, 3 insertions(+)
diff --git a/meson.build b/meson.build
index f2e4f2cc23..e4b7fa0728 100644
--- a/meson.build
+++ b/meson.build
@@ -405,6 +405,9 @@ cc_flags += [
# so use this CLang-specific arg to keep it quiet
'-Wno-typedef-redefinition',
+ # CLang complains about casts in G_DEFINE_TYPE(...)
+ '-Wno-incompatible-pointer-types-discards-qualifiers',
+
# We don't use -Wc++-compat so we have to enable it explicitly
'-Wjump-misses-init',
--
2.25.4