mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 15:10:09 +01:00
platform: workaround -Wmaybe-uninitialized with LTO
With LTO builds, it assumes that the assertion-failed code-paths
can be reached, and thus a warning gets emitted:
In function nmp_cache_lookup,
inlined from nm_platform_lookup at src/libnm-platform/nm-platform.c:3377:12,
inlined from nm_platform_lookup_object at ./src/libnm-platform/nmp-object.h:975:12:
src/libnm-platform/nmp-object.h:742:46: error: lookup.cache_id_type may be used uninitialized [-Werror=maybe-uninitialized]
742 | return nmp_cache_lookup_all(cache, lookup->cache_id_type, &lookup->selector_obj);
| ^
./src/libnm-platform/nmp-object.h: In function nm_platform_lookup_object:
./src/libnm-platform/nmp-object.h:972:15: note: lookup declared here
972 | NMPLookup lookup;
| ^
This commit is contained in:
parent
80cab06a14
commit
1ff2d13b7d
1 changed files with 4 additions and 4 deletions
|
|
@ -2078,6 +2078,9 @@ nmp_lookup_init_obj_type(NMPLookup *lookup, NMPObjectType obj_type)
|
|||
nm_assert(lookup);
|
||||
|
||||
switch (obj_type) {
|
||||
default:
|
||||
nm_assert_not_reached();
|
||||
/* fall-through */
|
||||
case NMP_OBJECT_TYPE_LINK:
|
||||
case NMP_OBJECT_TYPE_IP4_ADDRESS:
|
||||
case NMP_OBJECT_TYPE_IP6_ADDRESS:
|
||||
|
|
@ -2089,9 +2092,6 @@ nmp_lookup_init_obj_type(NMPLookup *lookup, NMPObjectType obj_type)
|
|||
_nmp_object_stackinit_from_type(&lookup->selector_obj, obj_type);
|
||||
lookup->cache_id_type = NMP_CACHE_ID_TYPE_OBJECT_TYPE;
|
||||
return _L(lookup);
|
||||
default:
|
||||
nm_assert_not_reached();
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2106,7 +2106,7 @@ nmp_lookup_init_link_by_ifname(NMPLookup *lookup, const char *ifname)
|
|||
|
||||
o = _nmp_object_stackinit_from_type(&lookup->selector_obj, NMP_OBJECT_TYPE_LINK);
|
||||
if (g_strlcpy(o->link.name, ifname, sizeof(o->link.name)) >= sizeof(o->link.name))
|
||||
g_return_val_if_reached(NULL);
|
||||
nm_assert_not_reached();
|
||||
lookup->cache_id_type = NMP_CACHE_ID_TYPE_LINK_BY_IFNAME;
|
||||
return _L(lookup);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue