https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107980
--- Comment #8 from Aaron Ballman <aaron at aaronballman dot com> --- (Sorry, I meant __VA_ARGS__ and not __VA_OPT__; C23 on the brain!) (In reply to Andrew Pinski from comment #6) > Maybe add a _Static_warn builtin instead which is like _Static_assert but > instead of an error, it is a warning. > > That is: > #define va_start(ap, ...) (_Static_warn(__builtin_va_opt_count(__VA_OPT__) > <= 1, "More than one argument supplied to the macro va_start"), > __builtin_va_start(ap, 0)) > > > THe only issue is that message does not get translated. Huh, that's a really neat idea to consider! But _Static_assert is a declaration, not an expression, so we'd have to use a statement expression there instead of rely on the comma operator. But I could use that for both diagnosing passing > 2 args as well as passing < 2 args (we sometimes like to warn "this feature is incompatible with standards before <blah>" in Clang). (In reply to Jakub Jelinek from comment #7) > Why do you need a builtin for counting number of arguments in __VA_OPT__? > That can be done in the preprocessor. All one needs is 1, 2 or more > arguments. Yes, you can beat the preprocessor into doing this for you, but a builtin that counts the number of arguments in __VA_ARGS__ would solve a problem users have (https://stackoverflow.com/questions/2124339/c-preprocessor-va-args-number-of-arguments), so I figured it was better than preprocessor games.