mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-24 20:20:23 +01:00
platform: avoid compiler warning in _NMP_OBJECT_TYPE_IS_OBJ_WITH_IFINDEX()
Surisingly, the compiler may detect the remaining obj_type in the default switch. Then, inlining nmp_class_from_type() it may detect that this is only possible to hit with an out or range access to _nmp_classes array. Rework the code to avoid that compiler warning. It's either way not supposed to happen. Also, drop the default switch case and explicitly list the enum values. Otherwise it is error prone to forget a switch case.
This commit is contained in:
parent
fd0d292caf
commit
9848589fbf
1 changed files with 8 additions and 2 deletions
|
|
@ -504,10 +504,16 @@ _NMP_OBJECT_TYPE_IS_OBJ_WITH_IFINDEX (NMPObjectType obj_type)
|
|||
case NMP_OBJECT_TYPE_LNK_VXLAN:
|
||||
case NMP_OBJECT_TYPE_LNK_WIREGUARD:
|
||||
return TRUE;
|
||||
default:
|
||||
nm_assert (nmp_class_from_type (obj_type));
|
||||
|
||||
case NMP_OBJECT_TYPE_ROUTING_RULE:
|
||||
return FALSE;
|
||||
|
||||
case NMP_OBJECT_TYPE_UNKNOWN:
|
||||
case __NMP_OBJECT_TYPE_LAST:
|
||||
break;
|
||||
}
|
||||
nm_assert_not_reached ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#define NMP_OBJECT_CAST_OBJECT(obj) \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue