[libvirt PATCH] Set -Wno-incompatible-pointer-types-discards-qualifiers

Martin Kletzander mkletzan at redhat.com
Thu Nov 12 12:42:32 UTC 2020


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 at 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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201112/4709e847/attachment-0001.sig>


More information about the libvir-list mailing list