mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-16 01:50:29 +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. (cherry picked from commit9848589fbf) (cherry picked from commit6f189da7b6)
This commit is contained in:
parent
57e5e2d5a9
commit
6da20c24cd
1 changed files with 8 additions and 2 deletions
|
|
@ -510,10 +510,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