aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2023-03-29 09:36:39 +0200
committerMarc Poulhiès <poulhies@adacore.com>2023-05-26 09:29:18 +0200
commitfa4b7069a0dfd28b58c718cf8b2060df47a39641 (patch)
tree2300e5c3983320d629d255de91ff6fa64a12e80b /gcc
parent9f6cee820f9c8d263dfcd1772127268508360838 (diff)
downloadgcc-fa4b7069a0dfd28b58c718cf8b2060df47a39641.zip
gcc-fa4b7069a0dfd28b58c718cf8b2060df47a39641.tar.gz
gcc-fa4b7069a0dfd28b58c718cf8b2060df47a39641.tar.bz2
ada: Remove redundant guard against empty lists
There is no need to guard against routine Contains being called on No_Elist, because it will return False. Code cleanup related to handling of primitive operations in GNATprove; semantics is unaffected. gcc/ada/ * sem_prag.adb (Record_Possible_Body_Reference): Remove call to Present. * sem_util.adb (Find_Untagged_Type_Of): Likewise.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_prag.adb4
-rw-r--r--gcc/ada/sem_util.adb1
2 files changed, 1 insertions, 4 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 96ea172..5363d2b 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -32644,9 +32644,7 @@ package body Sem_Prag is
if Nkind (Context) = N_Package_Body then
Spec_Id := Corresponding_Spec (Context);
- if Present (Abstract_States (Spec_Id))
- and then Contains (Abstract_States (Spec_Id), State_Id)
- then
+ if Contains (Abstract_States (Spec_Id), State_Id) then
if No (Body_References (State_Id)) then
Set_Body_References (State_Id, New_Elmt_List);
end if;
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index e11eded..9d12ee7 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -6524,7 +6524,6 @@ package body Sem_Util is
begin
while Present (E) and then E /= Prim loop
if not Is_Tagged_Type (E)
- and then Present (Direct_Primitive_Operations (E))
and then Contains (Direct_Primitive_Operations (E), Prim)
then
return E;