Hi:
Pls help me!
I use ncs v2.6.1.
C:\ncs\v2.6.1\zephyr\include\zephyr\sys\util_internal.h
When I check #define Z_IS_EMPTY_(...) No matter what I input, I can't get Z_S_SEMPTY_CSE_0001.
It is a check EMPTY.
if #define XX 1 use IS_EMPTY(XX).
#define IS_EMPTY(...) Z_IS_EMPTY_(__VA_ARGS__)
#define Z_TRIGGER_PARENTHESIS_(...) ,
#define Z_IS_EMPTY_(...) \
Z_IS_EMPTY__( \
Z_HAS_COMMA(__VA_ARGS__), \
Z_HAS_COMMA(Z_TRIGGER_PARENTHESIS_ __VA_ARGS__), \
Z_HAS_COMMA(__VA_ARGS__ (/*empty*/)), \
Z_HAS_COMMA(Z_TRIGGER_PARENTHESIS_ __VA_ARGS__ (/*empty*/)))
/* analysis
Z_IS_EMPTY__( \
Z_HAS_COMMA(XX), \
Z_HAS_COMMA(, XX), \
Z_HAS_COMMA(XX() ), \
Z_HAS_COMMA(, XX () ) \
->
0,\
1,\
0,\
1,\
*/
#define Z_IS_EMPTY__(_0, _1, _2, _3) \
Z_HAS_COMMA(Z_CAT5(Z_IS_EMPTY_CASE_, _0, _1, _2, _3))
/* analysis
Z_HAS_COMMA(Z_CAT5(Z_IS_EMPTY_CASE_, 0, 1, 0, 1))
->
Z_IS_EMPTY_CASE_0101
not Z_IS_EMPTY_CASE_0001
So it should return 0,But we know it has already been defined, it should return 1.
*/
#define Z_IS_EMPTY_CASE_0001 ,
#define Z_HAS_COMMA(...) \
NUM_VA_ARGS_LESS_1_IMPL(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)
#define NUM_VA_ARGS_LESS_1_IMPL( \
_ignored, \
_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
_11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \
_21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
_31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
_41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \
_51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \
_61, _62, N, ...) N