Commit 10c2c151 by Arnaud Charlet

[multiple changes]

2017-01-12  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch6.adb: Minor reformatting.
	* spark_xrefs.ads: minor cleanup of comments for SPARK xrefs

2017-01-12  Bob Duff  <duff@adacore.com>

	* binde.adb (Forced): New reason for a dependence.
	(Force_Elab_Order): Implementation of the new switch.
	* binde.ads: Minor comment fixes.
	* bindusg.adb: Add -f switch. Apparently, there was an -f switch
	long ago that is no longer supported; removed comment about that.
	* opt.ads (Force_Elab_Order_File): Name of file specified for
	-f switch.
	* switch-b.adb: Parse -f switch.

From-SVN: r244355
parent 84e13614
2017-01-12 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch6.adb: Minor reformatting.
* spark_xrefs.ads: minor cleanup of comments for SPARK xrefs
2017-01-12 Bob Duff <duff@adacore.com>
* binde.adb (Forced): New reason for a dependence.
(Force_Elab_Order): Implementation of the new switch.
* binde.ads: Minor comment fixes.
* bindusg.adb: Add -f switch. Apparently, there was an -f switch
long ago that is no longer supported; removed comment about that.
* opt.ads (Force_Elab_Order_File): Name of file specified for
-f switch.
* switch-b.adb: Parse -f switch.
2017-01-12 Justin Squirek <squirek@adacore.com> 2017-01-12 Justin Squirek <squirek@adacore.com>
* exp_ch6.adb (Check_View_Conversion): Created this function * exp_ch6.adb (Check_View_Conversion): Created this function
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -32,10 +32,10 @@ with Types; use Types; ...@@ -32,10 +32,10 @@ with Types; use Types;
package Binde is package Binde is
-- The following table records the chosen elaboration order. It is used -- The following table records the chosen elaboration order. It is used
-- by Gen_Elab_Call to generate the sequence of elaboration calls. Note -- by Gen_Elab_Calls to generate the sequence of elaboration calls. Note
-- that units are included in this table even if they have no elaboration -- that units are included in this table even if they have no elaboration
-- routine, since the table is also used to drive the generation of object -- routine, since the table is also used to drive the generation of object
-- files in the binder output. Gen_Elab_Call skips any units that have no -- files in the binder output. Gen_Elab_Calls skips any units that have no
-- elaboration routine. -- elaboration routine.
package Elab_Order is new Table.Table ( package Elab_Order is new Table.Table (
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -113,7 +113,9 @@ package body Bindusg is ...@@ -113,7 +113,9 @@ package body Bindusg is
Write_Line (" and enable symbolic tracebacks"); Write_Line (" and enable symbolic tracebacks");
Write_Line (" -E Same as -Ea"); Write_Line (" -E Same as -Ea");
-- The -f switch is voluntarily omitted, because it is obsolete -- Line for -f switch
Write_Line (" -felab-order Force elaboration order");
-- Line for -F switch -- Line for -F switch
......
...@@ -2265,9 +2265,8 @@ package body Exp_Ch6 is ...@@ -2265,9 +2265,8 @@ package body Exp_Ch6 is
-- extra formal. -- extra formal.
procedure Check_View_Conversion (Formal : Entity_Id; Actual : Node_Id); procedure Check_View_Conversion (Formal : Entity_Id; Actual : Node_Id);
-- Adds Invariant checks for every intermediate type between -- Adds invariant checks for every intermediate type between the range
-- the range of a view converted argument to its ancestor (from -- of a view converted argument to its ancestor (from parent to child).
-- parent to child).
function Inherited_From_Formal (S : Entity_Id) return Entity_Id; function Inherited_From_Formal (S : Entity_Id) return Entity_Id;
-- Within an instance, a type derived from an untagged formal derived -- Within an instance, a type derived from an untagged formal derived
...@@ -2361,31 +2360,35 @@ package body Exp_Ch6 is ...@@ -2361,31 +2360,35 @@ package body Exp_Ch6 is
procedure Check_View_Conversion (Formal : Entity_Id; Actual : Node_Id) is procedure Check_View_Conversion (Formal : Entity_Id; Actual : Node_Id) is
Arg : Entity_Id; Arg : Entity_Id;
Curr_Typ : Entity_Id := Empty; Curr_Typ : Entity_Id;
Inv_Checks : List_Id; Inv_Checks : List_Id;
Par_Typ : Entity_Id; Par_Typ : Entity_Id;
begin begin
Inv_Checks := No_List; Inv_Checks := No_List;
-- Extract actual object for type conversions -- Extract the argument from a potentially nested set of view
-- conversions.
Arg := Actual; Arg := Actual;
while Nkind (Arg) = N_Type_Conversion loop while Nkind (Arg) = N_Type_Conversion loop
Arg := Expression (Arg); Arg := Expression (Arg);
end loop; end loop;
-- Move up the derivation chain starting with the type of the -- Move up the derivation chain starting with the type of the formal
-- the formal parameter down to the type of the actual object. -- parameter down to the type of the actual object.
Par_Typ := Etype (Arg); Curr_Typ := Empty;
Par_Typ := Etype (Arg);
while Par_Typ /= Etype (Formal) and Par_Typ /= Curr_Typ loop while Par_Typ /= Etype (Formal) and Par_Typ /= Curr_Typ loop
Curr_Typ := Par_Typ; Curr_Typ := Par_Typ;
if Has_Invariants (Curr_Typ) if Has_Invariants (Curr_Typ)
and then Present (Invariant_Procedure (Curr_Typ)) and then Present (Invariant_Procedure (Curr_Typ))
then then
-- Verify the invariate of the current type. Generate: -- Verify the invariate of the current type. Generate:
-- Invariant_Check_Curr_Typ (Curr_Typ (Arg));
-- <Curr_Typ>Invariant (Curr_Typ (Arg));
Prepend_New_To (Inv_Checks, Prepend_New_To (Inv_Checks,
Make_Procedure_Call_Statement (Loc, Make_Procedure_Call_Statement (Loc,
...@@ -3292,7 +3295,7 @@ package body Exp_Ch6 is ...@@ -3292,7 +3295,7 @@ package body Exp_Ch6 is
-- Invariant checks are performed for every intermediate type between -- Invariant checks are performed for every intermediate type between
-- the range of a view converted argument to its ancestor (from -- the range of a view converted argument to its ancestor (from
-- parent to child) if it is passed as an "out" or "in out" parameter -- parent to child) if it is passed as an "out" or "in out" parameter
-- after executing the call (RM 7.3.2 (11-14)). -- after executing the call (RM 7.3.2 (12/3, 13/3, 14/3)).
if Ekind (Formal) /= E_In_Parameter if Ekind (Formal) /= E_In_Parameter
and then Nkind (Actual) = N_Type_Conversion and then Nkind (Actual) = N_Type_Conversion
......
...@@ -702,6 +702,10 @@ package Opt is ...@@ -702,6 +702,10 @@ package Opt is
-- GNATMAKE, GPRBUILD -- GNATMAKE, GPRBUILD
-- Set to force recompilations even when the objects are up-to-date. -- Set to force recompilations even when the objects are up-to-date.
Force_Elab_Order_File : String_Ptr := null;
-- GNATBIND
-- File name specified for -f switch (the forced elaboration order file)
Front_End_Inlining : Boolean := False; Front_End_Inlining : Boolean := False;
-- GNAT -- GNAT
-- Set True to activate inlining by front-end expansion (even on GCC -- Set True to activate inlining by front-end expansion (even on GCC
......
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
-- This package defines tables used to store information needed for the SPARK -- This package defines tables used to store information needed for the SPARK
-- mode. It is used by procedures in Lib.Xref.SPARK_Specific to build the -- mode. It is used by procedures in Lib.Xref.SPARK_Specific to build the
-- SPARK specific cross-references information before writing it out to the -- SPARK-specific cross-reference information before writing it to the ALI
-- ALI file, and by Get_SPARK_Xrefs/Put_SPARK_Xrefs to read and write the text -- file, and by Get_SPARK_Xrefs/Put_SPARK_Xrefs to read/write the textual
-- form that is used in the ALI file. -- representation that is stored in the ALI file.
with Types; use Types; with Types; use Types;
with GNAT.Table; with GNAT.Table;
...@@ -128,8 +128,9 @@ package SPARK_Xrefs is ...@@ -128,8 +128,9 @@ package SPARK_Xrefs is
-- -- Xref Section -- -- -- Xref Section --
-- ------------------ -- ------------------
-- A second section defines cross-references useful for computing the set -- A second section defines cross-references useful for computing global
-- of global variables read/written in each subprogram/package. -- variables read/written in each subprogram/package/protected_type/
-- task_type.
-- FX dependency-number filename . entity-number entity -- FX dependency-number filename . entity-number entity
...@@ -197,14 +198,13 @@ package SPARK_Xrefs is ...@@ -197,14 +198,13 @@ package SPARK_Xrefs is
-- The Generated Globals section is located at the end of the ALI file -- The Generated Globals section is located at the end of the ALI file
-- All lines introducing information related to the Generated Globals -- All lines with information related to the Generated Globals begin with
-- have the string "GG" appearing in the beginning. This string ("GG") -- string "GG". This string should therefore not be used in the beginning
-- should therefore not be used in the beginning of any line that does -- of any line not related to Generated Globals.
-- not relate to Generated Globals.
-- The processing (reading and writing) of this section happens in -- The processing (reading and writing) of this section happens in package
-- package Flow_Generated_Globals (from the SPARK 2014 sources), for -- Flow_Generated_Globals (from the SPARK 2014 sources), for further
-- further information please refer there. -- information please refer there.
---------------- ----------------
-- Xref Table -- -- Xref Table --
...@@ -235,20 +235,20 @@ package SPARK_Xrefs is ...@@ -235,20 +235,20 @@ package SPARK_Xrefs is
-- Column number for the entity referenced -- Column number for the entity referenced
File_Num : Nat; File_Num : Nat;
-- Set to the file dependency number for the cross-reference. Note -- File dependency number for the cross-reference. Note that if no file
-- that if no file entry is present explicitly, this is just a copy -- entry is present explicitly, this is just a copy of the reference for
-- of the reference for the current cross-reference section. -- the current cross-reference section.
Scope_Num : Nat; Scope_Num : Nat;
-- Set to the scope number for the cross-reference. Note that if no -- Scope number for the cross-reference. Note that if no scope entry is
-- scope entry is present explicitly, this is just a copy of the -- present explicitly, this is just a copy of the reference for the
-- reference for the current cross-reference section. -- current cross-reference section.
Line : Nat; Line : Nat;
-- Line number for the reference -- Line number for the reference
Rtype : Character; Rtype : Character;
-- Indicates type of reference, using code used in ALI file: -- Indicates type of the reference, using code used in ALI file:
-- r = reference -- r = reference
-- c = reference to constant object -- c = reference to constant object
-- m = modification -- m = modification
...@@ -348,7 +348,7 @@ package SPARK_Xrefs is ...@@ -348,7 +348,7 @@ package SPARK_Xrefs is
Unit_File_Name : String_Ptr; Unit_File_Name : String_Ptr;
-- Pointer to file name for unit in ALI file, when File_Name refers to a -- Pointer to file name for unit in ALI file, when File_Name refers to a
-- subunit. Otherwise null. -- subunit; otherwise null.
File_Num : Nat; File_Num : Nat;
-- Dependency number in ALI file -- Dependency number in ALI file
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2015, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2016, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -28,6 +28,7 @@ with Debug; use Debug; ...@@ -28,6 +28,7 @@ with Debug; use Debug;
with Osint; use Osint; with Osint; use Osint;
with Opt; use Opt; with Opt; use Opt;
with System.OS_Lib; use System.OS_Lib;
with System.WCh_Con; use System.WCh_Con; with System.WCh_Con; use System.WCh_Con;
package body Switch.B is package body Switch.B is
...@@ -252,6 +253,22 @@ package body Switch.B is ...@@ -252,6 +253,22 @@ package body Switch.B is
Ptr := Ptr + 1; Ptr := Ptr + 1;
end if; end if;
-- Processing for f switch
when 'f' =>
if Ptr = Max then
Bad_Switch (Switch_Chars);
end if;
Force_Elab_Order_File :=
new String'(Switch_Chars (Ptr + 1 .. Max));
Ptr := Max + 1;
if not Is_Read_Accessible_File (Force_Elab_Order_File.all) then
Osint.Fail (Force_Elab_Order_File.all & ": file not found");
end if;
-- Processing for F switch -- Processing for F switch
when 'F' => when 'F' =>
......
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