1*0a6a1f1dSLionel Sambuc /* ===-------- vadefs.h ---------------------------------------------------=== 2*0a6a1f1dSLionel Sambuc * 3*0a6a1f1dSLionel Sambuc * Permission is hereby granted, free of charge, to any person obtaining a copy 4*0a6a1f1dSLionel Sambuc * of this software and associated documentation files (the "Software"), to deal 5*0a6a1f1dSLionel Sambuc * in the Software without restriction, including without limitation the rights 6*0a6a1f1dSLionel Sambuc * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7*0a6a1f1dSLionel Sambuc * copies of the Software, and to permit persons to whom the Software is 8*0a6a1f1dSLionel Sambuc * furnished to do so, subject to the following conditions: 9*0a6a1f1dSLionel Sambuc * 10*0a6a1f1dSLionel Sambuc * The above copyright notice and this permission notice shall be included in 11*0a6a1f1dSLionel Sambuc * all copies or substantial portions of the Software. 12*0a6a1f1dSLionel Sambuc * 13*0a6a1f1dSLionel Sambuc * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14*0a6a1f1dSLionel Sambuc * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15*0a6a1f1dSLionel Sambuc * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16*0a6a1f1dSLionel Sambuc * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17*0a6a1f1dSLionel Sambuc * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18*0a6a1f1dSLionel Sambuc * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19*0a6a1f1dSLionel Sambuc * THE SOFTWARE. 20*0a6a1f1dSLionel Sambuc * 21*0a6a1f1dSLionel Sambuc *===-----------------------------------------------------------------------=== 22*0a6a1f1dSLionel Sambuc */ 23*0a6a1f1dSLionel Sambuc 24*0a6a1f1dSLionel Sambuc /* Only include this if we are aiming for MSVC compatibility. */ 25*0a6a1f1dSLionel Sambuc #ifndef _MSC_VER 26*0a6a1f1dSLionel Sambuc #include_next <vadefs.h> 27*0a6a1f1dSLionel Sambuc #else 28*0a6a1f1dSLionel Sambuc 29*0a6a1f1dSLionel Sambuc #ifndef __clang_vadefs_h 30*0a6a1f1dSLionel Sambuc #define __clang_vadefs_h 31*0a6a1f1dSLionel Sambuc 32*0a6a1f1dSLionel Sambuc #include_next <vadefs.h> 33*0a6a1f1dSLionel Sambuc 34*0a6a1f1dSLionel Sambuc /* Override macros from vadefs.h with definitions that work with Clang. */ 35*0a6a1f1dSLionel Sambuc #ifdef _crt_va_start 36*0a6a1f1dSLionel Sambuc #undef _crt_va_start 37*0a6a1f1dSLionel Sambuc #define _crt_va_start(ap, param) __builtin_va_start(ap, param) 38*0a6a1f1dSLionel Sambuc #endif 39*0a6a1f1dSLionel Sambuc #ifdef _crt_va_end 40*0a6a1f1dSLionel Sambuc #undef _crt_va_end 41*0a6a1f1dSLionel Sambuc #define _crt_va_end(ap) __builtin_va_end(ap) 42*0a6a1f1dSLionel Sambuc #endif 43*0a6a1f1dSLionel Sambuc #ifdef _crt_va_arg 44*0a6a1f1dSLionel Sambuc #undef _crt_va_arg 45*0a6a1f1dSLionel Sambuc #define _crt_va_arg(ap, type) __builtin_va_arg(ap, type) 46*0a6a1f1dSLionel Sambuc #endif 47*0a6a1f1dSLionel Sambuc 48*0a6a1f1dSLionel Sambuc /* VS 2015 switched to double underscore names, which is an improvement, but now 49*0a6a1f1dSLionel Sambuc * we have to intercept those names too. 50*0a6a1f1dSLionel Sambuc */ 51*0a6a1f1dSLionel Sambuc #ifdef __crt_va_start 52*0a6a1f1dSLionel Sambuc #undef __crt_va_start 53*0a6a1f1dSLionel Sambuc #define __crt_va_start(ap, param) __builtin_va_start(ap, param) 54*0a6a1f1dSLionel Sambuc #endif 55*0a6a1f1dSLionel Sambuc #ifdef __crt_va_end 56*0a6a1f1dSLionel Sambuc #undef __crt_va_end 57*0a6a1f1dSLionel Sambuc #define __crt_va_end(ap) __builtin_va_end(ap) 58*0a6a1f1dSLionel Sambuc #endif 59*0a6a1f1dSLionel Sambuc #ifdef __crt_va_arg 60*0a6a1f1dSLionel Sambuc #undef __crt_va_arg 61*0a6a1f1dSLionel Sambuc #define __crt_va_arg(ap, type) __builtin_va_arg(ap, type) 62*0a6a1f1dSLionel Sambuc #endif 63*0a6a1f1dSLionel Sambuc 64*0a6a1f1dSLionel Sambuc #endif 65*0a6a1f1dSLionel Sambuc #endif 66