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