summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-08-07 11:38:07 +0200
committerThomas Haller <thaller@redhat.com>2020-08-07 11:38:50 +0200
commit07264a5dc1f21eb7233a60f3f902d30591ebd9c9 (patch)
treec9b93724bea19744cb36837df8f6d10257f50ddf /shared
parent24c534225faa786a0a4a4cda6744659493354183 (diff)
downloadNetworkManager-07264a5dc1f21eb7233a60f3f902d30591ebd9c9.tar.gz
shared: avoid "-Wmaybe-uninitialized" in _char_lookup_has()
shared/nm-glib-aux/nm-shared-utils.c: In function ‘nm_utils_escaped_tokens_escape_full’: shared/nm-glib-aux/nm-shared-utils.c:1569:26: error: ‘ch_lookup_as_needed.<U7d10>.table[0]’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1569 | nm_assert (lookup->table[(guint8) 0] == 0); | ^ shared/nm-glib-aux/nm-shared-utils.c:1569:26: error: ‘ch_lookup_as_needed.<U7d10>.table[0]’ may be used uninitialized in this function [-Werror=maybe-uninitialized] Fixes: ae55b98e027f ('shared: add CharLookupTable type for nm_utils_strsplit_set_full()')
Diffstat (limited to 'shared')
-rw-r--r--shared/nm-glib-aux/nm-shared-utils.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-shared-utils.c b/shared/nm-glib-aux/nm-shared-utils.c
index ccb2e0f32d..656bab9a54 100644
--- a/shared/nm-glib-aux/nm-shared-utils.c
+++ b/shared/nm-glib-aux/nm-shared-utils.c
@@ -1563,8 +1563,13 @@ static gboolean
_char_lookup_has (const CharLookupTable *lookup,
char ch)
{
+ /* with some optimization levels, the compiler thinks this code
+ * might access uninitialized @lookup. It is not -- when you look at the
+ * callers of this function. */
+ NM_PRAGMA_WARNING_DISABLE ("-Wmaybe-uninitialized")
nm_assert (lookup->table[(guint8) '\0'] == 0);
return lookup->table[(guint8) ch] != 0;
+ NM_PRAGMA_WARNING_REENABLE
}
static gboolean