xref: /freebsd/contrib/llvm-project/clang/lib/Headers/vadefs.h (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric /* ===-------- vadefs.h ---------------------------------------------------===
2*0b57cec5SDimitry Andric  *
3*0b57cec5SDimitry Andric  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric  * See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric  *
7*0b57cec5SDimitry Andric  *===-----------------------------------------------------------------------===
8*0b57cec5SDimitry Andric  */
9*0b57cec5SDimitry Andric 
10*0b57cec5SDimitry Andric /* Only include this if we are aiming for MSVC compatibility. */
11*0b57cec5SDimitry Andric #ifndef _MSC_VER
12*0b57cec5SDimitry Andric #include_next <vadefs.h>
13*0b57cec5SDimitry Andric #else
14*0b57cec5SDimitry Andric 
15*0b57cec5SDimitry Andric #ifndef __clang_vadefs_h
16*0b57cec5SDimitry Andric #define __clang_vadefs_h
17*0b57cec5SDimitry Andric 
18*0b57cec5SDimitry Andric #include_next <vadefs.h>
19*0b57cec5SDimitry Andric 
20*0b57cec5SDimitry Andric /* Override macros from vadefs.h with definitions that work with Clang. */
21*0b57cec5SDimitry Andric #ifdef _crt_va_start
22*0b57cec5SDimitry Andric #undef _crt_va_start
23*0b57cec5SDimitry Andric #define _crt_va_start(ap, param) __builtin_va_start(ap, param)
24*0b57cec5SDimitry Andric #endif
25*0b57cec5SDimitry Andric #ifdef _crt_va_end
26*0b57cec5SDimitry Andric #undef _crt_va_end
27*0b57cec5SDimitry Andric #define _crt_va_end(ap)          __builtin_va_end(ap)
28*0b57cec5SDimitry Andric #endif
29*0b57cec5SDimitry Andric #ifdef _crt_va_arg
30*0b57cec5SDimitry Andric #undef _crt_va_arg
31*0b57cec5SDimitry Andric #define _crt_va_arg(ap, type)    __builtin_va_arg(ap, type)
32*0b57cec5SDimitry Andric #endif
33*0b57cec5SDimitry Andric 
34*0b57cec5SDimitry Andric /* VS 2015 switched to double underscore names, which is an improvement, but now
35*0b57cec5SDimitry Andric  * we have to intercept those names too.
36*0b57cec5SDimitry Andric  */
37*0b57cec5SDimitry Andric #ifdef __crt_va_start
38*0b57cec5SDimitry Andric #undef __crt_va_start
39*0b57cec5SDimitry Andric #define __crt_va_start(ap, param) __builtin_va_start(ap, param)
40*0b57cec5SDimitry Andric #endif
41*0b57cec5SDimitry Andric #ifdef __crt_va_end
42*0b57cec5SDimitry Andric #undef __crt_va_end
43*0b57cec5SDimitry Andric #define __crt_va_end(ap)          __builtin_va_end(ap)
44*0b57cec5SDimitry Andric #endif
45*0b57cec5SDimitry Andric #ifdef __crt_va_arg
46*0b57cec5SDimitry Andric #undef __crt_va_arg
47*0b57cec5SDimitry Andric #define __crt_va_arg(ap, type)    __builtin_va_arg(ap, type)
48*0b57cec5SDimitry Andric #endif
49*0b57cec5SDimitry Andric 
50*0b57cec5SDimitry Andric #endif
51*0b57cec5SDimitry Andric #endif
52