Commit e645cb39 by Arnaud Charlet

[multiple changes]

2015-11-18  Nicolas Roche  <roche@adacore.com>

	* sysdep.c (__gnat_localtime_tzoff): On Windows platform
	GetTimeZoneInformation function is thread-safe. Thus there
	is no need to lock the runtime in the implementation of
	__gnat_localtime_tzoff on that platform.

2015-11-18  Eric Botcazou  <ebotcazou@adacore.com>

	* s-arit64.adb (To_Neg_Int): Add a special case for 2**63 input.

2015-11-18  Hristian Kirtchev  <kirtchev@adacore.com>

	* contracts.adb (Analyze_Contracts): New routine.
	(Analyze_Enclosing_Package_Body_Contract): Removed.
	(Analyze_Entry_Or_Subprogram_Contract): Add formal parameter
	Freeze_Id.  Propagate the entity of the freezing body to vaious
	analysis routines.
	(Analyze_Initial_Declaration_Contract): Removed.
	(Analyze_Object_Contract): Add formal parameter
	Freeze_Id. Propagate the entity of the freezing body to vaious
	analysis routines.
	(Analyze_Previous_Contracts): New routine.
	* contracts.ads (Analyze_Enclosing_Package_Body_Contract): Removed.
	(Analyze_Contracts): New routine.
	(Analyze_Entry_Or_Subprogram_Contract): Add formal
	parameter Freeze_Id and update the comment on usage.
	(Analyze_Initial_Declaration_Contract): Removed.
	(Analyze_Object_Contract): Add formal parameter Freeze_Id and
	update the comment on usage.
	(Analyze_Previous_Contracts): New routine.
	* sem_ch3.adb (Analyze_Declarations): Use Analyze_Contracts to
	analyze all contracts of eligible constructs.
	* sem_ch6.adb (Analyze_Generic_Subprogram_Body):
	A body no longer freezes the contract of its initial
	declaration. This effect is achieved through different means.
	(Analyze_Subprogram_Body_Helper): A body now freezes the contracts
	of all eligible constructs that precede it. A body no longer
	freezes the contract of its initial declaration. This effect is
	achieved through different means.
	* sem_ch7.adb (Analyze_Package_Body_Helper): A body now freezes
	the contracts of all eligible constructs that precede it. A body
	no longer freezes the contract of its initial declaration. This
	effect is achieved through different means.
	* sem_ch9.adb (Analyze_Entry_Body): A body now freezes
	the contracts of all eligible constructs that precede
	it. A body no longer freezes the contract of its initial
	declaration. This effect is achieved through different means.
	(Analyze_Protected_Body): A body now freezes the contracts
	of all eligible constructs that precede it. A body no longer
	freezes the contract of its initial declaration. This effect
	is achieved through different means.
	(Analyze_Task_Body): A
	body now freezes the contracts of all eligible constructs that
	precede it. A body no longer freezes the contract of its initial
	declaration. This effect is achieved through different means.
	* sem_prag.adb (Add_Item_To_Name_Buffer): Single protected/task
	objects now output their respective current instance of xxx
	type messages.	(Analyze_Contract_Cases_In_Decl_Part): Add
	formal parameter Freeze_Id. Emit a clarification message
	when an undefined entity may the byproduct of contract
	freezing.
	(Analyze_Part_Of_In_Decl_Part): Add formal
	parameter Freeze_Id. Emit a clarification message when an
	undefined entity may the byproduct of contract freezing.
	(Analyze_Pre_Post_Condition_In_Decl_Part): Add formal
	parameter Freeze_Id. Emit a clarification message when an
	undefined entity may the byproduct of contract freezing.
	(Analyze_Refined_State_In_Decl_Part): Do not report unused body
	states as constituents of single protected/task types may not
	bave been identified yet.
	(Collect_Subprogram_Inputs_Outputs):
	Reimplemented.	(Contract_Freeze_Error): New routine.
	(Process_Overloadable): Use predicate Is_Single_Task_Object.
	* sem_prag.ads (Analyze_Contract_Cases_In_Decl_Part):
	Add formal parameter Freeze_Id and update the comment
	on usage.
	(Analyze_Part_Of_In_Decl_Part): Add formal
	parameter Freeze_Id and update the comment on usage.
	(Analyze_Pre_Post_Condition_In_Decl_Part): Add formal parameter
	Freeze_Id and update the comment on usage.
	* sem_util.adb (Check_Unused_Body_States): Remove global
	variable Legal_Constits. The routine now reports unused
	body states regardless of whether constituents are
	legal or not.
	(Collect_Body_States): A constituent of a
	single protected/task type is not a visible state of a
	package body.
	(Collect_Visible_States): A constituent
	of a single protected/task type is not a visible
	state of a package body.
	(Has_Undefined_Reference): New routine.
	(Is_Single_Concurrent_Object): Reimplemented.
	(Is_Single_Protected_Object): New routine.
	(Is_Single_Task_Object): New routine.
	(Is_Visible_Object): New routine.
	(Report_Unused_Body_States): Moved to Check_Unused_Body_States.
	* sem_util.ads (Check_Unused_Body_States): Update the comment on usage.
	(Has_Undefined_Reference): New routine.
	(Is_Single_Protected_Object): New routine.
	(Is_Single_Task_Object): New routine.
	(Report_Unused_Body_States): Moved to Check_Unused_Body_States.

2015-11-18  Pierre-Marie de Rodat  <derodat@adacore.com>

	* Makefile.rtl, impunit.adb: Add g-strhas.ads.
	* g-strhas.ads: New file.
	* s-strhas.ads: Add a comment to redirect users to g-strhas.ads.

2015-11-18  Bob Duff  <duff@adacore.com>

	* sem_elab.adb (Check_Internal_Call_Continue): Fix the case
	where the call in question is to a renaming of a subprogram that
	can be safely called without ABE.
	* checks.adb: Minor edits.

From-SVN: r230546
parent 33f47f42
2015-11-18 Nicolas Roche <roche@adacore.com>
* sysdep.c (__gnat_localtime_tzoff): On Windows platform
GetTimeZoneInformation function is thread-safe. Thus there
is no need to lock the runtime in the implementation of
__gnat_localtime_tzoff on that platform.
2015-11-18 Eric Botcazou <ebotcazou@adacore.com>
* s-arit64.adb (To_Neg_Int): Add a special case for 2**63 input.
2015-11-18 Hristian Kirtchev <kirtchev@adacore.com>
* contracts.adb (Analyze_Contracts): New routine.
(Analyze_Enclosing_Package_Body_Contract): Removed.
(Analyze_Entry_Or_Subprogram_Contract): Add formal parameter
Freeze_Id. Propagate the entity of the freezing body to vaious
analysis routines.
(Analyze_Initial_Declaration_Contract): Removed.
(Analyze_Object_Contract): Add formal parameter
Freeze_Id. Propagate the entity of the freezing body to vaious
analysis routines.
(Analyze_Previous_Contracts): New routine.
* contracts.ads (Analyze_Enclosing_Package_Body_Contract): Removed.
(Analyze_Contracts): New routine.
(Analyze_Entry_Or_Subprogram_Contract): Add formal
parameter Freeze_Id and update the comment on usage.
(Analyze_Initial_Declaration_Contract): Removed.
(Analyze_Object_Contract): Add formal parameter Freeze_Id and
update the comment on usage.
(Analyze_Previous_Contracts): New routine.
* sem_ch3.adb (Analyze_Declarations): Use Analyze_Contracts to
analyze all contracts of eligible constructs.
* sem_ch6.adb (Analyze_Generic_Subprogram_Body):
A body no longer freezes the contract of its initial
declaration. This effect is achieved through different means.
(Analyze_Subprogram_Body_Helper): A body now freezes the contracts
of all eligible constructs that precede it. A body no longer
freezes the contract of its initial declaration. This effect is
achieved through different means.
* sem_ch7.adb (Analyze_Package_Body_Helper): A body now freezes
the contracts of all eligible constructs that precede it. A body
no longer freezes the contract of its initial declaration. This
effect is achieved through different means.
* sem_ch9.adb (Analyze_Entry_Body): A body now freezes
the contracts of all eligible constructs that precede
it. A body no longer freezes the contract of its initial
declaration. This effect is achieved through different means.
(Analyze_Protected_Body): A body now freezes the contracts
of all eligible constructs that precede it. A body no longer
freezes the contract of its initial declaration. This effect
is achieved through different means.
(Analyze_Task_Body): A
body now freezes the contracts of all eligible constructs that
precede it. A body no longer freezes the contract of its initial
declaration. This effect is achieved through different means.
* sem_prag.adb (Add_Item_To_Name_Buffer): Single protected/task
objects now output their respective current instance of xxx
type messages. (Analyze_Contract_Cases_In_Decl_Part): Add
formal parameter Freeze_Id. Emit a clarification message
when an undefined entity may the byproduct of contract
freezing.
(Analyze_Part_Of_In_Decl_Part): Add formal
parameter Freeze_Id. Emit a clarification message when an
undefined entity may the byproduct of contract freezing.
(Analyze_Pre_Post_Condition_In_Decl_Part): Add formal
parameter Freeze_Id. Emit a clarification message when an
undefined entity may the byproduct of contract freezing.
(Analyze_Refined_State_In_Decl_Part): Do not report unused body
states as constituents of single protected/task types may not
bave been identified yet.
(Collect_Subprogram_Inputs_Outputs):
Reimplemented. (Contract_Freeze_Error): New routine.
(Process_Overloadable): Use predicate Is_Single_Task_Object.
* sem_prag.ads (Analyze_Contract_Cases_In_Decl_Part):
Add formal parameter Freeze_Id and update the comment
on usage.
(Analyze_Part_Of_In_Decl_Part): Add formal
parameter Freeze_Id and update the comment on usage.
(Analyze_Pre_Post_Condition_In_Decl_Part): Add formal parameter
Freeze_Id and update the comment on usage.
* sem_util.adb (Check_Unused_Body_States): Remove global
variable Legal_Constits. The routine now reports unused
body states regardless of whether constituents are
legal or not.
(Collect_Body_States): A constituent of a
single protected/task type is not a visible state of a
package body.
(Collect_Visible_States): A constituent
of a single protected/task type is not a visible
state of a package body.
(Has_Undefined_Reference): New routine.
(Is_Single_Concurrent_Object): Reimplemented.
(Is_Single_Protected_Object): New routine.
(Is_Single_Task_Object): New routine.
(Is_Visible_Object): New routine.
(Report_Unused_Body_States): Moved to Check_Unused_Body_States.
* sem_util.ads (Check_Unused_Body_States): Update the comment on usage.
(Has_Undefined_Reference): New routine.
(Is_Single_Protected_Object): New routine.
(Is_Single_Task_Object): New routine.
(Report_Unused_Body_States): Moved to Check_Unused_Body_States.
2015-11-18 Pierre-Marie de Rodat <derodat@adacore.com>
* Makefile.rtl, impunit.adb: Add g-strhas.ads.
* g-strhas.ads: New file.
* s-strhas.ads: Add a comment to redirect users to g-strhas.ads.
2015-11-18 Bob Duff <duff@adacore.com>
* sem_elab.adb (Check_Internal_Call_Continue): Fix the case
where the call in question is to a renaming of a subprogram that
can be safely called without ABE.
* checks.adb: Minor edits.
2015-11-18 Hristian Kirtchev <kirtchev@adacore.com> 2015-11-18 Hristian Kirtchev <kirtchev@adacore.com>
* atree.adb (Elist11): New routine. * atree.adb (Elist11): New routine.
......
...@@ -455,6 +455,7 @@ GNATRTL_NONTASKING_OBJS= \ ...@@ -455,6 +455,7 @@ GNATRTL_NONTASKING_OBJS= \
g-sptabo$(objext) \ g-sptabo$(objext) \
g-sptain$(objext) \ g-sptain$(objext) \
g-sptavs$(objext) \ g-sptavs$(objext) \
g-strhas$(objext) \
g-string$(objext) \ g-string$(objext) \
g-strspl$(objext) \ g-strspl$(objext) \
g-table$(objext) \ g-table$(objext) \
......
...@@ -1261,10 +1261,10 @@ package body Checks is ...@@ -1261,10 +1261,10 @@ package body Checks is
-- This block is inserted (using Insert_Actions), and then the node -- This block is inserted (using Insert_Actions), and then the node
-- is replaced with a reference to Rnn. -- is replaced with a reference to Rnn.
-- A special case arises if our parent is a conversion node. In this -- If our parent is a conversion node then there is no point in
-- case no point in generating a conversion to Result_Type, we will -- generating a conversion to Result_Type, we will let the parent
-- let the parent handle this. Note that this special case is not -- handle this. Note that this special case is not just about
-- just about optimization. Consider -- optimization. Consider
-- A,B,C : Integer; -- A,B,C : Integer;
-- ... -- ...
......
...@@ -50,6 +50,16 @@ with Tbuild; use Tbuild; ...@@ -50,6 +50,16 @@ with Tbuild; use Tbuild;
package body Contracts is package body Contracts is
procedure Analyze_Contracts
(L : List_Id;
Freeze_Nod : Node_Id;
Freeze_Id : Entity_Id);
-- Subsidiary to the one parameter version of Analyze_Contracts and routine
-- Analyze_Previous_Constracts. Analyze the contracts of all constructs in
-- the list L. If Freeze_Nod is set, then the analysis stops when the node
-- is reached. Freeze_Id is the entity of some related context which caused
-- freezing upto node Freeze_Nod.
procedure Expand_Subprogram_Contract (Body_Id : Entity_Id); procedure Expand_Subprogram_Contract (Body_Id : Entity_Id);
-- Expand the contracts of a subprogram body and its correspoding spec (if -- Expand the contracts of a subprogram body and its correspoding spec (if
-- any). This routine processes all [refined] pre- and postconditions as -- any). This routine processes all [refined] pre- and postconditions as
...@@ -330,30 +340,79 @@ package body Contracts is ...@@ -330,30 +340,79 @@ package body Contracts is
end if; end if;
end Add_Contract_Item; end Add_Contract_Item;
--------------------------------------------- -----------------------
-- Analyze_Enclosing_Package_Body_Contract -- -- Analyze_Contracts --
--------------------------------------------- -----------------------
procedure Analyze_Contracts (L : List_Id) is
begin
Analyze_Contracts (L, Freeze_Nod => Empty, Freeze_Id => Empty);
end Analyze_Contracts;
procedure Analyze_Enclosing_Package_Body_Contract (Body_Decl : Node_Id) is procedure Analyze_Contracts
Par : Node_Id; (L : List_Id;
Freeze_Nod : Node_Id;
Freeze_Id : Entity_Id)
is
Decl : Node_Id;
begin begin
-- Climb the parent chain looking for an enclosing body. Do not use the Decl := First (L);
-- scope stack, as a body uses the entity of its corresponding spec. while Present (Decl) loop
Par := Parent (Body_Decl); -- The caller requests that the traversal stops at a particular node
while Present (Par) loop -- that causes contract "freezing".
if Nkind (Par) = N_Package_Body then
Analyze_Package_Body_Contract
(Body_Id => Defining_Entity (Par),
Freeze_Id => Defining_Entity (Body_Decl));
return; if Present (Freeze_Nod) and then Decl = Freeze_Nod then
exit;
end if; end if;
Par := Parent (Par); -- Entry or subprogram declarations
if Nkind_In (Decl, N_Abstract_Subprogram_Declaration,
N_Entry_Declaration,
N_Generic_Subprogram_Declaration,
N_Subprogram_Declaration)
then
Analyze_Entry_Or_Subprogram_Contract
(Subp_Id => Defining_Entity (Decl),
Freeze_Id => Freeze_Id);
-- Entry or subprogram bodies
elsif Nkind_In (Decl, N_Entry_Body, N_Subprogram_Body) then
Analyze_Entry_Or_Subprogram_Body_Contract (Defining_Entity (Decl));
-- Objects
elsif Nkind (Decl) = N_Object_Declaration then
Analyze_Object_Contract
(Obj_Id => Defining_Entity (Decl),
Freeze_Id => Freeze_Id);
-- Protected untis
elsif Nkind_In (Decl, N_Protected_Type_Declaration,
N_Single_Protected_Declaration)
then
Analyze_Protected_Contract (Defining_Entity (Decl));
-- Subprogram body stubs
elsif Nkind (Decl) = N_Subprogram_Body_Stub then
Analyze_Subprogram_Body_Stub_Contract (Defining_Entity (Decl));
-- Task units
elsif Nkind_In (Decl, N_Single_Task_Declaration,
N_Task_Type_Declaration)
then
Analyze_Task_Contract (Defining_Entity (Decl));
end if;
Next (Decl);
end loop; end loop;
end Analyze_Enclosing_Package_Body_Contract; end Analyze_Contracts;
----------------------------------------------- -----------------------------------------------
-- Analyze_Entry_Or_Subprogram_Body_Contract -- -- Analyze_Entry_Or_Subprogram_Body_Contract --
...@@ -435,7 +494,10 @@ package body Contracts is ...@@ -435,7 +494,10 @@ package body Contracts is
-- Analyze_Entry_Or_Subprogram_Contract -- -- Analyze_Entry_Or_Subprogram_Contract --
------------------------------------------ ------------------------------------------
procedure Analyze_Entry_Or_Subprogram_Contract (Subp_Id : Entity_Id) is procedure Analyze_Entry_Or_Subprogram_Contract
(Subp_Id : Entity_Id;
Freeze_Id : Entity_Id := Empty)
is
Items : constant Node_Id := Contract (Subp_Id); Items : constant Node_Id := Contract (Subp_Id);
Subp_Decl : constant Node_Id := Unit_Declaration_Node (Subp_Id); Subp_Decl : constant Node_Id := Unit_Declaration_Node (Subp_Id);
...@@ -489,7 +551,7 @@ package body Contracts is ...@@ -489,7 +551,7 @@ package body Contracts is
else else
Prag := Pre_Post_Conditions (Items); Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop while Present (Prag) loop
Analyze_Pre_Post_Condition_In_Decl_Part (Prag); Analyze_Pre_Post_Condition_In_Decl_Part (Prag, Freeze_Id);
Prag := Next_Pragma (Prag); Prag := Next_Pragma (Prag);
end loop; end loop;
end if; end if;
...@@ -513,7 +575,7 @@ package body Contracts is ...@@ -513,7 +575,7 @@ package body Contracts is
-- Otherwise analyze the contract cases -- Otherwise analyze the contract cases
else else
Analyze_Contract_Cases_In_Decl_Part (Prag); Analyze_Contract_Cases_In_Decl_Part (Prag, Freeze_Id);
end if; end if;
else else
pragma Assert (Prag_Nam = Name_Test_Case); pragma Assert (Prag_Nam = Name_Test_Case);
...@@ -587,44 +649,14 @@ package body Contracts is ...@@ -587,44 +649,14 @@ package body Contracts is
end if; end if;
end Analyze_Entry_Or_Subprogram_Contract; end Analyze_Entry_Or_Subprogram_Contract;
------------------------------------------
-- Analyze_Initial_Declaration_Contract --
------------------------------------------
procedure Analyze_Initial_Declaration_Contract (Body_Decl : Node_Id) is
Spec_Id : constant Entity_Id := Unique_Defining_Entity (Body_Decl);
begin
-- Note that stubs are excluded because the compiler always analyzes the
-- proper body when a stub is encountered.
if Nkind (Body_Decl) = N_Entry_Body then
Analyze_Entry_Or_Subprogram_Contract (Spec_Id);
elsif Nkind (Body_Decl) = N_Package_Body then
Analyze_Package_Contract (Spec_Id);
elsif Nkind (Body_Decl) = N_Protected_Body then
Analyze_Protected_Contract (Spec_Id);
elsif Nkind (Body_Decl) = N_Subprogram_Body then
if Present (Corresponding_Spec (Body_Decl)) then
Analyze_Entry_Or_Subprogram_Contract (Spec_Id);
end if;
elsif Nkind (Body_Decl) = N_Task_Body then
Analyze_Task_Contract (Spec_Id);
else
raise Program_Error;
end if;
end Analyze_Initial_Declaration_Contract;
----------------------------- -----------------------------
-- Analyze_Object_Contract -- -- Analyze_Object_Contract --
----------------------------- -----------------------------
procedure Analyze_Object_Contract (Obj_Id : Entity_Id) is procedure Analyze_Object_Contract
(Obj_Id : Entity_Id;
Freeze_Id : Entity_Id := Empty)
is
Obj_Typ : constant Entity_Id := Etype (Obj_Id); Obj_Typ : constant Entity_Id := Etype (Obj_Id);
AR_Val : Boolean := False; AR_Val : Boolean := False;
AW_Val : Boolean := False; AW_Val : Boolean := False;
...@@ -769,7 +801,7 @@ package body Contracts is ...@@ -769,7 +801,7 @@ package body Contracts is
-- Analyze indicator Part_Of -- Analyze indicator Part_Of
if Present (Prag) then if Present (Prag) then
Analyze_Part_Of_In_Decl_Part (Prag); Analyze_Part_Of_In_Decl_Part (Prag, Freeze_Id);
-- The variable is a constituent of a single protected/task type -- The variable is a constituent of a single protected/task type
-- and behaves as a component of the type. Verify that references -- and behaves as a component of the type. Verify that references
...@@ -1055,6 +1087,51 @@ package body Contracts is ...@@ -1055,6 +1087,51 @@ package body Contracts is
end Analyze_Package_Contract; end Analyze_Package_Contract;
-------------------------------- --------------------------------
-- Analyze_Previous_Contracts --
--------------------------------
procedure Analyze_Previous_Contracts (Body_Decl : Node_Id) is
Body_Id : constant Entity_Id := Defining_Entity (Body_Decl);
Par : Node_Id;
begin
-- A body that is in the process of being inlined appears from source,
-- but carries name _parent. Such a body does not cause "freezing" of
-- contracts.
if Chars (Body_Id) = Name_uParent then
return;
end if;
-- Climb the parent chain looking for an enclosing package body. Do not
-- use the scope stack, as a body uses the entity of its corresponding
-- spec.
Par := Parent (Body_Decl);
while Present (Par) loop
if Nkind (Par) = N_Package_Body then
Analyze_Package_Body_Contract
(Body_Id => Defining_Entity (Par),
Freeze_Id => Defining_Entity (Body_Decl));
exit;
end if;
Par := Parent (Par);
end loop;
-- Analyze the contracts of all eligible construct upto the body which
-- caused the "freezing".
if Is_List_Member (Body_Decl) then
Analyze_Contracts
(L => List_Containing (Body_Decl),
Freeze_Nod => Body_Decl,
Freeze_Id => Body_Id);
end if;
end Analyze_Previous_Contracts;
--------------------------------
-- Analyze_Protected_Contract -- -- Analyze_Protected_Contract --
-------------------------------- --------------------------------
......
...@@ -59,9 +59,8 @@ package Contracts is ...@@ -59,9 +59,8 @@ package Contracts is
-- Test_Case -- Test_Case
-- Volatile_Function -- Volatile_Function
procedure Analyze_Enclosing_Package_Body_Contract (Body_Decl : Node_Id); procedure Analyze_Contracts (L : List_Id);
-- Analyze the contract of the nearest package body (if any) which encloses -- Analyze the contracts of all eligible constructs found in list L
-- package or subprogram body Body_Decl.
procedure Analyze_Entry_Or_Subprogram_Body_Contract (Body_Id : Entity_Id); procedure Analyze_Entry_Or_Subprogram_Body_Contract (Body_Id : Entity_Id);
-- Analyze all delayed pragmas chained on the contract of entry or -- Analyze all delayed pragmas chained on the contract of entry or
...@@ -77,7 +76,9 @@ package Contracts is ...@@ -77,7 +76,9 @@ package Contracts is
-- Refined_Post -- Refined_Post
-- Test_Case (stand alone subprogram body) -- Test_Case (stand alone subprogram body)
procedure Analyze_Entry_Or_Subprogram_Contract (Subp_Id : Entity_Id); procedure Analyze_Entry_Or_Subprogram_Contract
(Subp_Id : Entity_Id;
Freeze_Id : Entity_Id := Empty);
-- Analyze all delayed pragmas chained on the contract of entry or -- Analyze all delayed pragmas chained on the contract of entry or
-- subprogram Subp_Id as if they appeared at the end of a declarative -- subprogram Subp_Id as if they appeared at the end of a declarative
-- region. The pragmas in question are: -- region. The pragmas in question are:
...@@ -87,12 +88,13 @@ package Contracts is ...@@ -87,12 +88,13 @@ package Contracts is
-- Postcondition -- Postcondition
-- Precondition -- Precondition
-- Test_Case -- Test_Case
--
-- Freeze_Id is the entity of a [generic] package body or a [generic]
-- subprogram body which "freezes" the contract of Subp_Id.
procedure Analyze_Initial_Declaration_Contract (Body_Decl : Node_Id); procedure Analyze_Object_Contract
-- Analyze the contract of the initial declaration of entry body, package (Obj_Id : Entity_Id;
-- body, protected body, subprogram body or task body Body_Decl. Freeze_Id : Entity_Id := Empty);
procedure Analyze_Object_Contract (Obj_Id : Entity_Id);
-- Analyze all delayed pragmas chained on the contract of object Obj_Id as -- Analyze all delayed pragmas chained on the contract of object Obj_Id as
-- if they appeared at the end of the declarative region. The pragmas to be -- if they appeared at the end of the declarative region. The pragmas to be
-- considered are: -- considered are:
...@@ -103,6 +105,9 @@ package Contracts is ...@@ -103,6 +105,9 @@ package Contracts is
-- Effective_Writes -- Effective_Writes
-- Global (single concurrent object) -- Global (single concurrent object)
-- Part_Of -- Part_Of
--
-- Freeze_Id is the entity of a [generic] package body or a [generic]
-- subprogram body which "freezes" the contract of Obj_Id.
procedure Analyze_Package_Body_Contract procedure Analyze_Package_Body_Contract
(Body_Id : Entity_Id; (Body_Id : Entity_Id;
...@@ -123,6 +128,11 @@ package Contracts is ...@@ -123,6 +128,11 @@ package Contracts is
-- Initializes -- Initializes
-- Part_Of -- Part_Of
procedure Analyze_Previous_Contracts (Body_Decl : Node_Id);
-- Analyze the contracts of all source constructs found in the declarative
-- list which contains entry, package, protected, subprogram, or task body
-- denoted by Body_Decl. The analysis stops once Body_Decl is reached.
procedure Analyze_Protected_Contract (Prot_Id : Entity_Id); procedure Analyze_Protected_Contract (Prot_Id : Entity_Id);
-- Analyze all delayed pragmas chained on the contract of protected unit -- Analyze all delayed pragmas chained on the contract of protected unit
-- Prot_Id if they appeared at the end of a declarative region. Currently -- Prot_Id if they appeared at the end of a declarative region. Currently
......
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . S T R I N G _ H A S H --
-- --
-- S p e c --
-- --
-- Copyright (C) 2015, 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- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides a generic hashing function over strings, suitable for
-- use with a string keyed hash table. In particular, it is the basis for the
-- string hash functions in Ada.Containers.
--
-- The algorithm used here is not appropriate for applications that require
-- cryptographically strong hashes, or for application which wish to use very
-- wide hash values as pseudo unique identifiers. In such cases please refer
-- to GNAT.SHA1 and GNAT.MD5.
with System.String_Hash;
package GNAT.String_Hash renames System.String_Hash;
...@@ -312,6 +312,7 @@ package body Impunit is ...@@ -312,6 +312,7 @@ package body Impunit is
("g-sptabo", F), -- GNAT.Spitbol.Table_Boolean ("g-sptabo", F), -- GNAT.Spitbol.Table_Boolean
("g-sptain", F), -- GNAT.Spitbol.Table_Integer ("g-sptain", F), -- GNAT.Spitbol.Table_Integer
("g-sptavs", F), -- GNAT.Spitbol.Table_Vstring ("g-sptavs", F), -- GNAT.Spitbol.Table_Vstring
("g-strhas", F), -- GNAT.String_Hash
("g-string", F), -- GNAT.Strings ("g-string", F), -- GNAT.Strings
("g-strspl", F), -- GNAT.String_Split ("g-strspl", F), -- GNAT.String_Split
("g-sse ", F), -- GNAT.SSE ("g-sse ", F), -- GNAT.SSE
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2015, 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- --
...@@ -577,7 +577,9 @@ package body System.Arith_64 is ...@@ -577,7 +577,9 @@ package body System.Arith_64 is
---------------- ----------------
function To_Neg_Int (A : Uns64) return Int64 is function To_Neg_Int (A : Uns64) return Int64 is
R : constant Int64 := -To_Int (A); R : constant Int64 := (if A = 2**63 then Int64'First else -To_Int (A));
-- Note that we can't just use the expression of the Else, because it
-- overflows for A = 2**63.
begin begin
if R <= 0 then if R <= 0 then
return R; return R;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2009, Free Software Foundation, Inc. -- -- Copyright (C) 2009-2015, 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- --
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
-- cryptographically strong hashes, or for application which wish to use very -- cryptographically strong hashes, or for application which wish to use very
-- wide hash values as pseudo unique identifiers. In such cases please refer -- wide hash values as pseudo unique identifiers. In such cases please refer
-- to GNAT.SHA1 and GNAT.MD5. -- to GNAT.SHA1 and GNAT.MD5.
--
-- Note: this package is in the System hierarchy so that it can be directly
-- be used by other predefined packages. User access to this package is via
-- a renaming of this package in GNAT.String_Hash (file g-strhas.ads).
package System.String_Hash is package System.String_Hash is
pragma Pure; pragma Pure;
......
...@@ -2495,54 +2495,10 @@ package body Sem_Ch3 is ...@@ -2495,54 +2495,10 @@ package body Sem_Ch3 is
Analyze_Package_Body_Contract (Defining_Entity (Context)); Analyze_Package_Body_Contract (Defining_Entity (Context));
end if; end if;
-- Analyze the contracts of eligible constructs (see below) due to -- Analyze the contracts of various constructs now due to the delayed
-- the delayed visibility needs of their aspects and pragmas. -- visibility needs of their aspects and pragmas.
Decl := First (L); Analyze_Contracts (L);
while Present (Decl) loop
-- Entry or subprogram declarations
if Nkind_In (Decl, N_Abstract_Subprogram_Declaration,
N_Entry_Declaration,
N_Generic_Subprogram_Declaration,
N_Subprogram_Declaration)
then
Analyze_Entry_Or_Subprogram_Contract (Defining_Entity (Decl));
-- Entry or subprogram bodies
elsif Nkind_In (Decl, N_Entry_Body, N_Subprogram_Body) then
Analyze_Entry_Or_Subprogram_Body_Contract
(Defining_Entity (Decl));
-- Objects
elsif Nkind (Decl) = N_Object_Declaration then
Analyze_Object_Contract (Defining_Entity (Decl));
-- Protected untis
elsif Nkind_In (Decl, N_Protected_Type_Declaration,
N_Single_Protected_Declaration)
then
Analyze_Protected_Contract (Defining_Entity (Decl));
-- Subprogram body stubs
elsif Nkind (Decl) = N_Subprogram_Body_Stub then
Analyze_Subprogram_Body_Stub_Contract (Defining_Entity (Decl));
-- Task units
elsif Nkind_In (Decl, N_Single_Task_Declaration,
N_Task_Type_Declaration)
then
Analyze_Task_Contract (Defining_Entity (Decl));
end if;
Next (Decl);
end loop;
if Nkind (Context) = N_Package_Body then if Nkind (Context) = N_Package_Body then
......
...@@ -1294,15 +1294,6 @@ package body Sem_Ch6 is ...@@ -1294,15 +1294,6 @@ package body Sem_Ch6 is
Analyze_Aspect_Specifications_On_Body_Or_Stub (N); Analyze_Aspect_Specifications_On_Body_Or_Stub (N);
end if; end if;
-- A generic subprogram body "freezes" the contract of its initial
-- declaration. This analysis depends on attribute Corresponding_Spec
-- being set. Only bodies coming from source should cause this type
-- of "freezing".
if Comes_From_Source (N) then
Analyze_Initial_Declaration_Contract (N);
end if;
Analyze_Declarations (Declarations (N)); Analyze_Declarations (Declarations (N));
Check_Completion; Check_Completion;
...@@ -2988,7 +2979,8 @@ package body Sem_Ch6 is ...@@ -2988,7 +2979,8 @@ package body Sem_Ch6 is
begin begin
-- A [generic] subprogram body "freezes" the contract of the nearest -- A [generic] subprogram body "freezes" the contract of the nearest
-- enclosing package body: -- enclosing package body and all other contracts encountered in the
-- same declarative part upto and excluding the subprogram body:
-- package body Nearest_Enclosing_Package -- package body Nearest_Enclosing_Package
-- with Refined_State => (State => Constit) -- with Refined_State => (State => Constit)
...@@ -3009,7 +3001,7 @@ package body Sem_Ch6 is ...@@ -3009,7 +3001,7 @@ package body Sem_Ch6 is
-- Original_Node. -- Original_Node.
if Comes_From_Source (Original_Node (N)) then if Comes_From_Source (Original_Node (N)) then
Analyze_Enclosing_Package_Body_Contract (N); Analyze_Previous_Contracts (N);
end if; end if;
-- Generic subprograms are handled separately. They always have a -- Generic subprograms are handled separately. They always have a
...@@ -3787,14 +3779,6 @@ package body Sem_Ch6 is ...@@ -3787,14 +3779,6 @@ package body Sem_Ch6 is
Analyze_Aspect_Specifications_On_Body_Or_Stub (N); Analyze_Aspect_Specifications_On_Body_Or_Stub (N);
end if; end if;
-- A subprogram body "freezes" the contract of its initial declaration.
-- This analysis depends on attribute Corresponding_Spec being set. Only
-- bodies coming from source should cause this type of "freezing".
if Comes_From_Source (N) then
Analyze_Initial_Declaration_Contract (N);
end if;
Analyze_Declarations (Declarations (N)); Analyze_Declarations (Declarations (N));
-- Verify that the SPARK_Mode of the body agrees with that of its spec -- Verify that the SPARK_Mode of the body agrees with that of its spec
......
...@@ -543,7 +543,8 @@ package body Sem_Ch7 is ...@@ -543,7 +543,8 @@ package body Sem_Ch7 is
begin begin
-- A [generic] package body "freezes" the contract of the nearest -- A [generic] package body "freezes" the contract of the nearest
-- enclosing package body: -- enclosing package body and all other contracts encountered in the
-- same declarative part upto and excluding the package body:
-- package body Nearest_Enclosing_Package -- package body Nearest_Enclosing_Package
-- with Refined_State => (State => Constit) -- with Refined_State => (State => Constit)
...@@ -567,7 +568,7 @@ package body Sem_Ch7 is ...@@ -567,7 +568,7 @@ package body Sem_Ch7 is
-- Only bodies coming from source should cause this type of "freezing" -- Only bodies coming from source should cause this type of "freezing"
if Comes_From_Source (N) then if Comes_From_Source (N) then
Analyze_Enclosing_Package_Body_Contract (N); Analyze_Previous_Contracts (N);
end if; end if;
-- Find corresponding package specification, and establish the current -- Find corresponding package specification, and establish the current
...@@ -767,10 +768,6 @@ package body Sem_Ch7 is ...@@ -767,10 +768,6 @@ package body Sem_Ch7 is
-- This analysis depends on attribute Corresponding_Spec being set. Only -- This analysis depends on attribute Corresponding_Spec being set. Only
-- bodies coming from source shuld cause this type of "freezing". -- bodies coming from source shuld cause this type of "freezing".
if Comes_From_Source (N) then
Analyze_Initial_Declaration_Contract (N);
end if;
if Present (Declarations (N)) then if Present (Declarations (N)) then
Analyze_Declarations (Declarations (N)); Analyze_Declarations (Declarations (N));
Inspect_Deferred_Constant_Completion (Declarations (N)); Inspect_Deferred_Constant_Completion (Declarations (N));
......
...@@ -1192,12 +1192,13 @@ package body Sem_Ch9 is ...@@ -1192,12 +1192,13 @@ package body Sem_Ch9 is
Entry_Name : Entity_Id; Entry_Name : Entity_Id;
begin begin
-- An entry body "freezes" the contract of the nearest enclosing -- An entry body "freezes" the contract of the nearest enclosing package
-- package body. This ensures that any annotations referenced by the -- body and all other contracts encountered in the same declarative part
-- contract of an entry or subprogram body declared within the current -- upto and excluding the entry body. This ensures that any annotations
-- protected body are available. -- referenced by the contract of an entry or subprogram body declared
-- within the current protected body are available.
Analyze_Enclosing_Package_Body_Contract (N); Analyze_Previous_Contracts (N);
Tasking_Used := True; Tasking_Used := True;
...@@ -1354,11 +1355,6 @@ package body Sem_Ch9 is ...@@ -1354,11 +1355,6 @@ package body Sem_Ch9 is
(Sloc (N), Entry_Name, P_Type, N, Decls); (Sloc (N), Entry_Name, P_Type, N, Decls);
end if; end if;
-- An entry body "freezes" the contract of its initial declaration. This
-- analysis depends on attribute Corresponding_Body being set.
Analyze_Initial_Declaration_Contract (N);
if Present (Decls) then if Present (Decls) then
Analyze_Declarations (Decls); Analyze_Declarations (Decls);
Inspect_Deferred_Constant_Completion (Decls); Inspect_Deferred_Constant_Completion (Decls);
...@@ -1772,11 +1768,13 @@ package body Sem_Ch9 is ...@@ -1772,11 +1768,13 @@ package body Sem_Ch9 is
begin begin
-- A protected body "freezes" the contract of the nearest enclosing -- A protected body "freezes" the contract of the nearest enclosing
-- package body. This ensures that any annotations referenced by the -- package body and all other contracts encountered in the same
-- contract of an entry or subprogram body declared within the current -- declarative part upto and excluding the protected body. This ensures
-- protected body are available. -- that any annotations referenced by the contract of an entry or
-- subprogram body declared within the current protected body are
-- available.
Analyze_Enclosing_Package_Body_Contract (N); Analyze_Previous_Contracts (N);
Tasking_Used := True; Tasking_Used := True;
Set_Ekind (Body_Id, E_Protected_Body); Set_Ekind (Body_Id, E_Protected_Body);
...@@ -1819,11 +1817,6 @@ package body Sem_Ch9 is ...@@ -1819,11 +1817,6 @@ package body Sem_Ch9 is
Expand_Protected_Body_Declarations (N, Spec_Id); Expand_Protected_Body_Declarations (N, Spec_Id);
Last_E := Last_Entity (Spec_Id); Last_E := Last_Entity (Spec_Id);
-- A protected body "freezes" the contract of its initial declaration.
-- This analysis depends on attribute Corresponding_Spec being set.
Analyze_Initial_Declaration_Contract (N);
Analyze_Declarations (Declarations (N)); Analyze_Declarations (Declarations (N));
-- For visibility purposes, all entities in the body are private. Set -- For visibility purposes, all entities in the body are private. Set
...@@ -2816,11 +2809,12 @@ package body Sem_Ch9 is ...@@ -2816,11 +2809,12 @@ package body Sem_Ch9 is
begin begin
-- A task body "freezes" the contract of the nearest enclosing package -- A task body "freezes" the contract of the nearest enclosing package
-- body. This ensures that annotations referenced by the contract of an -- body and all other contracts encountered in the same declarative part
-- entry or subprogram body declared within the current protected body -- upto and excluding the task body. This ensures that annotations
-- are available. -- referenced by the contract of an entry or subprogram body declared
-- within the current protected body are available.
Analyze_Enclosing_Package_Body_Contract (N); Analyze_Previous_Contracts (N);
Tasking_Used := True; Tasking_Used := True;
Set_Scope (Body_Id, Current_Scope); Set_Scope (Body_Id, Current_Scope);
...@@ -2882,11 +2876,6 @@ package body Sem_Ch9 is ...@@ -2882,11 +2876,6 @@ package body Sem_Ch9 is
Install_Declarations (Spec_Id); Install_Declarations (Spec_Id);
Last_E := Last_Entity (Spec_Id); Last_E := Last_Entity (Spec_Id);
-- A task body "freezes" the contract of its initial declaration. This
-- analysis depends on attribute Corresponding_Spec being set.
Analyze_Initial_Declaration_Contract (N);
Analyze_Declarations (Decls); Analyze_Declarations (Decls);
Inspect_Deferred_Constant_Completion (Decls); Inspect_Deferred_Constant_Completion (Decls);
......
...@@ -2122,12 +2122,6 @@ package body Sem_Elab is ...@@ -2122,12 +2122,6 @@ package body Sem_Elab is
Outer_Scope : Entity_Id; Outer_Scope : Entity_Id;
Orig_Ent : Entity_Id) Orig_Ent : Entity_Id)
is is
Loc : constant Source_Ptr := Sloc (N);
Inst_Case : constant Boolean := Is_Generic_Unit (E);
Sbody : Node_Id;
Ebody : Entity_Id;
function Find_Elab_Reference (N : Node_Id) return Traverse_Result; function Find_Elab_Reference (N : Node_Id) return Traverse_Result;
-- Function applied to each node as we traverse the body. Checks for -- Function applied to each node as we traverse the body. Checks for
-- call or entity reference that needs checking, and if so checks it. -- call or entity reference that needs checking, and if so checks it.
...@@ -2235,6 +2229,12 @@ package body Sem_Elab is ...@@ -2235,6 +2229,12 @@ package body Sem_Elab is
end if; end if;
end Find_Elab_Reference; end Find_Elab_Reference;
Inst_Case : constant Boolean := Is_Generic_Unit (E);
Loc : constant Source_Ptr := Sloc (N);
Ebody : Entity_Id;
Sbody : Node_Id;
-- Start of processing for Check_Internal_Call_Continue -- Start of processing for Check_Internal_Call_Continue
begin begin
...@@ -2379,27 +2379,43 @@ package body Sem_Elab is ...@@ -2379,27 +2379,43 @@ package body Sem_Elab is
-- Not that special case, warning and dynamic check is required -- Not that special case, warning and dynamic check is required
-- If we have nothing in the call stack, then this is at the outer -- If we have nothing in the call stack, then this is at the outer
-- level, and the ABE is bound to occur, unless it's a 'Access. -- level, and the ABE is bound to occur, unless it's a 'Access, or
-- it's a renaming.
if Elab_Call.Last = 0 then if Elab_Call.Last = 0 then
Error_Msg_Warn := SPARK_Mode /= On; Error_Msg_Warn := SPARK_Mode /= On;
if Inst_Case then declare
Error_Msg_NE Insert_Check : Boolean := True;
("cannot instantiate& before body seen<<", N, Orig_Ent); -- This flag is set to True if an elaboration check should be
elsif Nkind (N) /= N_Attribute_Reference then -- inserted.
Error_Msg_NE
("cannot call& before body seen<<", N, Orig_Ent);
else
Error_Msg_NE
("Access attribute of & before body seen<<", N, Orig_Ent);
Error_Msg_N ("\possible Program_Error on later references<", N);
end if;
if Nkind (N) /= N_Attribute_Reference then begin
Error_Msg_N ("\Program_Error [<<", N); if Inst_Case then
Insert_Elab_Check (N); Error_Msg_NE
end if; ("cannot instantiate& before body seen<<", N, Orig_Ent);
elsif Nkind (N) = N_Attribute_Reference then
Error_Msg_NE
("Access attribute of & before body seen<<", N, Orig_Ent);
Error_Msg_N ("\possible Program_Error on later references<", N);
Insert_Check := False;
elsif Nkind (Unit_Declaration_Node (Orig_Ent)) /=
N_Subprogram_Renaming_Declaration
then
Error_Msg_NE
("cannot call& before body seen<<", N, Orig_Ent);
else
Insert_Check := False;
end if;
if Insert_Check then
Error_Msg_N ("\Program_Error [<<", N);
Insert_Elab_Check (N);
end if;
end;
-- Call is not at outer level -- Call is not at outer level
......
...@@ -181,8 +181,12 @@ package Sem_Prag is ...@@ -181,8 +181,12 @@ package Sem_Prag is
procedure Analyze_Pragma (N : Node_Id); procedure Analyze_Pragma (N : Node_Id);
-- Analyze procedure for pragma reference node N -- Analyze procedure for pragma reference node N
procedure Analyze_Contract_Cases_In_Decl_Part (N : Node_Id); procedure Analyze_Contract_Cases_In_Decl_Part
-- Perform full analysis of delayed pragma Contract_Cases (N : Node_Id;
Freeze_Id : Entity_Id := Empty);
-- Perform full analysis of delayed pragma Contract_Cases. Freeze_Id is the
-- entity of [generic] package body or [generic] subprogram body which
-- caused "freezing" of the related contract where the pragma resides.
procedure Analyze_Depends_In_Decl_Part (N : Node_Id); procedure Analyze_Depends_In_Decl_Part (N : Node_Id);
-- Perform full analysis of delayed pragma Depends. This routine is also -- Perform full analysis of delayed pragma Depends. This routine is also
...@@ -205,11 +209,20 @@ package Sem_Prag is ...@@ -205,11 +209,20 @@ package Sem_Prag is
procedure Analyze_Initializes_In_Decl_Part (N : Node_Id); procedure Analyze_Initializes_In_Decl_Part (N : Node_Id);
-- Perform full analysis of delayed pragma Initializes -- Perform full analysis of delayed pragma Initializes
procedure Analyze_Part_Of_In_Decl_Part (N : Node_Id); procedure Analyze_Part_Of_In_Decl_Part
-- Perform full analysis of delayed pragma Part_Of (N : Node_Id;
Freeze_Id : Entity_Id := Empty);
-- Perform full analysis of delayed pragma Part_Of. Freeze_Id is the entity
-- of [generic] package body or [generic] subprogram body which caused the
-- "freezing" of the related contract where the pragma resides.
procedure Analyze_Pre_Post_Condition_In_Decl_Part (N : Node_Id); procedure Analyze_Pre_Post_Condition_In_Decl_Part
-- Perform full analysis of pragmas Precondition and Postcondition (N : Node_Id;
Freeze_Id : Entity_Id := Empty);
-- Perform full analysis of pragmas Precondition and Postcondition.
-- Freeze_Id denotes the entity of [generic] package body or [generic]
-- subprogram body which caused "freezing" of the related contract where
-- the pragma resides.
procedure Analyze_Refined_Depends_In_Decl_Part (N : Node_Id); procedure Analyze_Refined_Depends_In_Decl_Part (N : Node_Id);
-- Preform full analysis of delayed pragma Refined_Depends. This routine -- Preform full analysis of delayed pragma Refined_Depends. This routine
......
...@@ -57,6 +57,9 @@ package Sem_Util is ...@@ -57,6 +57,9 @@ package Sem_Util is
-- for the current unit. The declarations are added in the current scope, -- for the current unit. The declarations are added in the current scope,
-- so the caller should push a new scope as required before the call. -- so the caller should push a new scope as required before the call.
function Add_Suffix (E : Entity_Id; Suffix : Character) return Name_Id;
-- Returns the name of E adding Suffix
function Address_Integer_Convert_OK (T1, T2 : Entity_Id) return Boolean; function Address_Integer_Convert_OK (T1, T2 : Entity_Id) return Boolean;
-- Given two types, returns True if we are in Allow_Integer_Address mode -- Given two types, returns True if we are in Allow_Integer_Address mode
-- and one of the types is (a descendent of) System.Address (and this type -- and one of the types is (a descendent of) System.Address (and this type
...@@ -327,13 +330,9 @@ package Sem_Util is ...@@ -327,13 +330,9 @@ package Sem_Util is
-- and post-state. -- and post-state.
procedure Check_Unused_Body_States (Body_Id : Entity_Id); procedure Check_Unused_Body_States (Body_Id : Entity_Id);
-- Verify that all abstract states and object declared in the state space -- Verify that all abstract states and objects declared in the state space
-- of a package body denoted by entity Body_Id are used as constituents. -- of package body Body_Id are used as constituents. Emit an error if this
-- Emit an error if this is not the case. -- is not the case.
function Collect_Body_States (Body_Id : Entity_Id) return Elist_Id;
-- Gather the entities of all abstract states and objects declared in the
-- body state space of package body Body_Id.
procedure Check_Unprotected_Access procedure Check_Unprotected_Access
(Context : Node_Id; (Context : Node_Id;
...@@ -342,6 +341,10 @@ package Sem_Util is ...@@ -342,6 +341,10 @@ package Sem_Util is
-- and the context is external to the protected operation, to warn against -- and the context is external to the protected operation, to warn against
-- a possible unlocked access to data. -- a possible unlocked access to data.
function Collect_Body_States (Body_Id : Entity_Id) return Elist_Id;
-- Gather the entities of all abstract states and objects declared in the
-- body state space of package body Body_Id.
procedure Collect_Interfaces procedure Collect_Interfaces
(T : Entity_Id; (T : Entity_Id;
Ifaces_List : out Elist_Id; Ifaces_List : out Elist_Id;
...@@ -1113,12 +1116,6 @@ package Sem_Util is ...@@ -1113,12 +1116,6 @@ package Sem_Util is
function Has_Suffix (E : Entity_Id; Suffix : Character) return Boolean; function Has_Suffix (E : Entity_Id; Suffix : Character) return Boolean;
-- Returns true if the last character of E is Suffix. Used in Assertions. -- Returns true if the last character of E is Suffix. Used in Assertions.
function Add_Suffix (E : Entity_Id; Suffix : Character) return Name_Id;
-- Returns the name of E adding Suffix
function Remove_Suffix (E : Entity_Id; Suffix : Character) return Name_Id;
-- Returns the name of E without Suffix
function Has_Tagged_Component (Typ : Entity_Id) return Boolean; function Has_Tagged_Component (Typ : Entity_Id) return Boolean;
-- Returns True if Typ is a composite type (array or record) which is -- Returns True if Typ is a composite type (array or record) which is
-- either itself a tagged type, or has a component (recursively) which is -- either itself a tagged type, or has a component (recursively) which is
...@@ -1126,8 +1123,12 @@ package Sem_Util is ...@@ -1126,8 +1123,12 @@ package Sem_Util is
-- component is present. This function is used to check if "=" has to be -- component is present. This function is used to check if "=" has to be
-- expanded into a bunch component comparisons. -- expanded into a bunch component comparisons.
function Has_Undefined_Reference (Expr : Node_Id) return Boolean;
-- Given arbitrary expression Expr, determine whether it contains at
-- least one name whose entity is Any_Id.
function Has_Volatile_Component (Typ : Entity_Id) return Boolean; function Has_Volatile_Component (Typ : Entity_Id) return Boolean;
-- Given an arbitrary type, determine whether it contains at least one -- Given arbitrary type Typ, determine whether it contains at least one
-- volatile component. -- volatile component.
function Implementation_Kind (Subp : Entity_Id) return Name_Id; function Implementation_Kind (Subp : Entity_Id) return Name_Id;
...@@ -1553,6 +1554,14 @@ package Sem_Util is ...@@ -1553,6 +1554,14 @@ package Sem_Util is
-- . machine_emax = 2**7 -- . machine_emax = 2**7
-- . machine_emin = 3 - machine_emax -- . machine_emin = 3 - machine_emax
function Is_Single_Protected_Object (Id : Entity_Id) return Boolean;
-- Determine whether arbitrary entity Id denotes the anonymous object
-- created for a single protected type.
function Is_Single_Task_Object (Id : Entity_Id) return Boolean;
-- Determine whether arbitrary entity Id denotes the anonymous object
-- created for a single task type.
function Is_SPARK_05_Initialization_Expr (N : Node_Id) return Boolean; function Is_SPARK_05_Initialization_Expr (N : Node_Id) return Boolean;
-- Determines if the tree referenced by N represents an initialization -- Determines if the tree referenced by N represents an initialization
-- expression in SPARK 2005, suitable for initializing an object in an -- expression in SPARK 2005, suitable for initializing an object in an
...@@ -1950,6 +1959,9 @@ package Sem_Util is ...@@ -1950,6 +1959,9 @@ package Sem_Util is
-- the removal performed by this routine does not affect the visibility of -- the removal performed by this routine does not affect the visibility of
-- existing homonyms. -- existing homonyms.
function Remove_Suffix (E : Entity_Id; Suffix : Character) return Name_Id;
-- Returns the name of E without Suffix
function Rep_To_Pos_Flag (E : Entity_Id; Loc : Source_Ptr) return Node_Id; function Rep_To_Pos_Flag (E : Entity_Id; Loc : Source_Ptr) return Node_Id;
-- This is used to construct the second argument in a call to Rep_To_Pos -- This is used to construct the second argument in a call to Rep_To_Pos
-- which is Standard_True if range checks are enabled (E is an entity to -- which is Standard_True if range checks are enabled (E is an entity to
...@@ -1963,13 +1975,6 @@ package Sem_Util is ...@@ -1963,13 +1975,6 @@ package Sem_Util is
-- more there is at least one case in the generated code (the code for -- more there is at least one case in the generated code (the code for
-- array assignment in a loop) that depends on this suppression. -- array assignment in a loop) that depends on this suppression.
procedure Report_Unused_Body_States
(Body_Id : Entity_Id;
States : Elist_Id);
-- Emit errors for each abstract state or object found in list States that
-- is declared in package body Body_Id, but is not used as constituent in a
-- state refinement.
procedure Require_Entity (N : Node_Id); procedure Require_Entity (N : Node_Id);
-- N is a node which should have an entity value if it is an entity name. -- N is a node which should have an entity value if it is an entity name.
-- If not, then check if there were previous errors. If so, just fill -- If not, then check if there were previous errors. If so, just fill
......
...@@ -605,27 +605,6 @@ long __gnat_invalid_tzoff = 259273; ...@@ -605,27 +605,6 @@ long __gnat_invalid_tzoff = 259273;
#if defined (__MINGW32__) #if defined (__MINGW32__)
#ifdef CERT
/* For the Cert run times on native Windows we use dummy functions
for locking and unlocking tasks since we do not support multiple
threads on this configuration (Cert run time on native Windows). */
void dummy (void) {}
void (*Lock_Task) () = &dummy;
void (*Unlock_Task) () = &dummy;
#else
#define Lock_Task system__soft_links__lock_task
extern void (*Lock_Task) (void);
#define Unlock_Task system__soft_links__unlock_task
extern void (*Unlock_Task) (void);
#endif
/* Reentrant localtime for Windows. */ /* Reentrant localtime for Windows. */
extern void extern void
...@@ -639,8 +618,6 @@ __gnat_localtime_tzoff (const time_t *timer, const int *is_historic, long *off) ...@@ -639,8 +618,6 @@ __gnat_localtime_tzoff (const time_t *timer, const int *is_historic, long *off)
DWORD tzi_status; DWORD tzi_status;
(*Lock_Task) ();
tzi_status = GetTimeZoneInformation (&tzi); tzi_status = GetTimeZoneInformation (&tzi);
/* Cases where we simply want to extract the offset of the current time /* Cases where we simply want to extract the offset of the current time
...@@ -712,8 +689,6 @@ __gnat_localtime_tzoff (const time_t *timer, const int *is_historic, long *off) ...@@ -712,8 +689,6 @@ __gnat_localtime_tzoff (const time_t *timer, const int *is_historic, long *off)
} }
} }
} }
(*Unlock_Task) ();
} }
#elif defined (__Lynx__) #elif defined (__Lynx__)
......
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