mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
src: workaround warning triggered in glib 2.69
Libvirt is using the G_GNUC_FALLTHROUGH macro provided by glib since version 2.60. Since we need to support older glib, we also have some compatibility code to define it if missing. We set the GLIB_VERSION_MAX_ALLOWED macro to ensure we get warnings when we use an API that dates from a glib version newer than our minimum benchmark. Historically this didn't get enforced for (most) macros, but GLib 2.69 has addressed that gap. This causes our usage of G_GNUC_FALLTHROUGH to trigger warnings. GLib is right to warn, because it does not know that we have added our own fallback for older versions. The only way to squelch this warning though, is to fully undefine the GLib provided G_GNUC_FALLTHROUGH and use our own in its place. We'll be able to remove all this compat burden when we finally update the min glib version to be >= 2.60 Reviewed-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
d91a3e96c0
commit
a556615555
@ -147,8 +147,17 @@
|
||||
*
|
||||
* silence the compiler warning when falling through a switch case
|
||||
*
|
||||
* TODO: Remove after upgrading to GLib >= 2.60
|
||||
* Note: GLib 2.69.0 introduced version checks on the
|
||||
* macro usage. Thus an app setting GLIB_VERSION_MAX_ALLOWED
|
||||
* to less than 2.60 will trigger a warning using G_GNUC_FALLTHROUGH
|
||||
* Normally the warning is a good thing, but we want to use our
|
||||
* fallback impl, so we have to temporarily cull the GLib macro.
|
||||
*
|
||||
* All this should be removed once updating to min GLib >= 2.60
|
||||
*/
|
||||
#if GLIB_CHECK_VERSION(2, 69, 0)
|
||||
# undef G_GNUC_FALLTHROUGH
|
||||
#endif
|
||||
#ifndef G_GNUC_FALLTHROUGH
|
||||
# if __GNUC_PREREQ (7, 0)
|
||||
# define G_GNUC_FALLTHROUGH __attribute__((fallthrough))
|
||||
|
Loading…
Reference in New Issue
Block a user