From: Yannick Moy Date: Wed, 6 Jul 2016 13:41:20 +0000 (+0000) Subject: sem_ch6.adb (Analyze_Expression_Function): Mark body of expression function as ghost... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6dfc5e671f592499d162ccf2cadd17b9de9d090c;p=gcc.git sem_ch6.adb (Analyze_Expression_Function): Mark body of expression function as ghost if needed when created. 2016-07-06 Yannick Moy * sem_ch6.adb (Analyze_Expression_Function): Mark body of expression function as ghost if needed when created. * sem_prag.adb (Analyze_Pragma.Process_Inline.Set_Inline_Flags): Remove special case. From-SVN: r238051 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 8f060caf8ab..98e47fbc758 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2016-07-06 Yannick Moy + + * sem_ch6.adb (Analyze_Expression_Function): Mark body of + expression function as ghost if needed when created. + * sem_prag.adb (Analyze_Pragma.Process_Inline.Set_Inline_Flags): + Remove special case. + 2016-07-06 Arnaud Charlet * lib.adb (Check_Same_Extended_Unit): Complete previous change. diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 86083eb6955..a47ebda2807 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -486,6 +486,15 @@ package body Sem_Ch6 is Set_Is_Inlined (Defining_Entity (N)); + -- If the expression function is Ghost, mark its body entity as + -- Ghost too. This avoids spurious errors on unanalyzed body entities + -- of expression functions, which are not yet marked as ghost, yet + -- identified as the Corresponding_Body of the ghost declaration. + + if Is_Ghost_Entity (Def_Id) then + Set_Is_Ghost_Entity (Defining_Entity (New_Body)); + end if; + -- Establish the linkages between the spec and the body. These are -- used when the expression function acts as the prefix of attribute -- 'Access in order to freeze the original expression which has been diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 3b9d9841f47..f603e317af4 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -9080,14 +9080,6 @@ package body Sem_Prag is Ghost_Id := Subp; end if; - -- Do not issue an error on an unanalyzed subprogram body entity. - -- It may lead to spurious errors on unanalyzed body entities of - -- expression functions, which are not yet marked as ghost, yet - -- identified as the Corresponding_Body of the ghost declaration. - - elsif Ekind (Subp) = E_Void then - null; - -- Otherwise the subprogram is non-Ghost. It is illegal to mix -- references to Ghost and non-Ghost entities (SPARK RM 6.9).