aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-10-07 22:27:46 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-11-24 05:16:05 -0500
commit42b91d9a746aa1736de6876a34b4d817591bffb1 (patch)
treedc01dc09769e9ae08af894a09f4aa44f038eab63 /gcc
parent45ce2307851e8e7fc653137253c8782f734c5697 (diff)
downloadgcc-42b91d9a746aa1736de6876a34b4d817591bffb1.zip
gcc-42b91d9a746aa1736de6876a34b4d817591bffb1.tar.gz
gcc-42b91d9a746aa1736de6876a34b4d817591bffb1.tar.bz2
[Ada] Reuse In_Same_List where possible
gcc/ada/ * contracts.adb, freeze.adb, sem_ch12.adb, sem_prag.adb: Reuse In_Same_List.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/contracts.adb3
-rw-r--r--gcc/ada/freeze.adb2
-rw-r--r--gcc/ada/sem_ch12.adb8
-rw-r--r--gcc/ada/sem_prag.adb4
4 files changed, 7 insertions, 10 deletions
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb
index 936b16e..3ef607f 100644
--- a/gcc/ada/contracts.adb
+++ b/gcc/ada/contracts.adb
@@ -2559,8 +2559,7 @@ package body Contracts is
Was_Expression_Function (Body_Decl)
and then Sloc (Body_Id) /= Sloc (Subp_Id)
and then In_Same_Source_Unit (Body_Id, Subp_Id)
- and then List_Containing (Body_Decl) /=
- List_Containing (Subp_Decl);
+ and then not In_Same_List (Body_Decl, Subp_Decl);
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 0779165..8ccc54e 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -2007,7 +2007,7 @@ package body Freeze is
| N_Task_Body
| N_Body_Stub
and then
- List_Containing (After) = List_Containing (Parent (E))
+ In_Same_List (After, Parent (E))
then
Error_Msg_Sloc := Sloc (Next (After));
Error_Msg_NE
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index f9df624..ab68f72 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -8802,7 +8802,7 @@ package body Sem_Ch12 is
while not Is_List_Member (P1)
or else not Is_List_Member (P2)
- or else List_Containing (P1) /= List_Containing (P2)
+ or else not In_Same_List (P1, P2)
loop
P1 := True_Parent (P1);
P2 := True_Parent (P2);
@@ -9092,8 +9092,7 @@ package body Sem_Ch12 is
-- after that of Parent_Inst. This relation is established by
-- comparing the Slocs of Parent_Inst freeze node and Inst.
- elsif List_Containing (Get_Unit_Instantiation_Node (Par)) =
- List_Containing (Inst_Node)
+ elsif In_Same_List (Get_Unit_Instantiation_Node (Par), Inst_Node)
and then Sloc (Freeze_Node (Par)) <= Sloc (Inst_Node)
then
Insert_Freeze_Node_For_Instance (Inst_Node, F_Node);
@@ -9989,8 +9988,7 @@ package body Sem_Ch12 is
-- the enclosing package, insert the freeze node after
-- the body.
- elsif List_Containing (Freeze_Node (Par)) =
- List_Containing (Parent (N))
+ elsif In_Same_List (Freeze_Node (Par), Parent (N))
and then Sloc (Freeze_Node (Par)) < Sloc (Parent (N))
then
Insert_Freeze_Node_For_Instance
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 590da55..8e36976 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -6090,7 +6090,7 @@ package body Sem_Prag is
-- The group and the current pragma are not in the same
-- declarative or statement list.
- if List_Containing (Stmt) /= List_Containing (N) then
+ if not In_Same_List (Stmt, N) then
Grouping_Error (Stmt);
-- Try to reach the current pragma from the first pragma
@@ -9885,7 +9885,7 @@ package body Sem_Prag is
-- the test will have been applied to the original generic.
elsif Nkind (Decl) in N_Formal_Subprogram_Declaration
- and then List_Containing (Decl) = List_Containing (N)
+ and then In_Same_List (Decl, N)
and then not In_Instance
then
Error_Msg_N