From 81c10c3f91cb42ecf1b32de800f09282bed31553 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 3 Jul 2019 08:13:55 +0000 Subject: [PATCH] [Ada] Do not consider inlined subprograms when generating C code 2019-07-03 Arnaud Charlet gcc/ada/ * sem_ch7.adb (Has_Referencer): Do not consider inlined subprograms when generating C code, which allows us to generate static inline subprograms. From-SVN: r272964 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/sem_ch7.adb | 14 ++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 879b776d0b4..d1b11cee9e2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-07-03 Arnaud Charlet + + * sem_ch7.adb (Has_Referencer): Do not consider inlined + subprograms when generating C code, which allows us to generate + static inline subprograms. + 2019-07-03 Justin Squirek * sem_ch6.adb (Check_Conformance): Add expression checking for diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 2ed2746dd62..a1b98f03240 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -389,6 +389,8 @@ package body Sem_Ch7 is end if; -- An inlined subprogram body acts as a referencer + -- unless we generate C code since inlining is then + -- handled by the C compiler. -- Note that we test Has_Pragma_Inline here in addition -- to Is_Inlined. We are doing this for a client, since @@ -397,8 +399,9 @@ package body Sem_Ch7 is -- should occur, so we need to catch all cases where the -- subprogram may be inlined by the client. - if Is_Inlined (Decl_Id) - or else Has_Pragma_Inline (Decl_Id) + if not Generate_C_Code + and then (Is_Inlined (Decl_Id) + or else Has_Pragma_Inline (Decl_Id)) then Has_Referencer_Of_Non_Subprograms := True; @@ -415,9 +418,12 @@ package body Sem_Ch7 is Decl_Id := Defining_Entity (Decl); -- An inlined subprogram body acts as a referencer + -- unless we generate C code since inlining is then + -- handled by the C compiler. - if Is_Inlined (Decl_Id) - or else Has_Pragma_Inline (Decl_Id) + if not Generate_C_Code + and then (Is_Inlined (Decl_Id) + or else Has_Pragma_Inline (Decl_Id)) then Has_Referencer_Of_Non_Subprograms := True; -- 2.30.2