vadefs.h revision 341825
12311Sjkh/* ===-------- vadefs.h ---------------------------------------------------===
22311Sjkh *
32311Sjkh * Permission is hereby granted, free of charge, to any person obtaining a copy
42311Sjkh * of this software and associated documentation files (the "Software"), to deal
52311Sjkh * in the Software without restriction, including without limitation the rights
62311Sjkh * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
72311Sjkh * copies of the Software, and to permit persons to whom the Software is
82311Sjkh * furnished to do so, subject to the following conditions:
92311Sjkh *
102311Sjkh * The above copyright notice and this permission notice shall be included in
112311Sjkh * all copies or substantial portions of the Software.
122311Sjkh *
132311Sjkh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
142311Sjkh * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
152311Sjkh * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
162311Sjkh * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
172311Sjkh * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
182311Sjkh * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1950479Speter * THE SOFTWARE.
202311Sjkh *
212311Sjkh *===-----------------------------------------------------------------------===
222311Sjkh */
232311Sjkh
242311Sjkh/* Only include this if we are aiming for MSVC compatibility. */
252311Sjkh#ifndef _MSC_VER
262311Sjkh#include_next <vadefs.h>
272311Sjkh#else
282311Sjkh
292311Sjkh#ifndef __clang_vadefs_h
302311Sjkh#define __clang_vadefs_h
312311Sjkh
322311Sjkh#include_next <vadefs.h>
332311Sjkh
342311Sjkh/* Override macros from vadefs.h with definitions that work with Clang. */
352311Sjkh#ifdef _crt_va_start
362311Sjkh#undef _crt_va_start
372311Sjkh#define _crt_va_start(ap, param) __builtin_va_start(ap, param)
382311Sjkh#endif
392311Sjkh#ifdef _crt_va_end
402311Sjkh#undef _crt_va_end
412311Sjkh#define _crt_va_end(ap)          __builtin_va_end(ap)
422311Sjkh#endif
432311Sjkh#ifdef _crt_va_arg
442311Sjkh#undef _crt_va_arg
452311Sjkh#define _crt_va_arg(ap, type)    __builtin_va_arg(ap, type)
462311Sjkh#endif
472311Sjkh
482311Sjkh/* VS 2015 switched to double underscore names, which is an improvement, but now
492311Sjkh * we have to intercept those names too.
502311Sjkh */
512311Sjkh#ifdef __crt_va_start
522311Sjkh#undef __crt_va_start
532311Sjkh#define __crt_va_start(ap, param) __builtin_va_start(ap, param)
542311Sjkh#endif
552311Sjkh#ifdef __crt_va_end
562311Sjkh#undef __crt_va_end
572311Sjkh#define __crt_va_end(ap)          __builtin_va_end(ap)
582311Sjkh#endif
592311Sjkh#ifdef __crt_va_arg
602311Sjkh#undef __crt_va_arg
612311Sjkh#define __crt_va_arg(ap, type)    __builtin_va_arg(ap, type)
622311Sjkh#endif
632311Sjkh
642311Sjkh#endif
652311Sjkh#endif
662311Sjkh