aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-11-21 07:57:25 +0100
committerEric Botcazou <ebotcazou@adacore.com>2022-11-21 09:48:42 +0100
commit061839c65de7d04589ced3a4e55ef391e7c66b71 (patch)
tree4bf6febe0cc0a8a5522975ef0b5dedca4776fc14 /gcc/testsuite/gnat.dg
parent454a823dc980bf3631b13670765f1a3eb66e499a (diff)
downloadgcc-061839c65de7d04589ced3a4e55ef391e7c66b71.zip
gcc-061839c65de7d04589ced3a4e55ef391e7c66b71.tar.gz
gcc-061839c65de7d04589ced3a4e55ef391e7c66b71.tar.bz2
Make ARMv8-M attribute cmse_nonsecure_call work in Ada
Unlike most other machine attributes, this one does not work in Ada because, while it applies to pointer-to-function types, it is explicitly marked as requiring declarations in the implementation. Now, in Ada, machine attributes are specified like this: type Non_Secure is access procedure; pragma Machine_Attribute (Non_Secure, "cmse_nonsecure_call"); i.e. not attached to the declaration of Non_Secure. The change extends the support to Ada by also accepting pointer-to-function types in the handler. gcc/ * config/arm/arm.cc (arm_attribute_table) <cmse_nonsecure_call>: Change decl_required field to false. (arm_handle_cmse_nonsecure_call): Deal with a TYPE node. gcc/testsuite/ * gnat.dg/machine_attr2.ads, gnat.dg/machine_attr2.adb: New test.
Diffstat (limited to 'gcc/testsuite/gnat.dg')
-rw-r--r--gcc/testsuite/gnat.dg/machine_attr2.adb15
-rw-r--r--gcc/testsuite/gnat.dg/machine_attr2.ads8
2 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/machine_attr2.adb b/gcc/testsuite/gnat.dg/machine_attr2.adb
new file mode 100644
index 0000000..e98a69a
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/machine_attr2.adb
@@ -0,0 +1,15 @@
+-- { dg-do compile { target arm*-*-* } }
+-- { dg-options "-mcpu=cortex-m33 -mcmse" }
+
+package body Machine_Attr2 is
+
+ procedure Call (Proc : Non_Secure) is
+ begin
+ Proc.all;
+ end;
+
+ procedure Foo; -- { dg-warning "only applies to base type" }
+ pragma Machine_Attribute (Foo, "cmse_nonsecure_call");
+ procedure Foo is null;
+
+end Machine_Attr2;
diff --git a/gcc/testsuite/gnat.dg/machine_attr2.ads b/gcc/testsuite/gnat.dg/machine_attr2.ads
new file mode 100644
index 0000000..4eda09e
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/machine_attr2.ads
@@ -0,0 +1,8 @@
+package Machine_Attr2 is
+
+ type Non_Secure is access procedure;
+ pragma Machine_Attribute (Non_Secure, "cmse_nonsecure_call");
+
+ procedure Call (Proc : Non_Secure);
+
+end Machine_Attr2;