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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 14 05:11:39 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:

> I haven't found the `*-compat` warnings ever actually helpful (if you want to check compat with previous versions, just build with the previous version!), but, given that they do exist, should a new diagnostic be emitted under `-Wpre-c23-compat` when __builtin_c23_va_start is called with 1-arg?

Yeah, it probably should given that `va_start(list)` won't compile under previous language modes.

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


More information about the cfe-commits mailing list