[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 3/3] glib: enforce the minimum required versi
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH v3 3/3] glib: enforce the minimum required version and warn about old APIs |
Date: |
Fri, 8 Jun 2018 19:33:52 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
On 08.06.2018 15:16, Daniel P. Berrangé wrote:
> There are two useful macros that can be defined before including
> glib.h that are related to the min required glib version
>
> - GLIB_VERSION_MIN_REQUIRED
>
> When this is defined, if code uses an API that was deprecated
> in this version, or older, a compiler warning will be emitted.
> This alerts maintainers to update their code to whatever new
> replacement API is now recommended best practice.
>
> - GLIB_VERSION_MAX_ALLOWED
>
> When this is defined, if code uses an API that was introduced
> in a version that is newer than the declared version, a compiler
> warning will be emitted. This alerts maintainers if new code
> accidentally uses functionality that won't be available on some
> supported platforms.
>
> The GLIB_VERSION_MAX_ALLOWED constant makes it a bit harder to opt
> in to using specific new APIs with a GLIB_CHECK_VERSION conditional.
> To workaround this Pragmas can be used to temporarily turn off the
> -Wdeprecated-declarations compiler warning, while a static inline
> compat function is implemented. This workaround is illustrated with the
> implementation of the g_strv_contains method to satisfy the test suite.
>
> Signed-off-by: Daniel P. Berrangé <address@hidden>
> ---
> include/glib-compat.h | 68 +++++++++++++++++++++++++++++++++++++++++++
> tests/test-qga.c | 2 --
> 2 files changed, 68 insertions(+), 2 deletions(-)
Reviewed-by: Thomas Huth <address@hidden>