Index: lib/Headers/_gnuc_va_list.h =================================================================== --- lib/Headers/_gnuc_va_list.h +++ lib/Headers/_gnuc_va_list.h @@ -0,0 +1,29 @@ +/*===---- _gnuc_va_list.h-------------------------------------------------=== +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +* +*===-----------------------------------------------------------------------=== +*/ + +#pragma once + +#ifndef _VA_LIST_DECLARED +#define _VA_LIST_DECLARED +typedef __builtin_va_list __gnuc_va_list; +#endif Index: lib/Headers/mm_malloc.h =================================================================== --- lib/Headers/mm_malloc.h +++ lib/Headers/mm_malloc.h @@ -24,26 +24,32 @@ #ifndef __MM_MALLOC_H #define __MM_MALLOC_H -#include +#ifdef __cplusplus +extern "C" void free(void *); +extern "C" void *malloc(__SIZE_TYPE__); +#else +void free(void *); +void *malloc(__SIZE_TYPE__); +#endif #ifdef _WIN32 #include #else #ifndef __cplusplus -extern int posix_memalign(void **__memptr, size_t __alignment, size_t __size); +extern int posix_memalign(void **__memptr, __SIZE_TYPE__ __alignment, __SIZE_TYPE__ __size); #else // Some systems (e.g. those with GNU libc) declare posix_memalign with an // exception specifier. Via an "egregious workaround" in // Sema::CheckEquivalentExceptionSpec, Clang accepts the following as a valid // redeclaration of glibc's declaration. -extern "C" int posix_memalign(void **__memptr, size_t __alignment, size_t __size); +extern "C" int posix_memalign(void **__memptr, __SIZE_TYPE__ __alignment, __SIZE_TYPE__ __size); #endif #endif #if !(defined(_WIN32) && defined(_mm_malloc)) static __inline__ void *__attribute__((__always_inline__, __nodebug__, __malloc__)) -_mm_malloc(size_t __size, size_t __align) +_mm_malloc(__SIZE_TYPE__ __size, __SIZE_TYPE__ __align) { if (__align == 1) { return malloc(__size); Index: lib/Headers/stdarg.h =================================================================== --- lib/Headers/stdarg.h +++ lib/Headers/stdarg.h @@ -26,6 +26,8 @@ #ifndef __STDARG_H #define __STDARG_H +#include <_gnuc_va_list.h> + #ifndef _VA_LIST typedef __builtin_va_list va_list; #define _VA_LIST @@ -43,10 +45,4 @@ #define va_copy(dest, src) __builtin_va_copy(dest, src) #endif -/* Hack required to make standard headers work, at least on Ubuntu */ -#ifndef __GNUC_VA_LIST -#define __GNUC_VA_LIST 1 -#endif -typedef __builtin_va_list __gnuc_va_list; - #endif /* __STDARG_H */