On Thu, Nov 12, 2020 at 01:42:32PM +0100, Martin Kletzander wrote: > 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. AFAIK, this warning flag is a new thing in latest clang in rawhide, so all the existing stuff we've relied on long term is still active. Doing this selectively wold be quite tedious because it isn't just one file long term. Once we've converted over all the current virObject classes, we'll have many many cases. > > > Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> > > --- > > 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 > > Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|