From c4ebb129b7ff9365dc09493aa5224618a6275ed6 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Tue, 8 Jul 2014 05:46:04 +0000 Subject: [PATCH] Headers: conditionalise more declarations Protect MMX specific declarations under a __MMX__ guard. This header can be included on non-x86 architectures (e.g. ARM) which do not support the MMX ISA. Use the preprocessor to prevent these declarations from being processed. llvm-svn: 212512 --- clang/lib/Headers/Intrin.h | 2 ++ clang/test/Headers/arm-intrin.c | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 clang/test/Headers/arm-intrin.c diff --git a/clang/lib/Headers/Intrin.h b/clang/lib/Headers/Intrin.h index cad3a3a0bd8d..d8dc0a4831c7 100644 --- a/clang/lib/Headers/Intrin.h +++ b/clang/lib/Headers/Intrin.h @@ -41,12 +41,14 @@ extern "C" { #endif +#if defined(__MMX__) /* And the random ones that aren't in those files. */ __m64 _m_from_float(float); __m64 _m_from_int(int _l); void _m_prefetch(void *); float _m_to_float(__m64); int _m_to_int(__m64 _M); +#endif /* Other assorted instruction intrinsics. */ void __addfsbyte(unsigned long, unsigned char); diff --git a/clang/test/Headers/arm-intrin.c b/clang/test/Headers/arm-intrin.c new file mode 100644 index 000000000000..294bc332986a --- /dev/null +++ b/clang/test/Headers/arm-intrin.c @@ -0,0 +1,6 @@ +// RUN: %clang -target armv7-windows -I %S/Inputs/include -Xclang -verify -E %s +// expected-no-diagnostics + +typedef __SIZE_TYPE__ size_t; +#include +