Headers: conditionalise more declarations
authorSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 8 Jul 2014 05:46:04 +0000 (05:46 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 8 Jul 2014 05:46:04 +0000 (05:46 +0000)
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
clang/test/Headers/arm-intrin.c [new file with mode: 0644]

index cad3a3a..d8dc0a4 100644 (file)
 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 (file)
index 0000000..294bc33
--- /dev/null
@@ -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 <Intrin.h>
+