Commit 81c10c3f by Arnaud Charlet Committed by Pierre-Marie de Rodat

[Ada] Do not consider inlined subprograms when generating C code

2019-07-03  Arnaud Charlet  <charlet@adacore.com>

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
parent 44f83ca4
2019-07-03 Arnaud Charlet <charlet@adacore.com>
* 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 <squirek@adacore.com> 2019-07-03 Justin Squirek <squirek@adacore.com>
* sem_ch6.adb (Check_Conformance): Add expression checking for * sem_ch6.adb (Check_Conformance): Add expression checking for
......
...@@ -389,6 +389,8 @@ package body Sem_Ch7 is ...@@ -389,6 +389,8 @@ package body Sem_Ch7 is
end if; end if;
-- An inlined subprogram body acts as a referencer -- 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 -- Note that we test Has_Pragma_Inline here in addition
-- to Is_Inlined. We are doing this for a client, since -- to Is_Inlined. We are doing this for a client, since
...@@ -397,8 +399,9 @@ package body Sem_Ch7 is ...@@ -397,8 +399,9 @@ package body Sem_Ch7 is
-- should occur, so we need to catch all cases where the -- should occur, so we need to catch all cases where the
-- subprogram may be inlined by the client. -- subprogram may be inlined by the client.
if Is_Inlined (Decl_Id) if not Generate_C_Code
or else Has_Pragma_Inline (Decl_Id) and then (Is_Inlined (Decl_Id)
or else Has_Pragma_Inline (Decl_Id))
then then
Has_Referencer_Of_Non_Subprograms := True; Has_Referencer_Of_Non_Subprograms := True;
...@@ -415,9 +418,12 @@ package body Sem_Ch7 is ...@@ -415,9 +418,12 @@ package body Sem_Ch7 is
Decl_Id := Defining_Entity (Decl); Decl_Id := Defining_Entity (Decl);
-- An inlined subprogram body acts as a referencer -- 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) if not Generate_C_Code
or else Has_Pragma_Inline (Decl_Id) and then (Is_Inlined (Decl_Id)
or else Has_Pragma_Inline (Decl_Id))
then then
Has_Referencer_Of_Non_Subprograms := True; Has_Referencer_Of_Non_Subprograms := True;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment