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>
* exp_ch6.adb (Check_View_Conversion): Created this function
......
......@@ -6,7 +6,7 @@
-- --
-- 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 --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -32,10 +32,10 @@ with Types; use Types;
package Binde is
-- 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
-- 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.
package Elab_Order is new Table.Table (
......
......@@ -6,7 +6,7 @@
-- --
-- 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 --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -113,7 +113,9 @@ package body Bindusg is
Write_Line (" and enable symbolic tracebacks");
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
......
......@@ -2265,9 +2265,8 @@ package body Exp_Ch6 is
-- extra formal.
procedure Check_View_Conversion (Formal : Entity_Id; Actual : Node_Id);
-- Adds Invariant checks for every intermediate type between
-- the range of a view converted argument to its ancestor (from
-- parent to child).
-- Adds invariant checks for every intermediate type between the range
-- of a view converted argument to its ancestor (from parent to child).
function Inherited_From_Formal (S : Entity_Id) return Entity_Id;
-- Within an instance, a type derived from an untagged formal derived
......@@ -2361,31 +2360,35 @@ package body Exp_Ch6 is
procedure Check_View_Conversion (Formal : Entity_Id; Actual : Node_Id) is
Arg : Entity_Id;
Curr_Typ : Entity_Id := Empty;
Curr_Typ : Entity_Id;
Inv_Checks : List_Id;
Par_Typ : Entity_Id;
begin
Inv_Checks := No_List;
-- Extract actual object for type conversions
-- Extract the argument from a potentially nested set of view
-- conversions.
Arg := Actual;
while Nkind (Arg) = N_Type_Conversion loop
Arg := Expression (Arg);
end loop;
-- Move up the derivation chain starting with the type of the
-- the formal parameter down to the type of the actual object.
-- Move up the derivation chain starting with the type of the formal
-- 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
Curr_Typ := Par_Typ;
if Has_Invariants (Curr_Typ)
and then Present (Invariant_Procedure (Curr_Typ))
then
-- 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,
Make_Procedure_Call_Statement (Loc,
......@@ -3292,7 +3295,7 @@ package body Exp_Ch6 is
-- Invariant checks are performed for every intermediate type between
-- 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
-- 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
and then Nkind (Actual) = N_Type_Conversion
......
......@@ -702,6 +702,10 @@ package Opt is
-- GNATMAKE, GPRBUILD
-- 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;
-- GNAT
-- Set True to activate inlining by front-end expansion (even on GCC
......
......@@ -25,9 +25,9 @@
-- 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
-- SPARK specific cross-references information before writing it out to the
-- ALI file, and by Get_SPARK_Xrefs/Put_SPARK_Xrefs to read and write the text
-- form that is used in the ALI file.
-- SPARK-specific cross-reference information before writing it to the ALI
-- file, and by Get_SPARK_Xrefs/Put_SPARK_Xrefs to read/write the textual
-- representation that is stored in the ALI file.
with Types; use Types;
with GNAT.Table;
......@@ -128,8 +128,9 @@ package SPARK_Xrefs is
-- -- Xref Section --
-- ------------------
-- A second section defines cross-references useful for computing the set
-- of global variables read/written in each subprogram/package.
-- A second section defines cross-references useful for computing global
-- variables read/written in each subprogram/package/protected_type/
-- task_type.
-- FX dependency-number filename . entity-number entity
......@@ -197,14 +198,13 @@ package SPARK_Xrefs is
-- The Generated Globals section is located at the end of the ALI file
-- All lines introducing information related to the Generated Globals
-- have the string "GG" appearing in the beginning. This string ("GG")
-- should therefore not be used in the beginning of any line that does
-- not relate to Generated Globals.
-- All lines with information related to the Generated Globals begin with
-- string "GG". This string should therefore not be used in the beginning
-- of any line not related to Generated Globals.
-- The processing (reading and writing) of this section happens in
-- package Flow_Generated_Globals (from the SPARK 2014 sources), for
-- further information please refer there.
-- The processing (reading and writing) of this section happens in package
-- Flow_Generated_Globals (from the SPARK 2014 sources), for further
-- information please refer there.
----------------
-- Xref Table --
......@@ -235,20 +235,20 @@ package SPARK_Xrefs is
-- Column number for the entity referenced
File_Num : Nat;
-- Set to the file dependency number for the cross-reference. Note
-- that if no file entry is present explicitly, this is just a copy
-- of the reference for the current cross-reference section.
-- File dependency number for the cross-reference. Note that if no file
-- entry is present explicitly, this is just a copy of the reference for
-- the current cross-reference section.
Scope_Num : Nat;
-- Set to the scope number for the cross-reference. Note that if no
-- scope entry is present explicitly, this is just a copy of the
-- reference for the current cross-reference section.
-- Scope number for the cross-reference. Note that if no scope entry is
-- present explicitly, this is just a copy of the reference for the
-- current cross-reference section.
Line : Nat;
-- Line number for the reference
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
-- c = reference to constant object
-- m = modification
......@@ -348,7 +348,7 @@ package SPARK_Xrefs is
Unit_File_Name : String_Ptr;
-- Pointer to file name for unit in ALI file, when File_Name refers to a
-- subunit. Otherwise null.
-- subunit; otherwise null.
File_Num : Nat;
-- Dependency number in ALI file
......
......@@ -6,7 +6,7 @@
-- --
-- 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 --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -28,6 +28,7 @@ with Debug; use Debug;
with Osint; use Osint;
with Opt; use Opt;
with System.OS_Lib; use System.OS_Lib;
with System.WCh_Con; use System.WCh_Con;
package body Switch.B is
......@@ -252,6 +253,22 @@ package body Switch.B is
Ptr := Ptr + 1;
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
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