+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
------------------------------------------------------------------------------
with System.Tasking;
+with Unchecked_Conversion;
package body Ada.Real_Time with
SPARK_Mode => Off
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
begin
Actuals := Parameter_Associations (N);
- -- Original function amy have been parameterless.
+ -- Original function may have been parameterless
if No (Actuals) then
Actuals := New_List;
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
---------------------------
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
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));
+
+ -- Nothing to check if the formal has a box or an
+ -- others_clause (necessarily with a box).
+
+ 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));
- -- 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.
+ else
+ Formal_P := Next_Entity (E);
+ Check_Formal_Package_Instance (Formal_P, E);
- Remove (Unit_Declaration_Node (Formal_P));
+ -- 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;