Skip to content

Commit 0d8caac

Browse files
committed
Bump minimum glib version to v2.66
Now that we dropped support for CentOS 8 and Ubuntu 20.04, we can look into bumping the glib version to a new minimum for further clean-ups. According to repology.org, available versions are: CentOS Stream 9: 2.66.7 Debian 11: 2.66.8 Fedora 38: 2.74.1 Freebsd: 2.78.4 Homebrew: 2.80.0 Openbsd: 2.78.4 OpenSuse leap 15.5: 2.70.5 pkgsrc_current: 2.78.4 Ubuntu 22.04: 2.72.1 Thus it should be safe to bump the minimum glib version to 2.66 now. Version 2.66 comes with new functions for URI parsing which will allow further clean-ups in the following patches. Reviewed-by: Daniel P. Berrangé <[email protected]> Message-ID: <[email protected]> Signed-off-by: Thomas Huth <[email protected]>
1 parent b563959 commit 0d8caac

File tree

3 files changed

+5
-42
lines changed

3 files changed

+5
-42
lines changed

include/glib-compat.h

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
/* Ask for warnings for anything that was marked deprecated in
2020
* the defined version, or before. It is a candidate for rewrite.
2121
*/
22-
#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_56
22+
#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_66
2323

2424
/* Ask for warnings if code tries to use function that did not
2525
* exist in the defined version. These risk breaking builds
2626
*/
27-
#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_56
27+
#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_66
2828

2929
#pragma GCC diagnostic push
3030
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@@ -105,29 +105,6 @@ static inline gpointer g_memdup2_qemu(gconstpointer mem, gsize byte_size)
105105
}
106106
#define g_memdup2(m, s) g_memdup2_qemu(m, s)
107107

108-
#if defined(G_OS_UNIX)
109-
/*
110-
* Note: The fallback implementation is not MT-safe, and it returns a copy of
111-
* the libc passwd (must be g_free() after use) but not the content. Because of
112-
* these important differences the caller must be aware of, it's not #define for
113-
* GLib API substitution.
114-
*/
115-
static inline struct passwd *
116-
g_unix_get_passwd_entry_qemu(const gchar *user_name, GError **error)
117-
{
118-
#if GLIB_CHECK_VERSION(2, 64, 0)
119-
return g_unix_get_passwd_entry(user_name, error);
120-
#else
121-
struct passwd *p = getpwnam(user_name);
122-
if (!p) {
123-
g_set_error_literal(error, G_UNIX_ERROR, 0, g_strerror(errno));
124-
return NULL;
125-
}
126-
return (struct passwd *)g_memdup(p, sizeof(*p));
127-
#endif
128-
}
129-
#endif /* G_OS_UNIX */
130-
131108
static inline bool
132109
qemu_g_test_slow(void)
133110
{

meson.build

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ have_xen_pci_passthrough = get_option('xen_pci_passthrough') \
869869

870870
# When bumping glib minimum version, please check also whether to increase
871871
# the _WIN32_WINNT setting in osdep.h according to the value from glib
872-
glib_req_ver = '>=2.56.0'
872+
glib_req_ver = '>=2.66.0'
873873
glib_pc = dependency('glib-2.0', version: glib_req_ver, required: true,
874874
method: 'pkg-config')
875875
glib_cflags = []
@@ -910,20 +910,6 @@ if not cc.compiles('''
910910
to the right pkg-config files for your build target.''')
911911
endif
912912

913-
# Silence clang warnings triggered by glib < 2.57.2
914-
if not cc.compiles('''
915-
#include <glib.h>
916-
typedef struct Foo {
917-
int i;
918-
} Foo;
919-
static void foo_free(Foo *f)
920-
{
921-
g_free(f);
922-
}
923-
G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free)
924-
int main(void) { return 0; }''', dependencies: glib_pc, args: ['-Wunused-function', '-Werror'])
925-
glib_cflags += cc.get_supported_arguments('-Wno-unused-function')
926-
endif
927913
glib = declare_dependency(dependencies: [glib_pc, gmodule],
928914
compile_args: glib_cflags,
929915
version: glib_pc.version())

qga/commands-posix-ssh.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test_get_passwd_entry(const gchar *user_name, GError **error)
3636
return p;
3737
}
3838

39-
#define g_unix_get_passwd_entry_qemu(username, err) \
39+
#define g_unix_get_passwd_entry(username, err) \
4040
test_get_passwd_entry(username, err)
4141
#endif
4242

@@ -46,7 +46,7 @@ get_passwd_entry(const char *username, Error **errp)
4646
g_autoptr(GError) err = NULL;
4747
struct passwd *p;
4848

49-
p = g_unix_get_passwd_entry_qemu(username, &err);
49+
p = g_unix_get_passwd_entry(username, &err);
5050
if (p == NULL) {
5151
error_setg(errp, "failed to lookup user '%s': %s",
5252
username, err->message);

0 commit comments

Comments
 (0)