[multiple changes]
2015-10-23 Gary Dismukes <dismukes@adacore.com> * exp_ch6.adb: Minor reformatting. 2015-10-23 Ed Schonberg <schonberg@adacore.com> * sem_ch12.adb (Check_Formal_Packages): A formal package whose actual part is (others => <>) os identical to a formal package with an actual part written as (<>). 2015-10-23 Arnaud Charlet <charlet@adacore.com> * a-reatim.adb ("/"): For Time_Span division convert the operands to integers and then use integer division, which conforms to the rounding required by Ada RM. From-SVN: r229250
This commit is contained in:
parent
241fac51c3
commit
a1c0906418
@ -1,3 +1,19 @@
|
||||
2015-10-23 Gary Dismukes <dismukes@adacore.com>
|
||||
|
||||
* exp_ch6.adb: Minor reformatting.
|
||||
|
||||
2015-10-23 Ed Schonberg <schonberg@adacore.com>
|
||||
|
||||
* sem_ch12.adb (Check_Formal_Packages): A formal package whose
|
||||
actual part is (others => <>) os identical to a formal package
|
||||
with an actual part written as (<>).
|
||||
|
||||
2015-10-23 Arnaud Charlet <charlet@adacore.com>
|
||||
|
||||
* a-reatim.adb ("/"): For Time_Span division convert the operands
|
||||
to integers and then use integer division, which conforms to
|
||||
the rounding required by Ada RM.
|
||||
|
||||
2015-10-23 Ed Schonberg <schonberg@adacore.com>
|
||||
|
||||
* sem_ch6.adb (Check_Missing_Return): Do not report a missing
|
||||
|
@ -31,6 +31,7 @@
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
with System.Tasking;
|
||||
with Unchecked_Conversion;
|
||||
|
||||
package body Ada.Real_Time with
|
||||
SPARK_Mode => Off
|
||||
@ -117,8 +118,20 @@ is
|
||||
function "/" (Left, Right : Time_Span) return Integer is
|
||||
pragma Unsuppress (Overflow_Check);
|
||||
pragma Unsuppress (Division_Check);
|
||||
|
||||
-- RM D.8 (27) specifies the effects of operators on Time_Span, and
|
||||
-- rounding of the division operator in particular, to be the same as
|
||||
-- effects on integer types. To get the correct rounding we first
|
||||
-- convert Time_Span to its root type Duration, which is represented as
|
||||
-- an 64-bit signed integer, and then use integer division.
|
||||
|
||||
type Duration_Rep is range -(2 ** 63) .. +((2 ** 63 - 1));
|
||||
|
||||
function To_Integer is
|
||||
new Unchecked_Conversion (Duration, Duration_Rep);
|
||||
begin
|
||||
return Integer (Duration (Left) / Duration (Right));
|
||||
return Integer
|
||||
(To_Integer (Duration (Left)) / To_Integer (Duration (Right)));
|
||||
end "/";
|
||||
|
||||
function "/" (Left : Time_Span; Right : Integer) return Time_Span is
|
||||
|
@ -9598,7 +9598,7 @@ package body Exp_Ch6 is
|
||||
begin
|
||||
Actuals := Parameter_Associations (N);
|
||||
|
||||
-- Original function amy have been parameterless.
|
||||
-- Original function may have been parameterless
|
||||
|
||||
if No (Actuals) then
|
||||
Actuals := New_List;
|
||||
|
@ -2590,6 +2590,7 @@ package body Sem_Ch12 is
|
||||
or else Nkind (First (Generic_Associations (N))) = N_Others_Choice
|
||||
then
|
||||
Associations := False;
|
||||
Set_Box_Present (N);
|
||||
end if;
|
||||
|
||||
-- If there are no generic associations, the generic parameters appear
|
||||
@ -6127,8 +6128,9 @@ package body Sem_Ch12 is
|
||||
---------------------------
|
||||
|
||||
procedure Check_Formal_Packages (P_Id : Entity_Id) is
|
||||
E : Entity_Id;
|
||||
Formal_P : Entity_Id;
|
||||
E : Entity_Id;
|
||||
Formal_P : Entity_Id;
|
||||
Formal_Decl : Node_Id;
|
||||
|
||||
begin
|
||||
-- Iterate through the declarations in the instance, looking for package
|
||||
@ -6146,15 +6148,35 @@ package body Sem_Ch12 is
|
||||
elsif Nkind (Parent (E)) /= N_Package_Renaming_Declaration then
|
||||
null;
|
||||
|
||||
elsif not Box_Present (Parent (Associated_Formal_Package (E))) then
|
||||
Formal_P := Next_Entity (E);
|
||||
Check_Formal_Package_Instance (Formal_P, E);
|
||||
else
|
||||
Formal_Decl := Parent (Associated_Formal_Package (E));
|
||||
|
||||
-- After checking, remove the internal validating package. It
|
||||
-- is only needed for semantic checks, and as it may contain
|
||||
-- generic formal declarations it should not reach gigi.
|
||||
-- Nothing to check if the formal has a box or an
|
||||
-- others_clause (necessarily with a box).
|
||||
|
||||
Remove (Unit_Declaration_Node (Formal_P));
|
||||
if Box_Present (Formal_Decl) then
|
||||
null;
|
||||
|
||||
elsif Nkind (First (Generic_Associations (Formal_Decl))) =
|
||||
N_Others_Choice
|
||||
then
|
||||
-- The internal validating package was generated but
|
||||
-- formal and instance are known to be compatible..
|
||||
|
||||
Formal_P := Next_Entity (E);
|
||||
Remove (Unit_Declaration_Node (Formal_P));
|
||||
|
||||
else
|
||||
Formal_P := Next_Entity (E);
|
||||
Check_Formal_Package_Instance (Formal_P, E);
|
||||
|
||||
-- After checking, remove the internal validating package.
|
||||
-- It is only needed for semantic checks, and as it may
|
||||
-- contain generic formal declarations it should not
|
||||
-- reach gigi.
|
||||
|
||||
Remove (Unit_Declaration_Node (Formal_P));
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user