From: Piotr Trojanek Date: Fri, 7 Oct 2022 19:58:58 +0000 (+0200) Subject: ada: Simplify detection of controlling formals X-Git-Tag: basepoints/gcc-14~3538 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50bd9f4e6fc7ac84b5d0f29b76dff1f82381ee38;p=thirdparty%2Fgcc.git ada: Simplify detection of controlling formals When detecting controlling formals we are only interested in formal parameters and not in other entities. gcc/ada/ * sem_ch6.adb (Controlling_Formal): Iterate with First/Next_Formal and not with First/Next_Entity. --- diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 228adcff5cd9..d28de10d3d66 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -10711,13 +10711,13 @@ package body Sem_Ch6 is E : Entity_Id; begin - E := First_Entity (Prim); + E := First_Formal (Prim); while Present (E) loop - if Is_Formal (E) and then Is_Controlling_Formal (E) then + if Is_Controlling_Formal (E) then return E; end if; - Next_Entity (E); + Next_Formal (E); end loop; return Empty;