macro: rename VA_ARGS_FOREACH to FOREACH_ARGUMENT
"VA_ARGS" is kinda confusing, as the macro just iterates through all arguments passed and has nothing to do with va_arg.
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
({ \
|
||||
typeof(type) UNIQ_T(_mask, uniq) = (type)0; \
|
||||
int UNIQ_T(_i, uniq); \
|
||||
VA_ARGS_FOREACH(UNIQ_T(_i, uniq), ##__VA_ARGS__) \
|
||||
FOREACH_ARGUMENT(UNIQ_T(_i, uniq), ##__VA_ARGS__) \
|
||||
UNIQ_T(_mask, uniq) |= INDEX_TO_MASK(type, UNIQ_T(_i, uniq)); \
|
||||
UNIQ_T(_mask, uniq); \
|
||||
})
|
||||
|
||||
+4
-4
@@ -380,11 +380,11 @@ assert_cc(sizeof(dummy_t) == 0);
|
||||
_q && _q > (base) ? &_q[-1] : NULL; \
|
||||
})
|
||||
|
||||
/* Iterate through each variadic arg. All must be the same type as 'entry' or must be implicitly
|
||||
/* Iterate through each argument passed. All must be the same type as 'entry' or must be implicitly
|
||||
* convertible. The iteration variable 'entry' must already be defined. */
|
||||
#define VA_ARGS_FOREACH(entry, ...) \
|
||||
_VA_ARGS_FOREACH(entry, UNIQ_T(_entries_, UNIQ), UNIQ_T(_current_, UNIQ), UNIQ_T(_va_sentinel_, UNIQ), ##__VA_ARGS__)
|
||||
#define _VA_ARGS_FOREACH(entry, _entries_, _current_, _va_sentinel_, ...) \
|
||||
#define FOREACH_ARGUMENT(entry, ...) \
|
||||
_FOREACH_ARGUMENT(entry, UNIQ_T(_entries_, UNIQ), UNIQ_T(_current_, UNIQ), UNIQ_T(_va_sentinel_, UNIQ), ##__VA_ARGS__)
|
||||
#define _FOREACH_ARGUMENT(entry, _entries_, _current_, _va_sentinel_, ...) \
|
||||
for (typeof(entry) _va_sentinel_[1] = {}, _entries_[] = { __VA_ARGS__ __VA_OPT__(,) _va_sentinel_[0] }, *_current_ = _entries_; \
|
||||
((long)(_current_ - _entries_) < (long)(ELEMENTSOF(_entries_) - 1)) && ({ entry = *_current_; true; }); \
|
||||
_current_++)
|
||||
|
||||
Reference in New Issue
Block a user