diff options
Diffstat (limited to 'gcc/ada/sem_prag.adb')
-rw-r--r-- | gcc/ada/sem_prag.adb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 3b8c2ff99e3..7dcf2787101 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -2949,21 +2949,24 @@ package body Sem_Prag is -- Processing for procedure, operator or function. -- If subprogram is aliased (as for an instance) indicate - -- that the renamed entity is inlined. + -- that the renamed entity (if declared in the same unit) + -- is inlined. if Is_Subprogram (Subp) then while Present (Alias (Inner_Subp)) loop Inner_Subp := Alias (Inner_Subp); end loop; - Set_Inline_Flags (Inner_Subp); + if In_Same_Source_Unit (Subp, Inner_Subp) then + Set_Inline_Flags (Inner_Subp); - Decl := Parent (Parent (Inner_Subp)); + Decl := Parent (Parent (Inner_Subp)); - if Nkind (Decl) = N_Subprogram_Declaration - and then Present (Corresponding_Body (Decl)) - then - Set_Inline_Flags (Corresponding_Body (Decl)); + if Nkind (Decl) = N_Subprogram_Declaration + and then Present (Corresponding_Body (Decl)) + then + Set_Inline_Flags (Corresponding_Body (Decl)); + end if; end if; Applies := True; |