[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 16 Jul 2014 14:26:47 +0000 (16:26 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 16 Jul 2014 14:26:47 +0000 (16:26 +0200)
2014-07-16  Robert Dewar  <dewar@adacore.com>

* gnat_ugn.texi: Document binder switch -Ra.
* gnatbind.adb (List_Closure_Display): Implement -Ra switch
(List_Closure_All).
* opt.ads (List_Closure_All): New switch.
* switch-b.adb (Scan_Binder_Switches): Recognize -Ra to set
List_Closure_All.

2014-07-16  Ben Brosgol  <brosgol@adacore.com>

* gnat_rm.texi: Minor edits, to make case consistent in names
of types and fields.

From-SVN: r212654

gcc/ada/ChangeLog
gcc/ada/gnat_rm.texi
gcc/ada/gnat_ugn.texi
gcc/ada/gnatbind.adb
gcc/ada/opt.ads
gcc/ada/switch-b.adb

index feff3ff..76cab67 100644 (file)
@@ -1,5 +1,19 @@
 2014-07-16  Robert Dewar  <dewar@adacore.com>
 
+       * gnat_ugn.texi: Document binder switch -Ra.
+       * gnatbind.adb (List_Closure_Display): Implement -Ra switch
+       (List_Closure_All).
+       * opt.ads (List_Closure_All): New switch.
+       * switch-b.adb (Scan_Binder_Switches): Recognize -Ra to set
+       List_Closure_All.
+
+2014-07-16  Ben Brosgol  <brosgol@adacore.com>
+
+       * gnat_rm.texi: Minor edits, to make case consistent in names
+       of types and fields.
+
+2014-07-16  Robert Dewar  <dewar@adacore.com>
+
        * gnat_rm.texi: Document erroneous mixing of thin pointers and
        unrestricted access
        * gnat_ugn.texi: Add note on size of access types about thin
index 8f1031a..a223d3d 100644 (file)
@@ -15542,51 +15542,51 @@ For example, consider the record
 
 @smallexample @c ada
    type Rb1 is array (1 .. 13) of Boolean;
-   pragma Pack (rb1);
+   pragma Pack (Rb1);
 
    type Rb2 is array (1 .. 65) of Boolean;
-   pragma Pack (rb2);
+   pragma Pack (Rb2);
 
    type AF is new Float with Atomic;
 
-   type x2 is record
-      l1 : Boolean;
-      l2 : Duration;
-      l3 : AF;
-      l4 : Boolean;
-      l5 : Rb1;
-      l6 : Rb2;
+   type X2 is record
+      L1 : Boolean;
+      L2 : Duration;
+      L3 : AF;
+      L4 : Boolean;
+      L5 : Rb1;
+      L6 : Rb2;
    end record;
-   pragma Pack (x2);
+   pragma Pack (X2);
 @end smallexample
 
 @noindent
-The representation for the record x2 is as follows:
+The representation for the record X2 is as follows:
 
 @smallexample @c ada
-for x2'Size use 224;
-for x2 use record
-   l1 at  0 range  0 .. 0;
-   l2 at  0 range  1 .. 64;
-   l3 at 12 range  0 .. 31;
-   l4 at 16 range  0 .. 0;
-   l5 at 16 range  1 .. 13;
-   l6 at 18 range  0 .. 71;
+for X2'Size use 224;
+for X2 use record
+   L1 at  0 range  0 .. 0;
+   L2 at  0 range  1 .. 64;
+   L3 at 12 range  0 .. 31;
+   L4 at 16 range  0 .. 0;
+   L5 at 16 range  1 .. 13;
+   L6 at 18 range  0 .. 71;
 end record;
 @end smallexample
 
 @noindent
-Studying this example, we see that the packable fields @code{l1}
-and @code{l2} are
+Studying this example, we see that the packable fields @code{L1}
+and @code{L2} are
 of length equal to their sizes, and placed at specific bit boundaries (and
 not byte boundaries) to
-eliminate padding.  But @code{l3} is of a non-packable float type (because
+eliminate padding.  But @code{L3} is of a non-packable float type (because
 it is aliased), so it is on the next appropriate alignment boundary.
 
-The next two fields are fully packable, so @code{l4} and @code{l5} are
+The next two fields are fully packable, so @code{L4} and @code{L5} are
 minimally packed with no gaps.  However, type @code{Rb2} is a packed
 array that is longer than 64 bits, so it is itself non-packable.  Thus
-the @code{l6} field is aligned to the next byte boundary, and takes an
+the @code{L6} field is aligned to the next byte boundary, and takes an
 integral number of bytes, i.e.@: 72 bits.
 
 @node Record Representation Clauses
index a8c84f0..85b4471 100644 (file)
@@ -8451,7 +8451,12 @@ Generate binder file suitable for CodePeer.
 
 @item ^-R^-R^
 @cindex @option{^-R^-R^} (@command{gnatbind})
-Output closure source list.
+Output closure source list, which includes all non-time-units that are
+included in the bind.
+
+@item ^-Ra^-Ra^
+@cindex @option{^-Ra^-Ra^} (@command{gnatbind})
+Like @option{-R} but the list includes run-time units.
 
 @item ^-s^/READ_SOURCES=ALL^
 @cindex @option{^-s^/READ_SOURCES=ALL^} (@command{gnatbind})
@@ -20126,6 +20131,8 @@ The tool currently does not support following features:
 @c *********************************
 @node Performing Dimensionality Analysis in GNAT
 @chapter Performing Dimensionality Analysis in GNAT
+@cindex Dimensionality analysis
+
 @noindent
 The GNAT compiler now supports dimensionality checking. The user can
 specify physical units for objects, and the compiler will verify that uses
@@ -20134,22 +20141,33 @@ familiar to engineering practice. The dimensions of algebraic expressions
 (including powers with static exponents) are computed from their consistuents.
 
 This feature depends on Ada 2012 aspect specifications, and is available from
-version 7.0.1 of GNAT onwards. The GNAT-specific aspect Dimension_System allows
-you to define a system of units; the aspect Dimension then allows the user
-to declare dimensioned quantities within a given system.
+version 7.0.1 of GNAT onwards.
+The GNAT-specific aspect @code{Dimension_System}
+@cindex @code{Dimension_System} aspect
+allows you to define a system of units; the aspect @code{Dimension}
+@cindex @code{Dimension} aspect
+then allows the user to declare dimensioned quantities within a given system.
+(These aspects are described in the @i{Implementation Defined Aspects}
+chapter of the @i{GNAT Reference Manual}).
 
 The major advantage of this model is that it does not require the declaration of
 multiple operators for all possible combinations of types: it is only necessary
 to use the proper subtypes in object declarations.
 
 The simplest way to impose dimensionality checking on a computation is to make
-use of the package System.Dim.Mks, which is part of the GNAT library. This
-package defines a floating-point type MKS_Type, for which a sequence of
+use of the package @code{System.Dim.Mks},
+@cindex @code{System.Dim.Mks} package (GNAT library)
+which is part of the GNAT library. This
+package defines a floating-point type @code{MKS_Type},
+@cindex @code{MKS_Type} type
+for which a sequence of
 dimension names are specified, together with their conventional abbreviations.
 The following should be read together with the full specification of the
-package, in file s-dimmks.ads.
+package, in file @file{s-dimmks.ads}.
+@cindex @file{s-dimmks.ads} file
 
 @smallexample @c ada
+@group
    type Mks_Type is new Long_Long_Float
      with
       Dimension_System => (
@@ -20160,40 +20178,49 @@ package, in file s-dimmks.ads.
         (Unit_Name => Kelvin,   Unit_Symbol => 'K',   Dim_Symbol => "Theta"),
         (Unit_Name => Mole,     Unit_Symbol => "mol", Dim_Symbol => 'N'),
         (Unit_Name => Candela,  Unit_Symbol => "cd",  Dim_Symbol => 'J'));
+@end group
 @end smallexample
 
 @noindent
 The package then defines a series of subtypes that correspond to these
 conventional units. For example:
+
 @smallexample @c ada
+@group
    subtype Length is Mks_Type
      with
       Dimension => (Symbol => 'm', Meter  => 1, others => 0);
+@end group
 @end smallexample
+
 @noindent
-and similarly for Mass, Time, Electric_Current, Thermodynamic_Temperature,
-Amount_Of_Substance, and Luminous_Intensity (the standard set of units of
-the SI system).
+and similarly for @code{Mass}, @code{Time}, @code{Electric_Current},
+@code{Thermodynamic_Temperature}, @code{Amount_Of_Substance}, and
+@code{Luminous_Intensity} (the standard set of units of the SI system).
 
 The package also defines conventional names for values of each unit, for
 example:
 
 @smallexample @c ada
+@group
    m   : constant Length           := 1.0;
    kg  : constant Mass             := 1.0;
    s   : constant Time             := 1.0;
    A   : constant Electric_Current := 1.0;
+@end group
 @end smallexample
 
 @noindent
 as well as useful multiples of these units:
 
 @smallexample @c ada
+@group
    cm  : constant Length := 1.0E-02;
    g   : constant Mass   := 1.0E-03;
    min : constant Time   := 60.0;
-   day : constant TIme   := 60.0 * 24.0 * min;
+   day : constant Time   := 60.0 * 24.0 * min;
   ...
+@end group
 @end smallexample
 
 @noindent
@@ -20203,17 +20230,20 @@ specifies its dimensions within the MKS system, as well as the string to
 be used for output of a value of that unit:
 
 @smallexample @c ada
+@group
   subtype Acceleration is Mks_Type
     with Dimension => ("m/sec^^^2",
                        Meter => 1,
                        Second => -2,
                        others => 0);
+@end group
 @end smallexample
 
 @noindent
 Here is a complete example of use:
 
 @smallexample @c ada
+@group
 with System.Dim.MKS; use System.Dim.Mks;
 with System.Dim.Mks_IO; use System.Dim.Mks_IO;
 with Text_IO; use Text_IO;
@@ -20223,6 +20253,8 @@ procedure Free_Fall is
   G : constant acceleration := 9.81 * m / (s ** 2);
   T : Time := 10.0*s;
   Distance : Length;
+@end group
+@group
 begin
   Put ("Gravitational constant: ");
   Put (G, Aft => 2, Exp => 0); Put_Line ("");
@@ -20231,36 +20263,45 @@ begin
   Put (Distance, Aft => 2, Exp => 0);
   Put_Line ("");
 end Free_Fall;
+@end group
 @end smallexample
 
 @noindent
 Execution of this program yields:
 @smallexample
+@group
 Gravitational constant:  9.81 m/sec^^^2
 distance travelled in 10 seconds of free fall 490.50 m
+@end group
 @end smallexample
 
 @noindent
 However, incorrect assignments such as:
 
 @smallexample @c ada
+@group
    Distance := 5.0;
    Distance := 5.0 * kg:
+@end group
 @end smallexample
 
 @noindent
 are rejected with the following diagnoses:
 
 @smallexample
+@group
    Distance := 5.0;
       >>> dimensions mismatch in assignment
       >>> left-hand side has dimension [L]
       >>> right-hand side is dimensionless
+@end group
 
+@group
    Distance := 5.0 * kg:
       >>> dimensions mismatch in assignment
       >>> left-hand side has dimension [L]
       >>> right-hand side has dimension [M]
+@end group
 @end smallexample
 
 @noindent
@@ -20268,9 +20309,11 @@ The dimensions of an expression are properly displayed, even if there is
 no explicit subtype for it. If we add to the program:
 
 @smallexample @c ada
+@group
       Put ("Final velocity: ");
       Put (G * T, Aft =>2, Exp =>0);
       Put_Line ("");
+@end group
 @end smallexample
 
 @noindent
@@ -20279,6 +20322,7 @@ then the output includes:
      Final velocity: 98.10 m.s**(-1)
 @end smallexample
 
+
 @c *********************************
 @node Generating Ada Bindings for C and C++ headers
 @chapter Generating Ada Bindings for C and C++ headers
index 14afac5..0903fe4 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -913,7 +913,8 @@ begin
                   --------------------
 
                   function Put_In_Sources
-                    (S : File_Name_Type) return Boolean is
+                    (S : File_Name_Type) return Boolean
+                  is
                   begin
                      for J in 1 .. Closure_Sources.Last loop
                         if Closure_Sources.Table (J) = S then
@@ -939,11 +940,14 @@ begin
                   for J in reverse Elab_Order.First .. Elab_Order.Last loop
                      Source := Units.Table (Elab_Order.Table (J)).Sfile;
 
-                     --  Do not include the sources of the runtime and do not
-                     --  include the same source several times.
+                     --  Do not include same source more than once
 
                      if Put_In_Sources (Source)
-                       and then not Is_Internal_File_Name (Source)
+
+                       --  Do not include run-time units unless -Ra switch set
+
+                       and then (List_Closure_All
+                                  or else not Is_Internal_File_Name (Source))
                      then
                         if not Zero_Formatting then
                            Write_Str ("   ");
index cbd1045..a844706 100644 (file)
@@ -885,7 +885,12 @@ package Opt is
 
    List_Closure : Boolean := False;
    --  GNATBIND
-   --  List all sources in the closure of a main (-R gnatbind switch)
+   --  List all sources in the closure of a main (-R or -Ra gnatbind switch)
+
+   List_Closure_All : Boolean := False;
+   --  GNATBIND
+   --  List all sources in closure of main including run-time units (-Ra
+   --  gnatbind switch).
 
    List_Dependencies : Boolean := False;
    --  GNATMAKE
index 8b66267..8253d41 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2011, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-2014, 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- --
@@ -379,6 +379,11 @@ package body Switch.B is
             Ptr := Ptr + 1;
             List_Closure := True;
 
+            if Switch_Chars (Ptr) = 'a' then
+               Ptr := Ptr + 1;
+               List_Closure_All := True;
+            end if;
+
          --  Processing for s switch
 
          when 's' =>