From: Piotr Trojanek Date: Fri, 9 May 2025 15:31:39 +0000 (+0200) Subject: ada: Move aspects when instantiating subprograms as compilation units X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=04d7a0e93946988bbaee5ead468df7b8ce3223ed;p=thirdparty%2Fgcc.git ada: Move aspects when instantiating subprograms as compilation units When rewriting N_Subprogram_Instantiation into wrapper packages we must move the original aspect specifications to the wrapper packages, as otherwise they will be only accessible via Original_Node. This is similar to how we move aspect specifications for expression functions and many other constructs. gcc/ada/ChangeLog: * sem_ch12.adb (Analyze_Subprogram_Instantiation): Move aspects when instantiating subprogram as a library unit. --- diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 062251f15a9..f492b236857 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -6704,6 +6704,7 @@ package body Sem_Ch12 is elsif Nkind (Parent (N)) = N_Compilation_Unit then Rewrite (N, Unit (Parent (N))); + Move_Aspects (From => Original_Node (N), To => N); Set_Unit (Parent (N), N); end if; @@ -6712,6 +6713,7 @@ package body Sem_Ch12 is elsif Nkind (Parent (N)) = N_Compilation_Unit then Rewrite (N, Unit (Parent (N))); + Move_Aspects (From => Original_Node (N), To => N); Set_Unit (Parent (N), N); end if;