+2016-05-02 Jerome Lambourg <lambourg@adacore.com>
+
+ * s-unstyp.ads: Code cleanups.
+
+2016-05-02 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_ch13.adb (Size_Too_Small_Error): Fix the error message format.
+
+2016-05-02 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_prag.adb (Expand_attributes_In_Consequence,
+ Expand_Attributes): If the prefix of'Old is an unconstrained type,
+ for example an unconstrained formal of the enclosing subprogram,
+ create an object declaration with an expression to obtain the
+ actual subtype of the temporary.
+
+2016-05-02 Arnaud Charlet <charlet@adacore.com>
+
+ * comperr.adb (Delete_SCIL_Files): Add missing handling of
+ N_Subprogram_Declaration.
+
2016-05-02 Gary Dismukes <dismukes@adacore.com>
* exp_ch5.adb, exp_ch7.adb, exp_ch7.ads, checks.adb, sem_attr.adb,
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2016, 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- --
Main := Unit (Cunit (Main_Unit));
case Nkind (Main) is
- when N_Subprogram_Body | N_Package_Declaration =>
+ when N_Subprogram_Declaration | N_Subprogram_Body |
+ N_Package_Declaration =>
Unit_Name := Defining_Unit_Name (Specification (Main));
when N_Package_Body =>
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2016, 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- --
-- the precondition procedure that follows.
Prepend_To (Decls, Decl);
- Analyze (Decl);
- -- Evaluate the prefix, generate:
- -- Temp := <Pref>;
+ -- If the type is unconstrained, the prefix provides its
+ -- value and constraint, so add it to declaration.
- if No (Eval_Stmts) then
- Eval_Stmts := New_List;
- end if;
+ if not Is_Constrained (Etype (Pref))
+ and then Is_Entity_Name (Pref)
+ then
+ Set_Expression (Decl, Pref);
+ Analyze (Decl);
+
+ -- Otherwise add an assignment statement to temporary
+ -- using prefix as RHS.
+
+ else
+ Analyze (Decl);
+
+ if No (Eval_Stmts) then
+ Eval_Stmts := New_List;
+ end if;
- Append_To (Eval_Stmts,
- Make_Assignment_Statement (Loc,
- Name => New_Occurrence_Of (Temp, Loc),
- Expression => Pref));
+ Append_To (Eval_Stmts,
+ Make_Assignment_Statement (Loc,
+ Name => New_Occurrence_Of (Temp, Loc),
+ Expression => Pref));
+
+ end if;
-- Ensure that the prefix is valid
type Packed_Bytes1 is array (Natural range <>) of aliased Packed_Byte;
for Packed_Bytes1'Alignment use 1;
for Packed_Bytes1'Component_Size use Packed_Byte'Size;
+ pragma Suppress_Initialization (Packed_Bytes1);
-- This is the type used to implement packed arrays where no alignment
-- is required. This includes the cases of 1,2,4 (where we use direct
-- masking operations), and all odd component sizes (where the clusters
type Packed_Bytes2 is new Packed_Bytes1;
for Packed_Bytes2'Alignment use Integer'Min (2, Standard'Maximum_Alignment);
+ pragma Suppress_Initialization (Packed_Bytes2);
-- This is the type used to implement packed arrays where an alignment
-- of 2 (is possible) is helpful for maximum efficiency of the get and
-- set routines in the corresponding library unit. This is true of all
type Packed_Bytes4 is new Packed_Bytes1;
for Packed_Bytes4'Alignment use Integer'Min (4, Standard'Maximum_Alignment);
+ pragma Suppress_Initialization (Packed_Bytes4);
-- This is the type used to implement packed arrays where an alignment
-- of 4 (if possible) is helpful for maximum efficiency of the get and
-- set routines in the corresponding library unit. This is true of all
if not ASIS_Mode then
Error_Msg_Uint_1 := Min_Siz;
- Error_Msg_NE ("size for & too small, minimum allowed is ^", N, T);
+ Error_Msg_NE ("size for& too small, minimum allowed is ^", N, T);
end if;
end Size_Too_Small_Error;