xref: /freebsd/contrib/llvm-project/clang/lib/Headers/__stdarg_va_arg.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
1 /*===---- __stdarg_va_arg.h - Definitions of va_start, va_arg, va_end-------===
2  *
3  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4  * See https://llvm.org/LICENSE.txt for license information.
5  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6  *
7  *===-----------------------------------------------------------------------===
8  */
9 
10 #ifndef va_arg
11 
12 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
13 /* C23 does not require the second parameter for va_start. */
14 #define va_start(ap, ...) __builtin_va_start(ap, 0)
15 #else
16 /* Versions before C23 do require the second parameter. */
17 #define va_start(ap, param) __builtin_va_start(ap, param)
18 #endif
19 #define va_end(ap) __builtin_va_end(ap)
20 #define va_arg(ap, type) __builtin_va_arg(ap, type)
21 
22 #endif
23