This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // RUN: cc -Wall -Wextra %s && ./a.out | |
| #include <assert.h> | |
| #if defined(__GNUC__) || defined(__clang__) | |
| // Supports 0-10 arguments | |
| #define VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N | |
| // ## deletes preceding comma if _VA_ARGS__ is empty (GCC, Clang) | |
| #define VA_NARGS(...) VA_NARGS_IMPL(_, ## __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) | |
| #else |