mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 04:18:07 +02:00
std-aux: add NM_ENSURE_IS_TYPE() macro
This commit is contained in:
parent
cf1b7d43df
commit
ae14caf05d
1 changed files with 6 additions and 0 deletions
|
|
@ -192,6 +192,12 @@ typedef uint64_t _nm_bitwise nm_be64_t;
|
||||||
|
|
||||||
#define NM_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0]))
|
#define NM_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||||
|
|
||||||
|
/* This does a compile time check that "type" is a suitable C type. It either
|
||||||
|
* returns a compile time constant of 1 or it fails compilation. The point
|
||||||
|
* is only in macros to check that a macro parameter (what we might pass to
|
||||||
|
* sizeof() is really a type, and not a variable. */
|
||||||
|
#define NM_ENSURE_IS_TYPE(type) (sizeof(void (*)(type[])) == sizeof(void (*)(void *)))
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue