1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
From a1ba437195286af3389ba9f2d43b8cb6c73ba3d8 Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Thu, 12 Oct 2023 15:55:58 +0100
Subject: [PATCH 144/157] [Backport][SME] AArch64: Fix Armv9-a warnings that
get emitted whenever a ACLE header is used.
Reference: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=de593b3cffdc9c030c5e697ad9092b1b085dabc4
At the moment, trying to use -march=armv9-a with any ACLE header such as
arm_neon.h results in rows and rows of warnings saying:
<built-in>: warning: "__ARM_ARCH" redefined
<built-in>: note: this is the location of the previous definition
This is obviously not useful and happens because the header was defined at
__ARM_ARCH == 8 and the commandline changes it.
The Arm port solves this by undef the macro during argument processing and we do
the same on AArch64 for the majority of macros. However we define this macro
using a different helper which requires the manual undef.
Thanks,
Tamar
gcc/ChangeLog:
* config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Add undef.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/armv9_warning.c: New test.
---
gcc/config/aarch64/aarch64-c.cc | 1 +
gcc/testsuite/gcc.target/aarch64/armv9_warning.c | 5 +++++
2 files changed, 6 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/aarch64/armv9_warning.c
diff --git a/gcc/config/aarch64/aarch64-c.cc b/gcc/config/aarch64/aarch64-c.cc
index 745719d8b..2d2ac42c4 100644
--- a/gcc/config/aarch64/aarch64-c.cc
+++ b/gcc/config/aarch64/aarch64-c.cc
@@ -129,6 +129,7 @@ aarch64_update_cpp_builtins (cpp_reader *pfile)
{
aarch64_def_or_undef (flag_unsafe_math_optimizations, "__ARM_FP_FAST", pfile);
+ cpp_undef (pfile, "__ARM_ARCH");
builtin_define_with_int_value ("__ARM_ARCH", AARCH64_ISA_V9A ? 9 : 8);
builtin_define_with_int_value ("__ARM_SIZEOF_MINIMAL_ENUM",
diff --git a/gcc/testsuite/gcc.target/aarch64/armv9_warning.c b/gcc/testsuite/gcc.target/aarch64/armv9_warning.c
new file mode 100644
index 000000000..35690d5bc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/armv9_warning.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv9-a -Wpedantic -Werror" } */
+
+#include <arm_neon.h>
+
--
2.33.0
|