serge-sans-paille created this revision. serge-sans-paille added reviewers: craig.topper, RKSimon. serge-sans-paille requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
It doesn't make sense to include those headers on the wrong architecture, provide an explicit error message in that case. Fix https://bugs.llvm.org/show_bug.cgi?id=48915 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D109686 Files: clang/lib/Headers/ammintrin.h clang/lib/Headers/emmintrin.h clang/lib/Headers/immintrin.h clang/lib/Headers/mmintrin.h clang/lib/Headers/nmmintrin.h clang/lib/Headers/pmmintrin.h clang/lib/Headers/smmintrin.h clang/lib/Headers/tmmintrin.h clang/lib/Headers/wmmintrin.h clang/lib/Headers/xmmintrin.h clang/test/Headers/xmmintrin-unsupported.c
Index: clang/test/Headers/xmmintrin-unsupported.c =================================================================== --- /dev/null +++ clang/test/Headers/xmmintrin-unsupported.c @@ -0,0 +1,5 @@ +// RUN: not %clang_cc1 %s -triple aarch64-eabi -fsyntax-only 2>&1 | FileCheck %s +// +// REQUIRES: x86-registered-target +// CHECK: This header is only meant to be used on x86 and x64 architecture +#include <xmmintrin.h> Index: clang/lib/Headers/xmmintrin.h =================================================================== --- clang/lib/Headers/xmmintrin.h +++ clang/lib/Headers/xmmintrin.h @@ -10,6 +10,10 @@ #ifndef __XMMINTRIN_H #define __XMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include <mmintrin.h> typedef int __v4si __attribute__((__vector_size__(16))); Index: clang/lib/Headers/wmmintrin.h =================================================================== --- clang/lib/Headers/wmmintrin.h +++ clang/lib/Headers/wmmintrin.h @@ -10,6 +10,10 @@ #ifndef __WMMINTRIN_H #define __WMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include <emmintrin.h> #include <__wmmintrin_aes.h> Index: clang/lib/Headers/tmmintrin.h =================================================================== --- clang/lib/Headers/tmmintrin.h +++ clang/lib/Headers/tmmintrin.h @@ -10,6 +10,10 @@ #ifndef __TMMINTRIN_H #define __TMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include <pmmintrin.h> /* Define the default attributes for the functions in this file. */ Index: clang/lib/Headers/smmintrin.h =================================================================== --- clang/lib/Headers/smmintrin.h +++ clang/lib/Headers/smmintrin.h @@ -10,6 +10,10 @@ #ifndef __SMMINTRIN_H #define __SMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include <tmmintrin.h> /* Define the default attributes for the functions in this file. */ Index: clang/lib/Headers/pmmintrin.h =================================================================== --- clang/lib/Headers/pmmintrin.h +++ clang/lib/Headers/pmmintrin.h @@ -10,6 +10,10 @@ #ifndef __PMMINTRIN_H #define __PMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include <emmintrin.h> /* Define the default attributes for the functions in this file. */ Index: clang/lib/Headers/nmmintrin.h =================================================================== --- clang/lib/Headers/nmmintrin.h +++ clang/lib/Headers/nmmintrin.h @@ -10,6 +10,10 @@ #ifndef __NMMINTRIN_H #define __NMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + /* To match expectations of gcc we put the sse4.2 definitions into smmintrin.h, just include it now then. */ #include <smmintrin.h> Index: clang/lib/Headers/mmintrin.h =================================================================== --- clang/lib/Headers/mmintrin.h +++ clang/lib/Headers/mmintrin.h @@ -10,6 +10,10 @@ #ifndef __MMINTRIN_H #define __MMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + typedef long long __m64 __attribute__((__vector_size__(8), __aligned__(8))); typedef long long __v1di __attribute__((__vector_size__(8))); Index: clang/lib/Headers/immintrin.h =================================================================== --- clang/lib/Headers/immintrin.h +++ clang/lib/Headers/immintrin.h @@ -10,6 +10,10 @@ #ifndef __IMMINTRIN_H #define __IMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include <x86gprintrin.h> #if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ Index: clang/lib/Headers/emmintrin.h =================================================================== --- clang/lib/Headers/emmintrin.h +++ clang/lib/Headers/emmintrin.h @@ -10,6 +10,10 @@ #ifndef __EMMINTRIN_H #define __EMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include <xmmintrin.h> typedef double __m128d __attribute__((__vector_size__(16), __aligned__(16))); Index: clang/lib/Headers/ammintrin.h =================================================================== --- clang/lib/Headers/ammintrin.h +++ clang/lib/Headers/ammintrin.h @@ -10,6 +10,10 @@ #ifndef __AMMINTRIN_H #define __AMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include <pmmintrin.h> /* Define the default attributes for the functions in this file. */
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits