From: Arnaud Charlet Date: Mon, 26 Oct 2015 11:29:34 +0000 (+0100) Subject: Code clean ups. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e310115eb98540ab7c1e099a15f6c66dd76450b7;p=gcc.git Code clean ups. From-SVN: r229335 --- diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index 87c39fbd551..5ef60948d7c 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -431,20 +431,9 @@ package body Contracts is Prag_Nam : Name_Id; begin - -- Do not analyze the contract of an entry declaration unless annotating - -- the original tree. It is preferable to analyze the contract after the - -- entry declaration has been transformed into a subprogram declaration - -- to properly handle references to unpacked formals. - - if Ekind_In (Subp_Id, E_Entry, E_Entry_Family) - and then not ASIS_Mode - and then not GNATprove_Mode - then - return; - -- Do not analyze a contract multiple times - elsif Present (Items) then + if Present (Items) then if Analyzed (Items) then return; else @@ -467,13 +456,29 @@ package body Contracts is elsif Present (Items) then - -- Analyze pre- and postconditions + -- Do not analyze the pre/postconditions of an entry declaration + -- unless annotating the original tree for ASIS or GNATprove. - Prag := Pre_Post_Conditions (Items); - while Present (Prag) loop - Analyze_Pre_Post_Condition_In_Decl_Part (Prag); - Prag := Next_Pragma (Prag); - end loop; + -- ??? References to formals are causing problems during contract + -- expansion as the references resolve to the entry formals, not + -- the subprogram body emulating the entry body. This will have to + -- be addressed. + + if Ekind_In (Subp_Id, E_Entry, E_Entry_Family) + and then not ASIS_Mode + and then not GNATprove_Mode + then + null; + + -- Otherwise analyze the pre/postconditions + + else + Prag := Pre_Post_Conditions (Items); + while Present (Prag) loop + Analyze_Pre_Post_Condition_In_Decl_Part (Prag); + Prag := Next_Pragma (Prag); + end loop; + end if; -- Analyze contract-cases and test-cases