Skip to content

Commit a0fcb50

Browse files
authored
[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
1 parent df10df8 commit a0fcb50

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clang/utils/TableGen/NeonEmitter.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2417,7 +2417,11 @@ void NeonEmitter::run(raw_ostream &OS) {
24172417
OS << "#ifndef __ARM_NEON_H\n";
24182418
OS << "#define __ARM_NEON_H\n\n";
24192419

2420-
OS << "#ifndef __ARM_FP\n";
2420+
OS << "#if !defined(__arm__) && !defined(__aarch64__) && "
2421+
"!defined(__arm64ec__)\n";
2422+
OS << "#error \"<arm_neon.h> is intended only for ARM and AArch64 "
2423+
"targets\"\n";
2424+
OS << "#elif !defined(__ARM_FP)\n";
24212425
OS << "#error \"NEON intrinsics not available with the soft-float ABI. "
24222426
"Please use -mfloat-abi=softfp or -mfloat-abi=hard\"\n";
24232427
OS << "#else\n\n";

0 commit comments

Comments
 (0)