* [Ada] Reorder processing of default expressions to avoid repeated calls
@ 2022-07-05 8:30 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-07-05 8:30 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
[-- Attachment #1: Type: text/plain, Size: 226 bytes --]
Code cleanup related to improved detection of uninitialised objects;
semantics is unaffected.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_ch6.adb (Process_Formals): Avoid repeated calls to
Expression.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 683 bytes --]
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
--- 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)) /=
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-05 8:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 8:30 [Ada] Reorder processing of default expressions to avoid repeated calls Pierre-Marie de Rodat
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).