Commit f35b24e9 by Robert Dewar Committed by Arnaud Charlet

layout.ads, layout.adb (Adjust_Esize_Alignment): Move spec to package spec from body

2007-04-20  Robert Dewar  <dewar@adacore.com>

	* layout.ads, layout.adb (Adjust_Esize_Alignment): Move spec to package
	spec from body
	(Layout_Type): Fix recomputation of size from alignment.

From-SVN: r125430
parent 27f92b16
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2006, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,6 +31,7 @@ with Einfo; use Einfo; ...@@ -31,6 +31,7 @@ with Einfo; use Einfo;
with Errout; use Errout; with Errout; use Errout;
with Exp_Ch3; use Exp_Ch3; with Exp_Ch3; use Exp_Ch3;
with Exp_Util; use Exp_Util; with Exp_Util; use Exp_Util;
with Namet; use Namet;
with Nlists; use Nlists; with Nlists; use Nlists;
with Nmake; use Nmake; with Nmake; use Nmake;
with Opt; use Opt; with Opt; use Opt;
...@@ -70,11 +71,6 @@ package body Layout is ...@@ -70,11 +71,6 @@ package body Layout is
-- Local Subprograms -- -- Local Subprograms --
----------------------- -----------------------
procedure Adjust_Esize_Alignment (E : Entity_Id);
-- E is the entity for a type or object. This procedure checks that the
-- size and alignment are compatible, and if not either gives an error
-- message if they cannot be adjusted or else adjusts them appropriately.
function Assoc_Add function Assoc_Add
(Loc : Source_Ptr; (Loc : Source_Ptr;
Left_Opnd : Node_Id; Left_Opnd : Node_Id;
...@@ -2486,9 +2482,8 @@ package body Layout is ...@@ -2486,9 +2482,8 @@ package body Layout is
declare declare
A : constant Uint := Alignment_In_Bits (E); A : constant Uint := Alignment_In_Bits (E);
S : constant SO_Ref := RM_Size (E); S : constant SO_Ref := RM_Size (E);
begin begin
Set_Esize (E, (S * A + A - 1) / A); Set_Esize (E, (S + A - 1) / A * A);
end; end;
end if; end if;
...@@ -2605,7 +2600,7 @@ package body Layout is ...@@ -2605,7 +2600,7 @@ package body Layout is
if Has_Object_Size_Clause (E) then if Has_Object_Size_Clause (E) then
Error_Msg_Uint_1 := RM_Size (E); Error_Msg_Uint_1 := RM_Size (E);
Error_Msg_F Error_Msg_F
("object size is too small, minimum is ^", ("object size is too small, minimum allowed is ^",
Expression (Get_Attribute_Definition_Clause Expression (Get_Attribute_Definition_Clause
(E, Attribute_Object_Size))); (E, Attribute_Object_Size)));
end if; end if;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2000-2004 Free Software Foundation, Inc. -- -- Copyright (C) 2000-2006, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -60,6 +60,13 @@ package Layout is ...@@ -60,6 +60,13 @@ package Layout is
-- it means that the object must be allocated dynamically, since -- it means that the object must be allocated dynamically, since
-- its length is not known at compile time. -- its length is not known at compile time.
-- The following are utility routines, called from various places
procedure Adjust_Esize_Alignment (E : Entity_Id);
-- E is the entity for a type or object. This procedure checks that the
-- size and alignment are compatible, and if not either gives an error
-- message if they cannot be adjusted or else adjusts them appropriately.
procedure Set_Discrete_RM_Size (Def_Id : Entity_Id); procedure Set_Discrete_RM_Size (Def_Id : Entity_Id);
-- Set proper RM_Size for discrete size, this is normally the minimum -- Set proper RM_Size for discrete size, this is normally the minimum
-- number of bits to accommodate the range given, except in the case -- number of bits to accommodate the range given, except in the case
......
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