aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Headers/mm_malloc.h18
-rw-r--r--lib/Headers/xmmintrin.h4
2 files changed, 9 insertions, 13 deletions
diff --git a/lib/Headers/mm_malloc.h b/lib/Headers/mm_malloc.h
index a402b57fd2..e7da543458 100644
--- a/lib/Headers/mm_malloc.h
+++ b/lib/Headers/mm_malloc.h
@@ -24,28 +24,20 @@
#ifndef __MM_MALLOC_H
#define __MM_MALLOC_H
-#include <stddef.h>
+#include <stdlib.h>
#ifdef _WIN32
#include <malloc.h>
#else
-
-// Forward declare allocation functions to allow this header to parse without
-// any system headers.
#ifndef __cplusplus
-extern void free(void *ptr);
-extern void *malloc(size_t size) __attribute__((__malloc__));
extern int posix_memalign(void **memptr, size_t alignment, size_t size);
#else
-// Some systems (e.g. those with GNU libc) declare some of these functions with
-// an exception specifier. Via an "egregious workaround" in
-// Sema::CheckEquivalentExceptionSpec, Clang accepts the following as valid
-// redeclarations of glibc's declarations.
-extern "C" void free(void *ptr);
-extern "C" void *malloc(size_t size) __attribute__((__malloc__));
+// 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);
#endif
-
#endif
static __inline__ void *__attribute__((__always_inline__, __nodebug__,
diff --git a/lib/Headers/xmmintrin.h b/lib/Headers/xmmintrin.h
index 6f270f8e08..42dd3e8d3b 100644
--- a/lib/Headers/xmmintrin.h
+++ b/lib/Headers/xmmintrin.h
@@ -34,7 +34,11 @@ typedef int __v4si __attribute__((__vector_size__(16)));
typedef float __v4sf __attribute__((__vector_size__(16)));
typedef float __m128 __attribute__((__vector_size__(16)));
+// This header should only be included in a hosted environment as it depends on
+// a standard library to provide allocation routines.
+#if __STDC_HOSTED__
#include <mm_malloc.h>
+#endif
static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
_mm_add_ss(__m128 a, __m128 b)