mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
macro: add 21st case for IN_SET
This commit is contained in:
@@ -350,11 +350,12 @@ assert_cc(sizeof(long long) == sizeof(intmax_t));
|
||||
#define CASE_F_18(X, ...) case X: CASE_F_17( __VA_ARGS__)
|
||||
#define CASE_F_19(X, ...) case X: CASE_F_18( __VA_ARGS__)
|
||||
#define CASE_F_20(X, ...) case X: CASE_F_19( __VA_ARGS__)
|
||||
#define CASE_F_21(X, ...) case X: CASE_F_20( __VA_ARGS__)
|
||||
|
||||
#define GET_CASE_F(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,NAME,...) NAME
|
||||
#define GET_CASE_F(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,NAME,...) NAME
|
||||
#define FOR_EACH_MAKE_CASE(...) \
|
||||
GET_CASE_F(__VA_ARGS__,CASE_F_20,CASE_F_19,CASE_F_18,CASE_F_17,CASE_F_16,CASE_F_15,CASE_F_14,CASE_F_13,CASE_F_12,CASE_F_11, \
|
||||
CASE_F_10,CASE_F_9,CASE_F_8,CASE_F_7,CASE_F_6,CASE_F_5,CASE_F_4,CASE_F_3,CASE_F_2,CASE_F_1) \
|
||||
GET_CASE_F(__VA_ARGS__,CASE_F_21,CASE_F_20,CASE_F_19,CASE_F_18,CASE_F_17,CASE_F_16,CASE_F_15,CASE_F_14,CASE_F_13,CASE_F_12, \
|
||||
CASE_F_11,CASE_F_10,CASE_F_9,CASE_F_8,CASE_F_7,CASE_F_6,CASE_F_5,CASE_F_4,CASE_F_3,CASE_F_2,CASE_F_1) \
|
||||
(__VA_ARGS__)
|
||||
|
||||
#define IN_SET(x, first, ...) \
|
||||
@@ -363,7 +364,7 @@ assert_cc(sizeof(long long) == sizeof(intmax_t));
|
||||
/* If the build breaks in the line below, you need to extend the case macros. We use typeof(+x) \
|
||||
* here to widen the type of x if it is a bit-field as this would otherwise be illegal. */ \
|
||||
static const typeof(+x) __assert_in_set[] _unused_ = { first, __VA_ARGS__ }; \
|
||||
assert_cc(ELEMENTSOF(__assert_in_set) <= 20); \
|
||||
assert_cc(ELEMENTSOF(__assert_in_set) <= 21); \
|
||||
switch (x) { \
|
||||
FOR_EACH_MAKE_CASE(first, __VA_ARGS__) \
|
||||
_found = true; \
|
||||
|
||||
Reference in New Issue
Block a user