aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.adb
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2024-03-25 22:49:58 +0100
committerMarc Poulhiès <poulhies@adacore.com>2024-05-20 09:47:04 +0200
commit32aa8b92c59d9c8343a618c7d1614bed7b0e107d (patch)
treea569c2eb0af5784bcf4f5d65ddf67ce542ac0898 /gcc/ada/sem_attr.adb
parent4ed963a52a0a7349f0beb765ee0802857d1752eb (diff)
downloadgcc-32aa8b92c59d9c8343a618c7d1614bed7b0e107d.zip
gcc-32aa8b92c59d9c8343a618c7d1614bed7b0e107d.tar.gz
gcc-32aa8b92c59d9c8343a618c7d1614bed7b0e107d.tar.bz2
ada: Apply restriction No_Implementation_Attributes to source nodes only
Restriction No_Implementation_Attributes must not be applied to nodes that come from expansion. In particular, it must not be applied to Object_Size, which is implementation-defined attribute before Ada 2022, but appears in expansion of tagged types since Ada 95. gcc/ada/ * sem_attr.adb (Analyze_Attribute): Move IF statement that checks restriction No_Implementation_Attributes for Ada 2005, 2012 and Ada 2022 attributes inside Comes_From_Source condition that checks the same restriction for Ada 83 attributes.
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r--gcc/ada/sem_attr.adb27
1 files changed, 14 insertions, 13 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 6c32d20..414224e 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -3221,9 +3221,10 @@ package body Sem_Attr is
Check_Restriction_No_Use_Of_Attribute (N);
- -- Deal with Ada 83 issues
-
if Comes_From_Source (N) then
+
+ -- Deal with Ada 83 issues
+
if not Attribute_83 (Attr_Id) then
if Ada_Version = Ada_83 then
Error_Msg_Name_1 := Aname;
@@ -3234,19 +3235,19 @@ package body Sem_Attr is
Check_Restriction (No_Implementation_Attributes, N);
end if;
end if;
- end if;
- -- Deal with Ada 2005 attributes that are implementation attributes
- -- because they appear in a version of Ada before Ada 2005, ditto for
- -- Ada 2012 and Ada 2022 attributes appearing in an earlier version.
+ -- Deal with Ada 2005 attributes that are implementation attributes
+ -- because they appear in a version of Ada before Ada 2005, ditto for
+ -- Ada 2012 and Ada 2022 attributes appearing in an earlier version.
- if (Attribute_05 (Attr_Id) and then Ada_Version < Ada_2005)
- or else
- (Attribute_12 (Attr_Id) and then Ada_Version < Ada_2012)
- or else
- (Attribute_22 (Attr_Id) and then Ada_Version < Ada_2022)
- then
- Check_Restriction (No_Implementation_Attributes, N);
+ if (Attribute_05 (Attr_Id) and then Ada_Version < Ada_2005)
+ or else
+ (Attribute_12 (Attr_Id) and then Ada_Version < Ada_2012)
+ or else
+ (Attribute_22 (Attr_Id) and then Ada_Version < Ada_2022)
+ then
+ Check_Restriction (No_Implementation_Attributes, N);
+ end if;
end if;
-- Remote access to subprogram type access attribute reference needs