From 70971d114126cbaff8531779d443ef522bdc5d02 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 12 Aug 2020 14:01:21 +0200 Subject: all: avoid wrong compiler warning about uninitalized variables with LTO Seems with LTO the compiler can sometimes think that thes variables are uninitialized. Usually those code paths are only after an assertion was hit (g_return*()), but we still need to workaround the warning. --- shared/nm-glib-aux/nm-shared-utils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'shared') diff --git a/shared/nm-glib-aux/nm-shared-utils.c b/shared/nm-glib-aux/nm-shared-utils.c index 656bab9a54..f6a9b83c01 100644 --- a/shared/nm-glib-aux/nm-shared-utils.c +++ b/shared/nm-glib-aux/nm-shared-utils.c @@ -4209,7 +4209,10 @@ nm_utils_hexstr2bin_alloc (const char *hexstr, guint8 *buffer; gsize buffer_len, len; - g_return_val_if_fail (hexstr, NULL); + if (G_UNLIKELY (!hexstr)) { + NM_SET_OUT (out_len, 0); + g_return_val_if_fail (hexstr, NULL); + } nm_assert (required_len > 0 || out_len); -- cgit v1.2.1