Commit 331e5015 by Arnaud Charlet

[multiple changes]

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.

From-SVN: r235738
parent 2c94bbe3
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,
......
......@@ -6,7 +6,7 @@
-- --
-- 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- --
......@@ -467,7 +467,8 @@ package body Comperr is
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 =>
......
......@@ -6,7 +6,7 @@
-- --
-- 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- --
......@@ -874,19 +874,32 @@ package body Exp_Prag is
-- 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
......
......@@ -60,6 +60,7 @@ package System.Unsigned_Types is
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
......@@ -68,6 +69,7 @@ package System.Unsigned_Types is
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
......@@ -78,6 +80,7 @@ package System.Unsigned_Types is
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
......
......@@ -10906,7 +10906,7 @@ package body Sem_Ch13 is
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;
......
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