[clang] a0fcb50 - [ARM] Improve arm_neon.h header diagnostic when included on unsupported targets (#147817)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 11 10:21:16 PDT 2025
Author: Jon Roelofs
Date: 2025-07-11T10:21:13-07:00
New Revision: a0fcb50bf99d1d48458ee27ca92e5cd54e9910d5
URL: https://github.com/llvm/llvm-project/commit/a0fcb50bf99d1d48458ee27ca92e5cd54e9910d5
DIFF: https://github.com/llvm/llvm-project/commit/a0fcb50bf99d1d48458ee27ca92e5cd54e9910d5.diff
LOG: [ARM] Improve arm_neon.h header diagnostic when included on unsupported targets (#147817)
The footgun here was that the preprocessor diagnostic that looks for
__ARM_FP would fire when included on targets like x86_64, but the
suggestion it gives in that case is totally bogus. Avoid giving bad
advice, by first checking whether we're being built for an appropriate
target, and only then do the soft-fp check.
rdar://155449666
Added:
Modified:
clang/utils/TableGen/NeonEmitter.cpp
Removed:
################################################################################
diff --git a/clang/utils/TableGen/NeonEmitter.cpp b/clang/utils/TableGen/NeonEmitter.cpp
index 409f1c4f71834..d4fb56e6a39b7 100644
--- a/clang/utils/TableGen/NeonEmitter.cpp
+++ b/clang/utils/TableGen/NeonEmitter.cpp
@@ -2417,7 +2417,11 @@ void NeonEmitter::run(raw_ostream &OS) {
OS << "#ifndef __ARM_NEON_H\n";
OS << "#define __ARM_NEON_H\n\n";
- OS << "#ifndef __ARM_FP\n";
+ OS << "#if !defined(__arm__) && !defined(__aarch64__) && "
+ "!defined(__arm64ec__)\n";
+ OS << "#error \"<arm_neon.h> is intended only for ARM and AArch64 "
+ "targets\"\n";
+ OS << "#elif !defined(__ARM_FP)\n";
OS << "#error \"NEON intrinsics not available with the soft-float ABI. "
"Please use -mfloat-abi=softfp or -mfloat-abi=hard\"\n";
OS << "#else\n\n";
More information about the cfe-commits
mailing list