From 2593c3e1cb8b4325f87ea5a2ce9c1f906c4cf45b Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 26 Jan 2010 11:02:11 +0100 Subject: [PATCH] [multiple changes] 2010-01-26 Arnaud Charlet * s-tpoben.adb: Update comments. 2010-01-26 Robert Dewar * freeze.adb (Set_Small_Size): Don't set size if alignment clause present. 2010-01-26 Robert Dewar * scos.ads: Clean up documentation, remove obsolete XOR references From-SVN: r156238 --- gcc/ada/ChangeLog | 12 ++++++++++++ gcc/ada/freeze.adb | 21 +++++++++++++++------ gcc/ada/s-tpoben.adb | 10 ++++------ gcc/ada/scos.ads | 11 ++++++++--- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3884aa43626a..6ed8ae337708 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +2010-01-26 Arnaud Charlet + + * s-tpoben.adb: Update comments. + +2010-01-26 Robert Dewar + + * freeze.adb (Set_Small_Size): Don't set size if alignment clause + present. + +2010-01-26 Robert Dewar + + * scos.ads: Clean up documentation, remove obsolete XOR references 2010-01-26 Vincent Celier * gnat_ugn.texi: Complete documentation on the restrictions for diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 26b821d38d10..c9639361ec01 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -568,7 +568,7 @@ package body Freeze is procedure Set_Small_Size (T : Entity_Id; S : Uint); -- Sets the compile time known size (32 bits or less) in the Esize -- field, of T checking for a size clause that was given which attempts - -- to give a smaller size. + -- to give a smaller size, and also checking for an alignment clause. function Size_Known (T : Entity_Id) return Boolean; -- Recursive function that does all the work @@ -589,6 +589,15 @@ package body Freeze is if S > 32 then return; + -- Don't bother if alignment clause with a value other than 1 is + -- present, because size may be padded up to meet back end alignment + -- requirements, and only the back end knows the rules! + + elsif Known_Alignment (T) and then Alignment (T) /= 1 then + return; + + -- Check for bad size clause given + elsif Has_Size_Clause (T) then if RM_Size (T) < S then Error_Msg_Uint_1 := S; @@ -890,12 +899,12 @@ package body Freeze is if Is_Elementary_Type (Ctyp) or else (Is_Array_Type (Ctyp) - and then Present (Packed_Array_Type (Ctyp)) - and then Is_Modular_Integer_Type - (Packed_Array_Type (Ctyp))) + and then Present (Packed_Array_Type (Ctyp)) + and then Is_Modular_Integer_Type + (Packed_Array_Type (Ctyp))) then - -- If RM_Size is known and static, then we can - -- keep accumulating the packed size. + -- If RM_Size is known and static, then we can keep + -- accumulating the packed size. if Known_Static_RM_Size (Ctyp) then diff --git a/gcc/ada/s-tpoben.adb b/gcc/ada/s-tpoben.adb index 561d79306c7e..4694310ebff2 100644 --- a/gcc/ada/s-tpoben.adb +++ b/gcc/ada/s-tpoben.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1998-2009, Free Software Foundation, Inc. -- +-- Copyright (C) 1998-2010, Free Software Foundation, Inc. -- -- -- -- GNARL 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- -- @@ -226,14 +226,12 @@ package body System.Tasking.Protected_Objects.Entries is raise Program_Error; end if; + -- pragma Assert (Self_Id.Deferral_Level = 0); -- If a PO is created from a controlled operation, abort is already -- deferred at this point, so we need to use Defer_Abort_Nestable - -- In some cases, the below assertion can be useful to spot + -- In some cases, the above assertion can be useful to spot -- inconsistencies, outside the above scenario involving controlled - -- types: - - -- pragma Assert (Self_Id.Deferral_Level = 0); - -- Why is this commented out Assert here ??? + -- types. Initialization.Defer_Abort_Nestable (Self_ID); Initialize_Lock (Init_Priority, Object.L'Access); diff --git a/gcc/ada/scos.ads b/gcc/ada/scos.ads index a72687426d9f..3efc5a54f3de 100644 --- a/gcc/ada/scos.ads +++ b/gcc/ada/scos.ads @@ -160,7 +160,12 @@ package SCOs is -- Decisions -- Note: in the following description, logical operator includes only the - -- short circuited forms (so can be only of NOT, AND THEN, or OR ELSE). + -- short circuited forms and NOT (so can be only NOT, AND THEN, OR ELSE). + -- The reason that we can exclude AND/OR/XOR is that we expect SCO's to + -- be generated using the restriction No_Direct_Boolean_Operators, which + -- does not permit the use of AND/OR/XOR on boolean operands. These are + -- permitted on modular integer types, but such operations do not count + -- as decisions in any case -- Decisions are either simple or complex. A simple decision is a boolean -- expresssion that occurs in the context of a control structure in the @@ -217,7 +222,7 @@ package SCOs is -- expression ::= !sloc term (if expr is NOT) -- In the last four cases, sloc is the source location of the AND, OR, - -- XOR or NOT token, respectively. + -- or NOT token, respectively. -- term ::= element -- term ::= expression @@ -296,7 +301,7 @@ package SCOs is -- Operator -- C1 = '!', '^', '&', '|' -- C2 = ' ' - -- From = location of NOT/XOR/AND/OR token + -- From = location of NOT/AND/OR token -- To = No_Source_Location -- Last = False -- 2.47.3