src: avoid warnings from use of G_GNUC_FALLTHROUGH
Since glib >= 2.69 we get warnings:
../src/ovirt-foreign-menu.c: In function 'ovirt_foreign_menu_next_async_step':
../src/ovirt-foreign-menu.c:319:13: error: Not available before 2.60 [-Werror]
319 | G_GNUC_FALLTHROUGH;
| ^~~~~~~~~~~~~~~
../src/ovirt-foreign-menu.c:345:13: error: Not available before 2.60 [-Werror]
345 | G_GNUC_FALLTHROUGH;
| ^~~~~~~~~~~~~~~
../src/ovirt-foreign-menu.c:351:13: error: Not available before 2.60 [-Werror]
351 | G_GNUC_FALLTHROUGH;
| ^~~~~~~~~~~~~~~
../src/ovirt-foreign-menu.c:357:13: error: Not available before 2.60 [-Werror]
357 | G_GNUC_FALLTHROUGH;
| ^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
GLib is right to warn about this, since it does not know that we
provided our own back-compat definition of the macro. For now we have to
temporarily purge glib's macro entirely in order to get rid of the
warning that is bogus for our usage.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Daniel P. Berrangé
2 years ago
30 | 30 | #include "virt-viewer-util.h" |
31 | 31 | #include "glib-compat.h" |
32 | 32 | |
33 | #if !GLIB_CHECK_VERSION(2, 60, 0) | |
34 | # if __GNUC_PREREQ (7, 0) | |
35 | # define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) | |
36 | # else | |
37 | # define G_GNUC_FALLTHROUGH do {} while(0) | |
38 | # endif | |
33 | /* GLib 2.69 annotated macros with version tags, and | |
34 | * since we set GLIB_VERSION_MAX_ALLOWED to 2.48 | |
35 | * it complains if we use G_GNUC_FALLTHROUGH at | |
36 | * all. We temporarily purge the GLib definition | |
37 | * of G_GNUC_FALLTHROUGH and define it ourselves. | |
38 | * When we set min glib >= 2.60, we can delete | |
39 | * all this | |
40 | */ | |
41 | #ifndef __GNUC_PREREQ | |
42 | # define __GNUC_PREREQ(maj, min) \ | |
43 | ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) | |
44 | #endif | |
45 | #undef G_GNUC_FALLTHROUGH | |
46 | #if __GNUC_PREREQ (7, 0) | |
47 | # define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) | |
48 | #else | |
49 | # define G_GNUC_FALLTHROUGH do {} while(0) | |
39 | 50 | #endif |
40 | 51 | |
41 | 52 | typedef enum { |