mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-24 19:30:07 +01:00
shared: add _NM_ENSURE_TYPE() macro
This commit is contained in:
parent
bdb8e65434
commit
acbab884ee
1 changed files with 12 additions and 0 deletions
|
|
@ -288,6 +288,18 @@ NM_G_ERROR_MSG (GError *error)
|
|||
((type *) (obj))
|
||||
#endif
|
||||
|
||||
#if _NM_CC_SUPPORT_GENERIC
|
||||
/* returns @value, if the type of @value matches @type.
|
||||
* This requires support for C11 _Generic(). If no support is
|
||||
* present, this returns @value directly.
|
||||
*
|
||||
* It's useful to check the let the compiler ensure that @value is
|
||||
* of a certain type. */
|
||||
#define _NM_ENSURE_TYPE(type, value) (_Generic ((value), type: (value)))
|
||||
#else
|
||||
#define _NM_ENSURE_TYPE(type, value) (value)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _NM_IN_SET_EVAL_1( op, _x, y) (_x == (y))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue