* [COMMITTED] ada: Remove redundant protection against empty list
@ 2023-09-05 11:08 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-09-05 11:08 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
From: Piotr Trojanek <trojanek@adacore.com>
Calls to First on No_List intentionally return Empty, so explicit guards
against No_List are unnecessary. Code cleanup; semantics is unaffected.
gcc/ada/
* sem_type.adb (Interface_Present_In_Ancestor): Remove guard against no
list of interfaces; fix style in comments (trailing dots).
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_type.adb | 40 +++++++++++++++++++---------------------
1 file changed, 19 insertions(+), 21 deletions(-)
diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb
index 8579130cdac..40de2951e20 100644
--- a/gcc/ada/sem_type.adb
+++ b/gcc/ada/sem_type.adb
@@ -2649,34 +2649,32 @@ package body Sem_Type is
-- In case of concurrent types we can't use the Corresponding Record_Typ
-- to look for the interface because it is built by the expander (and
-- hence it is not always available). For this reason we traverse the
- -- list of interfaces (available in the parent of the concurrent type)
+ -- list of interfaces (available in the parent of the concurrent type).
if Is_Concurrent_Type (Target_Typ) then
- if Present (Interface_List (Parent (Target_Typ))) then
- declare
- AI : Node_Id;
+ declare
+ AI : Node_Id;
- begin
- AI := First (Interface_List (Parent (Target_Typ)));
+ begin
+ AI := First (Interface_List (Parent (Target_Typ)));
- -- The progenitor itself may be a subtype of an interface type.
+ -- The progenitor itself may be a subtype of an interface type
- while Present (AI) loop
- if Etype (AI) = Iface_Typ
- or else Base_Type (Etype (AI)) = Iface_Typ
- then
- return True;
+ while Present (AI) loop
+ if Etype (AI) = Iface_Typ
+ or else Base_Type (Etype (AI)) = Iface_Typ
+ then
+ return True;
- elsif Present (Interfaces (Etype (AI)))
- and then Iface_Present_In_Ancestor (Etype (AI))
- then
- return True;
- end if;
+ elsif Present (Interfaces (Etype (AI)))
+ and then Iface_Present_In_Ancestor (Etype (AI))
+ then
+ return True;
+ end if;
- Next (AI);
- end loop;
- end;
- end if;
+ Next (AI);
+ end loop;
+ end;
return False;
end if;
--
2.40.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-05 11:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-05 11:08 [COMMITTED] ada: Remove redundant protection against empty list Marc Poulhiès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).