Commit ef952fd5 by Hristian Kirtchev Committed by Arnaud Charlet

exp_util.adb, [...]: Minor reformatting.

2017-04-28  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_util.adb, g-dyntab.adb, par-ch4.adb, sem_util.adb, sem_attr.adb,
	gnat1drv.adb, exp_disp.adb, namet.adb, alloc.ads: Minor reformatting.

From-SVN: r247383
parent dc99d241
2017-04-28 Hristian Kirtchev <kirtchev@adacore.com>
* exp_util.adb, g-dyntab.adb, par-ch4.adb, sem_util.adb, sem_attr.adb,
gnat1drv.adb, exp_disp.adb, namet.adb, alloc.ads: Minor reformatting.
2017-04-28 Gary Dismukes <dismukes@adacore.com> 2017-04-28 Gary Dismukes <dismukes@adacore.com>
* exp_util.adb: Minor reformatting. * exp_util.adb: Minor reformatting.
......
...@@ -651,8 +651,8 @@ package body Exp_Disp is ...@@ -651,8 +651,8 @@ package body Exp_Disp is
Controlling_Tag : Node_Id; Controlling_Tag : Node_Id;
procedure Build_Class_Wide_Check; procedure Build_Class_Wide_Check;
-- If the denoted subprogram has a class-wide precondition, generate -- If the denoted subprogram has a class-wide precondition, generate a
-- a check using that precondition before the dispatching call, because -- check using that precondition before the dispatching call, because
-- this is the only class-wide precondition that applies to the call. -- this is the only class-wide precondition that applies to the call.
function New_Value (From : Node_Id) return Node_Id; function New_Value (From : Node_Id) return Node_Id;
...@@ -665,11 +665,6 @@ package body Exp_Disp is ...@@ -665,11 +665,6 @@ package body Exp_Disp is
---------------------------- ----------------------------
procedure Build_Class_Wide_Check is procedure Build_Class_Wide_Check is
Prec : Node_Id;
Cond : Node_Id;
Msg : Node_Id;
Str_Loc : constant String := Build_Location_String (Loc);
function Replace_Formals (N : Node_Id) return Traverse_Result; function Replace_Formals (N : Node_Id) return Traverse_Result;
-- Replace occurrences of the formals of the subprogram by the -- Replace occurrences of the formals of the subprogram by the
-- corresponding actuals in the call, given that this check is -- corresponding actuals in the call, given that this check is
...@@ -697,6 +692,7 @@ package body Exp_Disp is ...@@ -697,6 +692,7 @@ package body Exp_Disp is
Rewrite (N, New_Copy_Tree (A)); Rewrite (N, New_Copy_Tree (A));
exit; exit;
end if; end if;
Next_Formal (F); Next_Formal (F);
Next_Actual (A); Next_Actual (A);
end loop; end loop;
...@@ -707,6 +703,17 @@ package body Exp_Disp is ...@@ -707,6 +703,17 @@ package body Exp_Disp is
end Replace_Formals; end Replace_Formals;
procedure Update is new Traverse_Proc (Replace_Formals); procedure Update is new Traverse_Proc (Replace_Formals);
-- Local variables
Str_Loc : constant String := Build_Location_String (Loc);
Cond : Node_Id;
Msg : Node_Id;
Prec : Node_Id;
-- Start of processing for Build_Class_Wide_Check
begin begin
-- Locate class-wide precondition, if any -- Locate class-wide precondition, if any
...@@ -727,10 +734,11 @@ package body Exp_Disp is ...@@ -727,10 +734,11 @@ package body Exp_Disp is
end if; end if;
-- The expression for the precondition is analyzed within the -- The expression for the precondition is analyzed within the
-- generated pragma. The message text is the last parameter -- generated pragma. The message text is the last parameter of
-- of the generated pragma, indicating source of precondition. -- the generated pragma, indicating source of precondition.
Cond := New_Copy_Tree Cond :=
New_Copy_Tree
(Expression (First (Pragma_Argument_Associations (Prec)))); (Expression (First (Pragma_Argument_Associations (Prec))));
Update (Cond); Update (Cond);
...@@ -750,8 +758,7 @@ package body Exp_Disp is ...@@ -750,8 +758,7 @@ package body Exp_Disp is
Then_Statements => New_List ( Then_Statements => New_List (
Make_Procedure_Call_Statement (Loc, Make_Procedure_Call_Statement (Loc,
Name => Name =>
New_Occurrence_Of New_Occurrence_Of (RTE (RE_Raise_Assert_Failure), Loc),
(RTE (RE_Raise_Assert_Failure), Loc),
Parameter_Associations => New_List (Msg))))); Parameter_Associations => New_List (Msg)))));
end if; end if;
end Build_Class_Wide_Check; end Build_Class_Wide_Check;
......
...@@ -1114,8 +1114,8 @@ package body Exp_Util is ...@@ -1114,8 +1114,8 @@ package body Exp_Util is
if Present (New_E) then if Present (New_E) then
Rewrite (N, New_Occurrence_Of (New_E, Sloc (N))); Rewrite (N, New_Occurrence_Of (New_E, Sloc (N)));
-- If the entity is an overridden primitive and we are not in -- If the entity is an overridden primitive and we are not
-- GNATprove mode, we must build a wrapper for the current -- in GNATprove mode, we must build a wrapper for the current
-- inherited operation. If the reference is the prefix of an -- inherited operation. If the reference is the prefix of an
-- attribute such as 'Result (or others ???) there is no need -- attribute such as 'Result (or others ???) there is no need
-- for a wrapper: the condition is just rewritten in terms of -- for a wrapper: the condition is just rewritten in terms of
......
...@@ -71,9 +71,12 @@ package body GNAT.Dynamic_Tables is ...@@ -71,9 +71,12 @@ package body GNAT.Dynamic_Tables is
procedure Append (T : in out Instance; New_Val : Table_Component_Type) is procedure Append (T : in out Instance; New_Val : Table_Component_Type) is
pragma Assert (not T.Locked); pragma Assert (not T.Locked);
New_Last : constant Table_Last_Type := Last (T) + 1; New_Last : constant Table_Last_Type := Last (T) + 1;
begin begin
if New_Last <= Last_Allocated (T) then if New_Last <= Last_Allocated (T) then
-- fast path
-- Fast path
T.P.Last := New_Last; T.P.Last := New_Last;
T.Table (New_Last) := New_Val; T.Table (New_Last) := New_Val;
......
...@@ -116,6 +116,24 @@ procedure Gnat1drv is ...@@ -116,6 +116,24 @@ procedure Gnat1drv is
---------------------------- ----------------------------
procedure Adjust_Global_Switches is procedure Adjust_Global_Switches is
procedure SPARK_Library_Warning (Kind : String);
-- Issue a warning in GNATprove mode if the run-time library does not
-- fully support IEEE-754 floating-point semantics.
---------------------------
-- SPARK_Library_Warning --
---------------------------
procedure SPARK_Library_Warning (Kind : String) is
begin
Write_Line
("warning: run-time library may be configured incorrectly");
Write_Line
("warning: (SPARK analysis requires support for " & Kind & ')');
end SPARK_Library_Warning;
-- Start of processing for Adjust_Global_Switches
begin begin
-- -gnatd.M enables Relaxed_RM_Semantics -- -gnatd.M enables Relaxed_RM_Semantics
...@@ -500,29 +518,15 @@ procedure Gnat1drv is ...@@ -500,29 +518,15 @@ procedure Gnat1drv is
-- Detect that the runtime library support for floating-point numbers -- Detect that the runtime library support for floating-point numbers
-- may not be compatible with SPARK analysis of IEEE-754 floats. -- may not be compatible with SPARK analysis of IEEE-754 floats.
declare
procedure SPARK_Library_Warning (Kind : String);
-- Issue a warning in GNATprove mode if the run-time library does
-- not fully support IEEE-754 floating-point semantics.
procedure SPARK_Library_Warning (Kind : String) is
begin
Write_Line
("warning: run-time library may be configured incorrectly");
Write_Line
("warning: (SPARK analysis requires support for " & Kind
& ')');
end SPARK_Library_Warning;
begin
if Denorm_On_Target = False then if Denorm_On_Target = False then
SPARK_Library_Warning ("float subnormals"); SPARK_Library_Warning ("float subnormals");
elsif Machine_Rounds_On_Target = False then elsif Machine_Rounds_On_Target = False then
SPARK_Library_Warning ("float rounding"); SPARK_Library_Warning ("float rounding");
elsif Signed_Zeros_On_Target = False then elsif Signed_Zeros_On_Target = False then
SPARK_Library_Warning ("signed zeros"); SPARK_Library_Warning ("signed zeros");
end if; end if;
end;
end if; end if;
-- Set Configurable_Run_Time mode if system.ads flag set or if the -- Set Configurable_Run_Time mode if system.ads flag set or if the
......
...@@ -161,6 +161,7 @@ package body Namet is ...@@ -161,6 +161,7 @@ package body Namet is
procedure Append (Buf : in out Bounded_String; Id : Name_Id) is procedure Append (Buf : in out Bounded_String; Id : Name_Id) is
pragma Assert (Id in Name_Entries.First .. Name_Entries.Last); pragma Assert (Id in Name_Entries.First .. Name_Entries.Last);
Index : constant Int := Name_Entries.Table (Id).Name_Chars_Index; Index : constant Int := Name_Entries.Table (Id).Name_Chars_Index;
Len : constant Short := Name_Entries.Table (Id).Name_Len; Len : constant Short := Name_Entries.Table (Id).Name_Len;
Chars : Name_Chars.Table_Type renames Chars : Name_Chars.Table_Type renames
......
...@@ -589,7 +589,7 @@ package body Ch4 is ...@@ -589,7 +589,7 @@ package body Ch4 is
-- Special handling for 'Image in Ada 2012, where -- Special handling for 'Image in Ada 2012, where
-- the attribute can be parameterless and its value -- the attribute can be parameterless and its value
-- can be the prefix of a slice. Rewrite name as a -- can be the prefix of a slice. Rewrite name as a
-- a slice, Expr is its low bound. -- slice, Expr is its low bound.
if Token = Tok_Dot_Dot if Token = Tok_Dot_Dot
and then Attr_Name = Name_Image and then Attr_Name = Name_Image
......
...@@ -4032,11 +4032,11 @@ package body Sem_Attr is ...@@ -4032,11 +4032,11 @@ package body Sem_Attr is
when Attribute_Image => when Attribute_Image =>
Check_SPARK_05_Restriction_On_Attribute; Check_SPARK_05_Restriction_On_Attribute;
-- AI12-00124-1 : The ARG has adopted the GNAT semantics of 'Img -- AI12-00124-1 : The ARG has adopted the GNAT semantics of 'Img for
-- for scalar types, so that the prefix can be an object and not -- scalar types, so that the prefix can be an object and not a type,
-- a type, and there is no need for an argument. Given this vote -- and there is no need for an argument. Given the vote of confidence
-- of confidence from the ARG, simplest is to transform this new -- from the ARG, simplest is to transform this new usage of 'Image
-- usage of 'Image into a reference to 'Img. -- into a reference to 'Img.
if Ada_Version > Ada_2005 if Ada_Version > Ada_2005
and then Is_Object_Reference (P) and then Is_Object_Reference (P)
...@@ -4048,9 +4048,9 @@ package body Sem_Attr is ...@@ -4048,9 +4048,9 @@ package body Sem_Attr is
Prefix => Relocate_Node (P), Prefix => Relocate_Node (P),
Attribute_Name => Name_Img)); Attribute_Name => Name_Img));
-- If the attribute reference includes expressions, the -- If the attribute reference includes expressions, the only
-- only possible interpretation is as an indexing of the -- possible interpretation is as an indexing of the parameterless
-- parameterless version of 'Image, so rewrite it accordingly. -- version of 'Image, so rewrite it accordingly.
else else
Rewrite (N, Rewrite (N,
...@@ -4061,6 +4061,7 @@ package body Sem_Attr is ...@@ -4061,6 +4061,7 @@ package body Sem_Attr is
Attribute_Name => Name_Img), Attribute_Name => Name_Img),
Expressions => Expressions (N))); Expressions => Expressions (N)));
end if; end if;
Analyze (N); Analyze (N);
return; return;
......
...@@ -11251,6 +11251,7 @@ package body Sem_Util is ...@@ -11251,6 +11251,7 @@ package body Sem_Util is
S := Current_Scope; S := Current_Scope;
while Present (S) and then S /= Standard_Standard loop while Present (S) and then S /= Standard_Standard loop
if Is_Generic_Instance (S) then if Is_Generic_Instance (S) then
-- A child instance is always compiled in the context of a parent -- A child instance is always compiled in the context of a parent
-- instance. Nevertheless, the actuals are not analyzed in an -- instance. Nevertheless, the actuals are not analyzed in an
-- instance context. We detect this case by examining the current -- instance context. We detect this case by examining the current
......
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