From 9823ae75e535f41f2ed1e5cc8c743589dfeb8fff Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 4 Jun 2021 23:36:45 +0200 Subject: [PATCH] std-aux: add _NM_MACRO_IDENTITY(), _NM_MACRO_CALL2(), _NM_MACRO_SELECT_FIRST() _NM_MACRO_CALL2() is needed, because we cannot call _NM_MACRO_CALL() inside _NM_MACRO_CALL(). --- src/libnm-std-aux/nm-std-aux.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libnm-std-aux/nm-std-aux.h b/src/libnm-std-aux/nm-std-aux.h index 3311137dc6..fce64a3363 100644 --- a/src/libnm-std-aux/nm-std-aux.h +++ b/src/libnm-std-aux/nm-std-aux.h @@ -475,7 +475,13 @@ nm_streq0(const char *s1, const char *s2) /*****************************************************************************/ -#define _NM_MACRO_CALL(macro, ...) macro(__VA_ARGS__) +#define _NM_MACRO_IDENTITY(...) __VA_ARGS__ + +#define _NM_MACRO_SELECT_FIRST(...) _NM_MACRO_SELECT_FIRST_IMPL(__VA_ARGS__, throwaway) +#define _NM_MACRO_SELECT_FIRST_IMPL(first, ...) first + +#define _NM_MACRO_CALL(macro, ...) macro(__VA_ARGS__) +#define _NM_MACRO_CALL2(macro, ...) macro(__VA_ARGS__) /*****************************************************************************/