From: Hristian Kirtchev Date: Wed, 20 Apr 2016 09:17:15 +0000 (+0000) Subject: sem_util.adb, [...]: Minor reformatting. X-Git-Tag: upstream/12.2.0~47741 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c37e6613f5530611fb5ba5db6c7972694a8b0f5c;p=platform%2Fupstream%2Fgcc.git sem_util.adb, [...]: Minor reformatting. 2016-04-20 Hristian Kirtchev * sem_util.adb, contracts.adb, ghost.adb, exp_ch6.adb: Minor reformatting. From-SVN: r235246 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index db327f3..2a459ec 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2016-04-20 Hristian Kirtchev + + * sem_util.adb, contracts.adb, ghost.adb, exp_ch6.adb: Minor + reformatting. + 2016-04-20 Javier Miranda * contracts.adb (Build_Postconditions_Procedure): Code cleanup. diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index af6264c..8aa8502 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -1734,10 +1734,12 @@ package body Contracts is -- Local variables - Loc : constant Source_Ptr := Sloc (Body_Decl); - Params : List_Id := No_List; - Proc_Bod : Node_Id; - Proc_Id : Entity_Id; + Loc : constant Source_Ptr := Sloc (Body_Decl); + Params : List_Id := No_List; + Proc_Bod : Node_Id; + Proc_Decl : Node_Id; + Proc_Id : Entity_Id; + Proc_Spec : Node_Id; -- Start of processing for Build_Postconditions_Procedure @@ -1749,7 +1751,19 @@ package body Contracts is end if; Proc_Id := Make_Defining_Identifier (Loc, Name_uPostconditions); - Set_Debug_Info_Needed (Proc_Id); + Set_Debug_Info_Needed (Proc_Id); + Set_Postconditions_Proc (Subp_Id, Proc_Id); + + -- Force the front-end inlining of _Postconditions when generating C + -- code, since its body may have references to itypes defined in the + -- enclosing subprogram, which would cause problems for unnesting + -- routines in the absence of inlining. + + if Generate_C_Code then + Set_Has_Pragma_Inline (Proc_Id); + Set_Has_Pragma_Inline_Always (Proc_Id); + Set_Is_Inlined (Proc_Id); + end if; -- The related subprogram is a function: create the specification of -- parameter _Result. @@ -1762,6 +1776,13 @@ package body Contracts is New_Occurrence_Of (Etype (Result), Loc))); end if; + Proc_Spec := + Make_Procedure_Specification (Loc, + Defining_Unit_Name => Proc_Id, + Parameter_Specifications => Params); + + Proc_Decl := Make_Subprogram_Declaration (Loc, Proc_Spec); + -- Insert _Postconditions before the first source declaration of the -- body. This ensures that the body will not cause any premature -- freezing, as it may mention types: @@ -1780,52 +1801,25 @@ package body Contracts is -- order reference. The body of _Postconditions must be placed after -- the declaration of Temp to preserve correct visibility. + Insert_Before_First_Source_Declaration (Proc_Decl); + Analyze (Proc_Decl); + -- Set an explicit End_Label to override the sloc of the implicit -- RETURN statement, and prevent it from inheriting the sloc of one -- the postconditions: this would cause confusing debug info to be -- produced, interfering with coverage-analysis tools. - declare - Proc_Decl : Node_Id; - Proc_Decl_Id : Entity_Id; - Proc_Spec : Node_Id; - begin - Proc_Spec := - Make_Procedure_Specification (Loc, - Defining_Unit_Name => Proc_Id, - Parameter_Specifications => Params); - - Proc_Decl := Make_Subprogram_Declaration (Loc, Proc_Spec); - Proc_Decl_Id := Defining_Entity (Specification (Proc_Decl)); - Set_Postconditions_Proc (Subp_Id, Proc_Decl_Id); - - -- Force the front end inlining of _PostConditions when generating - -- C code since its body may have references to itypes defined in - -- the enclosing subprogram, thus causing problems to unnesting - -- routines. - - if Generate_C_Code then - Set_Has_Pragma_Inline (Proc_Decl_Id); - Set_Has_Pragma_Inline_Always (Proc_Decl_Id); - Set_Is_Inlined (Proc_Decl_Id); - end if; - - Insert_Before_First_Source_Declaration (Proc_Decl); - Analyze (Proc_Decl); - - Proc_Bod := - Make_Subprogram_Body (Loc, - Specification => - Copy_Subprogram_Spec (Proc_Spec), - Declarations => Empty_List, - Handled_Statement_Sequence => - Make_Handled_Sequence_Of_Statements (Loc, - Statements => Stmts, - End_Label => Make_Identifier (Loc, Chars (Proc_Id)))); - - Insert_Before_First_Source_Declaration (Proc_Bod); - Analyze (Proc_Bod); - end; + Proc_Bod := + Make_Subprogram_Body (Loc, + Specification => + Copy_Subprogram_Spec (Proc_Spec), + Declarations => Empty_List, + Handled_Statement_Sequence => + Make_Handled_Sequence_Of_Statements (Loc, + Statements => Stmts, + End_Label => Make_Identifier (Loc, Chars (Proc_Id)))); + + Insert_After_And_Analyze (Proc_Decl, Proc_Bod); end Build_Postconditions_Procedure; ---------------------------- diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 511f479..ea8bed4 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -5522,6 +5522,7 @@ package body Exp_Ch6 is procedure Expand_N_Subprogram_Body_Stub (N : Node_Id) is Bod : Node_Id; + begin if Present (Corresponding_Body (N)) then Bod := Unit_Declaration_Node (Corresponding_Body (N)); diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb index 69865b5..8bd1031 100644 --- a/gcc/ada/ghost.adb +++ b/gcc/ada/ghost.adb @@ -256,9 +256,9 @@ package body Ghost is if Present (Subp_Id) then - -- The context is the internally built _postconditions - -- subprogram, which it is OK because the real check was - -- done before expansion activities. + -- The context is the internally built _Postconditions + -- procedure, which is OK because the real check was done + -- before expansion activities. if Chars (Subp_Id) = Name_uPostconditions then return True; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 4820830..da7d00a 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -14282,28 +14282,25 @@ package body Sem_Util is -------------------------------------- function Is_Unchecked_Conversion_Instance (Id : Entity_Id) return Boolean is - Par : Node_Id; - Gen_Par : Entity_Id; + Par : Node_Id; begin -- Look for a function whose generic parent is the predefined intrinsic -- function Unchecked_Conversion. if Ekind (Id) = E_Function then - Par := Parent (Id); + Par := Parent (Id); - if Nkind (Par) /= N_Function_Specification then - return False; - end if; + if Nkind (Par) = N_Function_Specification then + Par := Generic_Parent (Par); - Gen_Par := Generic_Parent (Par); - - return - Present (Gen_Par) - and then Chars (Gen_Par) = Name_Unchecked_Conversion - and then Is_Intrinsic_Subprogram (Gen_Par) - and then Is_Predefined_File_Name - (Unit_File_Name (Get_Source_Unit (Gen_Par))); + return + Present (Par) + and then Chars (Par) = Name_Unchecked_Conversion + and then Is_Intrinsic_Subprogram (Par) + and then Is_Predefined_File_Name + (Unit_File_Name (Get_Source_Unit (Par))); + end if; end if; return False;