aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_prag.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_prag.adb')
-rw-r--r--gcc/ada/sem_prag.adb27
1 files changed, 21 insertions, 6 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 4090d0c..2fc3698 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -8087,10 +8087,26 @@ package body Sem_Prag is
-- the test below also permits use in a configuration pragma file.
function Is_Configuration_Pragma return Boolean is
+ function Is_Pragma_Node (Prg : Node_Id) return Boolean is
+ (Nkind (Prg) = N_Pragma
+ or else
+ (Present (Original_Node (Prg))
+ and then Nkind (Original_Node (Prg)) = N_Pragma));
+ -- Returns true whether the node is a pragma or was originally a
+ -- pragma.
+ --
+ -- Note that some pragmas like Assertion_Policy are rewritten as
+ -- Null_Statment nodes but we still need to make sure here that the
+ -- original node was a pragma node.
+
+ -- Local variables
+
Lis : List_Id;
Par : constant Node_Id := Parent (N);
Prg : Node_Id;
+ -- Start of processing for Is_Configuration_Pragma
+
begin
-- Don't evaluate List_Containing (N) if Parent (N) could be
-- an N_Aspect_Specification node.
@@ -8119,7 +8135,7 @@ package body Sem_Prag is
loop
if Prg = N then
return True;
- elsif Nkind (Prg) /= N_Pragma then
+ elsif not Is_Pragma_Node (Prg) then
return False;
end if;
@@ -14677,19 +14693,18 @@ package body Sem_Prag is
D := Declaration_Node (E);
- if (Nkind (D) = N_Full_Type_Declaration and then Is_Array_Type (E))
+ if (Nkind (D) in N_Full_Type_Declaration
+ | N_Formal_Type_Declaration
+ and then Is_Array_Type (E))
or else
(Nkind (D) = N_Object_Declaration
and then Ekind (E) in E_Constant | E_Variable
and then Nkind (Object_Definition (D)) =
N_Constrained_Array_Definition)
- or else
- (Ada_Version >= Ada_2022
- and then Nkind (D) = N_Formal_Type_Declaration)
then
-- The flag is set on the base type, or on the object
- if Nkind (D) = N_Full_Type_Declaration then
+ if Is_Array_Type (E) then
E := Base_Type (E);
end if;