[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Tue, 26 Jan 2010 10:02:11 +0000 (11:02 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 26 Jan 2010 10:02:11 +0000 (11:02 +0100)
2010-01-26  Arnaud Charlet  <charlet@adacore.com>

* s-tpoben.adb: Update comments.

2010-01-26  Robert Dewar  <dewar@adacore.com>

* freeze.adb (Set_Small_Size): Don't set size if alignment clause
present.

2010-01-26  Robert Dewar  <dewar@adacore.com>

* scos.ads: Clean up documentation, remove obsolete XOR references

From-SVN: r156238

gcc/ada/ChangeLog
gcc/ada/freeze.adb
gcc/ada/s-tpoben.adb
gcc/ada/scos.ads

index 3884aa43626ae3491980a1529c7aeb3f6a7030fe..6ed8ae33770889ea840f657d714d33c1ce1320da 100644 (file)
@@ -1,3 +1,15 @@
+2010-01-26  Arnaud Charlet  <charlet@adacore.com>
+
+       * s-tpoben.adb: Update comments.
+
+2010-01-26  Robert Dewar  <dewar@adacore.com>
+
+       * freeze.adb (Set_Small_Size): Don't set size if alignment clause
+       present.
+
+2010-01-26  Robert Dewar  <dewar@adacore.com>
+
+       * scos.ads: Clean up documentation, remove obsolete XOR references
 2010-01-26  Vincent Celier  <celier@adacore.com>
 
        * gnat_ugn.texi: Complete documentation on the restrictions for
index 26b821d38d108cac66b3fb2fd601ca9cd1473e15..c9639361ec01c87b9d4e37df77b89579c8ec1ec2 100644 (file)
@@ -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
 
index 561d79306c7e0d02f87062804e131a156a4dd98c..4694310ebff27a011c72122a16b26a333415919d 100644 (file)
@@ -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);
index a72687426d9f85f84576ae7af19c9eb72dfc0ab5..3efc5a54f3de25bb33b4d6d393bdad846b1ac479 100644 (file)
@@ -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