Commit 16788d44 by Robert Dewar Committed by Arnaud Charlet

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

2013-07-05  Robert Dewar  <dewar@adacore.com>

	* exp_ch4.adb, a-cfdlli.ads, a-ngelfu.ads, s-bignum.adb: Minor
	reformatting.

From-SVN: r200707
parent da1b76c1
2013-07-05 Robert Dewar <dewar@adacore.com>
* exp_ch4.adb, a-cfdlli.ads, a-ngelfu.ads, s-bignum.adb: Minor
reformatting.
2013-07-05 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch4.adb (Expand_Composite_Equality): Use the full view
......
......@@ -78,30 +78,36 @@ package Ada.Containers.Formal_Doubly_Linked_Lists is
procedure Clear (Container : in out List);
procedure Assign (Target : in out List; Source : List)
with Pre => Target.Capacity >= Length (Source);
procedure Assign (Target : in out List; Source : List) with
Pre => Target.Capacity >= Length (Source);
function Copy (Source : List; Capacity : Count_Type := 0) return List;
function Element (Container : List; Position : Cursor) return Element_Type
with Pre => Has_Element (Container, Position);
function Element
(Container : List;
Position : Cursor) return Element_Type
with
Pre => Has_Element (Container, Position);
procedure Replace_Element
(Container : in out List;
Position : Cursor;
New_Item : Element_Type)
with Pre => Has_Element (Container, Position);
with
Pre => Has_Element (Container, Position);
procedure Move (Target : in out List; Source : in out List)
with Pre => Target.Capacity >= Length (Source);
procedure Move (Target : in out List; Source : in out List) with
Pre => Target.Capacity >= Length (Source);
procedure Insert
(Container : in out List;
Before : Cursor;
New_Item : Element_Type;
Count : Count_Type := 1)
with Pre => Length (Container) + Count <= Container.Capacity and then
(Has_Element (Container, Before) or else Before = No_Element);
with
Pre => Length (Container) + Count <= Container.Capacity
and then (Has_Element (Container, Before)
or else Before = No_Element);
procedure Insert
(Container : in out List;
......@@ -109,114 +115,133 @@ package Ada.Containers.Formal_Doubly_Linked_Lists is
New_Item : Element_Type;
Position : out Cursor;
Count : Count_Type := 1)
with Pre => Length (Container) + Count <= Container.Capacity and then
(Has_Element (Container, Before) or else Before = No_Element);
with
Pre => Length (Container) + Count <= Container.Capacity
and then (Has_Element (Container, Before)
or else Before = No_Element);
procedure Insert
(Container : in out List;
Before : Cursor;
Position : out Cursor;
Count : Count_Type := 1)
with Pre => Length (Container) + Count <= Container.Capacity and then
(Has_Element (Container, Before) or else Before = No_Element);
with
Pre => Length (Container) + Count <= Container.Capacity
and then (Has_Element (Container, Before)
or else Before = No_Element);
procedure Prepend
(Container : in out List;
New_Item : Element_Type;
Count : Count_Type := 1)
with Pre => Length (Container) + Count <= Container.Capacity;
with
Pre => Length (Container) + Count <= Container.Capacity;
procedure Append
(Container : in out List;
New_Item : Element_Type;
Count : Count_Type := 1)
with Pre => Length (Container) + Count <= Container.Capacity;
with
Pre => Length (Container) + Count <= Container.Capacity;
procedure Delete
(Container : in out List;
Position : in out Cursor;
Count : Count_Type := 1)
with Pre => Has_Element (Container, Position);
with
Pre => Has_Element (Container, Position);
procedure Delete_First
(Container : in out List;
Count : Count_Type := 1)
with Pre => not Is_Empty (Container);
with
Pre => not Is_Empty (Container);
procedure Delete_Last
(Container : in out List;
Count : Count_Type := 1)
with Pre => not Is_Empty (Container);
with
Pre => not Is_Empty (Container);
procedure Reverse_Elements (Container : in out List);
procedure Swap
(Container : in out List;
I, J : Cursor)
with Pre => Has_Element (Container, I) and then Has_Element (Container, J);
with
Pre => Has_Element (Container, I) and then Has_Element (Container, J);
procedure Swap_Links
(Container : in out List;
I, J : Cursor)
with Pre => Has_Element (Container, I) and then Has_Element (Container, J);
with
Pre => Has_Element (Container, I) and then Has_Element (Container, J);
procedure Splice
(Target : in out List;
Before : Cursor;
Source : in out List)
with Pre => Length (Source) + Length (Target) <= Target.Capacity and then
(Has_Element (Target, Before) or else Before = No_Element);
with
Pre => Length (Source) + Length (Target) <= Target.Capacity
and then (Has_Element (Target, Before)
or else Before = No_Element);
procedure Splice
(Target : in out List;
Before : Cursor;
Source : in out List;
Position : in out Cursor)
with Pre => Length (Source) + Length (Target) <= Target.Capacity and then
(Has_Element (Target, Before) or else Before = No_Element) and then
Has_Element (Source, Position);
with
Pre => Length (Source) + Length (Target) <= Target.Capacity
and then (Has_Element (Target, Before)
or else Before = No_Element)
and then Has_Element (Source, Position);
procedure Splice
(Container : in out List;
Before : Cursor;
Position : Cursor)
with Pre => 2 * Length (Container) <= Container.Capacity and then
(Has_Element (Container, Before) or else Before = No_Element) and then
Has_Element (Container, Position);
with
Pre => 2 * Length (Container) <= Container.Capacity
and then (Has_Element (Container, Before)
or else Before = No_Element)
and then Has_Element (Container, Position);
function First (Container : List) return Cursor;
function First_Element (Container : List) return Element_Type
with Pre => not Is_Empty (Container);
function First_Element (Container : List) return Element_Type with
Pre => not Is_Empty (Container);
function Last (Container : List) return Cursor;
function Last_Element (Container : List) return Element_Type
with Pre => not Is_Empty (Container);
function Last_Element (Container : List) return Element_Type with
Pre => not Is_Empty (Container);
function Next (Container : List; Position : Cursor) return Cursor
with Pre => Has_Element (Container, Position) or else Position = No_Element;
function Next (Container : List; Position : Cursor) return Cursor with
Pre => Has_Element (Container, Position) or else Position = No_Element;
procedure Next (Container : List; Position : in out Cursor)
with Pre => Has_Element (Container, Position) or else Position = No_Element;
procedure Next (Container : List; Position : in out Cursor) with
Pre => Has_Element (Container, Position) or else Position = No_Element;
function Previous (Container : List; Position : Cursor) return Cursor
with Pre => Has_Element (Container, Position) or else Position = No_Element;
function Previous (Container : List; Position : Cursor) return Cursor with
Pre => Has_Element (Container, Position) or else Position = No_Element;
procedure Previous (Container : List; Position : in out Cursor)
with Pre => Has_Element (Container, Position) or else Position = No_Element;
procedure Previous (Container : List; Position : in out Cursor) with
Pre => Has_Element (Container, Position) or else Position = No_Element;
function Find
(Container : List;
Item : Element_Type;
Position : Cursor := No_Element) return Cursor
with Pre => Has_Element (Container, Position) or else Position = No_Element;
with
Pre => Has_Element (Container, Position) or else Position = No_Element;
function Reverse_Find
(Container : List;
Item : Element_Type;
Position : Cursor := No_Element) return Cursor
with Pre => Has_Element (Container, Position) or else Position = No_Element;
with
Pre => Has_Element (Container, Position) or else Position = No_Element;
function Contains
(Container : List;
......@@ -241,10 +266,10 @@ package Ada.Containers.Formal_Doubly_Linked_Lists is
-- they are structurally equal (function "=" returns True) and that they
-- have the same set of cursors.
function Left (Container : List; Position : Cursor) return List
with Pre => Has_Element (Container, Position) or else Position = No_Element;
function Right (Container : List; Position : Cursor) return List
with Pre => Has_Element (Container, Position) or else Position = No_Element;
function Left (Container : List; Position : Cursor) return List with
Pre => Has_Element (Container, Position) or else Position = No_Element;
function Right (Container : List; Position : Cursor) return List with
Pre => Has_Element (Container, Position) or else Position = No_Element;
-- Left returns a container containing all elements preceding Position
-- (excluded) in Container. Right returns a container containing all
-- elements following Position (included) in Container. These two new
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2012, Free Software Foundation, Inc. --
-- Copyright (C) 2012-2013, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
......@@ -39,139 +39,114 @@ generic
package Ada.Numerics.Generic_Elementary_Functions is
pragma Pure;
function Sqrt (X : Float_Type'Base) return Float_Type'Base
with
function Sqrt (X : Float_Type'Base) return Float_Type'Base with
Post => Sqrt'Result >= 0.0
and then (if X = 0.0 then Sqrt'Result = 0.0)
and then (if X = 1.0 then Sqrt'Result = 1.0);
and then (if X = 0.0 then Sqrt'Result = 0.0)
and then (if X = 1.0 then Sqrt'Result = 1.0);
function Log (X : Float_Type'Base) return Float_Type'Base
with
Post => (if X = 1.0 then Log'Result = 0.0);
function Log (X, Base : Float_Type'Base) return Float_Type'Base
with
function Log (X, Base : Float_Type'Base) return Float_Type'Base with
Post => (if X = 1.0 then Log'Result = 0.0);
function Exp (X : Float_Type'Base) return Float_Type'Base
with
function Exp (X : Float_Type'Base) return Float_Type'Base with
Post => (if X = 0.0 then Exp'Result = 1.0);
function "**" (Left, Right : Float_Type'Base) return Float_Type'Base
with
function "**" (Left, Right : Float_Type'Base) return Float_Type'Base with
Post => "**"'Result >= 0.0
and then (if Right = 0.0 then "**"'Result = 1.0)
and then (if Right = 1.0 then "**"'Result = Left)
and then (if Left = 1.0 then "**"'Result = 1.0)
and then (if Left = 0.0 then "**"'Result = 0.0);
and then (if Right = 0.0 then "**"'Result = 1.0)
and then (if Right = 1.0 then "**"'Result = Left)
and then (if Left = 1.0 then "**"'Result = 1.0)
and then (if Left = 0.0 then "**"'Result = 0.0);
function Sin (X : Float_Type'Base) return Float_Type'Base
with
function Sin (X : Float_Type'Base) return Float_Type'Base with
Post => Sin'Result in -1.0 .. 1.0
and then (if X = 0.0 then Sin'Result = 0.0);
and then (if X = 0.0 then Sin'Result = 0.0);
function Sin (X, Cycle : Float_Type'Base) return Float_Type'Base
with
function Sin (X, Cycle : Float_Type'Base) return Float_Type'Base with
Post => Sin'Result in -1.0 .. 1.0
and then (if X = 0.0 then Sin'Result = 0.0);
and then (if X = 0.0 then Sin'Result = 0.0);
function Cos (X : Float_Type'Base) return Float_Type'Base
with
function Cos (X : Float_Type'Base) return Float_Type'Base with
Post => Cos'Result in -1.0 .. 1.0
and then (if X = 0.0 then Cos'Result = 1.0);
and then (if X = 0.0 then Cos'Result = 1.0);
function Cos (X, Cycle : Float_Type'Base) return Float_Type'Base
with
function Cos (X, Cycle : Float_Type'Base) return Float_Type'Base with
Post => Cos'Result in -1.0 .. 1.0
and then (if X = 0.0 then Cos'Result = 1.0);
and then (if X = 0.0 then Cos'Result = 1.0);
function Tan (X : Float_Type'Base) return Float_Type'Base
with
function Tan (X : Float_Type'Base) return Float_Type'Base with
Post => (if X = 0.0 then Tan'Result = 0.0);
function Tan (X, Cycle : Float_Type'Base) return Float_Type'Base
with
function Tan (X, Cycle : Float_Type'Base) return Float_Type'Base with
Post => (if X = 0.0 then Tan'Result = 0.0);
function Cot (X : Float_Type'Base) return Float_Type'Base;
function Cot (X, Cycle : Float_Type'Base) return Float_Type'Base;
function Arcsin (X : Float_Type'Base) return Float_Type'Base
with
function Arcsin (X : Float_Type'Base) return Float_Type'Base with
Post => (if X = 0.0 then Arcsin'Result = 0.0);
function Arcsin (X, Cycle : Float_Type'Base) return Float_Type'Base
with
function Arcsin (X, Cycle : Float_Type'Base) return Float_Type'Base with
Post => (if X = 0.0 then Arcsin'Result = 0.0);
function Arccos (X : Float_Type'Base) return Float_Type'Base
with
function Arccos (X : Float_Type'Base) return Float_Type'Base with
Post => (if X = 1.0 then Arccos'Result = 0.0);
function Arccos (X, Cycle : Float_Type'Base) return Float_Type'Base
with
function Arccos (X, Cycle : Float_Type'Base) return Float_Type'Base with
Post => (if X = 1.0 then Arccos'Result = 0.0);
function Arctan
(Y : Float_Type'Base;
X : Float_Type'Base := 1.0)
return Float_Type'Base
(Y : Float_Type'Base;
X : Float_Type'Base := 1.0) return Float_Type'Base
with
Post => (if X > 0.0 and Y = 0.0 then Arctan'Result = 0.0);
function Arctan
(Y : Float_Type'Base;
X : Float_Type'Base := 1.0;
Cycle : Float_Type'Base)
return Float_Type'Base
Cycle : Float_Type'Base) return Float_Type'Base
with
Post => (if X > 0.0 and Y = 0.0 then Arctan'Result = 0.0);
function Arccot
(X : Float_Type'Base;
Y : Float_Type'Base := 1.0)
return Float_Type'Base
Y : Float_Type'Base := 1.0) return Float_Type'Base
with
Post => (if X > 0.0 and Y = 0.0 then Arccot'Result = 0.0);
function Arccot
(X : Float_Type'Base;
Y : Float_Type'Base := 1.0;
Cycle : Float_Type'Base)
return Float_Type'Base
Cycle : Float_Type'Base) return Float_Type'Base
with
Post => (if X > 0.0 and Y = 0.0 then Arccot'Result = 0.0);
function Sinh (X : Float_Type'Base) return Float_Type'Base
with
function Sinh (X : Float_Type'Base) return Float_Type'Base with
Post => (if X = 0.0 then Sinh'Result = 0.0);
function Cosh (X : Float_Type'Base) return Float_Type'Base
with
function Cosh (X : Float_Type'Base) return Float_Type'Base with
Post => Cosh'Result >= 1.0
and then (if X = 0.0 then Cosh'Result = 1.0);
and then (if X = 0.0 then Cosh'Result = 1.0);
function Tanh (X : Float_Type'Base) return Float_Type'Base
with
function Tanh (X : Float_Type'Base) return Float_Type'Base with
Post => Tanh'Result in -1.0 .. 1.0
and then (if X = 0.0 then Tanh'Result = 0.0);
and then (if X = 0.0 then Tanh'Result = 0.0);
function Coth (X : Float_Type'Base) return Float_Type'Base
with
function Coth (X : Float_Type'Base) return Float_Type'Base with
Post => abs Coth'Result >= 1.0;
function Arcsinh (X : Float_Type'Base) return Float_Type'Base
with
function Arcsinh (X : Float_Type'Base) return Float_Type'Base with
Post => (if X = 0.0 then Arcsinh'Result = 0.0);
function Arccosh (X : Float_Type'Base) return Float_Type'Base
with
function Arccosh (X : Float_Type'Base) return Float_Type'Base with
Post => Arccosh'Result >= 0.0
and then (if X = 1.0 then Arccosh'Result = 0.0);
and then (if X = 1.0 then Arccosh'Result = 0.0);
function Arctanh (X : Float_Type'Base) return Float_Type'Base
with
function Arctanh (X : Float_Type'Base) return Float_Type'Base with
Post => (if X = 0.0 then Arctanh'Result = 0.0);
function Arccoth (X : Float_Type'Base) return Float_Type'Base;
......
......@@ -2587,6 +2587,8 @@ package body Exp_Ch4 is
Full_Type := Underlying_Type (Full_Type);
end if;
-- Case of array types
if Is_Array_Type (Full_Type) then
-- If the operand is an elementary type other than a floating-point
......@@ -2609,6 +2611,8 @@ package body Exp_Ch4 is
return Expand_Array_Equality (Nod, Lhs, Rhs, Bodies, Full_Type);
end if;
-- Case of tagged record types
elsif Is_Tagged_Type (Full_Type) then
-- Call the primitive operation "=" of this type
......@@ -2653,6 +2657,8 @@ package body Exp_Ch4 is
(Unchecked_Convert_To (Etype (First_Formal (Eq_Op)), Lhs),
Unchecked_Convert_To (Etype (First_Formal (Eq_Op)), Rhs)));
-- Case of untagged record types
elsif Is_Record_Type (Full_Type) then
Eq_Op := TSS (Full_Type, TSS_Composite_Equality);
......@@ -2821,9 +2827,9 @@ package body Exp_Ch4 is
return Expand_Record_Equality (Nod, Full_Type, Lhs, Rhs, Bodies);
end if;
else
-- If not array or record type, it is predefined equality.
-- Non-composite types (always use predefined equality)
else
return Make_Op_Eq (Loc, Left_Opnd => Lhs, Right_Opnd => Rhs);
end if;
end Expand_Composite_Equality;
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2012, Free Software Foundation, Inc. --
-- Copyright (C) 2012-2013, 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- --
......@@ -64,14 +64,18 @@ package body System.Bignums is
-- Local Subprograms --
-----------------------
function Add (X, Y : Digit_Vector; X_Neg, Y_Neg : Boolean) return Bignum
with Pre => X'First = 1 and then Y'First = 1;
function Add
(X, Y : Digit_Vector;
X_Neg : Boolean;
Y_Neg : Boolean) return Bignum
with
Pre => X'First = 1 and then Y'First = 1;
-- This procedure adds two signed numbers returning the Sum, it is used
-- for both addition and subtraction. The value computed is X + Y, with
-- X_Neg and Y_Neg giving the signs of the operands.
function Allocate_Bignum (Len : Length) return Bignum
with Post => Allocate_Bignum'Result.Len = Len;
function Allocate_Bignum (Len : Length) return Bignum with
Post => Allocate_Bignum'Result.Len = Len;
-- Allocate Bignum value of indicated length on secondary stack. On return
-- the Neg and D fields are left uninitialized.
......@@ -81,7 +85,8 @@ package body System.Bignums is
function Compare
(X, Y : Digit_Vector;
X_Neg, Y_Neg : Boolean) return Compare_Result
with Pre => X'First = 1 and then Y'First = 1;
with
Pre => X'First = 1 and then Y'First = 1;
-- Compare (X with sign X_Neg) with (Y with sign Y_Neg), and return the
-- result of the signed comparison.
......@@ -113,7 +118,11 @@ package body System.Bignums is
-- Add --
---------
function Add (X, Y : Digit_Vector; X_Neg, Y_Neg : Boolean) return Bignum is
function Add
(X, Y : Digit_Vector;
X_Neg : Boolean;
Y_Neg : Boolean) return Bignum
is
begin
-- If signs are the same, we are doing an addition, it is convenient to
-- ensure that the first operand is the longer of the two.
......
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