mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-13 10:50: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.
(cherry picked from commit 9848589fbf)
This commit is contained in:
parent
139586c95c
commit
6f189da7b6
1 changed files with 8 additions and 2 deletions
|
|
@ -496,10 +496,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