From b0bf18adaa92fdedee13eb006bb6a5357a8ede72 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 13 Jan 2017 10:43:56 +0100 Subject: [PATCH] [multiple changes] 2017-01-13 Hristian Kirtchev * expander.adb (Expand): Add a warning about using return statements in Ghost management code. * exp_ch3.adb (Freeze_Type): Add a warning about using return statements in Ghost management code. * exp_ch7.adb (Build_Invariant_Procedure_Body, Build_Invariant_Procedure_Declaration): Add a warning about using return statements in Ghost management code. * exp_disp.adb (Make_DT): Add a warning about using return statements in Ghost management code. * exp_util.adb (Build_DIC_Procedure_Body, Build_DIC_Procedure_Declaration, Make_Predicated_Call): Add a warning about using return statements in Ghost management code. * freeze.adb (Freeze_Entity): Add a warning about using return statements in Ghost management code. * sem.adb (Analyze, Do_Analyze): Add a warning about using return statements in Ghost management code. * sem_ch3.adb (Analyze_Object_Declaration, Process_Full_View): Add a warning about using return statements in Ghost management code. * sem_ch5.adb (Analyze_Assignment): Add a warning about using return statements in Ghost management code. * sem_ch6.adb (Analyze_Procedure_Call, Analyze_Subprogram_Body_Helper): Add a warning about using return statements in Ghost management code. * sem_ch7.adb (Analyze_Package_Body_Helper): Add a warning about using return statements in Ghost management code. * sem_ch12.adb (Analyze_Package_Instantiation, Analyze_Subprogram_Instantiation, Instantiate_Package_Body, Instantiate_Subprogram_Body): Add a warning about using return statements in Ghost management code. * sem_ch13.adb (Build_Predicate_Functions, Build_Predicate_Function_Declarations): Add a warning about using return statements in Ghost management code. * sem_prag.adb (Analyze_Contract_Cases_In_Decl_Part, Analyze_Initial_Condition_In_Decl_Part, Analyze_Pragma, Analyze_Pre_Post_Condition_In_Decl_Part): Add a warning about using return statements in Ghost management code. 2017-01-13 Tristan Gingold * s-mmosin-mingw.adb: Fix pragma import. 2017-01-13 Arnaud Charlet * gnat1drv.adb (Adjust_Global_Switches): Ignore -gnateE in codepeer mode. From-SVN: r244396 --- gcc/ada/ChangeLog | 48 ++++++++++++++++++++++++++++++++++++++ gcc/ada/exp_ch3.adb | 4 ++++ gcc/ada/exp_ch7.adb | 8 +++++++ gcc/ada/exp_disp.adb | 4 ++++ gcc/ada/exp_util.adb | 12 ++++++++++ gcc/ada/expander.adb | 4 ++++ gcc/ada/freeze.adb | 4 ++++ gcc/ada/gnat1drv.adb | 5 ++++ gcc/ada/s-mmosin-mingw.adb | 2 +- gcc/ada/sem.adb | 8 +++++++ gcc/ada/sem_ch12.adb | 16 +++++++++++++ gcc/ada/sem_ch13.adb | 8 +++++++ gcc/ada/sem_ch3.adb | 8 +++++++ gcc/ada/sem_ch5.adb | 4 ++++ gcc/ada/sem_ch6.adb | 13 +++++++++-- gcc/ada/sem_ch7.adb | 4 ++++ gcc/ada/sem_prag.adb | 16 +++++++++++++ 17 files changed, 165 insertions(+), 3 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9c04b307d1e..0569679f841 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,51 @@ +2017-01-13 Hristian Kirtchev + + * expander.adb (Expand): Add a warning about using return + statements in Ghost management code. + * exp_ch3.adb (Freeze_Type): Add a warning about using return + statements in Ghost management code. + * exp_ch7.adb (Build_Invariant_Procedure_Body, + Build_Invariant_Procedure_Declaration): Add a warning about + using return statements in Ghost management code. + * exp_disp.adb (Make_DT): Add a warning about using return + statements in Ghost management code. + * exp_util.adb (Build_DIC_Procedure_Body, + Build_DIC_Procedure_Declaration, Make_Predicated_Call): Add a + warning about using return statements in Ghost management code. + * freeze.adb (Freeze_Entity): Add a warning about using return + statements in Ghost management code. + * sem.adb (Analyze, Do_Analyze): Add a warning about using return + statements in Ghost management code. + * sem_ch3.adb (Analyze_Object_Declaration, Process_Full_View): Add + a warning about using return statements in Ghost management code. + * sem_ch5.adb (Analyze_Assignment): Add a warning about using + return statements in Ghost management code. + * sem_ch6.adb (Analyze_Procedure_Call, + Analyze_Subprogram_Body_Helper): Add a warning about using return + statements in Ghost management code. + * sem_ch7.adb (Analyze_Package_Body_Helper): Add a warning about + using return statements in Ghost management code. + * sem_ch12.adb (Analyze_Package_Instantiation, + Analyze_Subprogram_Instantiation, Instantiate_Package_Body, + Instantiate_Subprogram_Body): Add a warning about using return + statements in Ghost management code. + * sem_ch13.adb (Build_Predicate_Functions, + Build_Predicate_Function_Declarations): Add a warning about + using return statements in Ghost management code. + * sem_prag.adb (Analyze_Contract_Cases_In_Decl_Part, + Analyze_Initial_Condition_In_Decl_Part, Analyze_Pragma, + Analyze_Pre_Post_Condition_In_Decl_Part): Add a warning about + using return statements in Ghost management code. + +2017-01-13 Tristan Gingold + + * s-mmosin-mingw.adb: Fix pragma import. + +2017-01-13 Arnaud Charlet + + * gnat1drv.adb (Adjust_Global_Switches): Ignore -gnateE in + codepeer mode. + 2017-01-13 Hristian Kirtchev * atree.adb (Allocate_Initialize_Node): A newly created node is diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 93ae83fd233..3fafb9ca218 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -7011,6 +7011,10 @@ package body Exp_Ch3 is -- for initialization) are chained in the Actions field list of the freeze -- node using Append_Freeze_Actions. + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + function Freeze_Type (N : Node_Id) return Boolean is procedure Process_RACW_Types (Typ : Entity_Id); -- Validate and generate stubs for all RACW types associated with type diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 6b994aabd97..131df4a72ac 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -3455,6 +3455,10 @@ package body Exp_Ch7 is -- Build_Invariant_Procedure_Body -- ------------------------------------ + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Build_Invariant_Procedure_Body (Typ : Entity_Id; Partial_Invariant : Boolean := False) @@ -4674,6 +4678,10 @@ package body Exp_Ch7 is -- Build_Invariant_Procedure_Declaration -- ------------------------------------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Build_Invariant_Procedure_Declaration (Typ : Entity_Id; Partial_Invariant : Boolean := False) diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index 034e199e2e7..770cb0fa694 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -3613,6 +3613,10 @@ package body Exp_Disp is -- ... -- end; + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + function Make_DT (Typ : Entity_Id; N : Node_Id := Empty) return List_Id is Loc : constant Source_Ptr := Sloc (Typ); diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 82970136f0f..3d09a963865 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -1191,6 +1191,10 @@ package body Exp_Util is -- Build_DIC_Procedure_Body -- ------------------------------ + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Build_DIC_Procedure_Body (Typ : Entity_Id) is procedure Add_DIC_Check (DIC_Prag : Node_Id; @@ -1924,6 +1928,10 @@ package body Exp_Util is -- Build_DIC_Procedure_Declaration -- ------------------------------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Build_DIC_Procedure_Declaration (Typ : Entity_Id) is Loc : constant Source_Ptr := Sloc (Typ); @@ -7899,6 +7907,10 @@ package body Exp_Util is -- Make_Predicate_Call -- ------------------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + function Make_Predicate_Call (Typ : Entity_Id; Expr : Node_Id; diff --git a/gcc/ada/expander.adb b/gcc/ada/expander.adb index 64192b7989d..8bd95e301a5 100644 --- a/gcc/ada/expander.adb +++ b/gcc/ada/expander.adb @@ -77,6 +77,10 @@ package body Expander is -- Expand -- ------------ + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Expand (N : Node_Id) is Mode : Ghost_Mode_Type; diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index c601ac02ae7..ff7ee8cc271 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -2002,6 +2002,10 @@ package body Freeze is -- Freeze_Entity -- ------------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + function Freeze_Entity (E : Entity_Id; N : Node_Id; diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index 8582b93277e..1bf10b6b4b4 100644 --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -286,6 +286,11 @@ procedure Gnat1drv is Debug_Generated_Code := False; + -- Disable Exception_Extra_Info (-gnateE) which generates more + -- complex trees with no added value, and may confuse CodePeer. + + Exception_Extra_Info := False; + -- Turn cross-referencing on in case it was disabled (e.g. by -gnatD) -- to support source navigation. diff --git a/gcc/ada/s-mmosin-mingw.adb b/gcc/ada/s-mmosin-mingw.adb index 0785f3c89f6..11051fc6909 100644 --- a/gcc/ada/s-mmosin-mingw.adb +++ b/gcc/ada/s-mmosin-mingw.adb @@ -60,7 +60,7 @@ package body System.Mmap.OS_Interface is Mb : Natural; Wcstr : Address; Wc : Natural) return Integer; - pragma Import (C, MultiByteToWideChar); + pragma Import (Stdcall, MultiByteToWideChar, "MultiByteToWideChar"); Current_Codepage : Interfaces.C.unsigned; pragma Import (C, Current_Codepage, "__gnat_current_codepage"); diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index 75d6e3904b4..fc7bf7b80f5 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -97,6 +97,10 @@ package body Sem is -- Analyze -- ------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Analyze (N : Node_Id) is Mode : Ghost_Mode_Type; Mode_Set : Boolean := False; @@ -1337,6 +1341,10 @@ package body Sem is -- Do_Analyze -- ---------------- + -- WARNING: This routine manages Ghost regions. Return statements must + -- be replaced by gotos which jump to the end of the routine and restore + -- the Ghost mode. + procedure Do_Analyze is Save_Ghost_Mode : constant Ghost_Mode_Type := Ghost_Mode; diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 89b5586a5ff..185310f66db 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -3573,6 +3573,10 @@ package body Sem_Ch12 is -- Analyze_Package_Instantiation -- ----------------------------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Analyze_Package_Instantiation (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Gen_Id : constant Node_Id := Name (N); @@ -4839,6 +4843,10 @@ package body Sem_Ch12 is -- Analyze_Subprogram_Instantiation -- -------------------------------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Analyze_Subprogram_Instantiation (N : Node_Id; K : Entity_Kind) @@ -10786,6 +10794,10 @@ package body Sem_Ch12 is -- Instantiate_Package_Body -- ------------------------------ + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Instantiate_Package_Body (Body_Info : Pending_Body_Info; Inlined_Body : Boolean := False; @@ -11204,6 +11216,10 @@ package body Sem_Ch12 is -- Instantiate_Subprogram_Body -- --------------------------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Instantiate_Subprogram_Body (Body_Info : Pending_Body_Info; Body_Optional : Boolean := False) diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index bb57ad07b71..d1591263e0d 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -8244,6 +8244,10 @@ package body Sem_Ch13 is -- the typPredicateM version of the function, in which any occurrence of a -- Raise_Expression is converted to "return False". + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Build_Predicate_Functions (Typ : Entity_Id; N : Node_Id) is Loc : constant Source_Ptr := Sloc (Typ); @@ -8894,6 +8898,10 @@ package body Sem_Ch13 is -- Build_Predicate_Function_Declaration -- ------------------------------------------ + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + function Build_Predicate_Function_Declaration (Typ : Entity_Id) return Node_Id is diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 99d8b58982e..e9f6fcd1e2e 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -3303,6 +3303,10 @@ package body Sem_Ch3 is -- Analyze_Object_Declaration -- -------------------------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Analyze_Object_Declaration (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Id : constant Entity_Id := Defining_Identifier (N); @@ -19413,6 +19417,10 @@ package body Sem_Ch3 is -- Process_Full_View -- ----------------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Process_Full_View (N : Node_Id; Full_T, Priv_T : Entity_Id) is procedure Collect_Implemented_Interfaces (Typ : Entity_Id; diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 620b562bc2c..1a47be5a4cd 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -88,6 +88,10 @@ package body Sem_Ch5 is -- Analyze_Assignment -- ------------------------ + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Analyze_Assignment (N : Node_Id) is Lhs : constant Node_Id := Name (N); Rhs : constant Node_Id := Expression (N); diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 9d8792ac157..33233bdb854 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -1505,10 +1505,15 @@ package body Sem_Ch6 is -- Analyze_Procedure_Call -- ---------------------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Analyze_Procedure_Call (N : Node_Id) is procedure Analyze_Call_And_Resolve; - -- Do Analyze and Resolve calls for procedure call - -- At end, check illegal order dependence. + -- Do Analyze and Resolve calls for procedure call. At the end, check + -- for illegal order dependence. + -- ??? where is the check for illegal order dependencies? ------------------------------ -- Analyze_Call_And_Resolve -- @@ -2136,6 +2141,10 @@ package body Sem_Ch6 is -- specification matters, and is used to create a proper declaration for -- the subprogram, or to perform conformance checks. + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Analyze_Subprogram_Body_Helper (N : Node_Id) is Body_Spec : Node_Id := Specification (N); Body_Id : Entity_Id := Defining_Entity (Body_Spec); diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index f5c02c8fa52..4e1a27e77cc 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -193,6 +193,10 @@ package body Sem_Ch7 is -- Analyze_Package_Body_Helper -- --------------------------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Analyze_Package_Body_Helper (N : Node_Id) is procedure Hide_Public_Entities (Decls : List_Id); -- Attempt to hide all public entities found in declarative list Decls diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 513b19b8874..1fc6f76cc6a 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -361,6 +361,10 @@ package body Sem_Prag is -- Analyze_Contract_Cases_In_Decl_Part -- ----------------------------------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Analyze_Contract_Cases_In_Decl_Part (N : Node_Id; Freeze_Id : Entity_Id := Empty) @@ -2650,6 +2654,10 @@ package body Sem_Prag is -- Analyze_Initial_Condition_In_Decl_Part -- -------------------------------------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Analyze_Initial_Condition_In_Decl_Part (N : Node_Id) is Pack_Decl : constant Node_Id := Find_Related_Package_Or_Body (N); Pack_Id : constant Entity_Id := Defining_Entity (Pack_Decl); @@ -12466,6 +12474,10 @@ package body Sem_Prag is -- The identifiers Assertions and Statement_Assertions are not -- allowed, since they have special meaning for Check_Policy. + -- WARNING: The code below manages Ghost regions. Return statements + -- must be replaced by gotos which jump to the end of the code and + -- restore the Ghost mode. + when Pragma_Check => Check : declare Cname : Name_Id; Eloc : Source_Ptr; @@ -23547,6 +23559,10 @@ package body Sem_Prag is -- Analyze_Pre_Post_Condition_In_Decl_Part -- --------------------------------------------- + -- WARNING: This routine manages Ghost regions. Return statements must be + -- replaced by gotos which jump to the end of the routine and restore the + -- Ghost mode. + procedure Analyze_Pre_Post_Condition_In_Decl_Part (N : Node_Id; Freeze_Id : Entity_Id := Empty) -- 2.30.2