OSDN Git Service

2011-12-20 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Dec 2011 13:47:44 +0000 (13:47 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Dec 2011 13:47:44 +0000 (13:47 +0000)
* sem_ch3.adb, sem_ch5.adb, s-diinio.adb, s-diinio.ads, sem_dim.adb,
sem_dim.ads, sem_res.adb, s-stposu.adb, s-stposu.ads, sem_ch4.adb,
s-diflio.adb, s-diflio.ads, exp_disp.adb, s-llflex.ads: Minor
reformatting.
* aspects.ads: Dimension[_Aspects] are GNAT defined.

2011-12-20  Robert Dewar  <dewar@adacore.com>

* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Check
renaming case.

2011-12-20  Thomas Quinot  <quinot@adacore.com>

* sem_cat.adb, sem_ch10.adb (Analyze_With_Clause): For a WITH clause on
a child unit that is an illegal instantiation, mark the WITH clause in
error.
(Install_Siblings, Validate_Categorization_Dependency): Guard
against WITH clause marked as in error.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182534 138bc75d-0d04-0410-961f-82ee72b054a4

19 files changed:
gcc/ada/ChangeLog
gcc/ada/aspects.ads
gcc/ada/exp_disp.adb
gcc/ada/s-diflio.adb
gcc/ada/s-diflio.ads
gcc/ada/s-diinio.adb
gcc/ada/s-diinio.ads
gcc/ada/s-llflex.ads
gcc/ada/s-stposu.adb
gcc/ada/s-stposu.ads
gcc/ada/sem_cat.adb
gcc/ada/sem_ch10.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch4.adb
gcc/ada/sem_ch5.adb
gcc/ada/sem_dim.adb
gcc/ada/sem_dim.ads
gcc/ada/sem_res.adb

index 74d7309..dda4bac 100644 (file)
@@ -1,3 +1,24 @@
+2011-12-20  Robert Dewar  <dewar@adacore.com>
+
+       * sem_ch3.adb, sem_ch5.adb, s-diinio.adb, s-diinio.ads, sem_dim.adb,
+       sem_dim.ads, sem_res.adb, s-stposu.adb, s-stposu.ads, sem_ch4.adb,
+       s-diflio.adb, s-diflio.ads, exp_disp.adb, s-llflex.ads: Minor
+       reformatting.
+       * aspects.ads: Dimension[_Aspects] are GNAT defined.
+
+2011-12-20  Robert Dewar  <dewar@adacore.com>
+
+       * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Check
+       renaming case.
+
+2011-12-20  Thomas Quinot  <quinot@adacore.com>
+
+       * sem_cat.adb, sem_ch10.adb (Analyze_With_Clause): For a WITH clause on
+       a child unit that is an illegal instantiation, mark the WITH clause in
+       error.
+       (Install_Siblings, Validate_Categorization_Dependency): Guard
+       against WITH clause marked as in error.
+
 2011-12-20  Hristian Kirtchev  <kirtchev@adacore.com>
 
        * sem_res.adb (Resolve_Allocator): Warning on allocation
index b701fe5..fe50df7 100755 (executable)
@@ -54,8 +54,8 @@ package Aspects is
       Aspect_Default_Component_Value,
       Aspect_Default_Iterator,
       Aspect_Default_Value,
-      Aspect_Dimension,
-      Aspect_Dimension_System,
+      Aspect_Dimension,                     -- GNAT
+      Aspect_Dimension_System,              -- GNAT
       Aspect_Dispatching_Domain,
       Aspect_Dynamic_Predicate,
       Aspect_External_Tag,
@@ -150,27 +150,29 @@ package Aspects is
    --  The following array identifies all implementation defined aspects
 
    Impl_Defined_Aspects : constant array (Aspect_Id) of Boolean :=
-                            (Aspect_Object_Size          => True,
-                             Aspect_Predicate            => True,
-                             Aspect_Test_Case            => True,
-                             Aspect_Value_Size           => True,
-                             Aspect_Compiler_Unit        => True,
-                             Aspect_Preelaborate_05      => True,
-                             Aspect_Pure_05              => True,
-                             Aspect_Pure_12              => True,
-                             Aspect_Universal_Data       => True,
-                             Aspect_Ada_2005             => True,
+                            (Aspect_Ada_2005             => True,
                              Aspect_Ada_2012             => True,
+                             Aspect_Compiler_Unit        => True,
+                             Aspect_Dimension            => True,
+                             Aspect_Dimension_System     => True,
                              Aspect_Favor_Top_Level      => True,
                              Aspect_Inline_Always        => True,
+                             Aspect_Object_Size          => True,
                              Aspect_Persistent_BSS       => True,
+                             Aspect_Predicate            => True,
+                             Aspect_Preelaborate_05      => True,
+                             Aspect_Pure_05              => True,
+                             Aspect_Pure_12              => True,
                              Aspect_Pure_Function        => True,
                              Aspect_Shared               => True,
                              Aspect_Suppress_Debug_Info  => True,
+                             Aspect_Test_Case            => True,
+                             Aspect_Universal_Data       => True,
                              Aspect_Universal_Aliasing   => True,
                              Aspect_Unmodified           => True,
                              Aspect_Unreferenced         => True,
                              Aspect_Unreferenced_Objects => True,
+                             Aspect_Value_Size           => True,
                              others                      => False);
 
    --  The following array indicates aspects for which multiple occurrences of
index 2ba3150..23ffe90 100644 (file)
@@ -6512,7 +6512,7 @@ package body Exp_Disp is
       --  Alignment
 
       --  For CPP types we cannot rely on the value of 'Alignment provided
-      --  by the backend to initialize this TSD field.
+      --  by the backend to initialize this TSD field. Why not???
 
       if Convention (Typ) = Convention_CPP
         or else Is_CPP_Class (Root_Type (Typ))
index 7a14b8f..46b24cd 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                  B o d y                                 --
 --                                                                          --
---          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
+--            Copyright (C) 2011, 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- --
@@ -41,9 +41,9 @@ package body System.Dim_Float_IO is
      (File : File_Type;
       Item : Num_Dim_Float;
       Unit : String := "";
-      Fore : Field := Default_Fore;
-      Aft  : Field := Default_Aft;
-      Exp  : Field := Default_Exp)
+      Fore : Field  := Default_Fore;
+      Aft  : Field  := Default_Aft;
+      Exp  : Field  := Default_Exp)
    is
    begin
       Num_Dim_Float_IO.Put (File, Item, Fore, Aft, Exp);
@@ -53,9 +53,9 @@ package body System.Dim_Float_IO is
    procedure Put
      (Item : Num_Dim_Float;
       Unit : String := "";
-      Fore : Field := Default_Fore;
-      Aft  : Field := Default_Aft;
-      Exp  : Field := Default_Exp)
+      Fore : Field  := Default_Fore;
+      Aft  : Field  := Default_Aft;
+      Exp  : Field  := Default_Exp)
    is
    begin
       Num_Dim_Float_IO.Put (Item, Fore, Aft, Exp);
@@ -66,8 +66,8 @@ package body System.Dim_Float_IO is
      (To   : out String;
       Item : Num_Dim_Float;
       Unit : String := "";
-      Aft  : Field := Default_Aft;
-      Exp  : Field := Default_Exp)
+      Aft  : Field  := Default_Aft;
+      Exp  : Field  := Default_Exp)
    is
    begin
       Num_Dim_Float_IO.Put (To, Item, Aft, Exp);
index e70dc49..1b00d27 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                  S p e c                                 --
 --                                                                          --
---          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
+--            Copyright (C) 2011, 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- --
@@ -30,7 +30,7 @@
 ------------------------------------------------------------------------------
 
 --  Note that this package should only be instantiated with a float dimensioned
---  type.
+--  type. Shouldn't this be checked???
 
 --  This package is a generic package that provides IO facilities for float
 --  dimensioned types.
@@ -54,23 +54,23 @@ package System.Dim_Float_IO is
      (File : File_Type;
       Item : Num_Dim_Float;
       Unit : String := "";
-      Fore : Field := Default_Fore;
-      Aft  : Field := Default_Aft;
-      Exp  : Field := Default_Exp);
+      Fore : Field  := Default_Fore;
+      Aft  : Field  := Default_Aft;
+      Exp  : Field  := Default_Exp);
 
    procedure Put
      (Item : Num_Dim_Float;
       Unit : String := "";
-      Fore : Field := Default_Fore;
-      Aft  : Field := Default_Aft;
-      Exp  : Field := Default_Exp);
+      Fore : Field  := Default_Fore;
+      Aft  : Field  := Default_Aft;
+      Exp  : Field  := Default_Exp);
 
    procedure Put
      (To   : out String;
       Item : Num_Dim_Float;
       Unit : String := "";
-      Aft  : Field := Default_Aft;
-      Exp  : Field := Default_Exp);
+      Aft  : Field  := Default_Aft;
+      Exp  : Field  := Default_Exp);
 
    pragma Inline (Put);
 
index b530942..75f5768 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                  B o d y                                 --
 --                                                                          --
---          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
+--            Copyright (C) 2011, 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- --
@@ -38,10 +38,10 @@ package body System.Dim_Integer_IO is
    ---------
 
    procedure Put
-     (File : File_Type;
-      Item : Num_Dim_Integer;
-      Unit : String := "";
-      Width : Field := Default_Width;
+     (File  : File_Type;
+      Item  : Num_Dim_Integer;
+      Unit  : String      := "";
+      Width : Field       := Default_Width;
       Base  : Number_Base := Default_Base)
 
    is
@@ -51,9 +51,9 @@ package body System.Dim_Integer_IO is
    end Put;
 
    procedure Put
-     (Item : Num_Dim_Integer;
-      Unit : String := "";
-      Width : Field := Default_Width;
+     (Item  : Num_Dim_Integer;
+      Unit  : String      := "";
+      Width : Field       := Default_Width;
       Base  : Number_Base := Default_Base)
 
    is
@@ -63,9 +63,9 @@ package body System.Dim_Integer_IO is
    end Put;
 
    procedure Put
-     (To   : out String;
-      Item : Num_Dim_Integer;
-      Unit : String := "";
+     (To    : out String;
+      Item  : Num_Dim_Integer;
+      Unit  : String      := "";
       Base  : Number_Base := Default_Base)
 
    is
index 2325cea..ca29d3c 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                  S p e c                                 --
 --                                                                          --
---          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
+--            Copyright (C) 2011, 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- --
@@ -30,7 +30,7 @@
 ------------------------------------------------------------------------------
 
 --  Note that this package should only be instantiated with an integer
---  dimensioned type
+--  dimensioned type. Shouldn't this be checked ???
 
 --  This package is a generic package that provides IO facilities for integer
 --  dimensioned types.
@@ -46,26 +46,26 @@ generic
 
 package System.Dim_Integer_IO is
 
-   Default_Width : Field := Num_Dim_Integer'Width;
+   Default_Width : Field       := Num_Dim_Integer'Width;
    Default_Base  : Number_Base := 10;
 
    procedure Put
-     (File : File_Type;
-      Item : Num_Dim_Integer;
-      Unit : String := "";
-      Width : Field := Default_Width;
+     (File  : File_Type;
+      Item  : Num_Dim_Integer;
+      Unit  : String      := "";
+      Width : Field       := Default_Width;
       Base  : Number_Base := Default_Base);
 
    procedure Put
-     (Item : Num_Dim_Integer;
-      Unit : String := "";
-      Width : Field := Default_Width;
+     (Item  : Num_Dim_Integer;
+      Unit  : String      := "";
+      Width : Field       := Default_Width;
       Base  : Number_Base := Default_Base);
 
    procedure Put
-     (To   : out String;
-      Item : Num_Dim_Integer;
-      Unit : String := "";
+     (To    : out String;
+      Item  : Num_Dim_Integer;
+      Unit  : String      := "";
       Base  : Number_Base := Default_Base);
 
    pragma Inline (Put);
index 2ff301f..bd6d8b2 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                  S p e c                                 --
 --                                                                          --
---          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
+--             Copyright (C) 2011, 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- --
index 53f65cb..5ee3f2d 100644 (file)
@@ -440,7 +440,6 @@ package body System.Storage_Pools.Subpools is
    is
    begin
       raise Program_Error;
-
       return Pool.Subpools.Subpool;
    end Default_Subpool_For_Pool;
 
@@ -552,9 +551,7 @@ package body System.Storage_Pools.Subpools is
    begin
       --  Do nothing if the subpool was never used
 
-      if Subpool.Owner = null
-        or else Subpool.Node = null
-      then
+      if Subpool.Owner = null or else Subpool.Node = null then
          return;
       end if;
 
@@ -619,8 +616,9 @@ package body System.Storage_Pools.Subpools is
    -- Pool_Of_Subpool --
    ---------------------
 
-   function Pool_Of_Subpool (Subpool : not null Subpool_Handle)
-     return access Root_Storage_Pool_With_Subpools'Class
+   function Pool_Of_Subpool
+     (Subpool : not null Subpool_Handle)
+      return access Root_Storage_Pool_With_Subpools'Class
    is
    begin
       return Subpool.Owner;
index d5819ca..47099d2 100644 (file)
@@ -38,7 +38,7 @@ with System.Finalization_Masters;
 with System.Storage_Elements;
 
 package System.Storage_Pools.Subpools is
-   pragma Preelaborate (Subpools);
+   pragma Preelaborate;
 
    type Root_Storage_Pool_With_Subpools is abstract
      new Root_Storage_Pool with private;
@@ -74,12 +74,13 @@ package System.Storage_Pools.Subpools is
 
    --  ??? This precondition causes errors in simple tests, disabled for now
 
---      with Pre'Class => Pool_Of_Subpool (Subpool) = Pool'Access;
+   --      with Pre'Class => Pool_Of_Subpool (Subpool) = Pool'Access;
    --  This routine requires implementation. Allocate an object described by
    --  Size_In_Storage_Elements and Alignment on a subpool.
 
-   function Create_Subpool (Pool : in out Root_Storage_Pool_With_Subpools)
-     return not null Subpool_Handle is abstract;
+   function Create_Subpool
+     (Pool : in out Root_Storage_Pool_With_Subpools)
+      return not null Subpool_Handle is abstract;
    --  This routine requires implementation. Create a subpool within the given
    --  pool_with_subpools.
 
@@ -88,15 +89,16 @@ package System.Storage_Pools.Subpools is
       Storage_Address          : System.Address;
       Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
       Alignment                : System.Storage_Elements.Storage_Count)
-      is null;
+   is null;
 
    procedure Deallocate_Subpool
      (Pool    : in out Root_Storage_Pool_With_Subpools;
-      Subpool : in out Subpool_Handle) is abstract;
+      Subpool : in out Subpool_Handle)
+   is abstract;
 
    --  ??? This precondition causes errors in simple tests, disabled for now
 
---      with Pre'Class => Pool_Of_Subpool (Subpool) = Pool'Access;
+   --      with Pre'Class => Pool_Of_Subpool (Subpool) = Pool'Access;
    --  This routine requires implementation. Reclaim the storage a particular
    --  subpool occupies in a pool_with_subpools. This routine is called by
    --  Ada.Unchecked_Deallocate_Subpool.
@@ -107,8 +109,9 @@ package System.Storage_Pools.Subpools is
    --  Subpool_Handle_name in the allocator. The default implementation of this
    --  routine raises Program_Error.
 
-   function Pool_Of_Subpool (Subpool : not null Subpool_Handle)
-     return access Root_Storage_Pool_With_Subpools'Class;
+   function Pool_Of_Subpool
+     (Subpool : not null Subpool_Handle)
+      return access Root_Storage_Pool_With_Subpools'Class;
    --  Return the owner of the subpool
 
    procedure Set_Pool_Of_Subpool
@@ -118,9 +121,11 @@ package System.Storage_Pools.Subpools is
    --  Create_Subpool or similar subpool constructors. Raises Program_Error
    --  if the subpool already belongs to a pool.
 
-   overriding function Storage_Size (Pool : Root_Storage_Pool_With_Subpools)
-     return System.Storage_Elements.Storage_Count is
-       (System.Storage_Elements.Storage_Count'Last);
+   overriding function Storage_Size
+     (Pool : Root_Storage_Pool_With_Subpools)
+      return System.Storage_Elements.Storage_Count
+   is
+      (System.Storage_Elements.Storage_Count'Last);
 
 private
    --  Model
index 04cf958..8ac23de 100644 (file)
@@ -972,7 +972,13 @@ package body Sem_Cat is
          while Present (Item) loop
             if Nkind (Item) = N_With_Clause
               and then not (Implicit_With (Item)
-                              or else Limited_Present (Item))
+                              or else Limited_Present (Item)
+
+                              --  Skip if error already posted on the WITH
+                              --  clause (in which case the Name attribute
+                              --  may be invalid).
+
+                              or else Error_Posted (Item))
             then
                Entity_Of_Withed := Entity (Name (Item));
                Check_Categorization_Dependencies
index 27d9e45..b4c42ee 100644 (file)
@@ -2678,7 +2678,14 @@ package body Sem_Ch10 is
             Generate_Reference (Par_Name, Pref);
 
          else
-            Set_Name (N, Make_Null (Sloc (N)));
+            pragma Assert (Serious_Errors_Detected /= 0);
+
+            --  Mark the node to indicate that a related error has been posted.
+            --  This defends further compilation passes against cascaded errors
+            --  caused by the invalid WITH clause node.
+
+            Set_Error_Posted (N);
+            Set_Name (N, Error);
             return;
          end if;
       end if;
@@ -4100,6 +4107,7 @@ package body Sem_Ch10 is
          if Nkind (Item) /= N_With_Clause
            or else Implicit_With (Item)
            or else Limited_Present (Item)
+           or else Error_Posted (Item)
          then
             null;
 
index 31bbd13..22b2bec 100644 (file)
@@ -2184,18 +2184,41 @@ package body Sem_Ch13 is
          U_Ent := Underlying_Type (Ent);
       end if;
 
-      --  Complete other routine error checks
+      --  Avoid cascaded error
 
       if Etype (Nam) = Any_Type then
          return;
 
+      --  Must be declared in current scope
+
       elsif Scope (Ent) /= Current_Scope then
          Error_Msg_N ("entity must be declared in this scope", Nam);
          return;
 
+      --  Must not be a source renaming (we do have some cases where the
+      --  expander generates a renaming, and those cases are OK, in such
+      --  cases any attribute applies to the renamed object as well.
+
+      elsif Is_Object (Ent)
+        and then Present (Renamed_Object (Ent))
+        and then Comes_From_Source (Renamed_Object (Ent))
+      then
+         Get_Name_String (Chars (N));
+         Error_Msg_Strlen := Name_Len;
+         Error_Msg_String (1 .. Name_Len) := Name_Buffer (1 .. Name_Len);
+         Error_Msg_N
+           ("~ clause not allowed for a renaming declaration (RM 13.1(6))",
+            Nam);
+         return;
+
+      --  If no underlying entity, use entity itself, applies to some
+      --  previously detected error cases ???
+
       elsif No (U_Ent) then
          U_Ent := Ent;
 
+      --  Cannot specify for a subtype (exception Object/Value_Size)
+
       elsif Is_Type (U_Ent)
         and then not Is_First_Subtype (U_Ent)
         and then Id /= Attribute_Object_Size
@@ -2367,12 +2390,6 @@ package body Sem_Ch13 is
                   then
                      Error_Msg_N ("constant overlays a variable?", Expr);
 
-                  elsif Present (Renamed_Object (U_Ent)) then
-                     Error_Msg_N
-                       ("address clause not allowed"
-                          & " for a renaming declaration (RM 13.1(6))", Nam);
-                     return;
-
                   --  Imported variables can have an address clause, but then
                   --  the import is pretty meaningless except to suppress
                   --  initializations, so we do not need such variables to
@@ -2523,10 +2540,16 @@ package body Sem_Ch13 is
             elsif Align /= No_Uint then
                Set_Has_Alignment_Clause (U_Ent);
 
+               --  Tagged type case, check for attempt to set alignment to a
+               --  value greater than Max_Align, and reset if so.
+
                if Is_Tagged_Type (U_Ent) and then Align > Max_Align then
                   Error_Msg_N
                     ("?alignment for & set to Maximum_Aligment", Nam);
-                  Set_Alignment (U_Ent, Max_Align);
+                     Set_Alignment (U_Ent, Max_Align);
+
+               --  All other cases
+
                else
                   Set_Alignment (U_Ent, Align);
                end if;
@@ -6057,7 +6080,7 @@ package body Sem_Ch13 is
               Aspect_Type_Invariant    =>
             T := Standard_Boolean;
 
-         when Aspect_Dimension |
+         when Aspect_Dimension        |
               Aspect_Dimension_System =>
             raise Program_Error;
 
@@ -8792,8 +8815,8 @@ package body Sem_Ch13 is
             Source : constant Entity_Id  := T.Source;
             Target : constant Entity_Id  := T.Target;
 
-            Source_Siz    : Uint;
-            Target_Siz    : Uint;
+            Source_Siz : Uint;
+            Target_Siz : Uint;
 
          begin
             --  This validation check, which warns if we have unequal sizes for
index 9070b45..d468c73 100644 (file)
@@ -2037,6 +2037,7 @@ package body Sem_Ch3 is
       if Has_Aspects (N) then
          Analyze_Aspect_Specifications (N, Id);
       end if;
+
       Analyze_Dimension (N);
    end Analyze_Component_Declaration;
 
@@ -3780,6 +3781,7 @@ package body Sem_Ch3 is
       if Has_Aspects (N) then
          Analyze_Aspect_Specifications (N, Id);
       end if;
+
       Analyze_Dimension (N);
    end Analyze_Object_Declaration;
 
@@ -4579,6 +4581,7 @@ package body Sem_Ch3 is
       if Has_Aspects (N) then
          Analyze_Aspect_Specifications (N, Id);
       end if;
+
       Analyze_Dimension (N);
    end Analyze_Subtype_Declaration;
 
index bd56eef..97a8771 100644 (file)
@@ -6045,12 +6045,13 @@ package body Sem_Ch4 is
                  and then Is_Dimensioned_Type (Etype (L))
                then
                   Error_Msg_NE
-                    ("exponent for dimensioned type must be a Rational" &
+                    ("exponent for dimensioned type must be a rational" &
                      ", found}", R, Etype (R));
                else
                   Error_Msg_NE
                     ("exponent must be of type Natural, found}", R, Etype (R));
                end if;
+
                return;
             end if;
 
index 62df0de..54819b8 100644 (file)
@@ -827,7 +827,6 @@ package body Sem_Ch5 is
 
       declare
          Ent : constant Entity_Id := Get_Enclosing_Object (Lhs);
-
       begin
          if Present (Ent)
            and then Safe_To_Capture_Value (N, Ent)
@@ -840,6 +839,7 @@ package body Sem_Ch5 is
             Set_Last_Assignment (Ent, Lhs);
          end if;
       end;
+
       Analyze_Dimension (N);
    end Analyze_Assignment;
 
index b069169..4f20e45 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
+--            Copyright (C) 2011, 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- --
@@ -51,16 +51,15 @@ with GNAT.HTable;
 
 package body Sem_Dim is
 
-   --  Maximum number of dimensions in a dimension system
-
    Max_Dimensions : constant Int := 7;
+   --  Maximum number of dimensions in a dimension system
 
+   subtype Dim_Id is Pos range 1 .. Max_Dimensions;
    --  Dim_Id values are used to identify dimensions in a dimension system
    --  Note that the highest value of Dim_Id is Max_Dimensions
 
-   subtype Dim_Id is Pos range 1 .. Max_Dimensions;
-
    --  Record type for dimension system
+
    --  A dimension system is defined by the number and the names of its
    --  dimensions and its base type.
 
@@ -144,10 +143,12 @@ package body Sem_Dim is
    ---------
 
    function GCD (Left, Right : Whole) return Int is
-      L : Whole := Left;
-      R : Whole := Right;
+      L : Whole;
+      R : Whole;
 
    begin
+      L := Left;
+      R := Right;
       while R /= 0 loop
          L := L mod R;
 
@@ -194,7 +195,6 @@ package body Sem_Dim is
             Rational'(Numerator   => Left.Numerator * Right.Denominator +
                                        Left.Denominator * Right.Numerator,
                       Denominator => Left.Denominator * Right.Denominator);
-
    begin
       return Reduce (R);
    end "+";
@@ -263,6 +263,7 @@ package body Sem_Dim is
    --  The following table provides a relation between nodes and its dimension
    --  (if not dimensionless). If a node is not stored in the Hash Table, the
    --  node is considered to be dimensionless.
+
    --  A dimension is represented by an array of Max_Dimensions Rationals.
    --  If the corresponding dimension system has less than Max_Dimensions
    --  dimensions, the array is filled by as many as Zero_Rationals needed to
@@ -301,6 +302,10 @@ package body Sem_Dim is
 
    function AD_Hash (F : Node_Id) return AD_Hash_Range;
 
+   -------------
+   -- AD_Hash --
+   -------------
+
    function AD_Hash (F : Node_Id) return AD_Hash_Range is
    begin
       return AD_Hash_Range (F mod 512);
@@ -442,8 +447,9 @@ package body Sem_Dim is
       Id   : Node_Id;
       Expr : Node_Id)
    is
-      Def_Id   : constant Entity_Id := Defining_Identifier (N);
-      N_Kind   : constant Node_Kind := Nkind (N);
+      Def_Id : constant Entity_Id := Defining_Identifier (N);
+      N_Kind : constant Node_Kind := Nkind (N);
+
       Analyzed : array (Dimensions'Range) of Boolean := (others => False);
       --  This array has been defined in order to deals with Others_Choice
       --  It is a reminder of the dimensions in the aggregate that have already
@@ -496,6 +502,7 @@ package body Sem_Dim is
       is
          B_Typ   : Node_Id;
          Sub_Ind : Node_Id;
+
       begin
          --  Aspect_Dimension can only apply for subtypes
 
@@ -508,7 +515,6 @@ package body Sem_Dim is
             if Nkind (Sub_Ind) /= N_Subtype_Indication then
                B_Typ := Etype (Sub_Ind);
                return Get_Dimension_System_Id (B_Typ);
-
             else
                return No_Dim_Sys;
             end if;
@@ -529,7 +535,6 @@ package body Sem_Dim is
          Typ      : Entity_Id;
 
       begin
-
          --  Check the type is dimensionless before assigning a dimension
 
          if Nkind (N) = N_Subtype_Declaration then
@@ -580,9 +585,8 @@ package body Sem_Dim is
 
          if Present (Component_Associations (Expr)) then
 
-            --  If the aggregate is a positional aggregate with an
-            --  Others_Choice, the number of expressions must be less than or
-            --  equal to N_Of_Dims - 1.
+            --  For a positional aggregate with an Others_Choice, the number
+            --  of expressions must be less than or equal to N_Of_Dims - 1.
 
             if Present (Comp_Expr) then
                N_Dims_Aggr := List_Length (Expressions (Expr)) - 1;
@@ -711,7 +715,6 @@ package body Sem_Dim is
             if Dim_Name = Na_Id then
                Dim := D;
             end if;
-
          end loop;
 
          return Dim;
@@ -728,14 +731,14 @@ package body Sem_Dim is
          Comp_Expr : Node_Id;
 
       begin
-         Comp_Expr := First (Expressions (Expr));
-         Next (Comp_Expr);
 
+         Comp_Expr := Next (First (Expressions (Expr)));
          while Present (Comp_Expr) loop
 
             --  First, analyze the expression
 
             Analyze_And_Resolve (Comp_Expr);
+
             if not Compile_Time_Known_Value (Comp_Expr) then
                return False;
             end if;
@@ -744,7 +747,6 @@ package body Sem_Dim is
          end loop;
 
          Comp_Assn := First (Component_Associations (Expr));
-
          while Present (Comp_Assn) loop
             Comp_Expr := Expression (Comp_Assn);
 
@@ -823,7 +825,6 @@ package body Sem_Dim is
       Comp_Assn := First (Component_Associations (Expr));
 
       if Present (Comp_Expr) then
-
          if List_Length (Component_Associations (Expr)) > 1 then
             Error_Msg_N ("named association cannot follow " &
                          "positional association for aspect%", Expr);
@@ -927,10 +928,10 @@ package body Sem_Dim is
                   return;
                end if;
 
-               --  End the filling of Dims by the Others_Choice value
-               --  If N_Of_Dims < Max_Dimensions then only the
-               --  positions that haven't been already analyzed from
-               --  Dim_Id'First to N_Of_Dims are filled.
+               --  End the filling of Dims by the Others_Choice value. If
+               --  N_Of_Dims < Max_Dimensions then only the positions that
+               --  haven't been already analyzed from Dim_Id'First to N_Of_Dims
+               --  are filled.
 
                for Dim in Dim_Id'First .. N_Of_Dims loop
                   if not Analyzed (Dim) then
@@ -1011,7 +1012,8 @@ package body Sem_Dim is
    -- Analyze_Aspect_Dimension_System --
    -------------------------------------
 
-   --    with Dimension_System => DIMENSION_PAIRS
+   --  with Dimension_System => DIMENSION_PAIRS
+
    --  DIMENSION_PAIRS ::=
    --    (DIMENSION_PAIR
    --      [, DIMENSION_PAIR]
@@ -1033,9 +1035,9 @@ package body Sem_Dim is
       Dim_Node   : Node_Id;
       Dim_Symbol : Node_Id;
       D_Sys      : Dimension_System := No_Dimension_System;
-      Names      : Name_Array := No_Names;
+      Names      : Name_Array       := No_Names;
       N_Of_Dims  : N_Of_Dimensions;
-      Symbols    : Symbol_Array := No_Symbols;
+      Symbols    : Symbol_Array     := No_Symbols;
 
       function Derived_From_Numeric_Type (N : Node_Id) return Boolean;
       --  Return True if the node is a derived type declaration from any
@@ -1091,16 +1093,17 @@ package body Sem_Dim is
       function Check_Dimension_System_Syntax (N : Node_Id) return Boolean is
          Dim_Node : Node_Id;
          Expr_Dim : Node_Id;
+
       begin
          --  Chek that the aggregate is a positional array
 
          if Present (Component_Associations (N)) then
             return False;
-         else
-            Dim_Node := First (Expressions (N));
 
+         else
             --  Check that each component of the aggregate is an aggregate
 
+            Dim_Node := First (Expressions (N));
             while Present (Dim_Node) loop
 
                --  Verify that the aggregate is a pair of identifier and string
@@ -1161,7 +1164,8 @@ package body Sem_Dim is
 
       begin
          if List_Length (List_Expr) < Dim_Id'First
-           or else List_Length (List_Expr) > Max_Dimensions then
+           or else List_Length (List_Expr) > Max_Dimensions
+         then
             return False;
          else
             return True;
@@ -1181,8 +1185,8 @@ package body Sem_Dim is
       end if;
 
       if not Derived_From_Numeric_Type (N) then
-         Error_Msg_N ("aspect% only apply for type derived from numeric type",
-                      Id);
+         Error_Msg_N
+           ("aspect% only apply for type derived from numeric type", Id);
          return;
       end if;
 
@@ -1325,16 +1329,14 @@ package body Sem_Dim is
          --  Check the lhs and the rhs have the same dimension
 
          if not Present (Dim_Lhs) then
-
             if Present (Dim_Rhs) then
                Error_Msg_N ("?dimensions missmatch in assignment", N);
             end if;
-         else
 
+         else
             if Dim_Lhs /= Dim_Rhs then
                Error_Msg_N ("?dimensions missmatch in assignment", N);
             end if;
-
          end if;
       end Analyze_Dimensions_In_Assignment;
 
@@ -1366,7 +1368,6 @@ package body Sem_Dim is
             Dims              : Dimensions := Zero_Dimensions;
 
          begin
-
             if Nkind_In (N, N_Op_Add, N_Op_Mod, N_Op_Rem, N_Op_Subtract) then
                Error_Msg_Name_1 := Chars (N);
 
@@ -1397,7 +1398,6 @@ package body Sem_Dim is
                end if;
 
             elsif Nkind_In (N_Kind, N_Op_Multiply, N_Op_Divide) then
-
                if L_Has_Dimensions and R_Has_Dimensions then
 
                   --  Get both operands dimension and add them
@@ -1419,7 +1419,6 @@ package body Sem_Dim is
                   Dims := L_Dims;
 
                elsif not L_Has_Dimensions and R_Has_Dimensions then
-
                   if N_Kind = N_Op_Multiply then
                      Dims := R_Dims;
                   else
@@ -1499,8 +1498,7 @@ package body Sem_Dim is
                end;
 
             --  For relational operations, only a dimension checking is
-            --  performed.
-            --  No propagation
+            --  performed (no propagation).
 
             elsif N_Kind in N_Op_Compare then
                Error_Msg_Name_1 := Chars (N);
@@ -1525,9 +1523,9 @@ package body Sem_Dim is
    ---------------------------------------------
 
    procedure Analyze_Dimension_Component_Declaration (N : Node_Id) is
-      Expr   : constant Node_Id   := Expression (N);
-      Id     : constant Entity_Id := Defining_Identifier (N);
-      E_Typ  : constant Entity_Id := Etype (Id);
+      Expr   : constant Node_Id    := Expression (N);
+      Id     : constant Entity_Id  := Defining_Identifier (N);
+      E_Typ  : constant Entity_Id  := Etype (Id);
       Dim_T  : constant Dimensions := Get_Dimensions (E_Typ);
       Dim_E  : Dimensions;
 
@@ -1541,6 +1539,7 @@ package body Sem_Dim is
             Dim_E := Get_Dimensions (Expr);
 
             if Present (Dim_E) then
+
                --  Return an error if the dimension of the expression and the
                --  dimension of the type missmatch.
 
@@ -1549,7 +1548,7 @@ package body Sem_Dim is
                                "declaration", N);
                end if;
 
-            --  If the expression is dimensionless
+               --  Case of dimensionless expression
 
             else
                Error_Msg_N
@@ -1580,7 +1579,6 @@ package body Sem_Dim is
    begin
       if Present (Obj_Decls) then
          Obj_Decl := First (Obj_Decls);
-
          while Present (Obj_Decl) loop
             if Nkind (Obj_Decl) = N_Object_Declaration then
                Obj_Id := Defining_Identifier (Obj_Decl);
@@ -1676,7 +1674,6 @@ package body Sem_Dim is
 
          else
             Param := First (Par_Ass);
-
             while Present (Param) loop
                Dims_Param := Get_Dimensions (Param);
 
@@ -1726,7 +1723,6 @@ package body Sem_Dim is
          begin
             if Present (Exprs) then
                Expr := First (Exprs);
-
                while Present (Expr) loop
                   Remove_Dimensions (Expr);
                   Next (Expr);
@@ -1754,7 +1750,6 @@ package body Sem_Dim is
    procedure Analyze_Dimension_Identifier (N : Node_Id) is
       Ent  : constant Entity_Id := Entity (N);
       Dims : constant Dimensions := Get_Dimensions (Ent);
-
    begin
       if Present (Dims) then
          Set_Dimensions (N, Dims);
@@ -1776,12 +1771,14 @@ package body Sem_Dim is
 
    begin
       if Present (Dim_T) then
+
          --  Expression is present
 
          if Present (Expr) then
             Dim_E := Get_Dimensions (Expr);
 
             if Present (Dim_E) then
+
                --  Return an error if the dimension of the expression and the
                --  dimension of the type missmatch.
 
@@ -1797,13 +1794,12 @@ package body Sem_Dim is
                --  (depending on the dimensioned numeric type), return an error
                --  message.
 
-               if not Nkind_In
-                        (Original_Node (Expr),
-                         N_Real_Literal,
-                         N_Integer_Literal)
+               if not Nkind_In (Original_Node (Expr),
+                                N_Real_Literal,
+                                N_Integer_Literal)
                then
-                  Error_Msg_N ("?dimensions missmatch in object " &
-                               "declaration", N);
+                  Error_Msg_N
+                    ("?dimensions missmatch in object declaration", N);
                end if;
             end if;
 
@@ -1824,7 +1820,6 @@ package body Sem_Dim is
       Ren_Id   : constant Node_Id   := Name (N);
       E_Typ    : constant Entity_Id := Etype (Ren_Id);
       Dims_Typ : constant Dimensions := Get_Dimensions (E_Typ);
-
    begin
       if Present (Dims_Typ) then
          Copy_Dimensions (E_Typ, Id);
@@ -1841,7 +1836,6 @@ package body Sem_Dim is
       R_Ent     : constant Entity_Id := Return_Statement_Entity (N);
       R_Etyp    : constant Entity_Id := Etype (Return_Applies_To (R_Ent));
       Dims_R    : constant Dimensions := Get_Dimensions (R_Etyp);
-
    begin
       if Dims_R /= Dims_Expr then
          Error_Msg_N ("?dimensions missmatch in return statement", N);
@@ -1867,9 +1861,8 @@ package body Sem_Dim is
          begin
             if Present (Dims_Typ) then
 
-               --  If the subtype already has a dimension (from
-               --  Aspect_Dimension), it cannot inherit a dimension from its
-               --  subtype.
+               --  If subtype already has a dimension (from Aspect_Dimension),
+               --  it cannot inherit a dimension from its subtype.
 
                if Present (Dims_Ent) then
                   Error_Msg_N ("?subtype& already has a dimension", N);
@@ -1890,9 +1883,8 @@ package body Sem_Dim is
          begin
             if Present (Dims_Typ) then
 
-               --  If the subtype already has a dimension (from
-               --  Aspect_Dimension), it cannot inherit a dimension from its
-               --  subtype.
+               --  If subtype already has a dimension (from Aspect_Dimension),
+               --  it cannot inherit a dimension from its subtype.
 
                if Present (Dims_Ent) then
                   Error_Msg_N ("?subtype& already has a dimension", N);
@@ -1959,9 +1951,8 @@ package body Sem_Dim is
       Rtype        : Entity_Id;
 
    begin
-      --  A rational number is any number that can be expressed as the quotient
-      --  or fraction a/b of two integers, with the denominator b not equal to
-      --  zero.
+      --  A rational number is a number that can be expressed as the quotient
+      --  or fraction a/b of two integers, where b is non-zero.
 
       --  Check the expression is either a division of two integers or an
       --  integer itself. The check applies to the original node since the
@@ -1975,16 +1966,13 @@ package body Sem_Dim is
          Right := Right_Opnd (Or_N);
          Rtype := Etype (Right);
 
-         if Is_Integer_Type (Ltype)
-           and then Is_Integer_Type (Rtype)
-         then
+         if Is_Integer_Type (Ltype) and then Is_Integer_Type (Rtype) then
             Left_Int  := UI_To_Int (Expr_Value (Left));
             Right_Int := UI_To_Int (Expr_Value (Right));
 
             --  Verify that the denominator of the rational is positive
 
             if Right_Int > 0 then
-
                if Left_Int mod Right_Int = 0 then
                   R := +Whole (UI_To_Int (Expr_Value (Expr)));
                else
@@ -2020,7 +2008,6 @@ package body Sem_Dim is
             --  Verify that the denominator of the rational is positive
 
             if Right_Int > 0 then
-
                if Left_Int mod Right_Int = 0 then
                   R := +Whole (-UI_To_Int (Expr_Value (Expr)));
                else
@@ -2042,6 +2029,7 @@ package body Sem_Dim is
          if Is_Integer_Type (Etype (Expr)) then
             Right_Int := UI_To_Int (Expr_Value (Expr));
             R         :=  +Whole (Right_Int);
+
          else
             Error_Msg_N ("must be a rational", Expr);
          end if;
@@ -2054,9 +2042,8 @@ package body Sem_Dim is
 
    --  Eval the expon operator for dimensioned type
 
-   --  Note that if the exponent is an integer (denominator equals to 1) the
-   --  node is not evaluated here and must be evaluated by the Eval_Op_Expon
-   --  routine.
+   --  Note that if the exponent is an integer (denominator = 1) the node is
+   --  not evaluated here and must be evaluated by the Eval_Op_Expon routine.
 
    procedure Eval_Op_Expon_For_Dimensioned_Type
      (N : Node_Id;
@@ -2064,11 +2051,8 @@ package body Sem_Dim is
    is
       R   : constant Node_Id := Right_Opnd (N);
       Rat : Rational := Zero_Rational;
-
    begin
-      if Compile_Time_Known_Value (R)
-        and then Is_Real_Type (B_Typ)
-      then
+      if Compile_Time_Known_Value (R) and then Is_Real_Type (B_Typ) then
          Create_Rational_From_Expr (R, Rat);
          Eval_Op_Expon_With_Rational_Exponent (N, Rat);
       end if;
@@ -2105,8 +2089,7 @@ package body Sem_Dim is
 
    begin
       --  If Rat.Denominator = 1 that means the exponent is an Integer so
-      --  nothing has to be changed.
-      --  Note that the node must come from source
+      --  nothing has to be changed. Note that the node must come from source.
 
       if Comes_From_Source (N)
         and then Rat.Denominator /= 1
@@ -2143,6 +2126,7 @@ package body Sem_Dim is
 
             --  for Dim in Dims'First .. N_Dims loop
             --     Dim_Value := Dims (Dim);
+
             --     if Dim_Value.Denominator /= 1 then
             --        Append (Dim_Value.Numerator / Dim_Value.Denominator,
             --                Aspect_Dim_Expr);
@@ -2162,21 +2146,20 @@ package body Sem_Dim is
 
             for Dim in Dims'First .. Dim_Systems.Table (Sys).N_Of_Dims loop
                Dim_Value := Dims (Dim);
+
                if Dim_Value.Denominator /= 1 then
-                  Append (
+                  Append_To (List_Of_Dims,
                      Make_Op_Divide (Loc,
                        Left_Opnd  =>
                          Make_Integer_Literal (Loc,
                            Int (Dim_Value.Numerator)),
                        Right_Opnd =>
                          Make_Integer_Literal (Loc,
-                           Int (Dim_Value.Denominator))),
-                     List_Of_Dims);
+                           Int (Dim_Value.Denominator))));
+
                else
-                  Append (
-                    Make_Integer_Literal (Loc,
-                      Int (Dim_Value.Numerator)),
-                    List_Of_Dims);
+                  Append_To (List_Of_Dims,
+                    Make_Integer_Literal (Loc, Int (Dim_Value.Numerator)));
                end if;
             end loop;
 
@@ -2184,11 +2167,9 @@ package body Sem_Dim is
 
             New_Aspect :=
               Make_Aspect_Specification (Loc,
-                Identifier =>
-                  Make_Identifier (Loc, Name_Dimension),
+                Identifier => Make_Identifier (Loc, Name_Dimension),
                 Expression =>
-                  Make_Aggregate (Loc,
-                    Expressions => List_Of_Dims));
+                  Make_Aggregate (Loc, Expressions => List_Of_Dims));
 
             --  Step 1c: New identifier for the subtype
 
@@ -2200,8 +2181,7 @@ package body Sem_Dim is
             New_Typ_L :=
                Make_Subtype_Declaration (Loc,
                   Defining_Identifier => New_E,
-                  Subtype_Indication  =>
-                     New_Occurrence_Of (Base_Typ, Loc));
+                  Subtype_Indication  => New_Occurrence_Of (Base_Typ, Loc));
 
             Append (New_Aspect, New_Aspects);
             Set_Parent (New_Aspects, New_Typ_L);
@@ -2269,9 +2249,9 @@ package body Sem_Dim is
    -- Expand_Put_Call_With_Dimension_String --
    -------------------------------------------
 
-   --  For procedure Put defined in System.Dim_Float_IO and
-   --  System.Dim_Integer_IO, the default string parameter must be rewritten to
-   --  include the dimension symbols in the output of a dimensioned object.
+   --  For procedure Put defined in System.Dim_Float_IO/System.Dim_Integer_IO,
+   --  the default string parameter must be rewritten to include the dimension
+   --  symbols in the output of a dimensioned object.
 
    --  There are two different cases:
 
@@ -2286,9 +2266,9 @@ package body Sem_Dim is
    --  Put (v) returns:
    --  > 2.1 speed
 
-   --  2) If the parameter is an expression, the procedure
+   --  2) If the parameter is an expression, then we call the procedure
    --  Expand_Put_Call_With_Dimension_String creates the string (for instance
-   --  "m.s**(-1)") and rewrites the default string parameter of Put with the
+   --  "m.s**(-1)") and rewrite the default string parameter of Put with the
    --  corresponding the String_Id.
 
    procedure Expand_Put_Call_With_Dimension_String (N : Node_Id) is
@@ -2472,7 +2452,6 @@ package body Sem_Dim is
       Store_String_Char (' ');
 
       for Dim in Dimensions'Range loop
-
          Dim_Rat := Dims (Dim);
          if Dim_Rat /= Zero_Rational then
 
@@ -2485,7 +2464,6 @@ package body Sem_Dim is
             --  Positive dimension case
 
             if Dim_Rat.Numerator > 0 then
-
                if Dim_Systems.Table (Sys).Symbols (Dim) = No_String then
                   Store_String_Chars
                     (Get_Name_String (Dim_Systems.Table (Sys).Names (Dim)));
@@ -2496,7 +2474,6 @@ package body Sem_Dim is
                --  Integer case
 
                if Dim_Rat.Denominator = 1 then
-
                   if Dim_Rat.Numerator /= 1 then
                      Store_String_Chars ("**");
                      Store_String_Int (Int (Dim_Rat.Numerator));
@@ -2574,6 +2551,7 @@ package body Sem_Dim is
 
    begin
       --  Scan the Table in order to find N
+      --  What is N??? no sign of anything called N here ???
 
       for Dim_Sys in 1 .. Dim_Systems.Last loop
          if Parent (E) = Dim_Systems.Table (Dim_Sys).Base_Type then
@@ -2588,14 +2566,13 @@ package body Sem_Dim is
    -- Is_Dimensioned_Type --
    --------------------------
 
-   function Is_Dimensioned_Type (E : Entity_Id) return Boolean
-   is
+   function Is_Dimensioned_Type (E : Entity_Id) return Boolean is
    begin
       if Get_Dimension_System_Id (E) /= No_Dim_Sys then
          return True;
+      else
+         return False;
       end if;
-
-      return False;
    end Is_Dimensioned_Type;
 
    ---------------------
@@ -2606,8 +2583,7 @@ package body Sem_Dim is
       Dims : constant Dimensions := Get_Dimensions (From);
 
    begin
-      --  Copy the dimension of 'From to 'To' and remove the dimension of
-      --  'From'.
+      --  Copy the dimension of 'From to 'To' and remove dimension of 'From'
 
       if Present (Dims) then
          Set_Dimensions (To, Dims);
@@ -2669,7 +2645,6 @@ package body Sem_Dim is
 
    procedure Remove_Dimensions (N : Node_Id) is
       Dims : constant Dimensions := Get_Dimensions (N);
-
    begin
       if Present (Dims) then
          Aspect_Dimension_Hash_Table.Remove (N);
@@ -2691,7 +2666,6 @@ package body Sem_Dim is
 
       if Present (Par_Ass) then
          Actual := First (Par_Ass);
-
          while Present (Actual) loop
             Remove_Dimensions (Actual);
             Next (Actual);
@@ -2740,7 +2714,6 @@ package body Sem_Dim is
       if S_Kind = N_Accept_Statement then
          declare
             Param : Node_Id := First (Parameter_Specifications (S));
-
          begin
             while Present (Param) loop
                Remove_Dimensions (Param);
index 8089f43..cda1135 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
+--            Copyright (C) 2011, 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- --
 --  This new package of the GNAT compiler has been created in order to enable
 --  any user of the GNAT compiler to deal with physical issues.
 
---  Indeed, the user is now able to create his own dimension system and to
+--  Indeed, the user is now able to create their own dimension system and to
 --  assign a dimension, defined from the MKS system (package System.Dim_Mks)
---  or his own dimension systems, with any item and to run operations with
+--  or their own dimension systems, with any item and to run operations with
 --  dimensionned entities.
---  In that case, a dimensionnality checking will be performed at compile time.
+
+--  In that case, a dimensionality checking will be performed at compile time.
 --  If no dimension has been assigned, the compiler assumes that the item is
 --  dimensionless.
 
 -- Aspect_Dimension_System --
 -----------------------------
 
---  In order to enable the user to create his own dimension system, a new
+--  In order to enable the user to create their own dimension system, a new
 --  aspect: Aspect_Dimension_System has been created.
+
 --  Note that this aspect applies for type declaration of type derived from any
 --  numeric type.
 
---  It defines the names of each dimension.
+--  It defines the names of each dimension
 
 ----------------------
 -- Aspect_Dimension --
 
 --  This new aspect applies for subtype and object declarations in order to
 --  define new dimensions.
+
 --  Using this aspect, the user is able to create new subtype/object with any
 --  dimension needed.
+
 --  Note that the base type of the subtype/object must be the type that defines
 --  the corresponding dimension system.
 
@@ -75,6 +79,7 @@
 
 --  Depending on the node kind, either none, one phase or two phases are
 --  executed.
+
 --  Phase 2 is called only when the node allows a dimension (see body of
 --  Sem_Dim to get the list of nodes that permit dimensions).
 
@@ -82,7 +87,7 @@
 -- Dimension_IO --
 ------------------
 
---  This section contains the routine used for IO purposes.
+--  This section contains the routine used for IO purposes
 
 with Types; use Types;
 
@@ -103,8 +108,8 @@ package Sem_Dim is
    ----------------------
 
    procedure Analyze_Aspect_Dimension
-     (N : Node_Id;
-      Id : Node_Id;
+     (N    : Node_Id;
+      Id   : Node_Id;
       Expr : Node_Id);
    --  Analyzes the aggregate of Aspect_Dimension and attaches the
    --  corresponding dimension to N.
@@ -118,9 +123,9 @@ package Sem_Dim is
    --  when needed.
 
    procedure Eval_Op_Expon_For_Dimensioned_Type
-     (N : Node_Id;
+     (N     : Node_Id;
       B_Typ : Entity_Id);
-   --  Eval the Expon operator for dimensioned type with rational exponent
+   --  Evaluate the Expon operator for dimensioned type with rational exponent
 
    function Is_Dimensioned_Type (E : Entity_Id) return Boolean;
    --  Return True if the type is a dimensioned type (i.e: a type which has an
@@ -128,7 +133,7 @@ package Sem_Dim is
 
    procedure Remove_Dimension_In_Call (N : Node_Id);
    --  At the end of the Expand_Call routine, remove the dimensions of every
-   --  parameters in the call N.
+   --  parameter in the call N.
 
    procedure Remove_Dimension_In_Declaration (D : Node_Id);
    --  At the end of Analyze_Declarations routine (see Sem_Ch3), removes the
index 3a8d7d7..3ebd88f 100644 (file)
@@ -5814,8 +5814,6 @@ package body Sem_Res is
          end;
       end if;
 
-      --  dimension analysis
-
       Analyze_Dimension (N);
 
       --  All done, evaluate call and deal with elaboration issues
@@ -8015,12 +8013,10 @@ package body Sem_Res is
 
       Analyze_Dimension (N);
 
-      --  Evaluate the Expon operator for dimensioned type with rational
-      --  exponent.
+      --  Evaluate the exponentiation operator for dimensioned type with
+      --  rational exponent.
 
-      if Ada_Version >= Ada_2012
-        and then Is_Dimensioned_Type (B_Typ)
-      then
+      if Ada_Version >= Ada_2012 and then Is_Dimensioned_Type (B_Typ) then
          Eval_Op_Expon_For_Dimensioned_Type (N, B_Typ);
 
          --  Skip the Eval_Op_Expon if the node has already been evaluated
@@ -8657,11 +8653,12 @@ package body Sem_Res is
         and then Is_Packed (T)
         and then Is_LHS (N)
       then
-         Error_Msg_N ("?assignment to component of packed atomic record",
-                      Prefix (N));
-         Error_Msg_N ("?\may cause unexpected accesses to atomic object",
-                      Prefix (N));
+         Error_Msg_N
+           ("?assignment to component of packed atomic record", Prefix (N));
+         Error_Msg_N
+           ("?\may cause unexpected accesses to atomic object", Prefix (N));
       end if;
+
       Analyze_Dimension (N);
    end Resolve_Selected_Component;