[clang] [C23] Add __builtin_c23_va_start (PR #131166)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 13 09:35:40 PDT 2025


================
@@ -6,27 +6,20 @@
 
 #include <stdarg.h>
 
-#define DERP this is an error
-
 void func(...) { // expected-warning {{'...' as the only parameter of a function is incompatible with C standards before C23}}
   // Show that va_start doesn't require the second argument in C23 mode.
   va_list list;
-  va_start(list); // expected-warning {{passing no argument for the '...' parameter of a variadic macro is incompatible with C standards before C23}} expected-note@* {{macro 'va_start' defined here}}
-  va_end(list);
-
-  // Show that va_start doesn't expand or evaluate the second argument.
-  va_start(list, DERP);
+  va_start(list);
----------------
AaronBallman wrote:

> `// expected-warning {{passing no argument for the '...' parameter of a variadic macro is incompatible with C standards before C23}}`

This no longer fires because the definition of `va_start` in C23 mode now passes `__VA_ARGS__` so `list` is being passed as the variadic argument.

> `// Show that va_start doesn't expand or evaluate the second argument.`

This was changed during NB comment resolution. Now arguments are evaluated and expanded.

https://github.com/llvm/llvm-project/pull/131166


More information about the cfe-commits mailing list