From: Piotr Trojanek Date: Wed, 8 Jun 2022 18:49:57 +0000 (+0200) Subject: [Ada] Reorder processing of default expressions to avoid repeated calls X-Git-Tag: basepoints/gcc-14~5713 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ba8c078cabee2c6abc669971e1351536ce721ec;p=thirdparty%2Fgcc.git [Ada] Reorder processing of default expressions to avoid repeated calls Code cleanup related to improved detection of uninitialised objects; semantics is unaffected. gcc/ada/ * sem_ch6.adb (Process_Formals): Avoid repeated calls to Expression. --- diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 440770ad8bf..1efc8842db9 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -12985,10 +12985,10 @@ package body Sem_Ch6 is Set_Formal_Mode (Formal); if Ekind (Formal) = E_In_Parameter then - Set_Default_Value (Formal, Expression (Param_Spec)); + Default := Expression (Param_Spec); - if Present (Expression (Param_Spec)) then - Default := Expression (Param_Spec); + if Present (Default) then + Set_Default_Value (Formal, Default); if Is_Scalar_Type (Etype (Default)) then if Nkind (Parameter_Type (Param_Spec)) /=