2010-09-09 Pascal Obry <obry@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Sep 2010 08:57:08 +0000 (08:57 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Sep 2010 08:57:08 +0000 (08:57 +0000)
* gnat_ugn.texi: Update doc on windows related topics.

2010-09-09  Geert Bosch  <bosch@adacore.com>

* s-fatgen.adb: Update comments.

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

gcc/ada/ChangeLog
gcc/ada/gnat_ugn.texi
gcc/ada/s-fatgen.adb

index ae8b006..4600ec6 100644 (file)
@@ -1,3 +1,11 @@
+2010-09-09  Pascal Obry  <obry@adacore.com>
+
+       * gnat_ugn.texi: Update doc on windows related topics.
+
+2010-09-09  Geert Bosch  <bosch@adacore.com>
+
+       * s-fatgen.adb: Update comments.
+
 2010-09-09  Robert Dewar  <dewar@adacore.com>
 
        * par-ch4.adb (Box_Error): New procedure.
index 480f391..03a1d71 100644 (file)
@@ -26891,8 +26891,8 @@ platforms (NT, 2000, and XP Professional).
 * Windows Calling Conventions::
 * Introduction to Dynamic Link Libraries (DLLs)::
 * Using DLLs with GNAT::
-* Building DLLs with GNAT::
 * Building DLLs with GNAT Project files::
+* Building DLLs with GNAT::
 * Building DLLs with gnatdll::
 * GNAT and Windows Resources::
 * Debugging a DLL::
@@ -26953,11 +26953,7 @@ features are not used, but it is not guaranteed to work.
 
 @item
 It is not possible to link against Microsoft libraries except for
-import libraries. The library must be built to be compatible with
-@file{MSVCRT.LIB} (/MD Microsoft compiler option), @file{LIBC.LIB} and
-@file{LIBCMT.LIB} (/ML or /MT Microsoft compiler options) are known to
-not be compatible with the GNAT runtime. Even if the library is
-compatible with @file{MSVCRT.LIB} it is not guaranteed to work.
+import libraries. Interfacing must be done by the mean of DLLs.
 
 @item
 When the compilation environment is located on FAT32 drives, users may
@@ -27048,29 +27044,8 @@ interoperability strategy.
 
 If you use @command{gcc} to compile the non-Ada part of your application,
 there are no Windows-specific restrictions that affect the overall
-interoperability with your Ada code. If you plan to use
-Microsoft tools (e.g.@: Microsoft Visual C/C++), you should be aware of
-the following limitations:
-
-@itemize @bullet
-@item
-You cannot link your Ada code with an object or library generated with
-Microsoft tools if these use the @code{.tls} section (Thread Local
-Storage section) since the GNAT linker does not yet support this section.
-
-@item
-You cannot link your Ada code with an object or library generated with
-Microsoft tools if these use I/O routines other than those provided in
-the Microsoft DLL: @code{msvcrt.dll}. This is because the GNAT run time
-uses the services of @code{msvcrt.dll} for its I/Os. Use of other I/O
-libraries can cause a conflict with @code{msvcrt.dll} services. For
-instance Visual C++ I/O stream routines conflict with those in
-@code{msvcrt.dll}.
-@end itemize
-
-@noindent
-If you do want to use the Microsoft tools for your non-Ada code and hit one
-of the above limitations, you have two choices:
+interoperability with your Ada code. If you do want to use the
+Microsoft tools for your non-Ada code, you have two choices:
 
 @enumerate
 @item
@@ -27082,8 +27057,8 @@ build the DLL and use GNAT to build your executable
 @item
 Or you can encapsulate your Ada code in a DLL to be linked with the
 other part of your application. In this case, use GNAT to build the DLL
-(@pxref{Building DLLs with GNAT}) and use the Microsoft or whatever
-environment to build your executable.
+(@pxref{Building DLLs with GNAT Project files}) and use the Microsoft
+or whatever environment to build your executable.
 @end enumerate
 
 @node Windows Calling Conventions
@@ -27091,6 +27066,10 @@ environment to build your executable.
 @findex Stdcall
 @findex APIENTRY
 
+This section pertain only to Win32. On Win64 there is a single native
+calling convention. All convention specifiers are ignored on this
+platform.
+
 @menu
 * C Calling Convention::
 * Stdcall Calling Convention::
@@ -27394,11 +27373,23 @@ $ gnatmake my_ada_app -largs -lAPI
 
 @noindent
 The argument @option{-largs -lAPI} at the end of the @command{gnatmake} command
-tells the GNAT linker to look first for a library named @file{API.lib}
-(Microsoft-style name) and if not found for a libraries named
-@file{libAPI.dll.a}, @file{API.dll.a} or @file{libAPI.a}.
-(GNAT-style name). Note that if the Ada package spec for @file{API.dll}
-contains the following pragma
+tells the GNAT linker to look for an import library. The linker will
+look for a library name in this specific order:
+
+@enumerate
+@item @file{libAPI.dll.a}
+@item @file{API.dll.a}
+@item @file{libAPI.a}
+@item @file{API.lib}
+@item @file{libAPI.dll}
+@item @file{API.dll}
+@end enumerate
+
+The first three are the GNU style import libraries. The third is the
+Microsoft style import libraries. The last two are the DLL themself.
+
+Note that if the Ada package spec for @file{API.dll} contains the
+following pragma
 
 @smallexample @c ada
 pragma Linker_Options ("-lAPI");
@@ -27637,6 +27628,19 @@ See the Microsoft documentation for further details about the usage of
 @code{lib}.
 @end enumerate
 
+@node Building DLLs with GNAT Project files
+@section Building DLLs with GNAT Project files
+@cindex DLLs, building
+
+@noindent
+There is nothing specific to Windows in the build process.
+@pxref{Library Projects}.
+
+@noindent
+Due to a system limitation, it is not possible under Windows to create threads
+when inside the @code{DllMain} routine which is used for auto-initialization
+of shared libraries, so it is not possible to have library level tasks in SALs.
+
 @node Building DLLs with GNAT
 @section Building DLLs with GNAT
 @cindex DLLs, building
@@ -27699,19 +27703,6 @@ option.
 $ gnatmake main -Iapilib -bargs -shared -largs -Lapilib -lAPI
 @end smallexample
 
-@node Building DLLs with GNAT Project files
-@section Building DLLs with GNAT Project files
-@cindex DLLs, building
-
-@noindent
-There is nothing specific to Windows in the build process.
-@pxref{Library Projects}.
-
-@noindent
-Due to a system limitation, it is not possible under Windows to create threads
-when inside the @code{DllMain} routine which is used for auto-initialization
-of shared libraries, so it is not possible to have library level tasks in SALs.
-
 @node Building DLLs with gnatdll
 @section Building DLLs with gnatdll
 @cindex DLLs, building
@@ -27727,9 +27718,9 @@ of shared libraries, so it is not possible to have library level tasks in SALs.
 @end menu
 
 @noindent
-Note that it is preferred to use the built-in GNAT DLL support
-(@pxref{Building DLLs with GNAT}) or GNAT Project files
-(@pxref{Building DLLs with GNAT Project files}) to build DLLs.
+Note that it is preferred to use GNAT Project files
+(@pxref{Building DLLs with GNAT Project files}) or the built-in GNAT
+DLL support (@pxref{Building DLLs with GNAT}) or to build DLLs.
 
 This section explains how to build DLLs containing Ada code using
 @code{gnatdll}. These DLLs will be referred to as Ada DLLs in the
index cf7e425..1288904 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -162,13 +162,12 @@ package body System.Fat_Gen is
 
    begin
       if X = 0.0 then
+
+         --  The normalized exponent of zero is zero, see RM A.5.2(15)
+
          Frac := X;
          Expo := 0;
 
-         --  More useful would be defining Expo to be T'Machine_Emin - 1 or
-         --  T'Machine_Emin - T'Machine_Mantissa, which would preserve
-         --  monotonicity of the exponent function ???
-
       --  Check for infinities, transfinites, whatnot
 
       elsif X > T'Safe_Last then
@@ -205,6 +204,7 @@ package body System.Fat_Gen is
                   end if;
 
                   --  Ax < R_Power (N)
+
                end loop;
 
                --  1 <= Ax < Rad
@@ -229,6 +229,7 @@ package body System.Fat_Gen is
                   end if;
 
                   --  R_Neg_Power (N) <= Ax < 1
+
                end loop;
             end if;
 
@@ -553,8 +554,8 @@ package body System.Fat_Gen is
    -- Scaling --
    -------------
 
-   --  Return x * rad ** adjustment quickly,
-   --  or quietly underflow to zero, or overflow naturally.
+   --  Return x * rad ** adjustment quickly, or quietly underflow to zero,
+   --  or overflow naturally.
 
    function Scaling (X : T; Adjustment : UI) return T is
    begin
@@ -586,6 +587,7 @@ package body System.Fat_Gen is
                end if;
 
                --  -Log_Power (N) < Ex <= 0
+
             end loop;
 
             --  Ex = 0
@@ -611,6 +613,7 @@ package body System.Fat_Gen is
             end loop;
 
             --  Ex = 0
+
          end if;
 
          return Y;
@@ -648,13 +651,13 @@ package body System.Fat_Gen is
       else
          Decompose (X, X_Frac, X_Exp);
 
-         --  A special case, if the number we had was a negative power of
-         --  two, then we want to add half of what we would otherwise add,
-         --  since the exponent is going to be reduced.
+         --  A special case, if the number we had was a negative power of two,
+         --  then we want to add half of what we would otherwise add, since the
+         --  exponent is going to be reduced.
 
          --  Note that X_Frac has the same sign as X, so if X_Frac is -0.5,
-         --  then we know that we have a negative number (and hence a
-         --  negative power of 2).
+         --  then we know that we have a negative number (and hence a negative
+         --  power of 2).
 
          if X_Frac = -0.5 then
             return X + Gradual_Scaling (X_Exp - T'Machine_Mantissa - 1);
@@ -779,8 +782,8 @@ package body System.Fat_Gen is
       --  one read, but small enough so that all floating point object sizes
       --  are a multiple of the Float_Word'Size.
 
-      --  The following conditions must be met for all possible
-      --  instantiations of the attributes package:
+      --  The following conditions must be met for all possible instantiations
+      --  of the attributes package:
 
       --    - T'Size is an integral multiple of Float_Word'Size
 
@@ -795,9 +798,11 @@ package body System.Fat_Gen is
       type Rep_Index is range 0 .. 7;
 
       Rep_Words : constant Positive :=
-         (T'Size + Float_Word'Size - 1) / Float_Word'Size;
-      Rep_Last  : constant Rep_Index := Rep_Index'Min
-        (Rep_Index (Rep_Words - 1), (T'Mantissa + 16) / Float_Word'Size);
+                    (T'Size + Float_Word'Size - 1) / Float_Word'Size;
+      Rep_Last  : constant Rep_Index :=
+                    Rep_Index'Min
+                      (Rep_Index (Rep_Words - 1),
+                       (T'Mantissa + 16) / Float_Word'Size);
       --  Determine the number of Float_Words needed for representing the
       --  entire floating-point value. Do not take into account excessive
       --  padding, as occurs on IA-64 where 80 bits floats get padded to 128