1 /* ===-------- vadefs.h ---------------------------------------------------===
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 /* Only include this if we are aiming for MSVC compatibility. */
11 #ifndef _MSC_VER
12 #include_next <vadefs.h>
13 #else
14 
15 #ifndef __clang_vadefs_h
16 #define __clang_vadefs_h
17 
18 #include_next <vadefs.h>
19 
20 /* Override macros from vadefs.h with definitions that work with Clang. */
21 #ifdef _crt_va_start
22 #undef _crt_va_start
23 #define _crt_va_start(ap, param) __builtin_va_start(ap, param)
24 #endif
25 #ifdef _crt_va_end
26 #undef _crt_va_end
27 #define _crt_va_end(ap)          __builtin_va_end(ap)
28 #endif
29 #ifdef _crt_va_arg
30 #undef _crt_va_arg
31 #define _crt_va_arg(ap, type)    __builtin_va_arg(ap, type)
32 #endif
33 
34 /* VS 2015 switched to double underscore names, which is an improvement, but now
35  * we have to intercept those names too.
36  */
37 #ifdef __crt_va_start
38 #undef __crt_va_start
39 #define __crt_va_start(ap, param) __builtin_va_start(ap, param)
40 #endif
41 #ifdef __crt_va_end
42 #undef __crt_va_end
43 #define __crt_va_end(ap)          __builtin_va_end(ap)
44 #endif
45 #ifdef __crt_va_arg
46 #undef __crt_va_arg
47 #define __crt_va_arg(ap, type)    __builtin_va_arg(ap, type)
48 #endif
49 
50 #endif
51 #endif
52