diff options
author | Daniel P. Berrangé <berrange@redhat.com> | 2018-05-04 16:25:00 +0100 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2018-06-29 12:22:28 +0100 |
commit | e71e8cc035558eabd6b3e19f6d3254c754c027ef (patch) | |
tree | 1bb21ef5769d36b96c1616ff90a7949044d9f51b /tests/test-qga.c | |
parent | e7b3af81597db1a6b55f2c15d030d703c6b2c6ac (diff) |
glib: enforce the minimum required version and warn about old APIs
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é <berrange@redhat.com>
Diffstat (limited to 'tests/test-qga.c')
-rw-r--r-- | tests/test-qga.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/tests/test-qga.c b/tests/test-qga.c index 18e63cb533..30c9643257 100644 --- a/tests/test-qga.c +++ b/tests/test-qga.c @@ -744,12 +744,10 @@ static void test_qga_config(gconstpointer data) strv = g_key_file_get_string_list(kf, "general", "blacklist", &n, &error); g_assert_cmpint(n, ==, 2); -#if GLIB_CHECK_VERSION(2, 44, 0) g_assert_true(g_strv_contains((const char * const *)strv, "guest-ping")); g_assert_true(g_strv_contains((const char * const *)strv, "guest-get-time")); -#endif g_assert_no_error(error); g_strfreev(strv); |