aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/restrict.adb
diff options
context:
space:
mode:
authorGhjuvan Lacambre <lacambre@adacore.com>2020-05-11 13:51:13 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-07 05:26:55 -0400
commitd4175ef48ba562f6fb8098b6fa000f3d77e11e1b (patch)
treec2d4d1476bf72c6c8897fcb3884925e1dcde0eb3 /gcc/ada/restrict.adb
parent58e07eaae447b73763ae390a13a613a6b70679ce (diff)
downloadgcc-d4175ef48ba562f6fb8098b6fa000f3d77e11e1b.zip
gcc-d4175ef48ba562f6fb8098b6fa000f3d77e11e1b.tar.gz
gcc-d4175ef48ba562f6fb8098b6fa000f3d77e11e1b.tar.bz2
[Ada] Ensure No_Specification_Of_Aspect forbids pragmas and repr. clauses
gcc/ada/ * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Add call to Check_Restriction_No_Specification_Of_Aspect. * sem_prag.adb (Analyze_Pragma): Likewise. * restrict.ads (Check_Restriction_No_Specification_Of_Aspect): Mention possible new node kinds in documentation. * restrict.adb (Check_Restriction_No_Specification_Of_Aspect): Retrieve aspect id from different fields if given node is an N_Pragma or an N_Attribute_Definition_Clause.
Diffstat (limited to 'gcc/ada/restrict.adb')
-rw-r--r--gcc/ada/restrict.adb9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ada/restrict.adb b/gcc/ada/restrict.adb
index 0dab4c5..08788d1 100644
--- a/gcc/ada/restrict.adb
+++ b/gcc/ada/restrict.adb
@@ -626,7 +626,14 @@ package body Restrict is
return;
end if;
- Id := Identifier (N);
+ if Nkind (N) = N_Pragma then
+ Id := Pragma_Identifier (N);
+ elsif Nkind (N) = N_Attribute_Definition_Clause then
+ Id := N;
+ else
+ Id := Identifier (N);
+ end if;
+
A_Id := Get_Aspect_Id (Chars (Id));
pragma Assert (A_Id /= No_Aspect);