Commit b63d61f7 by Arnaud Charlet

[multiple changes]

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

	* a-cofuse.adb, a-cfdlli.adb, a-cofuse.ads, a-cfdlli.ads, a-cofuve.adb,
	a-cofuve.ads, a-cofuma.adb, a-cofuma.ads, sem_eval.adb, a-cofuba.adb:
	Minor reformatting.

2017-04-27  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch4.adb (Analyze_Call): If the return type of a function
	is incomplete in an context in which the full view is available,
	replace the type of the call by the full view, to prevent spurious
	type errors.
	* exp_disp.adb (Check_Premature_Freezing): Disable check on an
	abstract subprogram so that compiler does not reject a parameter
	of a primitive operation of a tagged type being frozen, when
	the untagged type of that parameter cannot be frozen.

2017-04-27  Bob Duff  <duff@adacore.com>

	* sem_attr.adb (Compute_Type_Key): Don't walk
	representation items for irrelevant types, which could be in a
	different source file.

2017-04-27  Steve Baird  <baird@adacore.com>

	* exp_attr.adb (Expand_N_Attribute_Reference):
	Don't expand Image, Wide_Image, Wide_Wide_Image attributes
	for CodePeer.

From-SVN: r247305
parent bb9e2aa2
2017-04-27 Hristian Kirtchev <kirtchev@adacore.com>
* a-cofuse.adb, a-cfdlli.adb, a-cofuse.ads, a-cfdlli.ads, a-cofuve.adb,
a-cofuve.ads, a-cofuma.adb, a-cofuma.ads, sem_eval.adb, a-cofuba.adb:
Minor reformatting.
2017-04-27 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb (Analyze_Call): If the return type of a function
is incomplete in an context in which the full view is available,
replace the type of the call by the full view, to prevent spurious
type errors.
* exp_disp.adb (Check_Premature_Freezing): Disable check on an
abstract subprogram so that compiler does not reject a parameter
of a primitive operation of a tagged type being frozen, when
the untagged type of that parameter cannot be frozen.
2017-04-27 Bob Duff <duff@adacore.com>
* sem_attr.adb (Compute_Type_Key): Don't walk
representation items for irrelevant types, which could be in a
different source file.
2017-04-27 Steve Baird <baird@adacore.com>
* exp_attr.adb (Expand_N_Attribute_Reference):
Don't expand Image, Wide_Image, Wide_Wide_Image attributes
for CodePeer.
2017-04-27 Yannick Moy <moy@adacore.com> 2017-04-27 Yannick Moy <moy@adacore.com>
* exp_unst.ads: Fix typos in comments. * exp_unst.ads: Fix typos in comments.
......
...@@ -33,14 +33,14 @@ pragma Ada_2012; ...@@ -33,14 +33,14 @@ pragma Ada_2012;
package body Ada.Containers.Functional_Base with SPARK_Mode => Off is package body Ada.Containers.Functional_Base with SPARK_Mode => Off is
function To_Count (Idx : Extended_Index) return Count_Type function To_Count (Idx : Extended_Index) return Count_Type is
is (Count_Type (Count_Type
(Extended_Index'Pos (Idx) - (Extended_Index'Pos (Idx) -
Extended_Index'Pos (Extended_Index'First))); Extended_Index'Pos (Extended_Index'First)));
function To_Index (Position : Count_Type) return Extended_Index function To_Index (Position : Count_Type) return Extended_Index is
is (Extended_Index'Val (Extended_Index'Val
(Position + Extended_Index'Pos (Extended_Index'First))); (Position + Extended_Index'Pos (Extended_Index'First)));
-- Conversion functions between Index_Type and Count_Type -- Conversion functions between Index_Type and Count_Type
function Find (C : Container; E : access Element_Type) return Count_Type; function Find (C : Container; E : access Element_Type) return Count_Type;
......
...@@ -93,8 +93,8 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is ...@@ -93,8 +93,8 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is
K : constant Key_Type := Get (Left.Keys, I); K : constant Key_Type := Get (Left.Keys, I);
begin begin
if not Equivalent_Keys (K, New_Key) if not Equivalent_Keys (K, New_Key)
and then Get (Right.Elements, Find (Right.Keys, K)) and then Get (Right.Elements, Find (Right.Keys, K)) /=
/= Get (Left.Elements, I) Get (Left.Elements, I)
then then
return False; return False;
end if; end if;
...@@ -106,7 +106,8 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is ...@@ -106,7 +106,8 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is
function Elements_Equal_Except function Elements_Equal_Except
(Left : Map; (Left : Map;
Right : Map; Right : Map;
X, Y : Key_Type) return Boolean X : Key_Type;
Y : Key_Type) return Boolean
is is
begin begin
for I in 1 .. Length (Left.Keys) loop for I in 1 .. Length (Left.Keys) loop
...@@ -115,8 +116,8 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is ...@@ -115,8 +116,8 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is
begin begin
if not Equivalent_Keys (K, X) if not Equivalent_Keys (K, X)
and then not Equivalent_Keys (K, Y) and then not Equivalent_Keys (K, Y)
and then Get (Right.Elements, Find (Right.Keys, K)) and then Get (Right.Elements, Find (Right.Keys, K)) /=
/= Get (Left.Elements, I) Get (Left.Elements, I)
then then
return False; return False;
end if; end if;
...@@ -167,6 +168,7 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is ...@@ -167,6 +168,7 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is
end if; end if;
end; end;
end loop; end loop;
return True; return True;
end Keys_Included; end Keys_Included;
...@@ -191,13 +193,15 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is ...@@ -191,13 +193,15 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is
end if; end if;
end; end;
end loop; end loop;
return True; return True;
end Keys_Included_Except; end Keys_Included_Except;
function Keys_Included_Except function Keys_Included_Except
(Left : Map; (Left : Map;
Right : Map; Right : Map;
X, Y : Key_Type) return Boolean X : Key_Type;
Y : Key_Type) return Boolean
is is
begin begin
for I in 1 .. Length (Left.Keys) loop for I in 1 .. Length (Left.Keys) loop
...@@ -212,6 +216,7 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is ...@@ -212,6 +216,7 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is
end if; end if;
end; end;
end loop; end loop;
return True; return True;
end Keys_Included_Except; end Keys_Included_Except;
...@@ -229,8 +234,8 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is ...@@ -229,8 +234,8 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is
--------------- ---------------
function Same_Keys (Left : Map; Right : Map) return Boolean is function Same_Keys (Left : Map; Right : Map) return Boolean is
(Keys_Included (Left, Right) (Keys_Included (Left, Right)
and Keys_Included (Left => Right, Right => Left)); and Keys_Included (Left => Right, Right => Left));
--------- ---------
-- Set -- -- Set --
...@@ -243,6 +248,6 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is ...@@ -243,6 +248,6 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is
is is
(Keys => Container.Keys, (Keys => Container.Keys,
Elements => Elements =>
Set (Container.Elements, Find (Container.Keys, Key), New_Item)); Set (Container.Elements, Find (Container.Keys, Key), New_Item));
end Ada.Containers.Functional_Maps; end Ada.Containers.Functional_Maps;
...@@ -36,6 +36,7 @@ generic ...@@ -36,6 +36,7 @@ generic
type Key_Type (<>) is private; type Key_Type (<>) is private;
type Element_Type (<>) is private; type Element_Type (<>) is private;
with function Equivalent_Keys (Left, Right : Key_Type) return Boolean; with function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
package Ada.Containers.Functional_Maps with SPARK_Mode is package Ada.Containers.Functional_Maps with SPARK_Mode is
type Map is private with type Map is private with
...@@ -90,9 +91,9 @@ package Ada.Containers.Functional_Maps with SPARK_Mode is ...@@ -90,9 +91,9 @@ package Ada.Containers.Functional_Maps with SPARK_Mode is
Post => Post =>
"="'Result = "="'Result =
((for all Key of Left => ((for all Key of Left =>
Has_Key (Right, Key) Has_Key (Right, Key)
and then Get (Right, Key) = Get (Left, Key)) and then Get (Right, Key) = Get (Left, Key))
and (for all Key of Right => Has_Key (Left, Key))); and (for all Key of Right => Has_Key (Left, Key)));
pragma Warnings (Off, "unused variable ""Key"""); pragma Warnings (Off, "unused variable ""Key""");
function Is_Empty (Container : Map) return Boolean with function Is_Empty (Container : Map) return Boolean with
...@@ -117,8 +118,8 @@ package Ada.Containers.Functional_Maps with SPARK_Mode is ...@@ -117,8 +118,8 @@ package Ada.Containers.Functional_Maps with SPARK_Mode is
Global => null, Global => null,
Post => Post =>
Same_Keys'Result = Same_Keys'Result =
(Keys_Included (Left, Right) (Keys_Included (Left, Right)
and Keys_Included (Left => Right, Right => Left)); and Keys_Included (Left => Right, Right => Left));
pragma Annotate (GNATprove, Inline_For_Proof, Same_Keys); pragma Annotate (GNATprove, Inline_For_Proof, Same_Keys);
function Keys_Included_Except function Keys_Included_Except
...@@ -130,24 +131,27 @@ package Ada.Containers.Functional_Maps with SPARK_Mode is ...@@ -130,24 +131,27 @@ package Ada.Containers.Functional_Maps with SPARK_Mode is
with with
Global => null, Global => null,
Post => Post =>
Keys_Included_Except'Result = Keys_Included_Except'Result =
(for all Key of Left => (for all Key of Left =>
(if not Equivalent_Keys (Key, New_Key) (if not Equivalent_Keys (Key, New_Key) then
then Has_Key (Right, Key))); Has_Key (Right, Key)));
function Keys_Included_Except function Keys_Included_Except
(Left : Map; (Left : Map;
Right : Map; Right : Map;
X, Y : Key_Type) return Boolean X : Key_Type;
Y : Key_Type) return Boolean
-- Returns True if Left contains only keys of Right and possibly X and Y -- Returns True if Left contains only keys of Right and possibly X and Y
with with
Global => null, Global => null,
Post => Post =>
Keys_Included_Except'Result = Keys_Included_Except'Result =
(for all Key of Left => (for all Key of Left =>
(if not Equivalent_Keys (Key, X) and not Equivalent_Keys (Key, Y) (if not Equivalent_Keys (Key, X)
then Has_Key (Right, Key))); and not Equivalent_Keys (Key, Y)
then
Has_Key (Right, Key)));
function Elements_Equal_Except function Elements_Equal_Except
(Left : Map; (Left : Map;
...@@ -162,13 +166,14 @@ package Ada.Containers.Functional_Maps with SPARK_Mode is ...@@ -162,13 +166,14 @@ package Ada.Containers.Functional_Maps with SPARK_Mode is
Post => Post =>
Elements_Equal_Except'Result = Elements_Equal_Except'Result =
(for all Key of Left => (for all Key of Left =>
(if not Equivalent_Keys (Key, New_Key) (if not Equivalent_Keys (Key, New_Key) then
then Get (Left, Key) = Get (Right, Key))); Get (Left, Key) = Get (Right, Key)));
function Elements_Equal_Except function Elements_Equal_Except
(Left : Map; (Left : Map;
Right : Map; Right : Map;
X, Y : Key_Type) return Boolean X : Key_Type;
Y : Key_Type) return Boolean
-- Returns True if all the keys of Left are mapped to the same elements in -- Returns True if all the keys of Left are mapped to the same elements in
-- Left and Right except X and Y. -- Left and Right except X and Y.
...@@ -178,8 +183,10 @@ package Ada.Containers.Functional_Maps with SPARK_Mode is ...@@ -178,8 +183,10 @@ package Ada.Containers.Functional_Maps with SPARK_Mode is
Post => Post =>
Elements_Equal_Except'Result = Elements_Equal_Except'Result =
(for all Key of Left => (for all Key of Left =>
(if not Equivalent_Keys (Key, X) and not Equivalent_Keys (Key, Y) (if not Equivalent_Keys (Key, X)
then Get (Left, Key) = Get (Right, Key))); and not Equivalent_Keys (Key, Y)
then
Get (Left, Key) = Get (Right, Key)));
---------------------------- ----------------------------
-- Construction Functions -- -- Construction Functions --
...@@ -192,19 +199,19 @@ package Ada.Containers.Functional_Maps with SPARK_Mode is ...@@ -192,19 +199,19 @@ package Ada.Containers.Functional_Maps with SPARK_Mode is
(Container : Map; (Container : Map;
New_Key : Key_Type; New_Key : Key_Type;
New_Item : Element_Type) return Map New_Item : Element_Type) return Map
-- Returns Container augmented with the mapping Key -> New_Item. -- Returns Container augmented with the mapping Key -> New_Item
with with
Global => null, Global => null,
Pre => Pre =>
not Has_Key (Container, New_Key) not Has_Key (Container, New_Key)
and Length (Container) < Count_Type'Last, and Length (Container) < Count_Type'Last,
Post => Post =>
Length (Container) + 1 = Length (Add'Result) Length (Container) + 1 = Length (Add'Result)
and Has_Key (Add'Result, New_Key) and Has_Key (Add'Result, New_Key)
and Get (Add'Result, New_Key) = New_Item and Get (Add'Result, New_Key) = New_Item
and Container <= Add'Result and Container <= Add'Result
and Keys_Included_Except (Add'Result, Container, New_Key); and Keys_Included_Except (Add'Result, Container, New_Key);
function Set function Set
(Container : Map; (Container : Map;
...@@ -218,9 +225,9 @@ package Ada.Containers.Functional_Maps with SPARK_Mode is ...@@ -218,9 +225,9 @@ package Ada.Containers.Functional_Maps with SPARK_Mode is
Pre => Has_Key (Container, Key), Pre => Has_Key (Container, Key),
Post => Post =>
Length (Container) = Length (Set'Result) Length (Container) = Length (Set'Result)
and Get (Set'Result, Key) = New_Item and Get (Set'Result, Key) = New_Item
and Same_Keys (Container, Set'Result) and Same_Keys (Container, Set'Result)
and Elements_Equal_Except (Container, Set'Result, Key); and Elements_Equal_Except (Container, Set'Result, Key);
--------------------------- ---------------------------
-- Iteration Primitives -- -- Iteration Primitives --
...@@ -281,11 +288,15 @@ private ...@@ -281,11 +288,15 @@ private
is is
(Count_Type (Key) in 1 .. Key_Containers.Length (Container.Keys)); (Count_Type (Key) in 1 .. Key_Containers.Length (Container.Keys));
function Iter_Next (Container : Map; Key : Private_Key) return Private_Key function Iter_Next
(Container : Map;
Key : Private_Key) return Private_Key
is is
(if Key = Private_Key'Last then 0 else Key + 1); (if Key = Private_Key'Last then 0 else Key + 1);
function Iter_Element (Container : Map; Key : Private_Key) return Key_Type function Iter_Element
(Container : Map;
Key : Private_Key) return Key_Type
is is
(Key_Containers.Get (Container.Keys, Count_Type (Key))); (Key_Containers.Get (Container.Keys, Count_Type (Key)));
......
...@@ -54,7 +54,7 @@ package body Ada.Containers.Functional_Sets with SPARK_Mode => Off is ...@@ -54,7 +54,7 @@ package body Ada.Containers.Functional_Sets with SPARK_Mode => Off is
function Add (Container : Set; Item : Element_Type) return Set is function Add (Container : Set; Item : Element_Type) return Set is
(Content => (Content =>
Add (Container.Content, Length (Container.Content) + 1, Item)); Add (Container.Content, Length (Container.Content) + 1, Item));
-------------- --------------
-- Contains -- -- Contains --
...@@ -73,7 +73,7 @@ package body Ada.Containers.Functional_Sets with SPARK_Mode => Off is ...@@ -73,7 +73,7 @@ package body Ada.Containers.Functional_Sets with SPARK_Mode => Off is
Item : Element_Type) return Boolean Item : Element_Type) return Boolean
is is
(for all E of Left => (for all E of Left =>
Equivalent_Elements (E, Item) or Contains (Right, E)); Equivalent_Elements (E, Item) or Contains (Right, E));
----------------------- -----------------------
-- Included_In_Union -- -- Included_In_Union --
...@@ -85,7 +85,7 @@ package body Ada.Containers.Functional_Sets with SPARK_Mode => Off is ...@@ -85,7 +85,7 @@ package body Ada.Containers.Functional_Sets with SPARK_Mode => Off is
Right : Set) return Boolean Right : Set) return Boolean
is is
(for all Item of Container => (for all Item of Container =>
Contains (Left, Item) or Contains (Right, Item)); Contains (Left, Item) or Contains (Right, Item));
--------------------------- ---------------------------
-- Includes_Intersection -- -- Includes_Intersection --
...@@ -97,7 +97,7 @@ package body Ada.Containers.Functional_Sets with SPARK_Mode => Off is ...@@ -97,7 +97,7 @@ package body Ada.Containers.Functional_Sets with SPARK_Mode => Off is
Right : Set) return Boolean Right : Set) return Boolean
is is
(for all Item of Left => (for all Item of Left =>
(if Contains (Right, Item) then Contains (Container, Item))); (if Contains (Right, Item) then Contains (Container, Item)));
------------------ ------------------
-- Intersection -- -- Intersection --
......
...@@ -34,8 +34,10 @@ private with Ada.Containers.Functional_Base; ...@@ -34,8 +34,10 @@ private with Ada.Containers.Functional_Base;
generic generic
type Element_Type (<>) is private; type Element_Type (<>) is private;
with with function Equivalent_Elements
function Equivalent_Elements (Left, Right : Element_Type) return Boolean; (Left : Element_Type;
Right : Element_Type) return Boolean;
package Ada.Containers.Functional_Sets with SPARK_Mode is package Ada.Containers.Functional_Sets with SPARK_Mode is
type Set is private with type Set is private with
...@@ -80,8 +82,8 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is ...@@ -80,8 +82,8 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is
Global => null, Global => null,
Post => Post =>
"="'Result = "="'Result =
((for all Item of Left => Contains (Right, Item)) (for all Item of Left => Contains (Right, Item))
and (for all Item of Right => Contains (Left, Item))); and (for all Item of Right => Contains (Left, Item));
pragma Warnings (Off, "unused variable ""Item"""); pragma Warnings (Off, "unused variable ""Item""");
function Is_Empty (Container : Set) return Boolean with function Is_Empty (Container : Set) return Boolean with
...@@ -102,8 +104,8 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is ...@@ -102,8 +104,8 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is
Global => null, Global => null,
Post => Post =>
Included_Except'Result = Included_Except'Result =
(for all E of Left => (for all E of Left =>
Contains (Right, E) or Equivalent_Elements (E, Item)); Contains (Right, E) or Equivalent_Elements (E, Item));
function Includes_Intersection function Includes_Intersection
(Container : Set; (Container : Set;
...@@ -117,7 +119,7 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is ...@@ -117,7 +119,7 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is
Post => Post =>
Includes_Intersection'Result = Includes_Intersection'Result =
(for all Item of Left => (for all Item of Left =>
(if Contains (Right, Item) then Contains (Container, Item))); (if Contains (Right, Item) then Contains (Container, Item)));
function Included_In_Union function Included_In_Union
(Container : Set; (Container : Set;
...@@ -130,7 +132,7 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is ...@@ -130,7 +132,7 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is
Post => Post =>
Included_In_Union'Result = Included_In_Union'Result =
(for all Item of Container => (for all Item of Container =>
Contains (Left, Item) or Contains (Right, Item)); Contains (Left, Item) or Contains (Right, Item));
function Num_Overlaps (Left : Set; Right : Set) return Count_Type with function Num_Overlaps (Left : Set; Right : Set) return Count_Type with
-- Number of elements that are both in Left and Right -- Number of elements that are both in Left and Right
...@@ -158,9 +160,9 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is ...@@ -158,9 +160,9 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is
and Length (Container) < Count_Type'Last, and Length (Container) < Count_Type'Last,
Post => Post =>
Length (Add'Result) = Length (Container) + 1 Length (Add'Result) = Length (Container) + 1
and Contains (Add'Result, Item) and Contains (Add'Result, Item)
and Container <= Add'Result and Container <= Add'Result
and Included_Except (Add'Result, Container, Item); and Included_Except (Add'Result, Container, Item);
function Remove (Container : Set; Item : Element_Type) return Set with function Remove (Container : Set; Item : Element_Type) return Set with
-- Return a new set containing all the elements of Container except E -- Return a new set containing all the elements of Container except E
...@@ -169,9 +171,9 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is ...@@ -169,9 +171,9 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is
Pre => Contains (Container, Item), Pre => Contains (Container, Item),
Post => Post =>
Length (Remove'Result) = Length (Container) - 1 Length (Remove'Result) = Length (Container) - 1
and not Contains (Remove'Result, Item) and not Contains (Remove'Result, Item)
and Remove'Result <= Container and Remove'Result <= Container
and Included_Except (Container, Remove'Result, Item); and Included_Except (Container, Remove'Result, Item);
function Intersection (Left : Set; Right : Set) return Set with function Intersection (Left : Set; Right : Set) return Set with
-- Returns the intersection of Left and Right -- Returns the intersection of Left and Right
...@@ -188,8 +190,8 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is ...@@ -188,8 +190,8 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is
Global => null, Global => null,
Pre => Pre =>
Length (Left) - Num_Overlaps (Left, Right) Length (Left) - Num_Overlaps (Left, Right) <=
<= Count_Type'Last - Length (Right), Count_Type'Last - Length (Right),
Post => Post =>
Length (Union'Result) = Length (Union'Result) =
Length (Left) - Num_Overlaps (Left, Right) + Length (Right) Length (Left) - Num_Overlaps (Left, Right) + Length (Right)
...@@ -212,7 +214,9 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is ...@@ -212,7 +214,9 @@ package Ada.Containers.Functional_Sets with SPARK_Mode is
with with
Global => null; Global => null;
function Iter_Next (Container : Set; Key : Private_Key) return Private_Key function Iter_Next
(Container : Set;
Key : Private_Key) return Private_Key
with with
Global => null, Global => null,
Pre => Iter_Has_Element (Container, Key); Pre => Iter_Has_Element (Container, Key);
...@@ -249,7 +253,9 @@ private ...@@ -249,7 +253,9 @@ private
is is
(Count_Type (Key) in 1 .. Containers.Length (Container.Content)); (Count_Type (Key) in 1 .. Containers.Length (Container.Content));
function Iter_Next (Container : Set; Key : Private_Key) return Private_Key function Iter_Next
(Container : Set;
Key : Private_Key) return Private_Key
is is
(if Key = Private_Key'Last then 0 else Key + 1); (if Key = Private_Key'Last then 0 else Key + 1);
......
...@@ -40,7 +40,7 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is ...@@ -40,7 +40,7 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is
function "<" (Left : Sequence; Right : Sequence) return Boolean is function "<" (Left : Sequence; Right : Sequence) return Boolean is
(Length (Left.Content) < Length (Right.Content) (Length (Left.Content) < Length (Right.Content)
and then (for all I in Index_Type'First .. Last (Left) => and then (for all I in Index_Type'First .. Last (Left) =>
Get (Left.Content, I) = Get (Right.Content, I))); Get (Left.Content, I) = Get (Right.Content, I)));
---------- ----------
-- "<=" -- -- "<=" --
...@@ -49,7 +49,7 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is ...@@ -49,7 +49,7 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is
function "<=" (Left : Sequence; Right : Sequence) return Boolean is function "<=" (Left : Sequence; Right : Sequence) return Boolean is
(Length (Left.Content) <= Length (Right.Content) (Length (Left.Content) <= Length (Right.Content)
and then (for all I in Index_Type'First .. Last (Left) => and then (for all I in Index_Type'First .. Last (Left) =>
Get (Left.Content, I) = Get (Right.Content, I))); Get (Left.Content, I) = Get (Right.Content, I)));
--------- ---------
-- "=" -- -- "=" --
...@@ -62,13 +62,15 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is ...@@ -62,13 +62,15 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is
-- Add -- -- Add --
--------- ---------
function Add (Container : Sequence; New_Item : Element_Type) return Sequence function Add
(Container : Sequence;
New_Item : Element_Type) return Sequence
is is
(Content => Add (Container.Content, (Content =>
Index_Type'Val Add (Container.Content,
(Index_Type'Pos (Index_Type'First) + Index_Type'Val (Index_Type'Pos (Index_Type'First) +
Length (Container.Content)), Length (Container.Content)),
New_Item)); New_Item));
function Add function Add
(Container : Sequence; (Container : Sequence;
...@@ -92,6 +94,7 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is ...@@ -92,6 +94,7 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is
return False; return False;
end if; end if;
end loop; end loop;
return True; return True;
end Constant_Range; end Constant_Range;
...@@ -111,6 +114,7 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is ...@@ -111,6 +114,7 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is
return True; return True;
end if; end if;
end loop; end loop;
return False; return False;
end Contains; end Contains;
...@@ -142,7 +146,8 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is ...@@ -142,7 +146,8 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is
function Equal_Except function Equal_Except
(Left : Sequence; (Left : Sequence;
Right : Sequence; Right : Sequence;
X, Y : Index_Type) return Boolean X : Index_Type;
Y : Index_Type) return Boolean
is is
begin begin
if Length (Left.Content) /= Length (Right.Content) then if Length (Left.Content) /= Length (Right.Content) then
...@@ -174,8 +179,8 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is ...@@ -174,8 +179,8 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is
---------- ----------
function Last (Container : Sequence) return Extended_Index is function Last (Container : Sequence) return Extended_Index is
(Index_Type'Val ((Index_Type'Pos (Index_Type'First) - 1) (Index_Type'Val
+ Length (Container))); ((Index_Type'Pos (Index_Type'First) - 1) + Length (Container)));
------------ ------------
-- Length -- -- Length --
...@@ -200,6 +205,7 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is ...@@ -200,6 +205,7 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is
return False; return False;
end if; end if;
end loop; end loop;
return True; return True;
end Range_Equal; end Range_Equal;
...@@ -216,8 +222,8 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is ...@@ -216,8 +222,8 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is
is is
begin begin
for I in Fst .. Lst loop for I in Fst .. Lst loop
if Get (Left, I) if Get (Left, I) /=
/= Get (Right, Index_Type'Val (Index_Type'Pos (I) + Offset)) Get (Right, Index_Type'Val (Index_Type'Pos (I) + Offset))
then then
return False; return False;
end if; end if;
...@@ -229,8 +235,9 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is ...@@ -229,8 +235,9 @@ package body Ada.Containers.Functional_Vectors with SPARK_Mode => Off is
-- Remove -- -- Remove --
------------ ------------
function Remove (Container : Sequence; function Remove
Position : Index_Type) return Sequence (Container : Sequence;
Position : Index_Type) return Sequence
is is
(Content => Remove (Container.Content, Position)); (Content => Remove (Container.Content, Position));
......
...@@ -3598,6 +3598,14 @@ package body Exp_Attr is ...@@ -3598,6 +3598,14 @@ package body Exp_Attr is
-- Image attribute is handled in separate unit Exp_Imgv -- Image attribute is handled in separate unit Exp_Imgv
when Attribute_Image => when Attribute_Image =>
-- Leave attribute unexpanded in CodePeer mode: the gnat2scil
-- back-end knows how to handle this attribute directly.
if CodePeer_Mode then
return;
end if;
Exp_Imgv.Expand_Image_Attribute (N); Exp_Imgv.Expand_Image_Attribute (N);
--------- ---------
...@@ -6995,6 +7003,14 @@ package body Exp_Attr is ...@@ -6995,6 +7003,14 @@ package body Exp_Attr is
-- Wide_Image attribute is handled in separate unit Exp_Imgv -- Wide_Image attribute is handled in separate unit Exp_Imgv
when Attribute_Wide_Image => when Attribute_Wide_Image =>
-- Leave attribute unexpanded in CodePeer mode: the gnat2scil
-- back-end knows how to handle this attribute directly.
if CodePeer_Mode then
return;
end if;
Exp_Imgv.Expand_Wide_Image_Attribute (N); Exp_Imgv.Expand_Wide_Image_Attribute (N);
--------------------- ---------------------
...@@ -7004,6 +7020,14 @@ package body Exp_Attr is ...@@ -7004,6 +7020,14 @@ package body Exp_Attr is
-- Wide_Wide_Image attribute is handled in separate unit Exp_Imgv -- Wide_Wide_Image attribute is handled in separate unit Exp_Imgv
when Attribute_Wide_Wide_Image => when Attribute_Wide_Wide_Image =>
-- Leave attribute unexpanded in CodePeer mode: the gnat2scil
-- back-end knows how to handle this attribute directly.
if CodePeer_Mode then
return;
end if;
Exp_Imgv.Expand_Wide_Wide_Image_Attribute (N); Exp_Imgv.Expand_Wide_Wide_Image_Attribute (N);
---------------- ----------------
......
...@@ -4510,10 +4510,13 @@ package body Exp_Disp is ...@@ -4510,10 +4510,13 @@ package body Exp_Disp is
if Building_Static_DT (Typ) then if Building_Static_DT (Typ) then
declare declare
Save : constant Boolean := Freezing_Library_Level_Tagged_Type; Saved_FLLTT : constant Boolean :=
Freezing_Library_Level_Tagged_Type;
Formal : Entity_Id;
Frnodes : List_Id;
Prim : Entity_Id; Prim : Entity_Id;
Prim_Elmt : Elmt_Id; Prim_Elmt : Elmt_Id;
Frnodes : List_Id;
begin begin
Freezing_Library_Level_Tagged_Type := True; Freezing_Library_Level_Tagged_Type := True;
...@@ -4523,18 +4526,21 @@ package body Exp_Disp is ...@@ -4523,18 +4526,21 @@ package body Exp_Disp is
Prim := Node (Prim_Elmt); Prim := Node (Prim_Elmt);
Frnodes := Freeze_Entity (Prim, Typ); Frnodes := Freeze_Entity (Prim, Typ);
declare -- We disable this check for abstract subprograms, given that
F : Entity_Id; -- they cannot be called directly and thus the state of their
-- untagged formals is of no concern. The RM is unclear in any
begin -- case concerning the need for this check, and this topic may
F := First_Formal (Prim); -- go back to the ARG.
while Present (F) loop
Check_Premature_Freezing (Prim, Typ, Etype (F)); if not Is_Abstract_Subprogram (Prim) then
Next_Formal (F); Formal := First_Formal (Prim);
while Present (Formal) loop
Check_Premature_Freezing (Prim, Typ, Etype (Formal));
Next_Formal (Formal);
end loop; end loop;
Check_Premature_Freezing (Prim, Typ, Etype (Prim)); Check_Premature_Freezing (Prim, Typ, Etype (Prim));
end; end if;
if Present (Frnodes) then if Present (Frnodes) then
Append_List_To (Result, Frnodes); Append_List_To (Result, Frnodes);
...@@ -4543,7 +4549,7 @@ package body Exp_Disp is ...@@ -4543,7 +4549,7 @@ package body Exp_Disp is
Next_Elmt (Prim_Elmt); Next_Elmt (Prim_Elmt);
end loop; end loop;
Freezing_Library_Level_Tagged_Type := Save; Freezing_Library_Level_Tagged_Type := Saved_FLLTT;
end; end;
end if; end if;
......
...@@ -6310,21 +6310,28 @@ package body Sem_Attr is ...@@ -6310,21 +6310,28 @@ package body Sem_Attr is
end; end;
end if; end if;
-- Fold in representation aspects for the type, which appear in if Is_First_Subtype (T) then
-- the same source buffer.
Rep := First_Rep_Item (T); -- Fold in representation aspects for the type, which appear in
-- the same source buffer. If the representation aspects are in
-- a different source file, then skip them; they apply to some
-- other type, perhaps one we're derived from.
while Present (Rep) loop Rep := First_Rep_Item (T);
if Comes_From_Source (Rep) then
Sloc_Range (Rep, P_Min, P_Max);
pragma Assert (SFI = Get_Source_File_Index (P_Min));
pragma Assert (SFI = Get_Source_File_Index (P_Max));
Process_One_Declaration;
end if;
Rep := Next_Rep_Item (Rep); while Present (Rep) loop
end loop; if Comes_From_Source (Rep) then
Sloc_Range (Rep, P_Min, P_Max);
if SFI = Get_Source_File_Index (P_Min) then
pragma Assert (SFI = Get_Source_File_Index (P_Max));
Process_One_Declaration;
end if;
end if;
Rep := Next_Rep_Item (Rep);
end loop;
end if;
end Compute_Type_Key; end Compute_Type_Key;
-- Start of processing for Type_Key -- Start of processing for Type_Key
......
...@@ -1463,6 +1463,25 @@ package body Sem_Ch4 is ...@@ -1463,6 +1463,25 @@ package body Sem_Ch4 is
-- actuals. -- actuals.
Check_Function_Writable_Actuals (N); Check_Function_Writable_Actuals (N);
-- The return type of the function may be incomplete. This can be
-- the case if the type is a generic formal, or a limited view. It
-- can also happen when the function declaration appears before the
-- full view of the type (which is legal in Ada 2012) and the call
-- appears in a different unit, in which case the incomplete view
-- must be replaced with the full view to prevent subsequent type
-- errors.
if Is_Incomplete_Type (Etype (N))
and then Present (Full_View (Etype (N)))
then
if Is_Entity_Name (Nam) then
Set_Etype (Nam, Full_View (Etype (N)));
Set_Etype (Entity (Nam), Full_View (Etype (N)));
end if;
Set_Etype (N, Full_View (Etype (N)));
end if;
end if; end if;
end Analyze_Call; end Analyze_Call;
......
...@@ -630,17 +630,17 @@ package body Sem_Eval is ...@@ -630,17 +630,17 @@ package body Sem_Eval is
-- to discrete and non-discrete types. -- to discrete and non-discrete types.
elsif (Nkind (Choice) = N_Subtype_Indication elsif (Nkind (Choice) = N_Subtype_Indication
or else (Is_Entity_Name (Choice) or else (Is_Entity_Name (Choice)
and then Is_Type (Entity (Choice)))) and then Is_Type (Entity (Choice))))
and then Has_Predicates (Etype (Choice)) and then Has_Predicates (Etype (Choice))
and then Has_Static_Predicate (Etype (Choice)) and then Has_Static_Predicate (Etype (Choice))
then then
if Is_Discrete_Type (Etype (Choice)) then if Is_Discrete_Type (Etype (Choice)) then
return Choices_Match return
(Expr, Static_Discrete_Predicate (Etype (Choice))); Choices_Match
(Expr, Static_Discrete_Predicate (Etype (Choice)));
elsif elsif Real_Or_String_Static_Predicate_Matches (Expr, Etype (Choice))
Real_Or_String_Static_Predicate_Matches (Expr, Etype (Choice))
then then
return Match; return Match;
......
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