OSDN Git Service

2009-04-20 Thomas Quinot <quinot@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / gnat_ugn.texi
index 1f49987..7d573f7 100644 (file)
@@ -7,21 +7,24 @@
 @c                                                                            o
 @c                             G N A T _ U G N                                o
 @c                                                                            o
-@c                     Copyright (C) 1992-2006, AdaCore                       o
-@c                                                                            o
-@c  GNAT is free software;  you can  redistribute it  and/or modify it under  o
-@c  terms of the  GNU General Public License as published  by the Free Soft-  o
-@c  ware  Foundation;  either version 2,  or (at your option) any later ver-  o
-@c  sion.  GNAT is distributed in the hope that it will be useful, but WITH-  o
-@c  OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY  o
-@c  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License  o
-@c  for  more details.  You should have  received  a copy of the GNU General  o
-@c  Public License  distributed with GNAT;  see file COPYING.  If not, write  o
-@c  to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor,  o
-@c  Boston, MA 02110-1301, USA.                                               o
+@c   GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com).   o
 @c                                                                            o
 @c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
 
+@setfilename gnat_ugn.info
+
+@copying
+Copyright @copyright{} 1995-2005, 2006, 2007, 2008 Free Software Foundation,
+Inc.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.2 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with no Front-Cover Texts and with no Back-Cover
+Texts.  A copy of the license is included in the section entitled
+``GNU Free Documentation License''.
+@end copying
+
 @c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
 @c
 @c                           GNAT_UGN Style Guide
 @c
 @c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
 
-@ifset vms
-@setfilename gnat_ugn_vms.info
-@end ifset
-
-@ifset unw
-@setfilename gnat_ugn_unw.info
-@end ifset
+@set NOW January 2007
+@c This flag is used where the text refers to conditions that exist when the
+@c text was entered into the document but which may change over time.
+@c Update the setting for the flag, and (if necessary) the text surrounding,
+@c the references to the flag, on future doc revisions:
+@c search for @value{NOW}.
 
 @set FSFEDITION
 @set EDITION GNAT
+@set DEFAULTLANGUAGEVERSION Ada 2005
+@set NONDEFAULTLANGUAGEVERSION Ada 95
 
 @ifset unw
 @set PLATFORM
-@set FILE gnat_ugn_unw
 @end ifset
 
 @ifset vms
 @set PLATFORM OpenVMS
-@set FILE gnat_ugn_vms
 @end ifset
 
+@c @ovar(ARG)
+@c ----------
+@c The ARG is an optional argument.  To be used for macro arguments in
+@c their documentation (@defmac).
+@macro ovar{varname}
+@r{[}@var{\varname\}@r{]}@c
+@end macro
+
 @settitle @value{EDITION} User's Guide @value{PLATFORM}
 @dircategory GNU Ada tools
 @direntry
-* @value{EDITION} User's Guide (@value{FILE}) @value{PLATFORM}
+* @value{EDITION} User's Guide: (gnat_ugn). @value{PLATFORM}
 @end direntry
 
 @include gcc-common.texi
 @syncodeindex fn cp
 @c %**end of header
 
-@copying
-Copyright @copyright{} 1995-2005, Free Software Foundation
-
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.2
-or any later version published by the Free Software Foundation;
-with the Invariant Sections being ``GNU Free Documentation License'', with the
-Front-Cover Texts being
-``@value{EDITION} User's Guide'',
-and with no Back-Cover Texts.
-A copy of the license is included in the section entitled
-``GNU Free Documentation License''.
-@end copying
-
 @titlepage
 @title @value{EDITION} User's Guide
 @ifset vms
@@ -132,9 +128,13 @@ A copy of the license is included in the section entitled
 @titlefont{@i{@value{PLATFORM}}}
 @end flushright
 @end ifset
-@subtitle GNAT, The GNU Ada 95 Compiler
+
+@sp 2
+
+@subtitle GNAT, The GNU Ada Compiler
 @versionsubtitle
-@author Ada Core Technologies, Inc.
+@author AdaCore
+
 @page
 @vskip 0pt plus 1filll
 
@@ -150,7 +150,7 @@ A copy of the license is included in the section entitled
 @value{EDITION} User's Guide @value{PLATFORM}
 
 @noindent
-GNAT, The GNU Ada 95 Compiler@*
+GNAT, The GNU Ada Compiler@*
 GCC version @value{version-GCC}@*
 
 @noindent
@@ -185,16 +185,21 @@ AdaCore@*
 @end ifclear
 * Memory Management Issues::
 * Stack Related Facilities::
-* Verifying properties using gnatcheck::
+* Verifying Properties Using gnatcheck::
 * Creating Sample Bodies Using gnatstub::
+* Generating Ada Bindings for C and C++ headers::
 * Other Utility Programs::
 * Running and Debugging Ada Programs::
+@ifclear vms
+* Code Coverage and Profiling::
+@end ifclear
 @ifset vms
 * Compatibility with HP Ada::
 @end ifset
 * Platform-Specific Information for the Run-Time Libraries::
 * Example of Binder Output File::
 * Elaboration Order Handling in GNAT::
+* Conditional Compilation::
 * Inline Assembler::
 * Compatibility and Porting Guide::
 @ifset unw
@@ -223,7 +228,6 @@ Getting Started with GNAT
 @end ifset
 @ifclear vms
 * Introduction to GPS::
-* Introduction to Glide and GVD::
 @end ifclear
 
 The GNAT Compilation Model
@@ -317,6 +321,7 @@ The GNAT Make Program gnatmake
 
 Improving Performance
 * Performance Considerations::
+* Text_IO Suggestions::
 * Reducing Size of Ada Executables with gnatelim::
 * Reducing Size of Executables with unused subprogram/data elimination::
 
@@ -409,7 +414,7 @@ File Name Krunching Using gnatkr
 * Examples of gnatkr Usage::
 
 Preprocessing Using gnatprep
-
+* Preprocessing Symbols::
 * Using gnatprep::
 * Switches for gnatprep::
 * Form of Definitions File::
@@ -478,14 +483,16 @@ The gnatmem Tool
 * Example of gnatmem Usage::
 @end ifclear
 
-Verifying properties using gnatcheck
+Verifying Properties Using gnatcheck
 
 * Format of the Report File::
 * General gnatcheck Switches::
 * gnatcheck Rule Options::
-* Add the Results of Compiler Checks to gnatcheck Output::
+* Adding the Results of Compiler Checks to gnatcheck Output::
+* Project-Wide Checks::
+* Predefined Rules::
 
- Sample Bodies Using gnatstub
+Sample Bodies Using gnatstub
 
 * Running gnatstub::
 * Switches for gnatstub::
@@ -494,10 +501,14 @@ Other Utility Programs
 
 * Using Other Utility Programs with GNAT::
 * The External Symbol Naming Scheme of GNAT::
+* Converting Ada Files to html with gnathtml::
+
 @ifclear vms
-* Ada Mode for Glide::
+Code Coverage and Profiling
+
+* Code Coverage of Ada Programs using gcov::
+* Profiling an Ada Program using gprof::
 @end ifclear
-* Converting Ada Files to html with gnathtml::
 
 Running and Debugging Ada Programs
 
@@ -522,7 +533,7 @@ Running and Debugging Ada Programs
 @ifset vms
 Compatibility with HP Ada
 
-* Ada 95 Compatibility::
+* Ada Language Compatibility::
 * Differences in the Definition of Package System::
 * Language-Related Features::
 * The Package STANDARD::
@@ -583,14 +594,15 @@ Platform-Specific Information for the Run-Time Libraries
 * Solaris-Specific Considerations::
 * Linux-Specific Considerations::
 * AIX-Specific Considerations::
+* Irix-Specific Considerations::
 
 Example of Binder Output File
 
 Elaboration Order Handling in GNAT
 
-* Elaboration Code in Ada 95::
-* Checking the Elaboration Order in Ada 95::
-* Controlling the Elaboration Order in Ada 95::
+* Elaboration Code::
+* Checking the Elaboration Order::
+* Controlling the Elaboration Order::
 * Controlling Elaboration in GNAT - Internal Calls::
 * Controlling Elaboration in GNAT - External Calls::
 * Default Behavior in GNAT - Ensuring Safety::
@@ -602,6 +614,13 @@ Elaboration Order Handling in GNAT
 * Summary of Procedures for Elaboration Control::
 * Other Elaboration Order Considerations::
 
+Conditional Compilation
+* Use of Boolean Constants::
+* Debugging - A Special Case::
+* Conditionalizing Declarations::
+* Use of Alternative Implementations::
+* Preprocessing::
+
 Inline Assembler
 
 * Basic Assembler Syntax::
@@ -614,13 +633,14 @@ Inline Assembler
 Compatibility and Porting Guide
 
 * Compatibility with Ada 83::
+* Compatibility between Ada 95 and Ada 2005::
 * Implementation-dependent characteristics::
 @ifclear vms
 @c This brief section is only in the non-VMS version
 @c The complete chapter on HP Ada issues is in the VMS version
 * Compatibility with HP Ada 83::
 @end ifclear
-* Compatibility with Other Ada 95 Systems::
+* Compatibility with Other Ada Systems::
 * Representation Clauses::
 @ifset vms
 * Transitioning to 64-Bit GNAT for OpenVMS::
@@ -653,22 +673,35 @@ Microsoft Windows Topics
 @noindent
 @ifset vms
 This guide describes the use of @value{EDITION},
-a full language compiler for the Ada
-95 programming language, implemented on OpenVMS for HP's Alpha and
+a compiler and software development toolset for the full Ada
+programming language, implemented on OpenVMS for HP's Alpha and
 Integrity server (I64) platforms.
 @end ifset
 @ifclear vms
 This guide describes the use of @value{EDITION},
 a compiler and software development
-toolset for the full Ada 95 programming language.
+toolset for the full Ada programming language.
 @end ifclear
-It describes the features of the compiler and tools, and details
-how to use them to build Ada 95 applications.
+It documents the features of the compiler and tools, and explains
+how to use them to build Ada applications.
+
+@value{EDITION} implements Ada 95 and Ada 2005, and it may also be invoked in
+Ada 83 compatibility mode.
+By default, @value{EDITION} assumes @value{DEFAULTLANGUAGEVERSION},
+but you can override with a compiler switch
+(@pxref{Compiling Different Versions of Ada})
+to explicitly specify the language version.
+Throughout this manual, references to ``Ada'' without a year suffix
+apply to both the Ada 95 and Ada 2005 versions of the language.
 
-@ifset PROEDITION
-For ease of exposition, ``GNAT Pro'' will be referred to simply as
+
+@ifclear FSFEDITION
+For ease of exposition, ``@value{EDITION}'' will be referred to simply as
 ``GNAT'' in the remainder of this document.
-@end ifset
+@end ifclear
+
+
+
 
 @menu
 * What This Guide Contains::
@@ -762,7 +795,7 @@ file names on operating systems with a limit on the length of names.
 @item
 @ref{Preprocessing Using gnatprep}, describes @code{gnatprep}, a
 preprocessor utility that allows a single source file to be used to
-generate multiple or parameterized source files, by means of macro
+generate multiple or parameterized source files by means of macro
 substitution.
 
 @ifset vms
@@ -806,7 +839,7 @@ allocation and deallocation and helps detect ``memory leaks''.
 stack checking and analysis.
 
 @item
-@ref{Verifying properties using gnatcheck}, discusses @code{gnatcheck},
+@ref{Verifying Properties Using gnatcheck}, discusses @code{gnatcheck},
 a utility that checks Ada code against a set of rules.
 
 @item
@@ -814,9 +847,19 @@ a utility that checks Ada code against a set of rules.
 a utility that generates empty but compilable bodies for library units.
 
 @item
+@ref{Generating Ada Bindings for C and C++ headers}, describes how to
+generate automatically Ada bindings from C and C++ headers.
+
+@item
 @ref{Other Utility Programs}, discusses several other GNAT utilities,
 including @code{gnathtml}.
 
+@ifclear vms
+@item
+@ref{Code Coverage and Profiling}, describes how to perform a structural
+coverage and profile the execution of Ada programs.
+@end ifclear
+
 @item
 @ref{Running and Debugging Ada Programs}, describes how to run and debug
 Ada programs.
@@ -848,13 +891,17 @@ output file for a sample program.
 you deal with elaboration order issues.
 
 @item
+@ref{Conditional Compilation}, describes how to model conditional compilation,
+both with Ada in general and with GNAT facilities in particular.
+
+@item
 @ref{Inline Assembler}, shows how to use the inline assembly facility
 in an Ada program.
 
 @item
-@ref{Compatibility and Porting Guide}, includes sections on compatibility
-of GNAT with other Ada 83 and Ada 95 compilation systems, to assist
-in porting code from other environments.
+@ref{Compatibility and Porting Guide}, contains sections on compatibility
+of GNAT with other Ada development environments (including Ada 83 systems),
+to assist in porting code from those environments.
 
 @ifset unw
 @item
@@ -869,10 +916,16 @@ Microsoft Windows platform.
 @unnumberedsec What You Should Know before Reading This Guide
 
 @cindex Ada 95 Language Reference Manual
+@cindex Ada 2005 Language Reference Manual
 @noindent
-This user's guide assumes that you are familiar with Ada 95 language, as
+This guide assumes a basic familiarity with the Ada 95 language, as
 described in the International Standard ANSI/ISO/IEC-8652:1995, January
 1995.
+It does not require knowledge of the new features introduced by Ada 2005,
+(officially known as ISO/IEC 8652:1995 with Technical Corrigendum 1
+and Amendment 1).
+Both reference manuals are included in the GNAT documentation
+package.
 
 @node Related Information
 @unnumberedsec Related Information
@@ -883,36 +936,42 @@ documents:
 
 @itemize @bullet
 @item
-@cite{GNAT Reference Manual}, which contains all reference
-material for the GNAT implementation of Ada 95.
+@xref{Top, GNAT Reference Manual, About This Guide, gnat_rm, GNAT
+Reference Manual}, which contains all reference material for the GNAT
+implementation of Ada.
 
 @ifset unw
 @item
-@cite{Using the GNAT Programming System}, which describes the GPS
-integrated development environment.
+@cite{Using the GNAT Programming Studio}, which describes the GPS
+Integrated Development Environment.
 
 @item
-@cite{GNAT Programming System Tutorial}, which introduces the
+@cite{GNAT Programming Studio Tutorial}, which introduces the
 main GPS features through examples.
 @end ifset
 
 @item
-@cite{Ada 95 Language Reference Manual}, which contains all reference
+@cite{Ada 95 Reference Manual}, which contains reference
 material for the Ada 95 programming language.
 
 @item
-@cite{Debugging with GDB}
+@cite{Ada 2005 Reference Manual}, which contains reference
+material for the Ada 2005 programming language.
+
+@item
+@xref{Top,, Debugging with GDB, gdb, Debugging with GDB},
 @ifset vms
-, located in the GNU:[DOCS] directory,
+in the GNU:[DOCS] directory,
 @end ifset
-contains all details on the use of the GNU source-level debugger.
+for all details on the use of the GNU source-level debugger.
 
 @item
-@cite{GNU Emacs Manual}
+@xref{Top,, The extensible self-documenting text editor, emacs,
+GNU Emacs Manual},
 @ifset vms
-located in the GNU:[DOCS] directory if the EMACS kit is installed,
+located in the GNU:[DOCS] directory if the EMACS kit is installed,
 @end ifset
-contains full information on the extensible editor and programming
+for full information on the extensible editor and programming
 environment Emacs.
 
 @end itemize
@@ -929,23 +988,24 @@ in this guide:
 
 @itemize @bullet
 @item
-@code{Functions}, @code{utility program names}, @code{standard names},
+@code{Functions}, @command{utility program names}, @code{standard names},
 and @code{classes}.
 
 @item
-@samp{Option flags}
+@option{Option flags}
 
 @item
-@file{File Names}, @file{button names}, and @file{field names}.
+@file{File names}, @samp{button names}, and @samp{field names}.
 
 @item
-@var{Variables}.
+@code{Variables}, @env{environment variables}, and @var{metasyntactic
+variables}.
 
 @item
 @emph{Emphasis}.
 
 @item
-[optional information or parameters]
+@r{[}optional information or parameters@r{]}
 
 @item
 Examples are described by text
@@ -979,15 +1039,14 @@ executable Ada programs.
 @ifset unw
 @ref{Running GNAT}, through @ref{Using the gnatmake Utility},
 show how to use the command line environment.
-@ref{Introduction to Glide and GVD}, provides a brief
-introduction to the visually-oriented IDE for GNAT.
-Supplementing Glide on some platforms is GPS, the
-GNAT Programming System, which offers a richer graphical
-``look and feel'', enhanced configurability, support for
-development in other programming language, comprehensive
-browsing features, and many other capabilities.
+@ref{Introduction to GPS}, provides a brief
+introduction to the GNAT Programming Studio, a visually-oriented
+Integrated Development Environment for GNAT.
+GPS offers a graphical ``look and feel'', support for development in
+other programming languages, comprehensive browsing features, and
+many other capabilities.
 For information on GPS please refer to
-@cite{Using the GNAT Programming System}.
+@cite{Using the GNAT Programming Studio}.
 @end ifset
 
 @menu
@@ -1000,7 +1059,6 @@ For information on GPS please refer to
 @end ifset
 @ifclear vms
 * Introduction to GPS::
-* Introduction to Glide and GVD::
 @end ifclear
 @end menu
 
@@ -1030,12 +1088,10 @@ performs the necessary compilation, binding and linking steps.
 
 @noindent
 Any text editor may be used to prepare an Ada program.
-@ifclear vms
-If @code{Glide} is
-used, the optional Ada mode may be helpful in laying out the program.
-@end ifclear
+(If @code{Emacs} is
+used, the optional Ada mode may be helpful in laying out the program.)
 The
-program text is a normal text file. We will suppose in our initial
+program text is a normal text file. We will assume in our initial
 example that you have used your editor to prepare the following
 standard format text file:
 
@@ -1075,7 +1131,7 @@ $ gcc -c hello.adb
 
 @noindent
 @command{gcc} is the command used to run the compiler. This compiler is
-capable of compiling programs in several languages, including Ada 95 and
+capable of compiling programs in several languages, including Ada and
 C. It assumes that you have given it an Ada program if the file extension is
 either @file{.ads} or @file{.adb}, and it will then call
 the GNAT compiler to compile the specified file.
@@ -1282,7 +1338,7 @@ can be extremely helpful to use @command{gnatmake}, because working out by hand
 what needs to be recompiled can be difficult.
 
 Note that @command{gnatmake}
-takes into account all the Ada 95 rules that
+takes into account all the Ada rules that
 establish dependencies among units. These include dependencies that result
 from inlining subprogram bodies, and from
 generic instantiation. Unlike some other
@@ -1307,7 +1363,7 @@ written as @kbd{C-h}), and the tutorial by @kbd{C-h t}.
 
 Documentation on Emacs and other tools is available in Emacs under the
 pull-down menu button: @code{Help - Info}. After selecting @code{Info},
-use the middle mouse button to select a topic (e.g. Emacs).
+use the middle mouse button to select a topic (e.g.@: Emacs).
 
 In a character cell terminal, do @kbd{C-h i} to invoke info, and then @kbd{m}
 (stands for menu) followed by the menu item desired, as in @kbd{m Emacs}, to
@@ -1323,14 +1379,14 @@ environment and shell for the sophisticated user.
 @ifclear vms
 @node Introduction to GPS
 @section Introduction to GPS
-@cindex GPS (GNAT Programming System)
-@cindex GNAT Programming System (GPS)
+@cindex GPS (GNAT Programming Studio)
+@cindex GNAT Programming Studio (GPS)
 @noindent
 Although the command line interface (@command{gnatmake}, etc.) alone
 is sufficient, a graphical Interactive Development
 Environment can make it easier for you to compose, navigate, and debug
 programs.  This section describes the main features of GPS
-(``GNAT Programming System''), the GNAT graphical IDE.
+(``GNAT Programming Studio''), the GNAT graphical IDE.
 You will see how to use GPS to build and debug an executable, and
 you will also learn some of the basics of the GNAT ``project'' facility.
 
@@ -1583,7 +1639,7 @@ statement @code{Put_Line@ (Line@ (1..N));}
 Select @code{Debug}, then @code{Run}.  When the
 @code{Program Arguments} window appears, click @code{OK}.
 A console window will appear; enter some line of text,
-e.g. @code{abcde}, at the prompt.
+e.g.@: @code{abcde}, at the prompt.
 The program will pause execution when it gets to the
 breakpoint, and the corresponding line is highlighted.
 
@@ -1629,261 +1685,6 @@ The value of @code{N} will be 0, and the program will terminate.
 The console window will disappear.
 @end enumerate
 @end enumerate
-
-@node Introduction to Glide and GVD
-@section Introduction to Glide and GVD
-@cindex Glide
-@cindex GVD
-@noindent
-This section describes the main features of Glide,
-a GNAT graphical IDE, and also shows how to use the basic commands in GVD,
-the GNU Visual Debugger.
-These tools may be present in addition to, or in place of, GPS on some
-platforms.
-Additional information on Glide and GVD may be found
-in the on-line help for these tools.
-
-@menu
-* Building a New Program with Glide::
-* Simple Debugging with GVD::
-* Other Glide Features::
-@end menu
-
-@node Building a New Program with Glide
-@subsection Building a New Program with Glide
-@noindent
-The simplest way to invoke Glide is to enter @command{glide}
-at the command prompt.  It will generally be useful to issue this
-as a background command, thus allowing you to continue using
-your command window for other purposes while Glide is running:
-
-@smallexample
-$ glide&
-@end smallexample
-
-@noindent
-Glide will start up with an initial screen displaying the top-level menu items
-as well as some other information.  The menu selections are as follows
-@itemize @bullet
-@item @code{Buffers}
-@item @code{Files}
-@item @code{Tools}
-@item @code{Edit}
-@item @code{Search}
-@item @code{Mule}
-@item @code{Glide}
-@item @code{Help}
-@end itemize
-
-@noindent
-For this introductory example, you will need to create a new Ada source file.
-First, select the @code{Files} menu.  This will pop open a menu with around
-a dozen or so items.  To create a file, select the @code{Open file...} choice.
-Depending on the platform, you may see a pop-up window where you can browse
-to an appropriate directory and then enter the file name, or else simply
-see a line at the bottom of the Glide window where you can likewise enter
-the file name.  Note that in Glide, when you attempt to open a non-existent
-file, the effect is to create a file with that name.  For this example enter
-@file{hello.adb} as the name of the file.
-
-A new buffer will now appear, occupying the entire Glide window,
-with the file name at the top.  The menu selections are slightly different
-from the ones you saw on the opening screen; there is an @code{Entities} item,
-and in place of @code{Glide} there is now an @code{Ada} item.  Glide uses
-the file extension to identify the source language, so @file{adb} indicates
-an Ada source file.
-
-You will enter some of the source program lines explicitly,
-and use the syntax-oriented template mechanism to enter other lines.
-First, type the following text:
-@smallexample
-with Ada.Text_IO; use Ada.Text_IO;
-procedure Hello is
-begin
-@end smallexample
-
-@noindent
-Observe that Glide uses different colors to distinguish reserved words from
-identifiers.  Also, after the @code{procedure Hello is} line, the cursor is
-automatically indented in anticipation of declarations.  When you enter
-@code{begin}, Glide recognizes that there are no declarations and thus places
-@code{begin} flush left.  But after the @code{begin} line the cursor is again
-indented, where the statement(s) will be placed.
-
-The main part of the program will be a @code{for} loop.  Instead of entering
-the text explicitly, however, use a statement template.  Select the @code{Ada}
-item on the top menu bar, move the mouse to the @code{Statements} item,
-and you will see a large selection of alternatives.  Choose @code{for loop}.
-You will be prompted (at the bottom of the buffer) for a loop name;
-simply press the @key{Enter} key since a loop name is not needed.
-You should see the beginning of a @code{for} loop appear in the source
-program window.  You will now be prompted for the name of the loop variable;
-enter a line with the identifier @code{ind} (lower case).  Note that,
-by default, Glide capitalizes the name (you can override such behavior
-if you wish, although this is outside the scope of this introduction).
-Next, Glide prompts you for the loop range; enter a line containing
-@code{1..5} and you will see this also appear in the source program,
-together with the remaining elements of the @code{for} loop syntax.
-
-Next enter the statement (with an intentional error, a missing semicolon)
-that will form the body of the loop:
-@smallexample
-Put_Line("Hello, World" & Integer'Image(I))
-@end smallexample
-
-@noindent
-Finally, type @code{end Hello;} as the last line in the program.
-Now save the file: choose the @code{File} menu item, and then the
-@code{Save buffer} selection.  You will see a message at the bottom
-of the buffer confirming that the file has been saved.
-
-You are now ready to attempt to build the program.  Select the @code{Ada}
-item from the top menu bar.  Although we could choose simply to compile
-the file, we will instead attempt to do a build (which invokes
-@command{gnatmake}) since, if the compile is successful, we want to build
-an executable.  Thus select @code{Ada build}.  This will fail because of the
-compilation error, and you will notice that the Glide window has been split:
-the top window contains the source file, and the bottom window contains the
-output from the GNAT tools. Glide allows you to navigate from a compilation
-error to the source file position corresponding to the error: click the
-middle mouse button (or simultaneously press the left and right buttons,
-on a two-button mouse) on the diagnostic line in the tool window.  The
-focus will shift to the source window, and the cursor will be positioned
-on the character at which the error was detected.
-
-Correct the error: type in a semicolon to terminate the statement.
-Although you can again save the file explicitly, you can also simply invoke
-@code{Ada} @result{} @code{Build} and you will be prompted to save the file.
-This time the build will succeed; the tool output window shows you the
-options that are supplied by default.  The GNAT tools' output (e.g.
-object and ALI files, executable) will go in the directory from which
-Glide was launched.
-
-To execute the program, choose @code{Ada} and then @code{Run}.
-You should see the program's output displayed in the bottom window:
-
-@smallexample
-Hello, world 1
-Hello, world 2
-Hello, world 3
-Hello, world 4
-Hello, world 5
-@end smallexample
-
-@node Simple Debugging with GVD
-@subsection Simple Debugging with GVD
-
-@noindent
-This section describes how to set breakpoints, examine/modify variables,
-and step through execution.
-
-In order to enable debugging, you need to pass the @option{-g} switch
-to both the compiler and to @command{gnatlink}.  If you are using
-the command line, passing @option{-g} to @command{gnatmake} will have
-this effect.  You can then launch GVD, e.g. on the @code{hello} program,
-by issuing the command:
-
-@smallexample
-$ gvd hello
-@end smallexample
-
-@noindent
-If you are using Glide, then @option{-g} is passed to the relevant tools
-by default when you do a build.  Start the debugger by selecting the
-@code{Ada} menu item, and then @code{Debug}.
-
-GVD comes up in a multi-part window.  One pane shows the names of files
-comprising your executable; another pane shows the source code of the current
-unit (initially your main subprogram), another pane shows the debugger output
-and user interactions, and the fourth pane (the data canvas at the top
-of the window) displays data objects that you have selected.
-
-To the left of the source file pane, you will notice green dots adjacent
-to some lines.  These are lines for which object code exists and where
-breakpoints can thus be set.  You set/reset a breakpoint by clicking
-the green dot.  When a breakpoint is set, the dot is replaced by an @code{X}
-in a red circle.  Clicking the circle toggles the breakpoint off,
-and the red circle is replaced by the green dot.
-
-For this example, set a breakpoint at the statement where @code{Put_Line}
-is invoked.
-
-Start program execution by selecting the @code{Run} button on the top menu bar.
-(The @code{Start} button will also start your program, but it will
-cause program execution to break at the entry to your main subprogram.)
-Evidence of reaching the breakpoint will appear: the source file line will be
-highlighted, and the debugger interactions pane will display
-a relevant message.
-
-You can examine the values of variables in several ways.  Move the mouse
-over an occurrence of @code{Ind} in the @code{for} loop, and you will see
-the value (now @code{1}) displayed.  Alternatively, right-click on @code{Ind}
-and select @code{Display Ind}; a box showing the variable's name and value
-will appear in the data canvas.
-
-Although a loop index is a constant with respect to Ada semantics,
-you can change its value in the debugger.  Right-click in the box
-for @code{Ind}, and select the @code{Set Value of Ind} item.
-Enter @code{2} as the new value, and press @command{OK}.
-The box for @code{Ind} shows the update.
-
-Press the @code{Step} button on the top menu bar; this will step through
-one line of program text (the invocation of @code{Put_Line}), and you can
-observe the effect of having modified @code{Ind} since the value displayed
-is @code{2}.
-
-Remove the breakpoint, and resume execution by selecting the @code{Cont}
-button.  You will see the remaining output lines displayed in the debugger
-interaction window, along with a message confirming normal program
-termination.
-
-@node Other Glide Features
-@subsection Other Glide Features
-
-@noindent
-You may have observed that some of the menu selections contain abbreviations;
-e.g., @code{(C-x C-f)} for @code{Open file...} in the @code{Files} menu.
-These are @emph{shortcut keys} that you can use instead of selecting
-menu items.  The @key{C} stands for @key{Ctrl}; thus @code{(C-x C-f)} means
-@key{Ctrl-x} followed by @key{Ctrl-f}, and this sequence can be used instead
-of selecting @code{Files} and then @code{Open file...}.
-
-To abort a Glide command, type @key{Ctrl-g}.
-
-If you want Glide to start with an existing source file, you can either
-launch Glide as above and then open the file via @code{Files} @result{}
-@code{Open file...}, or else simply pass the name of the source file
-on the command line:
-
-@smallexample
-$ glide hello.adb&
-@end smallexample
-
-@noindent
-While you are using Glide, a number of @emph{buffers} exist.
-You create some explicitly; e.g., when you open/create a file.
-Others arise as an effect of the commands that you issue; e.g., the buffer
-containing the output of the tools invoked during a build.  If a buffer
-is hidden, you can bring it into a visible window by first opening
-the @code{Buffers} menu and then selecting the desired entry.
-
-If a buffer occupies only part of the Glide screen and you want to expand it
-to fill the entire screen, then click in the buffer and then select
-@code{Files} @result{} @code{One Window}.
-
-If a window is occupied by one buffer and you want to split the window
-to bring up a second buffer, perform the following steps:
-@itemize @bullet
-@item Select @code{Files} @result{} @code{Split Window};
-this will produce two windows each of which holds the original buffer
-(these are not copies, but rather different views of the same buffer contents)
-
-@item With the focus in one of the windows,
-select the desired buffer from the @code{Buffers} menu
-@end itemize
-
-@noindent
-To exit from Glide, choose @code{Files} @result{} @code{Exit}.
 @end ifclear
 
 @node The GNAT Compilation Model
@@ -1985,7 +1786,7 @@ you will place each subunit or child unit in a separate file.
 @section Foreign Language Representation
 
 @noindent
-GNAT supports the standard character sets defined in Ada 95 as well as
+GNAT supports the standard character sets defined in Ada as well as
 several other non-standard character sets for use in localized versions
 of the compiler (@pxref{Character Set Control}).
 @menu
@@ -2001,7 +1802,7 @@ of the compiler (@pxref{Character Set Control}).
 @noindent
 The basic character set is Latin-1. This character set is defined by ISO
 standard 8859, part 1. The lower half (character codes @code{16#00#}
-... @code{16#7F#)} is identical to standard ASCII coding, but the upper half
+@dots{} @code{16#7F#)} is identical to standard ASCII coding, but the upper half
 is used to represent additional characters. These include extended letters
 used by European languages, such as French accents, the vowels with umlauts
 used in German, and the extra letter A-ring used in Swedish.
@@ -2070,7 +1871,7 @@ lowercase equivalence.
 Any character in the range 80-FF allowed in identifiers, and all are
 considered distinct. In other words, there are no uppercase and lowercase
 equivalences in this range. This is useful in conjunction with
-certain encoding schemes used for some foreign character sets (e.g.
+certain encoding schemes used for some foreign character sets (e.g.,
 the typical method of representing Chinese characters on the PC).
 
 @item No Upper-Half
@@ -2146,14 +1947,14 @@ is a one, two, or three byte sequence:
 @iftex
 @leftskip=.7cm
 @end iftex
-16#0000#-16#007f#: 2#0xxxxxxx#
-16#0080#-16#07ff#: 2#110xxxxx# 2#10xxxxxx#
-16#0800#-16#ffff#: 2#1110xxxx# 2#10xxxxxx# 2#10xxxxxx#
+16#0000#-16#007f#: 2#0@var{xxxxxxx}#
+16#0080#-16#07ff#: 2#110@var{xxxxx}# 2#10@var{xxxxxx}#
+16#0800#-16#ffff#: 2#1110@var{xxxx}# 2#10@var{xxxxxx}# 2#10@var{xxxxxx}#
 
 @end smallexample
 
 @noindent
-where the xxx bits correspond to the left-padded bits of the
+where the @var{xxx} bits correspond to the left-padded bits of the
 16-bit character value. Note that all lower half ASCII characters
 are represented as ASCII bytes and all upper half characters and
 other wide characters are represented as sequences of upper-half
@@ -2184,7 +1985,7 @@ ACVC (Ada Compiler Validation Capability) test suite distributions.
 
 @noindent
 Note: Some of these coding schemes do not permit the full use of the
-Ada 95 character set. For example, neither Shift JIS, nor EUC allow the
+Ada character set. For example, neither Shift JIS, nor EUC allow the
 use of the upper half of the Latin-1 set.
 
 @node File Naming Rules
@@ -2199,10 +2000,10 @@ the unit and replacing the separating dots with hyphens and using
 An exception arises if the file name generated by the above rules starts
 with one of the characters
 @ifset vms
-A,G,I, or S,
+@samp{A}, @samp{G}, @samp{I}, or @samp{S},
 @end ifset
 @ifclear vms
-a,g,i, or s,
+@samp{a}, @samp{g}, @samp{i}, or @samp{s},
 @end ifclear
 and the second character is a
 minus. In this case, the character ^tilde^dollar sign^ is used in place
@@ -2210,10 +2011,10 @@ of the minus. The reason for this special rule is to avoid clashes with
 the standard names for child units of the packages System, Ada,
 Interfaces, and GNAT, which use the prefixes
 @ifset vms
-S- A- I- and G-
+@samp{S-}, @samp{A-}, @samp{I-}, and @samp{G-},
 @end ifset
 @ifclear vms
-s- a- i- and g-
+@samp{s-}, @samp{a-}, @samp{i-}, and @samp{g-},
 @end ifclear
 respectively.
 
@@ -2313,7 +2114,7 @@ GNAT allows completely arbitrary file names to be specified using the
 source file name pragma. However, if the file name specified has an
 extension other than @file{.ads} or @file{.adb} it is necessary to use
 a special syntax when compiling the file. The name in this case must be
-preceded by the special sequence @code{-x} followed by a space and the name
+preceded by the special sequence @option{-x} followed by a space and the name
 of the language, here @code{ada}, as in:
 
 @smallexample
@@ -2325,7 +2126,8 @@ $ gcc -c -x ada peculiar_file_name.sim
 @command{gnatmake} handles non-standard file names in the usual manner (the
 non-standard file name for the main program is simply used as the
 argument to gnatmake). Note that if the extension is also non-standard,
-then it must be included in the gnatmake command, it may not be omitted.
+then it must be included in the @command{gnatmake} command, it may not
+be omitted.
 
 @node Alternative File Naming Schemes
 @section Alternative File Naming Schemes
@@ -2347,18 +2149,18 @@ alternative scheme for naming is specified by the use of
 @smallexample @c ada
 pragma Source_File_Name (
    Spec_File_Name  => FILE_NAME_PATTERN
- [,Casing          => CASING_SPEC]
[,Dot_Replacement => STRING_LITERAL]);
+ @r{[},Casing          => CASING_SPEC@r{]}
@r{[},Dot_Replacement => STRING_LITERAL@r{]});
 
 pragma Source_File_Name (
    Body_File_Name  => FILE_NAME_PATTERN
- [,Casing          => CASING_SPEC]
[,Dot_Replacement => STRING_LITERAL]);
+ @r{[},Casing          => CASING_SPEC@r{]}
@r{[},Dot_Replacement => STRING_LITERAL@r{]});
 
 pragma Source_File_Name (
    Subunit_File_Name  => FILE_NAME_PATTERN
- [,Casing             => CASING_SPEC]
[,Dot_Replacement    => STRING_LITERAL]);
+ @r{[},Casing             => CASING_SPEC@r{]}
@r{[},Dot_Replacement    => STRING_LITERAL@r{]});
 
 FILE_NAME_PATTERN ::= STRING_LITERAL
 CASING_SPEC ::= Lowercase | Uppercase | Mixedcase
@@ -2390,7 +2192,7 @@ a separate @code{Subunit_File_Name} rule, and in this case the
 @code{Body_File_name} rule is used for subunits as well.
 
 The separate rule for subunits can also be used to implement the rather
-unusual case of a compilation environment (e.g. a single directory) which
+unusual case of a compilation environment (e.g.@: a single directory) which
 contains a subunit and a child unit with the same unit name. Although
 both units cannot appear in the same partition, the Ada Reference Manual
 allows (but does not require) the possibility of the two units coexisting
@@ -2571,19 +2373,22 @@ that for inlining to actually occur as a result of the use of this switch,
 it is necessary to compile in optimizing mode.
 
 @cindex @option{-gnatN} switch
-The use of @option{-gnatN} activates a more extensive inlining optimization
+The use of @option{-gnatN} activates  inlining optimization
 that is performed by the front end of the compiler. This inlining does
 not require that the code generation be optimized. Like @option{-gnatn},
 the use of this switch generates additional dependencies.
-Note that
-@option{-gnatN} automatically implies @option{-gnatn} so it is not necessary
-to specify both options.
+
+When using a gcc-based back end (in practice this means using any version
+of GNAT other than the JGNAT, .NET or GNAAMP versions), then the use of
+@option{-gnatN} is deprecated, and the use of @option{-gnatn} is preferred.
+Historically front end inlining was more extensive than the gcc back end
+inlining, but that is no longer the case.
 
 @item
-If an object file O  depends on the proper body of a subunit through inlining
-or instantiation, it depends on the parent unit of the subunit. This means that
-any modification of the parent unit or one of its subunits affects the
-compilation of O.
+If an object file @file{O} depends on the proper body of a subunit through
+inlining or instantiation, it depends on the parent unit of the subunit.
+This means that any modification of the parent unit or one of its subunits
+affects the compilation of @file{O}.
 
 @item
 The object file for a parent unit depends on all its subunit body files.
@@ -2599,9 +2404,10 @@ unit @code{B}, whose elaboration calls an inlined procedure in package
 @code{C}, in file @file{c.adb}.
 
 The set of dependent files described by these rules includes all the
-files on which the unit is semantically dependent, as described in the
-Ada 95 Language Reference Manual. However, it is a superset of what the
-ARM describes, because it includes generic, inline, and subunit dependencies.
+files on which the unit is semantically dependent, as dictated by the
+Ada language standard. However, it is a superset of what the
+standard describes, because it includes generic, inline, and subunit
+dependencies.
 
 An object file must be recreated by recompiling the corresponding source
 file if any of the source files on which it depends are modified. For
@@ -2646,7 +2452,7 @@ A list of relevant restrictions applying to the unit (used for consistency)
 checking.
 
 @item
-Categorization information (e.g. use of pragma @code{Pure}).
+Categorization information (e.g.@: use of pragma @code{Pure}).
 
 @item
 Information on all @code{with}'ed units, including presence of
@@ -2731,9 +2537,9 @@ specifically one that comprises units in both Ada and C.
 Interfacing Ada with a foreign language such as C involves using
 compiler directives to import and/or export entity definitions in each
 language---using @code{extern} statements in C, for instance, and the
-@code{Import}, @code{Export}, and @code{Convention} pragmas in Ada.  For
-a full treatment of these topics, read Appendix B, section 1 of the Ada
-95 Language Reference Manual.
+@code{Import}, @code{Export}, and @code{Convention} pragmas in Ada.
+A full treatment of these topics is provided in Appendix B, section 1
+of the Ada Reference Manual.
 
 There are two ways to build a program using GNAT that contains some Ada
 sources and some foreign language sources, depending on whether or not
@@ -2920,6 +2726,12 @@ gnatlink unit2.ali main.o -o exec_file
 This procedure yields a binary executable called @file{exec_file}.
 @end enumerate
 
+@noindent
+Depending on the circumstances (for example when your non-Ada main object
+does not provide symbol @code{main}), you may also need to instruct the
+GNAT linker not to include the standard startup objects by passing the
+@option{^-nostartfiles^/NOSTART_FILES^} switch to @command{gnatlink}.
+
 @node Calling Conventions
 @subsection Calling Conventions
 @cindex Foreign Languages
@@ -2978,14 +2790,14 @@ Equivalent to Assembler.
 @findex COBOL
 @item COBOL
 Data will be passed according to the conventions described
-in section B.4 of the Ada 95 Reference Manual.
+in section B.4 of the Ada Reference Manual.
 
 @findex C
 @cindex Interfacing to C
 @cindex Convention C
 @item C
 Data will be passed according to the conventions described
-in section B.3 of the Ada 95 Reference Manual.
+in section B.3 of the Ada Reference Manual.
 
 A note on interfacing to a C ``varargs'' function:
 @findex C varargs function
@@ -3028,7 +2840,7 @@ Equivalent to C.
 @findex C++
 @cindex Interfacing to C++
 @cindex Convention C++
-@item CPP
+@item C_Plus_Plus (or CPP)
 This stands for C++. For most purposes this is identical to C.
 See the separate description of the specialized GNAT pragmas relating to
 C++ interfacing for further details.
@@ -3039,16 +2851,15 @@ C++ interfacing for further details.
 @cindex Convention Fortran
 @item Fortran
 Data will be passed according to the conventions described
-in section B.5 of the Ada 95 Reference Manual.
+in section B.5 of the Ada Reference Manual.
 
 @item Intrinsic
-This applies to an intrinsic operation, as defined in the Ada 95
+This applies to an intrinsic operation, as defined in the Ada
 Reference Manual. If a pragma Import (Intrinsic) applies to a subprogram,
 this means that the body of the subprogram is provided by the compiler itself,
 usually by means of an efficient code sequence, and that the user does not
-supply an explicit body for it. In an application program, the pragma can
-only be applied to the following two sets of names, which the GNAT compiler
-recognizes.
+supply an explicit body for it. In an application program, the pragma may
+be applied to the following sets of names:
 
 @itemize @bullet
 @item
@@ -3059,7 +2870,9 @@ first one must be a signed integer type or a modular type with a binary
 modulus, and the second parameter must be of type Natural.
 The return type must be the same as the type of the first argument. The size
 of this type can only be 8, 16, 32, or 64.
-@item binary arithmetic operators: ``+'', ``-'', ``*'', ``/''
+
+@item
+Binary arithmetic operators: ``+'', ``-'', ``*'', ``/''
 The corresponding operator declaration must have parameters and result type
 that have the same root numeric type (for example, all three are long_float
 types). This simplifies the definition of operations that use type checking
@@ -3079,18 +2892,35 @@ This common idiom is often programmed with a generic definition and an
 explicit body. The pragma makes it simpler to introduce such declarations.
 It incurs no overhead in compilation time or code size, because it is
 implemented as a single machine instruction.
+
+@item
+General subprogram entities, to bind an Ada subprogram declaration to
+a compiler builtin by name with back-ends where such interfaces are
+available. A typical example is the set of ``__builtin'' functions
+exposed by the GCC back-end, as in the following example:
+
+@smallexample @c ada
+   function builtin_sqrt (F : Float) return Float;
+   pragma Import (Intrinsic, builtin_sqrt, "__builtin_sqrtf");
+@end smallexample
+
+Most of the GCC builtins are accessible this way, and as for other
+import conventions (e.g. C), it is the user's responsibility to ensure
+that the Ada subprogram profile matches the underlying builtin
+expectations.
 @end itemize
+
 @noindent
 
 @ifset unw
 @findex Stdcall
 @cindex Convention Stdcall
 @item Stdcall
-This is relevant only to Windows XP/2000/NT/95 implementations of GNAT,
+This is relevant only to Windows XP/2000/NT implementations of GNAT,
 and specifies that the @code{Stdcall} calling sequence will be used,
 as defined by the NT API. Nevertheless, to ease building
 cross-platform bindings this convention will be handled as a @code{C} calling
-convention on non Windows platforms.
+convention on non-Windows platforms.
 
 @findex DLL
 @cindex Convention DLL
@@ -3133,38 +2963,37 @@ meaning as Fortran.
 @noindent
 A programmer inexperienced with mixed-language development may find that
 building an application containing both Ada and C++ code can be a
-challenge. As a matter of fact, interfacing with C++ has not been
-standardized in the Ada 95 Reference Manual due to the immaturity of --
-and lack of standards for -- C++ at the time. This section gives a few
+challenge.  This section gives a few
 hints that should make this task easier. The first section addresses
-the differences regarding interfacing with C. The second section
+the differences between interfacing with C and interfacing with C++.
+The second section
 looks into the delicate problem of linking the complete application from
 its Ada and C++ parts. The last section gives some hints on how the GNAT
-run time can be adapted in order to allow inter-language dispatching
+run-time library can be adapted in order to allow inter-language dispatching
 with a new C++ compiler.
 
 @menu
 * Interfacing to C++::
 * Linking a Mixed C++ & Ada Program::
 * A Simple Example::
-* Adapting the Run Time to a New C++ Compiler::
+* Interfacing with C++ at the Class Level::
 @end menu
 
 @node Interfacing to C++
 @subsection Interfacing to C++
 
 @noindent
-GNAT supports interfacing with C++ compilers generating code that is
-compatible with the standard Application Binary Interface of the given
-platform.
+GNAT supports interfacing with the G++ compiler (or any C++ compiler
+generating code that is compatible with the G++ Application Binary
+Interface ---see http://www.codesourcery.com/archives/cxx-abi).
 
 @noindent
 Interfacing can be done at 3 levels: simple data, subprograms, and
-classes. In the first two cases, GNAT offers a specific @var{Convention
-CPP} that behaves exactly like @var{Convention C}. Usually, C++ mangles
-the names of subprograms, and currently, GNAT does not provide any help
-to solve the demangling problem. This problem can be addressed in two
-ways:
+classes. In the first two cases, GNAT offers a specific @code{Convention
+C_Plus_Plus} (or @code{CPP}) that behaves exactly like @code{Convention C}.
+Usually, C++ mangles the names of subprograms, and currently, GNAT does
+not provide any help to solve the demangling problem. This problem can be
+addressed in two ways:
 @itemize @bullet
 @item
 by modifying the C++ code in order to force a C convention using
@@ -3177,8 +3006,8 @@ the pragma import.
 
 @noindent
 Interfacing at the class level can be achieved by using the GNAT specific
-pragmas such as @code{CPP_Class} and @code{CPP_Virtual}. See the GNAT
-Reference Manual for additional information.
+pragmas such as @code{CPP_Constructor}.  @xref{Interfacing to C++,,,
+gnat_rm, GNAT Reference Manual}, for additional information.
 
 @node Linking a Mixed C++ & Ada Program
 @subsection Linking a Mixed C++ & Ada Program
@@ -3208,16 +3037,17 @@ $ gnatmake ada_unit -largs file1.o file2.o --LINK=c++
 
 @item
 Using GNAT and G++ from two different GCC installations: If both
-compilers are on the PATH, the previous method may be used. It is
-important to note that environment variables such as C_INCLUDE_PATH,
-GCC_EXEC_PREFIX, BINUTILS_ROOT, and GCC_ROOT will affect both compilers
+compilers are on the @env{PATH}, the previous method may be used. It is
+important to note that environment variables such as
+@env{C_INCLUDE_PATH}, @env{GCC_EXEC_PREFIX}, @env{BINUTILS_ROOT}, and
+@env{GCC_ROOT} will affect both compilers
 at the same time and may make one of the two compilers operate
 improperly if set during invocation of the wrong compiler.  It is also
 very important that the linker uses the proper @file{libgcc.a} GCC
 library -- that is, the one from the C++ compiler installation. The
-implicit link command as suggested in the gnatmake command from the
-former example can be replaced by an explicit link command with the
-full-verbosity option in order to verify which library is used:
+implicit link command as suggested in the @command{gnatmake} command
+from the former example can be replaced by an explicit link command with
+the full-verbosity option in order to verify which library is used:
 @smallexample
 $ gnatbind ada_unit
 $ gnatlink -v -v ada_unit file1.o file2.o --LINK=c++
@@ -3255,7 +3085,7 @@ $ gnatlink ada_unit file1.o file2.o --LINK=./my_script
 Where CC is the name of the non-GNU C++ compiler.
 
 If the @code{zero cost} exception mechanism is used, and the platform
-supports automatic registration of exception tables (e.g. Solaris or IRIX),
+supports automatic registration of exception tables (e.g.@: Solaris or IRIX),
 paths to more objects are required:
 
 @smallexample
@@ -3268,7 +3098,7 @@ $ gnatlink ada_unit file1.o file2.o --LINK=./my_script
 @end smallexample
 
 If the @code{zero cost} exception mechanism is used, and the platform
-doesn't support automatic registration of exception tables (e.g. HP-UX,
+doesn't support automatic registration of exception tables (e.g.@: HP-UX,
 Tru64 or AIX), the simple approach described above will not work and
 a pre-linking phase using GNAT will be necessary.
 
@@ -3365,51 +3195,273 @@ A::A(void)
    a_value = 1010;
   printf ("in A::A, a_value = %d \n",a_value);
 @}
+@end smallexample
 
+@smallexample @c ada
 -- Ada sources
-@b{package} @b{body} Simple_Cpp_Interface @b{is}
+package body Simple_Cpp_Interface is
 
-   @b{procedure} Ada_Method2 (This : @b{in} @b{out} A; V : Integer) @b{is}
-   @b{begin}
+   procedure Ada_Method2 (This : in out A; V : Integer) is
+   begin
       Method1 (This);
       This.A_Value := V;
-   @b{end} Ada_Method2;
+   end Ada_Method2;
 
-@b{end} Simple_Cpp_Interface;
+end Simple_Cpp_Interface;
 
-@b{package} Simple_Cpp_Interface @b{is}
-   @b{type} A @b{is} @b{limited}
-      @b{record}
+with System;
+package Simple_Cpp_Interface is
+   type A is limited
+      record
+         Vptr    : System.Address;
          O_Value : Integer;
          A_Value : Integer;
-      @b{end} @b{record};
-   @b{pragma} Convention (C, A);
+      end record;
+   pragma Convention (C, A);
 
-   @b{procedure} Method1 (This : @b{in} @b{out} A);
-   @b{pragma} Import (C, Method1);
+   procedure Method1 (This : in out A);
+   pragma Import (C, Method1);
 
-   @b{procedure} Ada_Method2 (This : @b{in} @b{out} A; V : Integer);
-   @b{pragma} Export (C, Ada_Method2);
+   procedure Ada_Method2 (This : in out A; V : Integer);
+   pragma Export (C, Ada_Method2);
 
-@b{end} Simple_Cpp_Interface;
+end Simple_Cpp_Interface;
 @end smallexample
 
-@node Adapting the Run Time to a New C++ Compiler
-@subsection Adapting the Run Time to a New C++ Compiler
+@node Interfacing with C++ at the Class Level
+@subsection Interfacing with C++ at the Class Level
 @noindent
-GNAT offers the capability to derive Ada 95 tagged types directly from
-preexisting C++ classes and . See ``Interfacing with C++'' in the
-@cite{GNAT Reference Manual}. The mechanism used by GNAT for achieving
-such a goal
-has been made user configurable through a GNAT library unit
-@code{Interfaces.CPP}. The default version of this file is adapted to
-the GNU C++ compiler. Internal knowledge of the virtual
-table layout used by the new C++ compiler is needed to configure
-properly this unit. The Interface of this unit is known by the compiler
-and cannot be changed except for the value of the constants defining the
-characteristics of the virtual table: CPP_DT_Prologue_Size, CPP_DT_Entry_Size,
-CPP_TSD_Prologue_Size, CPP_TSD_Entry_Size. Read comments in the source
-of this unit for more details.
+In this section we demonstrate the GNAT features for interfacing with
+C++ by means of an example making use of Ada 2005 abstract interface
+types. This example consists of a classification of animals; classes
+have been used to model our main classification of animals, and
+interfaces provide support for the management of secondary
+classifications. We first demonstrate a case in which the types and
+constructors are defined on the C++ side and imported from the Ada
+side, and latter the reverse case.
+
+The root of our derivation will be the @code{Animal} class, with a
+single private attribute (the @code{Age} of the animal) and two public
+primitives to set and get the value of this attribute.
+
+@smallexample
+@b{class} Animal @{
+ @b{public}:
+   @b{virtual} void Set_Age (int New_Age);
+   @b{virtual} int Age ();
+ @b{private}:
+   int Age_Count;
+@};
+@end smallexample
+
+Abstract interface types are defined in C++ by means of classes with pure
+virtual functions and no data members. In our example we will use two
+interfaces that provide support for the common management of @code{Carnivore}
+and @code{Domestic} animals:
+
+@smallexample
+@b{class} Carnivore @{
+@b{public}:
+   @b{virtual} int Number_Of_Teeth () = 0;
+@};
+
+@b{class} Domestic @{
+@b{public}:
+   @b{virtual void} Set_Owner (char* Name) = 0;
+@};
+@end smallexample
+
+Using these declarations, we can now say that a @code{Dog} is an animal that is
+both Carnivore and Domestic, that is:
+
+@smallexample
+@b{class} Dog : Animal, Carnivore, Domestic @{
+ @b{public}:
+   @b{virtual} int  Number_Of_Teeth ();
+   @b{virtual} void Set_Owner (char* Name);
+
+   Dog(); // Constructor
+ @b{private}:
+   int  Tooth_Count;
+   char *Owner;
+@};
+@end smallexample
+
+In the following examples we will assume that the previous declarations are
+located in a file named @code{animals.h}. The following package demonstrates
+how to import these C++ declarations from the Ada side:
+
+@smallexample @c ada
+with Interfaces.C.Strings; use Interfaces.C.Strings;
+package Animals is
+  type Carnivore is interface;
+  pragma Convention (C_Plus_Plus, Carnivore);
+  function Number_Of_Teeth (X : Carnivore)
+     return Natural is abstract;
+
+  type Domestic is interface;
+  pragma Convention (C_Plus_Plus, Set_Owner);
+  procedure Set_Owner
+    (X    : in out Domestic;
+     Name : Chars_Ptr) is abstract;
+
+  type Animal is tagged record
+    Age : Natural := 0;
+  end record;
+  pragma Import (C_Plus_Plus, Animal);
+
+  procedure Set_Age (X : in out Animal; Age : Integer);
+  pragma Import (C_Plus_Plus, Set_Age);
+
+  function Age (X : Animal) return Integer;
+  pragma Import (C_Plus_Plus, Age);
+
+  type Dog is new Animal and Carnivore and Domestic with record
+    Tooth_Count : Natural;
+    Owner       : String (1 .. 30);
+  end record;
+  pragma Import (C_Plus_Plus, Dog);
+
+  function Number_Of_Teeth (A : Dog) return Integer;
+  pragma Import (C_Plus_Plus, Number_Of_Teeth);
+
+  procedure Set_Owner (A : in out Dog; Name : Chars_Ptr);
+  pragma Import (C_Plus_Plus, Set_Owner);
+
+  function New_Dog return Dog'Class;
+  pragma CPP_Constructor (New_Dog);
+  pragma Import (CPP, New_Dog, "_ZN3DogC2Ev");
+end Animals;
+@end smallexample
+
+Thanks to the compatibility between GNAT run-time structures and the C++ ABI,
+interfacing with these C++ classes is easy. The only requirement is that all
+the primitives and components must be declared exactly in the same order in
+the two languages.
+
+Regarding the abstract interfaces, we must indicate to the GNAT compiler by
+means of a @code{pragma Convention (C_Plus_Plus)}, the convention used to pass
+the arguments to the called primitives will be the same as for C++. For the
+imported classes we use @code{pragma Import} with convention @code{C_Plus_Plus}
+to indicate that they have been defined on the C++ side; this is required
+because the dispatch table associated with these tagged types will be built
+in the C++ side and therefore will not contain the predefined Ada primitives
+which Ada would otherwise expect.
+
+As the reader can see there is no need to indicate the C++ mangled names
+associated with each subprogram because it is assumed that all the calls to
+these primitives will be dispatching calls. The only exception is the
+constructor, which must be registered with the compiler by means of
+@code{pragma CPP_Constructor} and needs to provide its associated C++
+mangled name because the Ada compiler generates direct calls to it.
+
+With the above packages we can now declare objects of type Dog on the Ada side
+and dispatch calls to the corresponding subprograms on the C++ side. We can
+also extend the tagged type Dog with further fields and primitives, and
+override some of its C++ primitives on the Ada side. For example, here we have
+a type derivation defined on the Ada side that inherits all the dispatching
+primitives of the ancestor from the C++ side.
+
+@smallexample
+@b{with} Animals; @b{use} Animals;
+@b{package} Vaccinated_Animals @b{is}
+  @b{type} Vaccinated_Dog @b{is new} Dog @b{with null record};
+  @b{function} Vaccination_Expired (A : Vaccinated_Dog) @b{return} Boolean;
+@b{end} Vaccinated_Animals;
+@end smallexample
+
+It is important to note that, because of the ABI compatibility, the programmer
+does not need to add any further information to indicate either the object
+layout or the dispatch table entry associated with each dispatching operation.
+
+Now let us define all the types and constructors on the Ada side and export
+them to C++, using the same hierarchy of our previous example:
+
+@smallexample @c ada
+with Interfaces.C.Strings;
+use Interfaces.C.Strings;
+package Animals is
+  type Carnivore is interface;
+  pragma Convention (C_Plus_Plus, Carnivore);
+  function Number_Of_Teeth (X : Carnivore)
+     return Natural is abstract;
+
+  type Domestic is interface;
+  pragma Convention (C_Plus_Plus, Set_Owner);
+  procedure Set_Owner
+    (X    : in out Domestic;
+     Name : Chars_Ptr) is abstract;
+
+  type Animal is tagged record
+    Age : Natural := 0;
+  end record;
+  pragma Convention (C_Plus_Plus, Animal);
+
+  procedure Set_Age (X : in out Animal; Age : Integer);
+  pragma Export (C_Plus_Plus, Set_Age);
+
+  function Age (X : Animal) return Integer;
+  pragma Export (C_Plus_Plus, Age);
+
+  type Dog is new Animal and Carnivore and Domestic with record
+    Tooth_Count : Natural;
+    Owner       : String (1 .. 30);
+  end record;
+  pragma Convention (C_Plus_Plus, Dog);
+
+  function Number_Of_Teeth (A : Dog) return Integer;
+  pragma Export (C_Plus_Plus, Number_Of_Teeth);
+
+  procedure Set_Owner (A : in out Dog; Name : Chars_Ptr);
+  pragma Export (C_Plus_Plus, Set_Owner);
+
+  function New_Dog return Dog'Class;
+  pragma Export (C_Plus_Plus, New_Dog);
+end Animals;
+@end smallexample
+
+Compared with our previous example the only difference is the use of
+@code{pragma Export} to indicate to the GNAT compiler that the primitives will
+be available to C++. Thanks to the ABI compatibility, on the C++ side there is
+nothing else to be done; as explained above, the only requirement is that all
+the primitives and components are declared in exactly the same order.
+
+For completeness, let us see a brief C++ main program that uses the
+declarations available in @code{animals.h} (presented in our first example) to
+import and use the declarations from the Ada side, properly initializing and
+finalizing the Ada run-time system along the way:
+
+@smallexample
+@b{#include} "animals.h"
+@b{#include} <iostream>
+@b{using namespace} std;
+
+void Check_Carnivore (Carnivore *obj) @{@dots{}@}
+void Check_Domestic (Domestic *obj)   @{@dots{}@}
+void Check_Animal (Animal *obj)       @{@dots{}@}
+void Check_Dog (Dog *obj)             @{@dots{}@}
+
+@b{extern} "C" @{
+  void adainit (void);
+  void adafinal (void);
+  Dog* new_dog ();
+@}
+
+void test ()
+@{
+  Dog *obj = new_dog();  // Ada constructor
+  Check_Carnivore (obj); // Check secondary DT
+  Check_Domestic (obj);  // Check secondary DT
+  Check_Animal (obj);    // Check primary DT
+  Check_Dog (obj);       // Check primary DT
+@}
+
+int main ()
+@{
+  adainit ();  test();  adafinal ();
+  return 0;
+@}
+@end smallexample
 
 @node Comparison between GNAT and C/C++ Compilation Models
 @section Comparison between GNAT and C/C++ Compilation Models
@@ -3450,7 +3502,7 @@ malfunctioned at run time.
 @noindent
 This section is intended for Ada programmers who have
 used an Ada compiler implementing the traditional Ada library
-model, as described in the Ada 95 Language Reference Manual.
+model, as described in the Ada Reference Manual.
 
 @cindex GNAT library
 In GNAT, there is no ``library'' in the normal sense. Instead, the set of
@@ -3596,7 +3648,7 @@ compiled.
 
 @cindex cannot generate code
 If you attempt to compile any of these files, you will get one of the
-following error messages (where fff is the name of the file you compiled):
+following error messages (where @var{fff} is the name of the file you compiled):
 
 @smallexample
 cannot generate code for file @var{fff} (package spec)
@@ -3620,7 +3672,7 @@ without generating code, then use the @option{-gnatc} switch.
 The basic command for compiling a file containing an Ada unit is
 
 @smallexample
-$ gcc -c [@var{switches}] @file{file name}
+$ gcc -c @ovar{switches} @file{file name}
 @end smallexample
 
 @noindent
@@ -3721,9 +3773,10 @@ system configuration. You must have a GNAT cross-compiler built if
 @cindex @option{-B} (@command{gcc})
 Load compiler executables (for example, @code{gnat1}, the Ada compiler)
 from @var{dir} instead of the default location. Only use this switch
-when multiple versions of the GNAT compiler are available. See the
-@command{gcc} manual page for further details. You would normally use the
-@option{-b} or @option{-V} switch instead.
+when multiple versions of the GNAT compiler are available.
+@xref{Directory Options,, Options for Directory Search, gcc, Using the
+GNU Compiler Collection (GCC)}, for further details. You would normally
+use the @option{-b} or @option{-V} switch instead.
 
 @item -c
 @cindex @option{-c} (@command{gcc})
@@ -3743,7 +3796,24 @@ Suppresses all back-end inlining, even if other optimization or inlining
 switches are set.
 This includes suppression of inlining that results
 from the use of the pragma @code{Inline_Always}.
-See also @option{-gnatn} and @option{-gnatN}.
+Any occurrences of pragma @code{Inline} or @code{Inline_Always}
+are ignored, and @option{-gnatn} and @option{-gnatN} have no
+effect if this switch is present.
+
+@item -fno-inline-functions
+@cindex @option{-fno-inline-functions} (@command{gcc})
+Suppresses automatic inlining of simple subprograms, which is enabled
+if @option{-O3} is used.
+
+@item -fno-inline-small-functions
+@cindex @option{-fno-inline-small-functions} (@command{gcc})
+Suppresses automatic inlining of small subprograms, which is enabled
+if @option{-O2} is used.
+
+@item -fno-inline-functions-called-once
+@cindex @option{-fno-inline-functions-called-once} (@command{gcc})
+Suppresses inlining of subprograms local to the unit and called once
+from within it, which is enabled if @option{-O1} is used.
 
 @item -fno-strict-aliasing
 @cindex @option{-fno-strict-aliasing} (@command{gcc})
@@ -3761,7 +3831,7 @@ See @ref{Stack Overflow Checking} for details.
 Makes the compiler output stack usage information for the program, on a
 per-function basis. See @ref{Static Stack Usage Analysis} for details.
 
-@item -fcallgraph-info[=su]
+@item -fcallgraph-info@r{[}=su@r{]}
 @cindex @option{-fcallgraph-info} (@command{gcc})
 Makes the compiler output callgraph information for the program, on a
 per-file basis.  The information is generated in the VCG format.  It can
@@ -3791,16 +3861,23 @@ Allow full Ada 2005 features.
 Assertions enabled. @code{Pragma Assert} and @code{pragma Debug} to be
 activated. Note that these pragmas can also be controlled using the
 configuration pragmas @code{Assertion_Policy} and @code{Debug_Policy}.
+It also activates pragmas @code{Check}, @code{Precondition}, and
+@code{Postcondition}. Note that these pragmas can also be controlled
+using the configuration pragma @code{Check_Policy}.
 
 @item -gnatA
 @cindex @option{-gnatA} (@command{gcc})
-Avoid processing @file{gnat.adc}. If a gnat.adc file is present,
+Avoid processing @file{gnat.adc}. If a @file{gnat.adc} file is present,
 it will be ignored.
 
 @item -gnatb
 @cindex @option{-gnatb} (@command{gcc})
 Generate brief messages to @file{stderr} even if verbose mode set.
 
+@item -gnatB
+@cindex @option{-gnatB} (@command{gcc})
+Assume no invalid (bad) values except for 'Valid attribute use.
+
 @item -gnatc
 @cindex @option{-gnatc} (@command{gcc})
 Check syntax and semantics only (no code generation attempted).
@@ -3815,8 +3892,13 @@ debug options. Certain debug options are relevant to applications
 programmers, and these are documented at appropriate points in this
 users guide.
 
+@ifclear vms
 @item -gnatD
-@cindex @option{-gnatD} (@command{gcc})
+@cindex @option{-gnatD[nn]} (@command{gcc})
+@end ifclear
+@ifset vms
+@item /XDEBUG /LXDEBUG=nnn
+@end ifset
 Create expanded source files for source level debugging. This switch
 also suppress generation of cross-reference information
 (see @option{-gnatx}).
@@ -3829,15 +3911,19 @@ Specify a configuration pragma file
 @end ifclear
 (@pxref{The Configuration Pragmas Files}).
 
-@item ^-gnateD^/DATA_PREPROCESSING=^symbol[=value]
+@item ^-gnateD^/DATA_PREPROCESSING=^symbol@r{[}=@var{value}@r{]}
 @cindex @option{-gnateD} (@command{gcc})
-Defines a symbol, associated with value, for preprocessing.
+Defines a symbol, associated with @var{value}, for preprocessing.
 (@pxref{Integrated Preprocessing}).
 
 @item -gnatef
 @cindex @option{-gnatef} (@command{gcc})
 Display full source path name in brief error messages.
 
+@item -gnateG
+@cindex @option{-gnateG} (@command{gcc})
+Save result of preprocessing in a text file.
+
 @item -gnatem=@var{path}
 @cindex @option{-gnatem} (@command{gcc})
 Specify a mapping file
@@ -3867,17 +3953,24 @@ attempt to suppress cascaded errors.
 @cindex @option{-gnatF} (@command{gcc})
 Externals names are folded to all uppercase.
 
-@item -gnatg
-@cindex @option{-gnatg} (@command{gcc})
+@item ^-gnatg^/GNAT_INTERNAL^
+@cindex @option{^-gnatg^/GNAT_INTERNAL^} (@command{gcc})
 Internal GNAT implementation mode. This should not be used for
 applications programs, it is intended only for use by the compiler
 and its run-time library. For documentation, see the GNAT sources.
-Note that @option{-gnatg} implies @option{-gnatwu} so that warnings
-are generated on unreferenced entities, and all warnings are treated
-as errors.
+Note that @option{^-gnatg^/GNAT_INTERNAL^} implies
+@option{^-gnatwae^/WARNINGS=ALL,ERRORS^} and
+@option{^-gnatyg^/STYLE_CHECKS=GNAT^}
+so that all standard warnings and all standard style options are turned on.
+All warnings and style error messages are treated as errors.
 
-@item -gnatG
-@cindex @option{-gnatG} (@command{gcc})
+@ifclear vms
+@item -gnatG=nn
+@cindex @option{-gnatG[nn]} (@command{gcc})
+@end ifclear
+@ifset vms
+@item /EXPAND_SOURCE, /LEXPAND_SOURCE=nnn
+@end ifset
 List generated expanded code in source form.
 
 @item ^-gnath^/HELP^
@@ -3890,10 +3983,16 @@ Identifier character set
 @ifclear vms
 (@var{c}=1/2/3/4/8/9/p/f/n/w).
 @end ifclear
-@ifset vms
 For details of the possible selections for @var{c},
 see @ref{Character Set Control}.
-@end ifset
+
+@item ^-gnatI^/IGNORE_REP_CLAUSES^
+@cindex @option{^-gnatI^IGNORE_REP_CLAUSES^} (@command{gcc})
+Ignore representation clauses. When this switch is used, all
+representation clauses are treated as comments. This is useful
+when initially porting code where you want to ignore rep clause
+problems, and also for compiling foreign code (particularly
+for use with ASIS).
 
 @item -gnatjnn
 @cindex @option{-gnatjnn} (@command{gcc})
@@ -3916,9 +4015,13 @@ source output.
 @item -gnatm=@var{n}
 @cindex @option{-gnatm} (@command{gcc})
 Limit number of detected error or warning messages to @var{n}
-where @var{n} is in the range 1..999_999. The default setting if
-no switch is given is 9999. Compilation is terminated if this
-limit is exceeded. The equal sign here is optional.
+where @var{n} is in the range 1..999999. The default setting if
+no switch is given is 9999. If the number of warnings reaches this
+limit, then a message is output and further warnings are suppressed,
+but the compilation is continued. If the number of error messages
+reaches this limit, then a message is output and the compilation
+is abandoned. The equal sign here is optional. A value of zero
+means that no limit applies.
 
 @item -gnatn
 @cindex @option{-gnatn} (@command{gcc})
@@ -3932,41 +4035,43 @@ Activate front end inlining for subprograms for which
 pragma @code{Inline} is specified. This inlining is performed
 by the front end and will be visible in the
 @option{-gnatG} output.
-In some cases, this has proved more effective than the back end
-inlining resulting from the use of
-@option{-gnatn}.
-Note that
-@option{-gnatN} automatically implies
-@option{-gnatn} so it is not necessary
-to specify both options. There are a few cases that the back-end inlining
-catches that cannot be dealt with in the front-end.
+
+When using a gcc-based back end (in practice this means using any version
+of GNAT other than the JGNAT, .NET or GNAAMP versions), then the use of
+@option{-gnatN} is deprecated, and the use of @option{-gnatn} is preferred.
+Historically front end inlining was more extensive than the gcc back end
+inlining, but that is no longer the case.
 
 @item -gnato
 @cindex @option{-gnato} (@command{gcc})
 Enable numeric overflow checking (which is not normally enabled by
-default). Not that division by zero is a separate check that is not
+default). Note that division by zero is a separate check that is not
 controlled by this switch (division by zero checking is on by default).
 
 @item -gnatp
 @cindex @option{-gnatp} (@command{gcc})
-Suppress all checks.
+Suppress all checks. See @ref{Run-Time Checks} for details.
 
 @item -gnatP
 @cindex @option{-gnatP} (@command{gcc})
 Enable polling. This is required on some systems (notably Windows NT) to
 obtain asynchronous abort and asynchronous transfer of control capability.
-See the description of pragma Polling in the GNAT Reference Manual for
-full details.
+@xref{Pragma Polling,,, gnat_rm, GNAT Reference Manual}, for full
+details.
 
 @item -gnatq
 @cindex @option{-gnatq} (@command{gcc})
-Don't quit; try semantics, even if parse errors.
+Don't quit. Try semantics, even if parse errors.
 
 @item -gnatQ
 @cindex @option{-gnatQ} (@command{gcc})
-Don't quit; generate @file{ALI} and tree files even if illegalities.
+Don't quit. Generate @file{ALI} and tree files even if illegalities.
+
+@item -gnatr
+@cindex @option{-gnatr} (@command{gcc})
+Treat pragma Restrictions as Restriction_Warnings.
 
-@item ^-gnatR[0/1/2/3[s]]^/REPRESENTATION_INFO^
+@item ^-gnatR@r{[}0@r{/}1@r{/}2@r{/}3@r{[}s@r{]]}^/REPRESENTATION_INFO^
 @cindex @option{-gnatR} (@command{gcc})
 Output representation information for declared types and objects.
 
@@ -4003,7 +4108,7 @@ Verbose mode. Full error output with source lines to @file{stdout}.
 Control level of validity checking. See separate section describing
 this feature.
 
-@item ^-gnatw@var{xxx}^/WARNINGS=(@var{option}[,...])^
+@item ^-gnatw@var{xxx}^/WARNINGS=(@var{option}@r{[},@dots{}@r{]})^
 @cindex @option{^-gnatw^/WARNINGS^} (@command{gcc})
 Warning mode where
 ^@var{xxx} is a string of option letters that^the list of options^ denotes
@@ -4024,7 +4129,7 @@ Wide character encoding method
 @cindex @option{-gnatx} (@command{gcc})
 Suppress generation of cross-reference information.
 
-@item ^-gnaty^/STYLE_CHECKS=(option,option..)^
+@item ^-gnaty^/STYLE_CHECKS=(option,option@dots{})^
 @cindex @option{^-gnaty^/STYLE_CHECKS^} (@command{gcc})
 Enable built-in style checks (@pxref{Style Checking}).
 
@@ -4083,7 +4188,7 @@ Inhibit the search of the default location for the GNAT Run Time
 Library (RTL) ALI files.
 
 @ifclear vms
-@item -O[@var{n}]
+@item -O@ovar{n}
 @cindex @option{-O} (@command{gcc})
 @var{n} controls the optimization level.
 
@@ -4100,17 +4205,26 @@ time.
 Extensive optimization, may improve execution time, possibly at the cost of
 substantially increased compilation time.
 
+@item n = 3
+Same as @option{-O2}, and also includes inline expansion for small subprograms
+in the same unit.
+
+@item n = s
+Optimize space usage
 @end table
+
+@noindent
+See also @ref{Optimization Levels}.
 @end ifclear
 
 @ifset vms
 @item  /NOOPTIMIZE
 @cindex @option{/NOOPTIMIZE} (@code{GNAT COMPILE})
 Equivalent to @option{/OPTIMIZE=NONE}.
-This is the default behavior in the absence of an @option{/OPTMIZE}
+This is the default behavior in the absence of an @option{/OPTIMIZE}
 qualifier.
 
-@item /OPTIMIZE[=(keyword[,...])]
+@item /OPTIMIZE@r{[}=(keyword@r{[},@dots{}@r{]})@r{]}
 @cindex @option{/OPTIMIZE} (@code{GNAT COMPILE})
 Selects the level of optimization for your program. The supported
 keywords are as follows:
@@ -4118,7 +4232,7 @@ keywords are as follows:
 @item   ALL
 Perform most optimizations, including those that
 are expensive.
-This is the default if the @option{/OPTMIZE} qualifier is supplied
+This is the default if the @option{/OPTIMIZE} qualifier is supplied
 without keyword options.
 
 @item   NONE
@@ -4130,11 +4244,21 @@ Perform some optimizations, but omit ones that are costly.
 @item   DEVELOPMENT
 Same as @code{SOME}.
 
+@item INLINING
+Full optimization as in @option{/OPTIMIZE=ALL}, and also attempts
+automatic inlining of small subprograms within a unit
+
 @item   UNROLL_LOOPS
 Try to unroll loops. This keyword may be specified together with
 any keyword above other than @code{NONE}. Loop unrolling
 usually, but not always, improves the performance of programs.
+
+@item SPACE
+Optimize space usage
 @end table
+
+@noindent
+See also @ref{Optimization Levels}.
 @end ifset
 
 @ifclear vms
@@ -4176,12 +4300,12 @@ Execute @var{ver} version of the compiler. This is the @command{gcc}
 version, not the GNAT version.
 @end ifclear
 
-@item ^-w^NO_BACK_END_WARNINGS^
+@item ^-w^/NO_BACK_END_WARNINGS^
 @cindex @option{-w} (@command{gcc})
 Turn off warnings generated by the back end of the compiler. Use of
 this switch also causes the default for front end warnings to be set
 to suppress (as though @option{-gnatws} had appeared at the start of
-the options.
+the options).
 
 @end table
 
@@ -4261,8 +4385,10 @@ e.adb:4:20: ";" should be "is"
 @noindent
 The first integer after the file name is the line number in the file,
 and the second integer is the column number within the line.
-@code{glide} can parse the error messages
+@ifclear vms
+@code{GPS} can parse the error messages
 and point to the referenced character.
+@end ifclear
 The following switches provide control over the error message
 format:
 
@@ -4354,7 +4480,7 @@ warning messages generated.
 
 @item -^gnatl^OUTPUT_FILE^=file
 @cindex @option{^-gnatl^OUTPUT_FILE^=fname} (@command{gcc})
-This has the same effect as @code{-gnatl} except that the output is
+This has the same effect as @option{-gnatl} except that the output is
 written to a file instead of to standard output. If the given name
 @file{fname} does not start with a period, then it is the full name
 of the file to be written. If @file{fname} is an extension, it is
@@ -4386,17 +4512,26 @@ format message or full listing (which as usual is written to
 The @code{m} stands for maximum.
 @end ifclear
 @var{n} is a decimal integer in the
-range of 1 to 999 and limits the number of error messages to be
-generated. For example, using @option{-gnatm2} might yield
+range of 1 to 999999 and limits the number of error or warning
+messages to be generated. For example, using
+@option{-gnatm2} might yield
 
 @smallexample
 e.adb:3:04: Incorrect spelling of keyword "function"
 e.adb:5:35: missing ".."
-fatal error: maximum errors reached
+fatal error: maximum number of errors detected
 compilation abandoned
 @end smallexample
 
 @noindent
+The default setting if
+no switch is given is 9999. If the number of warnings reaches this
+limit, then a message is output and further warnings are suppressed,
+but the compilation is continued. If the number of error messages
+reaches this limit, then a message is output and the compilation
+is abandoned. A value of zero means that no limit applies.
+
+@noindent
 Note that the equal sign is optional, so the switches
 @option{-gnatm2} and @option{-gnatm=2} are equivalent.
 
@@ -4478,7 +4613,7 @@ illegalities are detected in the program. The use of @option{-gnatQ} forces
 generation of the @file{ALI} file. This file is marked as being in
 error, so it cannot be used for binding purposes, but it does contain
 reasonably complete cross-reference information, and thus may be useful
-for use by tools (e.g. semantic browsing tools or integrated development
+for use by tools (e.g., semantic browsing tools or integrated development
 environments) that are driven from the @file{ALI} file. This switch
 implies @option{-gnatq}, since the semantic phase must be run to get a
 meaningful ALI file.
@@ -4505,7 +4640,7 @@ since ALI files are never generated if @option{-gnats} is set.
 @cindex Warning messages
 @noindent
 In addition to error messages, which correspond to illegalities as defined
-in the Ada 95 Reference Manual, the compiler detects two kinds of warning
+in the Ada Reference Manual, the compiler detects two kinds of warning
 situations.
 
 First, the compiler considers some constructs suspicious and generates a
@@ -4542,6 +4677,9 @@ Out-of-range values being assigned
 Possible order of elaboration problems
 
 @item
+Assertions (pragma Assert) that are sure to fail
+
+@item
 Unreachable code
 
 @item
@@ -4668,8 +4806,8 @@ A range in a @code{for} loop that is known to be null or might be null
 The following section lists compiler switches that are available
 to control the handling of warning messages. It is also possible
 to exercise much finer control over what warnings are issued and
-suppressed using the GNAT pragma Warnings, which is documented
-in the GNAT Reference manual.
+suppressed using the GNAT pragma Warnings, @xref{Pragma Warnings,,,
+gnat_rm, GNAT Reference manual}.
 
 @table @option
 @c !sort!
@@ -4683,6 +4821,7 @@ switch are
 @option{-gnatwd} (implicit dereferencing),
 @option{-gnatwh} (hiding),
 @option{-gnatwl} (elaboration warnings),
+@option{-gnatw.o} (warn on values set by out parameters ignored)
 and @option{-gnatwt} (tracking of deleted conditional code).
 All other optional warnings are turned on.
 
@@ -4693,6 +4832,22 @@ This switch suppresses all optional warning messages, see remaining list
 in this section for details on optional warning messages that can be
 individually controlled.
 
+@item -gnatw.a
+@emph{Activate warnings on failing assertions.}
+@cindex @option{-gnatw.a} (@command{gcc})
+@cindex Assert failures
+This switch activates warnings for assertions where the compiler can tell at
+compile time that the assertion will fail. Note that this warning is given
+even if assertions are disabled. The default is that such warnings are
+generated.
+
+@item -gnatw.A
+@emph{Suppress warnings on failing assertions.}
+@cindex @option{-gnatw.A} (@command{gcc})
+@cindex Assert failures
+This switch suppresses warnings for assertions where the compiler can tell at
+compile time that the assertion will fail.
+
 @item -gnatwb
 @emph{Activate warnings on bad fixed values.}
 @cindex @option{-gnatwb} (@command{gcc})
@@ -4713,6 +4868,21 @@ are not generated.
 This switch suppresses warnings for static fixed-point expressions whose
 value is not an exact multiple of Small.
 
+@item -gnatw.b
+@emph{Activate warnings on biased representation.}
+@cindex @option{-gnatw.b} (@command{gcc})
+@cindex Biased representation
+This switch activates warnings when a size clause, value size clause, component
+clause, or component size clause forces the use of biased representation for an
+integer type (e.g. representing a range of 10..11 in a single bit by using 0/1
+to represent 10/11). The default is that such warnings are generated.
+
+@item -gnatw.B
+@emph{Suppress warnings on biased representation.}
+@cindex @option{-gnatwB} (@command{gcc})
+This switch suppresses warnings for representation clauses that force the use
+of biased representation.
+
 @item -gnatwc
 @emph{Activate warnings on conditionals.}
 @cindex @option{-gnatwc} (@command{gcc})
@@ -4733,6 +4903,12 @@ then it will warn that the ``>'' or ``<'' part of the test
 is useless and that the operator could be replaced by ``=''.
 An example would be comparing a @code{Natural} variable <= 0.
 
+This warning option also generates warnings if
+one or both tests is optimized away in a membership test for integer
+values if the result can be determined at compile time. Range tests on
+enumeration types are not included, since it is common for such tests
+to include an end point.
+
 This warning can also be turned on using @option{-gnatwa}.
 
 @item -gnatwC
@@ -4741,6 +4917,23 @@ This warning can also be turned on using @option{-gnatwa}.
 This switch suppresses warnings for conditional expressions used in
 tests that are known to be True or False at compile time.
 
+@item -gnatw.c
+@emph{Activate warnings on missing component clauses.}
+@cindex @option{-gnatw.c} (@command{gcc})
+@cindex Component clause, missing
+This switch activates warnings for record components where a record
+representation clause is present and has component clauses for the
+majority, but not all, of the components. A warning is given for each
+component for which no component clause is present.
+
+This warning can also be turned on using @option{-gnatwa}.
+
+@item -gnatw.C
+@emph{Suppress warnings on missing component clauses.}
+@cindex @option{-gnatwC} (@command{gcc})
+This switch suppresses warnings for record components that are
+missing a component clause in the situation described above.
+
 @item -gnatwd
 @emph{Activate warnings on implicit dereferencing.}
 @cindex @option{-gnatwd} (@command{gcc})
@@ -4770,6 +4963,13 @@ This switch causes warning messages to be treated as errors.
 The warning string still appears, but the warning messages are counted
 as errors, and prevent the generation of an object file.
 
+@item -gnatw.e
+@emph{Activate every optional warning}
+@cindex @option{-gnatw.e} (@command{gcc})
+@cindex Warnings, activate every optional warning
+This switch activates all optional warnings, including those which
+are not activated by @code{-gnatwa}.
+
 @item -gnatwf
 @emph{Activate warnings on unreferenced formals.}
 @cindex @option{-gnatwf} (@command{gcc})
@@ -4885,20 +5085,32 @@ This warning can also be turned on using @option{-gnatwa}.
 This switch disables warnings on variables that could be declared constants.
 
 @item -gnatwl
-@emph{Activate warnings for missing elaboration pragmas.}
+@emph{Activate warnings for elaboration pragmas.}
 @cindex @option{-gnatwl} (@command{gcc})
 @cindex Elaboration, warnings
 This switch activates warnings on missing
 @code{Elaborate_All} and @code{Elaborate} pragmas.
 See the section in this guide on elaboration checking for details on
-when such pragmas should be used. Warnings are also generated if you
+when such pragmas should be used. In dynamic elaboration mode, this switch
+generations warnings about the need to add elaboration pragmas. Note however,
+that if you blindly follow these warnings, and add @code{Elaborate_All}
+warnings wherever they are recommended, you basically end up with the
+equivalent of the static elaboration model, which may not be what you want for
+legacy code for which the static model does not work.
+
+For the static model, the messages generated are labeled "info:" (for
+information messages). They are not warnings to add elaboration pragmas,
+merely informational messages showing what implicit elaboration pragmas
+have been added, for use in analyzing elaboration circularity problems.
+
+Warnings are also generated if you
 are using the static mode of elaboration, and a @code{pragma Elaborate}
 is encountered. The default is that such warnings
 are not generated.
 This warning is not automatically turned on by the use of @option{-gnatwa}.
 
 @item -gnatwL
-@emph{Suppress warnings for missing elaboration pragmas.}
+@emph{Suppress warnings for elaboration pragmas.}
 @cindex @option{-gnatwL} (@command{gcc})
 This switch suppresses warnings on missing Elaborate and Elaborate_All pragmas.
 See the section in this guide on elaboration checking for details on
@@ -4948,6 +5160,27 @@ This switch suppresses warnings on possibly unintended initialization
 effects of defining address clauses that cause one variable to overlap
 another.
 
+@item -gnatw.o
+@emph{Activate warnings on modified but unreferenced out parameters.}
+@cindex @option{-gnatw.o} (@command{gcc})
+This switch activates warnings for variables that are modified by using
+them as actuals for a call to a procedure with an out mode formal, where
+the resulting assigned value is never read. It is applicable in the case
+where there is more than one out mode formal. If there is only one out
+mode formal, the warning is issued by default (controlled by -gnatwu).
+The warning is suppressed for volatile
+variables and also for variables that are renamings of other variables
+or for which an address clause is given.
+The default is that these warnings are not given. Note that this warning
+is not included in -gnatwa, it must be activated explicitly.
+
+@item -gnatw.O
+@emph{Disable warnings on modified but unreferenced out parameters.}
+@cindex @option{-gnatw.O} (@command{gcc})
+This switch suppresses warnings for variables that are modified by using
+them as actuals for a call to a procedure with an out mode formal, where
+the resulting assigned value is never read.
+
 @item -gnatwp
 @emph{Activate warnings on ineffective pragma Inlines.}
 @cindex @option{-gnatwp} (@command{gcc})
@@ -4958,6 +5191,8 @@ many reasons for not being able to inline a call, including most
 commonly that the call is too complex to inline. The default is
 that such warnings are not given.
 This warning can also be turned on using @option{-gnatwa}.
+Warnings on ineffective inlining by the gcc back-end can be activated
+separately, using the gcc switch -Winline.
 
 @item -gnatwP
 @emph{Suppress warnings on ineffective pragma Inlines.}
@@ -4966,18 +5201,38 @@ This switch suppresses warnings on ineffective pragma Inlines. If the
 inlining mechanism cannot inline a call, it will simply ignore the
 request silently.
 
+@item -gnatw.p
+@emph{Activate warnings on parameter ordering.}
+@cindex @option{-gnatw.p} (@command{gcc})
+@cindex Parameter order, warnings
+This switch activates warnings for cases of suspicious parameter
+ordering when the list of arguments are all simple identifiers that
+match the names of the formals, but are in a different order. The
+warning is suppressed if any use of named parameter notation is used,
+so this is the appropriate way to suppress a false positive (and
+serves to emphasize that the "misordering" is deliberate). The
+default is
+that such warnings are not given.
+This warning can also be turned on using @option{-gnatwa}.
+
+@item -gnatw.P
+@emph{Suppress warnings on parameter ordering.}
+@cindex @option{-gnatw.P} (@command{gcc})
+This switch suppresses warnings on cases of suspicious parameter
+ordering.
+
 @item -gnatwq
 @emph{Activate warnings on questionable missing parentheses.}
 @cindex @option{-gnatwq} (@command{gcc})
 @cindex Parentheses, warnings
 This switch activates warnings for cases where parentheses are not used and
 the result is potential ambiguity from a readers point of view. For example
-(not a > b) when a and b are modular means (not (a) > b) and very likely the
+(not a > b) when a and b are modular means ((not a) > b) and very likely the
 programmer intended (not (a > b)). Similarly (-x mod 5) means (-(x mod 5)) and
 quite likely ((-x) mod 5) was intended. In such situations it seems best to
 follow the rule of always parenthesizing to make the association clear, and
 this warning switch warns if such parentheses are not present. The default
-is that these warnings are not given.
+is that these warnings are given.
 This warning can also be turned on using @option{-gnatwa}.
 
 @item -gnatwQ
@@ -5089,6 +5344,17 @@ This warning can also be turned on using @option{-gnatwa}.
 @cindex @option{-gnatwV} (@command{gcc})
 This switch suppresses warnings for access to variables which
 may not be properly initialized.
+For variables of a composite type, the warning can also be suppressed in
+Ada 2005 by using a default initialization with a box. For example, if
+Table is an array of records whose components are only partially uninitialized,
+then the following code:
+
+@smallexample @c ada
+   Tab : Table := (others => <>);
+@end smallexample
+
+will suppress warnings on subsequent statements that access components
+of variable Tab.
 
 @item -gnatww
 @emph{Activate warnings on wrong low bound assumption.}
@@ -5099,21 +5365,38 @@ with a literal or S'Length. This is a case where the code is assuming that the
 low bound is one, which is in general not true (for example when a slice is
 passed). The default is that such warnings are generated.
 This warning can also be turned on using @option{-gnatwa}.
-F
 
 @item -gnatwW
 @emph{Suppress warnings on wrong low bound assumption.}
 @cindex @option{-gnatwW} (@command{gcc})
-This switch activates warnings for indexing an unconstrained string parameter
-with a literal or S'Length. This warning can also be suppressed by providing
-an Assert pragma that checks the low bound, for example:
+This switch suppresses warnings for indexing an unconstrained string parameter
+with a literal or S'Length. Note that this warning can also be suppressed
+in a particular case by adding an
+assertion that the lower bound is 1,
+as shown in the following example.
 
 @smallexample @c ada
    procedure K (S : String) is
       pragma Assert (S'First = 1);
-      ...
+      @dots{}
 @end smallexample
 
+@item -gnatw.w
+@emph{Activate warnings on unnecessary Warnings Off pragmas}
+@cindex @option{-gnatw.w} (@command{gcc})
+@cindex Warnings Off control
+This switch activates warnings for use of @code{pragma Warnings (Off, entity}
+where either the pragma is entirely useless (because it suppresses no
+warnings), or it could be replaced by @code{pragma Unreferenced} or
+@code{pragma Unmodified}.The default is that these warnings are not given.
+Note that this warning is not included in -gnatwa, it must be
+activated explicitly.
+
+@item -gnatw.W
+@emph{Suppress warnings on unnecessary Warnings Off pragmas}
+@cindex @option{-gnatw.W} (@command{gcc})
+This switch suppresses warnings for use of @code{pragma Warnings (Off, entity}.
+
 @item -gnatwx
 @emph{Activate warnings on Export/Import pragmas.}
 @cindex @option{-gnatwx} (@command{gcc})
@@ -5135,6 +5418,20 @@ The sense of this is that you are telling the compiler that
 you know what you are doing in writing the pragma, and it
 should not complain at you.
 
+@item -gnatw.x
+@emph{Activate warnings for No_Exception_Propagation mode.}
+@cindex @option{-gnatwm} (@command{gcc})
+This switch activates warnings for exception usage when pragma Restrictions
+(No_Exception_Propagation) is in effect. Warnings are given for implicit or
+explicit exception raises which are not covered by a local handler, and for
+exception handlers which do not cover a local raise. The default is that these
+warnings are not given.
+
+@item -gnatw.X
+@emph{Disable warnings for No_Exception_Propagation mode.}
+This switch disables warnings for exception usage when pragma Restrictions
+(No_Exception_Propagation) is in effect.
+
 @item -gnatwy
 @emph{Activate warnings for Ada 2005 compatibility issues.}
 @cindex @option{-gnatwy} (@command{gcc})
@@ -5162,7 +5459,9 @@ incompatibilities between Ada 95 and Ada 2005.
 This switch activates warnings for unchecked conversions
 where the types are known at compile time to have different
 sizes. The default
-is that such warnings are generated.
+is that such warnings are generated. Warnings are also
+generated for subprogram pointers with different conventions,
+and, on VMS only, for data pointers with different conventions.
 This warning can also be turned on using @option{-gnatwa}.
 
 @item -gnatwZ
@@ -5170,23 +5469,33 @@ This warning can also be turned on using @option{-gnatwa}.
 @cindex @option{-gnatwZ} (@command{gcc})
 This switch suppresses warnings for unchecked conversions
 where the types are known at compile time to have different
-sizes.
+sizes or conventions.
+
+@item ^-Wunused^WARNINGS=UNUSED^
+@cindex @option{-Wunused}
+The warnings controlled by the @option{-gnatw} switch are generated by
+the front end of the compiler. The @option{GCC} back end can provide
+additional warnings and they are controlled by the @option{-W} switch.
+For example, @option{^-Wunused^WARNINGS=UNUSED^} activates back end
+warnings for entities that are declared but not referenced.
 
 @item ^-Wuninitialized^WARNINGS=UNINITIALIZED^
 @cindex @option{-Wuninitialized}
-The warnings controlled by the @option{-gnatw} switch are generated by the
-front end of the compiler. In some cases, the @option{^gcc^GCC^} back end
-can provide additional warnings. One such useful warning is provided by
-@option{^-Wuninitialized^WARNINGS=UNINITIALIZED^}. This must be used in
-conjunction with turning on optimization mode. This causes the flow
-analysis circuits of the back end optimizer to output additional
-warnings about uninitialized variables.
+Similarly, @option{^-Wuninitialized^WARNINGS=UNINITIALIZED^} activates
+the back end warning for uninitialized variables. This switch must be
+used in conjunction with an optimization level greater than zero.
+
+@item ^-Wall^/ALL_BACK_END_WARNINGS^
+@cindex @option{-Wall}
+This switch enables all the above warnings from the @option{GCC} back end.
+The code generator detects a number of warning situations that are missed
+by the @option{GNAT} front end, and this switch can be used to activate them.
+The use of this switch also sets the default front end warning mode to
+@option{-gnatwa}, that is, most front end warnings activated as well.
 
 @item ^-w^/NO_BACK_END_WARNINGS^
 @cindex @option{-w}
-This switch suppresses warnings from the @option{^gcc^GCC^} back end. The
-code generator detects a number of warning situations that are missed
-by the @option{GNAT} front end, and this switch can be used to suppress them.
+Conversely, this switch suppresses warnings from the @option{GCC} back end.
 The use of this switch also sets the default front end warning mode to
 @option{-gnatws}, that is, front end warnings suppressed as well.
 
@@ -5248,8 +5557,8 @@ The pragmas have the form:
 
 @smallexample
 @cartouche
-   @b{pragma} Assert (@var{Boolean-expression} [,
-                      @var{static-string-expression}])
+   @b{pragma} Assert (@var{Boolean-expression} @r{[},
+                      @var{static-string-expression}@r{]})
    @b{pragma} Debug (@var{procedure call})
 @end cartouche
 @end smallexample
@@ -5270,7 +5579,7 @@ The @code{Debug} pragma causes @var{procedure} to be called. Note that
 debugging procedures to be called between declarations.
 
 @ifset vms
-@item /DEBUG[=debug-level]
+@item /DEBUG@r{[}=debug-level@r{]}
 @itemx  /NODEBUG
 Specifies how much debugging information is to be included in
 the resulting object file where 'debug-level' is one of the following:
@@ -5297,7 +5606,7 @@ file. Note that this doesn't include traceback information.
 @findex Validity Checking
 
 @noindent
-The Ada 95 Reference Manual has specific requirements for checking
+The Ada Reference Manual has specific requirements for checking
 for invalid values. In particular, RM 13.9.1 requires that the
 evaluation of invalid values (for example from unchecked conversions),
 not result in erroneous execution. In GNAT, the result of such an
@@ -5309,6 +5618,12 @@ statements (where a wild jump might result from an invalid value),
 and subscripts on the left hand side (where memory corruption could
 occur as a result of an invalid value).
 
+The @option{-gnatB} switch tells the compiler to assume that all
+values are valid (that is, within their declared subtype range)
+except in the context of a use of the Valid attribute. This means
+the compiler can generate more efficient code, since the range
+of values is better known at compile time.
+
 The @option{-gnatV^@var{x}^^} switch allows more control over the validity
 checking mode.
 @ifclear vms
@@ -5373,9 +5688,9 @@ are assigned component by component.
 @cindex @option{-gnatVf} (@command{gcc})
 In the absence of this switch, validity checking occurs only for discrete
 values. If @option{-gnatVf} is specified, then validity checking also applies
-for floating-point values, and NaN's and infinities are considered invalid,
+for floating-point values, and NaNs and infinities are considered invalid,
 as well as out of range values for constrained types. Note that this means
-that standard @code{IEEE} infinity mode is not allowed. The exact contexts
+that standard IEEE infinity mode is not allowed. The exact contexts
 in which floating-point values are checked depends on the setting of other
 options. For example,
 @option{^-gnatVif^VALIDITY_CHECKING=(IN_PARAMS,FLOATS)^} or
@@ -5418,7 +5733,7 @@ the shift operators defined as intrinsic in package @code{Interfaces}
 and operands for attributes such as @code{Pos}. Checks are also made
 on individual component values for composite comparisons, and on the
 expressions in type conversions and qualified expressions. Checks are
-also made on explicit ranges using .. (e.g. slices, loops etc).
+also made on explicit ranges using @samp{..} (e.g.@: slices, loops etc).
 
 @item -gnatVp
 @emph{Validity checks for parameters.}
@@ -5488,7 +5803,7 @@ turns on all validity checking options except for
 checking of @code{@b{in out}} procedure arguments.
 
 The specification of additional validity checking generates extra code (and
-in the case of @option{-gnatVa} the code expansion can be substantial.
+in the case of @option{-gnatVa} the code expansion can be substantial).
 However, these additional checks can be very useful in detecting
 uninitialized variables, incorrect use of unchecked conversion, and other
 errors leading to invalid values. The use of pragma @code{Initialize_Scalars}
@@ -5504,7 +5819,7 @@ temporary disabling of validity checks.
 @findex Style checking
 
 @noindent
-The @option{-gnaty^x^(option,option,...)^} switch
+The @option{-gnaty^x^(option,option,@dots{})^} switch
 @cindex @option{-gnaty} (@command{gcc})
 causes the compiler to
 enforce specified style rules. A limited set of style rules has been used
@@ -5513,7 +5828,7 @@ to activate all or some of these checks. If the source program fails a
 specified style check, an appropriate warning message is given, preceded by
 the character sequence ``(style)''.
 @ifset vms
-@code{(option,option,...)} is a sequence of keywords
+@code{(option,option,@dots{})} is a sequence of keywords
 @end ifset
 @ifclear vms
 The string @var{x} is a sequence of letters or digits
@@ -5523,36 +5838,41 @@ checks to be performed. The following checks are defined:
 
 @table @option
 @c !sort!
-@item 1-9
+@item 0-9
 @emph{Specify indentation level.}
 If a digit from 1-9 appears
 ^in the string after @option{-gnaty}^as an option for /STYLE_CHECKS^
 then proper indentation is checked, with the digit indicating the
-indentation level required.
+indentation level required. A value of zero turns off this style check.
 The general style of required indentation is as specified by
 the examples in the Ada Reference Manual. Full line comments must be
 aligned with the @code{--} starting on a column that is a multiple of
-the alignment level.
+the alignment level, or they may be aligned the same way as the following
+non-blank line (this is useful when full line comments appear in the middle
+of a statement.
 
 @item ^a^ATTRIBUTE^
 @emph{Check attribute casing.}
-If the ^letter a^word ATTRIBUTE^ appears in the string after @option{-gnaty}
-then attribute names, including the case of keywords such as @code{digits}
+Attribute names, including the case of keywords such as @code{digits}
 used as attributes names, must be written in mixed case, that is, the
 initial letter and any letter following an underscore must be uppercase.
 All other letters must be lowercase.
 
+@item ^A^ARRAY_INDEXES^
+@emph{Use of array index numbers in array attributes.}
+When using the array attributes First, Last, Range,
+or Length, the index number must be omitted for one-dimensional arrays
+and is required for multi-dimensional arrays.
+
 @item ^b^BLANKS^
 @emph{Blanks not allowed at statement end.}
-If the ^letter b^word BLANKS^ appears in the string after @option{-gnaty} then
-trailing blanks are not allowed at the end of statements. The purpose of this
+Trailing blanks are not allowed at the end of statements. The purpose of this
 rule, together with h (no horizontal tabs), is to enforce a canonical format
 for the use of blanks to separate source tokens.
 
 @item ^c^COMMENTS^
 @emph{Check comments.}
-If the ^letter c^word COMMENTS^ appears in the string after @option{-gnaty}
-then comments must meet the following set of rules:
+Comments must meet the following set of rules:
 
 @itemize @bullet
 
@@ -5580,9 +5900,9 @@ including @command{gnatprep} (where ``@code{--!}'' is used) and the SPARK
 annotation
 language (where ``@code{--#}'' is used). For the purposes of this rule, a
 special character is defined as being in one of the ASCII ranges
-@code{16#21#..16#2F#} or @code{16#3A#..16#3F#}.
+@code{16#21#@dots{}16#2F#} or @code{16#3A#@dots{}16#3F#}.
 Note that this usage is not permitted
-in GNAT implementation units (i.e. when @option{-gnatg} is used).
+in GNAT implementation units (i.e., when @option{-gnatg} is used).
 
 @item
 A line consisting entirely of minus signs, possibly preceded by blanks, is
@@ -5604,57 +5924,55 @@ example:
 
 @item ^d^DOS_LINE_ENDINGS^
 @emph{Check no DOS line terminators present.}
-If the ^letter d^word DOS_LINE_ENDINGS^ appears in the string after
-@option{-gnaty} then all lines must be terminated by a single ASCII.LF
+All lines must be terminated by a single ASCII.LF
 character (in particular the DOS line terminator sequence CR/LF is not
 allowed).
 
 @item ^e^END^
 @emph{Check end/exit labels.}
-If the ^letter e^word END^ appears in the string after @option{-gnaty} then
-optional labels on @code{end} statements ending subprograms and on
+Optional labels on @code{end} statements ending subprograms and on
 @code{exit} statements exiting named loops, are required to be present.
 
 @item ^f^VTABS^
 @emph{No form feeds or vertical tabs.}
-If the ^letter f^word VTABS^ appears in the string after @option{-gnaty} then
-neither form feeds nor vertical tab characters are permitted
+Neither form feeds nor vertical tab characters are permitted
 in the source text.
 
+@item ^g^GNAT^
+@emph{GNAT style mode}
+The set of style check switches is set to match that used by the GNAT sources.
+This may be useful when developing code that is eventually intended to be
+incorporated into GNAT. For further details, see GNAT sources.
+
 @item ^h^HTABS^
 @emph{No horizontal tabs.}
-If the ^letter h^word HTABS^ appears in the string after @option{-gnaty} then
-horizontal tab characters are not permitted in the source text.
+Horizontal tab characters are not permitted in the source text.
 Together with the b (no blanks at end of line) check, this
 enforces a canonical form for the use of blanks to separate
 source tokens.
 
 @item ^i^IF_THEN^
 @emph{Check if-then layout.}
-If the ^letter i^word IF_THEN^ appears in the string after @option{-gnaty},
-then the keyword @code{then} must appear either on the same
+The keyword @code{then} must appear either on the same
 line as corresponding @code{if}, or on a line on its own, lined
 up under the @code{if} with at least one non-blank line in between
 containing all or part of the condition to be tested.
 
 @item ^I^IN_MODE^
 @emph{check mode IN keywords}
-If the ^letter I (upper case)^word IN_MODE^ appears in the string
-after @option{-gnaty} then mode @code{in} (the default mode) is not
+Mode @code{in} (the default mode) is not
 allowed to be given explicitly. @code{in out} is fine,
 but not @code{in} on its own.
 
 @item ^k^KEYWORD^
 @emph{Check keyword casing.}
-If the ^letter k^word KEYWORD^ appears in the string after @option{-gnaty} then
-all keywords must be in lower case (with the exception of keywords
+All keywords must be in lower case (with the exception of keywords
 such as @code{digits} used as attribute names to which this check
 does not apply).
 
 @item ^l^LAYOUT^
 @emph{Check layout.}
-If the ^letter l^word LAYOUT^ appears in the string after @option{-gnaty} then
-layout of statement and declaration constructs must follow the
+Layout of statement and declaration constructs must follow the
 recommendations in the Ada Reference Manual, as indicated by the
 form of the syntax rules. For example an @code{else} keyword must
 be lined up with the corresponding @code{if} keyword.
@@ -5664,7 +5982,8 @@ option are more liberal than those in the Ada Reference Manual. First
 in the case of record declarations, it is permissible to put the
 @code{record} keyword on the same line as the @code{type} keyword, and
 then the @code{end} in @code{end record} must line up under @code{type}.
-For example, either of the following two layouts is acceptable:
+This is also permitted when the type declaration is split on two lines.
+For example, any of the following three layouts is acceptable:
 
 @smallexample @c ada
 @cartouche
@@ -5678,10 +5997,17 @@ type q is
       a : integer;
       b : integer;
    end record;
-@end cartouche
-@end smallexample
 
-@noindent
+type q is
+   record
+      a : integer;
+      b : integer;
+end record;
+
+@end cartouche
+@end smallexample
+
+@noindent
 Second, in the case of a block statement, a permitted alternative
 is to put the block label on the same line as the @code{declare} or
 @code{begin} keyword, and then line the @code{end} keyword up under
@@ -5723,16 +6049,13 @@ Clear :
 
 @item ^Lnnn^MAX_NESTING=nnn^
 @emph{Set maximum nesting level}
-If the sequence ^Lnnn^MAX_NESTING=nnn^, where nnn is a decimal number in
-the range 0-999, appears in the string after @option{-gnaty} then the
-maximum level of nesting of constructs (including subprograms, loops,
-blocks, packages, and conditionals) may not exceed the given value. A
-value of zero disconnects this style check.
+The maximum level of nesting of constructs (including subprograms, loops,
+blocks, packages, and conditionals) may not exceed the given value
+@option{nnn}. A value of zero disconnects this style check.
 
 @item ^m^LINE_LENGTH^
 @emph{Check maximum line length.}
-If the ^letter m^word LINE_LENGTH^ appears in the string after @option{-gnaty}
-then the length of source lines must not exceed 79 characters, including
+The length of source lines must not exceed 79 characters, including
 any trailing blanks. The value of 79 allows convenient display on an
 80 character wide device or window, allowing for possible special
 treatment of 80 character lines. Note that this count is of
@@ -5742,46 +6065,56 @@ a single character (however many bytes are needed in the encoding).
 
 @item ^Mnnn^MAX_LENGTH=nnn^
 @emph{Set maximum line length.}
-If the sequence ^M^MAX_LENGTH=^nnn, where nnn is a decimal number, appears in
-the string after @option{-gnaty} then the length of lines must not exceed the
-given value. The maximum value that can be specified is 32767.
+The length of lines must not exceed the
+given value @option{nnn}. The maximum value that can be specified is 32767.
 
 @item ^n^STANDARD_CASING^
 @emph{Check casing of entities in Standard.}
-If the ^letter n^word STANDARD_CASING^ appears in the string
-after @option{-gnaty} then any identifier from Standard must be cased
+Any identifier from Standard must be cased
 to match the presentation in the Ada Reference Manual (for example,
 @code{Integer} and @code{ASCII.NUL}).
 
+@item ^N^NONE^
+@emph{Turn off all style checks}
+All style check options are turned off.
+
 @item ^o^ORDERED_SUBPROGRAMS^
 @emph{Check order of subprogram bodies.}
-If the ^letter o^word ORDERED_SUBPROGRAMS^ appears in the string
-after @option{-gnaty} then all subprogram bodies in a given scope
-(e.g. a package body) must be in alphabetical order. The ordering
+All subprogram bodies in a given scope
+(e.g.@: a package body) must be in alphabetical order. The ordering
 rule uses normal Ada rules for comparing strings, ignoring casing
 of letters, except that if there is a trailing numeric suffix, then
-the value of this suffix is used in the ordering (e.g. Junk2 comes
+the value of this suffix is used in the ordering (e.g.@: Junk2 comes
 before Junk10).
 
+@item ^O^OVERRIDING_INDICATORS^
+@emph{Check that overriding subprograms are explicitly marked as such.}
+The declaration of a primitive operation of a type extension that overrides
+an inherited operation must carry an overriding indicator.
+
 @item ^p^PRAGMA^
 @emph{Check pragma casing.}
-If the ^letter p^word PRAGMA^ appears in the string after @option{-gnaty} then
-pragma names must be written in mixed case, that is, the
+Pragma names must be written in mixed case, that is, the
 initial letter and any letter following an underscore must be uppercase.
 All other letters must be lowercase.
 
 @item ^r^REFERENCES^
 @emph{Check references.}
-If the ^letter r^word REFERENCES^ appears in the string after @option{-gnaty}
-then all identifier references must be cased in the same way as the
+All identifier references must be cased in the same way as the
 corresponding declaration. No specific casing style is imposed on
 identifiers. The only requirement is for consistency of references
 with declarations.
 
+@item ^S^STATEMENTS_AFTER_THEN_ELSE^
+@emph{Check no statements after THEN/ELSE.}
+No statements are allowed
+on the same line as a THEN or ELSE keyword following the
+keyword in an IF statement. OR ELSE and AND THEN are not affected,
+and a special exception allows a pragma to appear after ELSE.
+
 @item ^s^SPECS^
 @emph{Check separate specs.}
-If the ^letter s^word SPECS^ appears in the string after @option{-gnaty} then
-separate declarations (``specs'') are required for subprograms (a
+Separate declarations (``specs'') are required for subprograms (a
 body is not allowed to serve as its own declaration). The only
 exception is that parameterless library level procedures are
 not required to have a separate declaration. This exception covers
@@ -5789,8 +6122,7 @@ the most frequent form of main program procedures.
 
 @item ^t^TOKEN^
 @emph{Check token spacing.}
-If the ^letter t^word TOKEN^ appears in the string after @option{-gnaty} then
-the following token spacing rules are enforced:
+The following token spacing rules are enforced:
 
 @itemize @bullet
 
@@ -5839,16 +6171,47 @@ A vertical bar must be surrounded by spaces.
 
 @item ^u^UNNECESSARY_BLANK_LINES^
 @emph{Check unnecessary blank lines.}
-Check for unnecessary blank lines. A blank line is considered
+Unnecessary blank lines are not allowed. A blank line is considered
 unnecessary if it appears at the end of the file, or if more than
 one blank line occurs in sequence.
 
 @item ^x^XTRA_PARENS^
 @emph{Check extra parentheses.}
-Check for the use of an unnecessary extra level of parentheses (C-style)
+Unnecessary extra level of parentheses (C-style) are not allowed
 around conditions in @code{if} statements, @code{while} statements and
 @code{exit} statements.
 
+@item ^y^ALL_BUILTIN^
+@emph{Set all standard style check options}
+This is equivalent to @code{gnaty3aAbcefhiklmnprst}, that is all checking
+options enabled with the exception of @option{-gnatyo}, @option{-gnatyI},
+@option{-gnatyS}, @option{-gnatyLnnn},
+@option{-gnatyd}, @option{-gnatyu}, and @option{-gnatyx}.
+
+@ifclear vms
+@item -
+@emph{Remove style check options}
+This causes any subsequent options in the string to act as canceling the
+corresponding style check option. To cancel maximum nesting level control,
+use @option{L} parameter witout any integer value after that, because any
+digit following @option{-} in the parameter string of the @option{-gnaty}
+option will be threated as canceling indentation check. The same is true
+for @option{M} parameter. @option{y} and @option{N} parameters are not
+allowed after @option{-}.
+
+@item +
+This causes any subsequent options in the string to enable the corresponding
+style check option. That is, it cancels the effect of a previous ^-^REMOVE^,
+if any.
+@end ifclear
+
+@ifset vms
+@item NOxxx
+@emph{Removing style check options}
+If the name of a style check is preceded by @option{NO} then the corresponding
+style check is turned off. For example @option{NOCOMMENTS} turns off style
+checking for comments.
+@end ifset
 @end table
 
 @noindent
@@ -5871,18 +6234,18 @@ including style messages, as fatal errors.
 The switch
 @ifclear vms
 @option{-gnaty} on its own (that is not
-followed by any letters or digits),
-is equivalent to @code{gnaty3abcefhiklmnprst}, that is all checking
-options enabled with the exception of @option{-gnatyo},
-@option{-gnatyd}, @option{-gnatyu}, and @option{-gnatyx}.
+followed by any letters or digits), then the effect is equivalent
+to the use of @option{-gnatyy}, as described above, that is all
+built-in standard style check options are enabled.
+
 @end ifclear
 @ifset vms
 /STYLE_CHECKS=ALL_BUILTIN enables all checking options with
 the exception of ORDERED_SUBPROGRAMS, UNNECESSARY_BLANK_LINES,
 XTRA_PARENS, and DOS_LINE_ENDINGS. In addition
 @end ifset
-an indentation level of 3 is set. This is similar to the standard
-checking option that is used for the GNAT sources.
+
+
 
 The switch
 @ifclear vms
@@ -5902,14 +6265,11 @@ clears any previously set style checks.
 @cindex Checks, stack overflow checking
 
 @noindent
-If you compile with the default options, GNAT will insert many run-time
-checks into the compiled code, including code that performs range
-checking against constraints, but not arithmetic overflow checking for
-integer operations (including division by zero), checks for access
-before elaboration on subprogram calls, or stack overflow checking. All
-other run-time checks, as required by the Ada 95 Reference Manual, are
-generated by default. The following @command{gcc} switches refine this
-default behavior:
+By default, the following checks are suppressed: integer overflow
+checks, stack overflow checks, and checks for access before
+elaboration on subprogram calls. All other checks, including range
+checks and array bounds checks, are turned on by default. The
+following @command{gcc} switches refine this default behavior.
 
 @table @option
 @c !sort!
@@ -5918,13 +6278,33 @@ default behavior:
 @cindex Suppressing checks
 @cindex Checks, suppressing
 @findex Suppress
-Suppress all run-time checks as though @code{pragma Suppress (all_checks})
+Suppress all run-time checks as though @code{pragma Suppress (All_checks)}
 had been present in the source. Validity checks are also suppressed (in
 other words @option{-gnatp} also implies @option{-gnatVn}.
 Use this switch to improve the performance
 of the code at the expense of safety in the presence of invalid data or
 program bugs.
 
+Note that when checks are suppressed, the compiler is allowed, but not
+required, to omit the checking code. If the run-time cost of the
+checking code is zero or near-zero, the compiler will generate it even
+if checks are suppressed. In particular, if the compiler can prove
+that a certain check will necessarily fail, it will generate code to
+do an unconditional ``raise'', even if checks are suppressed. The
+compiler warns in this case.
+
+Of course, run-time checks are omitted whenever the compiler can prove
+that they will not fail, whether or not checks are suppressed.
+
+Note that if you suppress a check that would have failed, program
+execution is erroneous, which means the behavior is totally
+unpredictable. The program might crash, or print wrong answers, or
+do anything else. It might even do exactly what you wanted it to do
+(and then it might start failing mysteriously next week or next
+year). The compiler will generate code based on the assumption that
+the condition being checked is true, which can result in disaster if
+that assumption is wrong.
+
 @item -gnato
 @cindex @option{-gnato} (@command{gcc})
 @cindex Overflow checks
@@ -5938,12 +6318,12 @@ the true value of the result of an operation may be outside the base
 range of the result type. The following example shows the distinction:
 
 @smallexample @c ada
-X1 : Integer := Integer'Last;
-X2 : Integer range 1 .. 5 := 5;
-X3 : Integer := Integer'Last;
-X4 : Integer range 1 .. 5 := 5;
-F  : Float := 2.0E+20;
-...
+X1 : Integer := "Integer'Last";
+X2 : Integer range 1 .. 5 := "5";
+X3 : Integer := "Integer'Last";
+X4 : Integer range 1 .. 5 := "5";
+F  : Float := "2.0E+20";
+@dots{}
 X1 := X1 + 1;
 X2 := X2 + 1;
 X3 := Integer (F);
@@ -5951,15 +6331,23 @@ X4 := Integer (F);
 @end smallexample
 
 @noindent
+Note that if explicit values are assigned at compile time, the
+compiler may be able to detect overflow at compile time, in which case
+no actual run-time checking code is required, and Constraint_Error
+will be raised unconditionally, with or without
+@option{-gnato}. That's why the assigned values in the above fragment
+are in quotes, the meaning is "assign a value not known to the
+compiler that happens to be equal to ...". The remaining discussion
+assumes that the compiler cannot detect the values at compile time.
+
 Here the first addition results in a value that is outside the base range
 of Integer, and hence requires an overflow check for detection of the
 constraint error. Thus the first assignment to @code{X1} raises a
 @code{Constraint_Error} exception only if @option{-gnato} is set.
 
-The second increment operation results in a violation
-of the explicit range constraint, and such range checks are always
-performed (unless specifically suppressed with a pragma @code{suppress}
-or the use of @option{-gnatp}).
+The second increment operation results in a violation of the explicit
+range constraint; such range checks are performed by default, and are
+unaffected by @option{-gnato}.
 
 The two conversions of @code{F} both result in values that are outside
 the base range of type @code{Integer} and thus will raise
@@ -5994,12 +6382,12 @@ generate IEEE NaN and infinite values on overflow or invalid operations
 (such as dividing 0.0 by 0.0).
 
 The reason that we distinguish overflow checking from other kinds of
-range constraint checking is that a failure of an overflow check can
-generate an incorrect value, but cannot cause erroneous behavior. This
-is unlike the situation with a constraint check on an array subscript,
-where failure to perform the check can result in random memory description,
-or the range check on a case statement, where failure to perform the check
-can cause a wild jump.
+range constraint checking is that a failure of an overflow check, unlike
+for example the failure of a range check, can result in an incorrect
+value, but cannot cause random memory destruction (like an out of range
+subscript), or a wild jump (from an out of range case value). Overflow
+checking is also quite expensive in time and space, since in general it
+requires the use of double length arithmetic.
 
 Note again that @option{-gnato} is off by default, so overflow checking is
 not performed in default mode. This means that out of the box, with the
@@ -6015,6 +6403,8 @@ explicitly use the -gnato switch either on the @command{gnatmake} or
 @cindex Check, elaboration
 Enables dynamic checks for access-before-elaboration
 on subprogram calls and generic instantiations.
+Note that @option{-gnatE} is not necessary for safety, because in the
+default mode, GNAT ensures statically that the checks would not fail.
 For full details of the effect and use of this switch,
 @xref{Compiling Using gcc}.
 
@@ -6100,7 +6490,7 @@ The @code{c} stands for ``check''.
 @end ifclear
 Causes the compiler to operate in semantic check mode,
 with full checking for all illegalities specified in the
-Ada 95 Reference Manual, but without generation of any object code
+Ada Reference Manual, but without generation of any object code
 (no object file is generated).
 
 Because dependent files must be accessed, you must follow the GNAT
@@ -6123,7 +6513,7 @@ generated. An @file{ALI} file is generated for use in the context of
 cross-reference tools, but this file is marked as not being suitable
 for binding (since no object file is generated).
 The checking corresponds exactly to the notion of
-legality in the Ada 95 Reference Manual.
+legality in the Ada Reference Manual.
 
 Any unit can be compiled in semantics-checking-only mode, including
 units that would not normally be compiled (subunits,
@@ -6132,87 +6522,84 @@ and specifications where a separate body is present).
 
 @node Compiling Different Versions of Ada
 @subsection Compiling Different Versions of Ada
+
+@noindent
+The switches described in this section allow you to explicitly specify
+the version of the Ada language that your programs are written in.
+By default @value{EDITION} assumes @value{DEFAULTLANGUAGEVERSION},
+but you can also specify @value{NONDEFAULTLANGUAGEVERSION} or
+indicate Ada 83 compatibility mode.
+
 @table @option
 @cindex Compatibility with Ada 83
-@cindex Ada 83 mode
-@cindex Ada 95 mode
-@cindex Ada 2005 mode
-
-GNAT is primarily an Ada 95 compiler, but the switches described in
-this section allow operation in Ada 83 compatibility mode, and also
-allow the use of a preliminary implementation of many of the expected
-new features in Ada 2005, the forthcoming new version of the standard.
 
 @item -gnat83 (Ada 83 Compatibility Mode)
 @cindex @option{-gnat83} (@command{gcc})
 @cindex ACVC, Ada 83 tests
+@cindex Ada 83 mode
 
 @noindent
-Although GNAT is primarily an Ada 95 compiler, it accepts this switch to
-specify that an Ada 83 program is to be compiled in Ada 83 mode. If you specify
-this switch, GNAT rejects most Ada 95 extensions and applies Ada 83 semantics
-where this can be done easily.
+Although GNAT is primarily an Ada 95 / Ada 2005 compiler, this switch
+specifies that the program is to be compiled in Ada 83 mode. With
+@option{-gnat83}, GNAT rejects most post-Ada 83 extensions and applies Ada 83
+semantics where this can be done easily.
 It is not possible to guarantee this switch does a perfect
-job; for example, some subtle tests, such as are
+job; some subtle tests, such as are
 found in earlier ACVC tests (and that have been removed from the ACATS suite
 for Ada 95), might not compile correctly.
 Nevertheless, this switch may be useful in some circumstances, for example
-where, due to contractual reasons, legacy code needs to be maintained
+where, due to contractual reasons, existing code needs to be maintained
 using only Ada 83 features.
 
 With few exceptions (most notably the need to use @code{<>} on
 @cindex Generic formal parameters
-unconstrained generic formal parameters, the use of the new Ada 95
+unconstrained generic formal parameters, the use of the new Ada 95 / Ada 2005
 reserved words, and the use of packages
-with optional bodies), it is not necessary to use the
+with optional bodies), it is not necessary to specify the
 @option{-gnat83} switch when compiling Ada 83 programs, because, with rare
-exceptions, Ada 95 is upwardly compatible with Ada 83. This
-means that a correct Ada 83 program is usually also a correct Ada 95
-program.
+exceptions, Ada 95 and Ada 2005 are upwardly compatible with Ada 83. Thus
+a correct Ada 83 program is usually also a correct program
+in these later versions of the language standard.
 For further information, please refer to @ref{Compatibility and Porting Guide}.
 
 @item -gnat95 (Ada 95 mode)
 @cindex @option{-gnat95} (@command{gcc})
+@cindex Ada 95 mode
 
 @noindent
-GNAT is primarily an Ada 95 compiler, and all current releases of GNAT Pro
-compile in Ada 95 mode by default. Typically, Ada 95 is sufficiently upwards
-compatible with Ada 83, that legacy Ada 83 programs may be compiled using
-this default Ada95 mode without problems (see section above describing the
-use of @option{-gnat83} to run in Ada 83 mode).
+This switch directs the compiler to implement the Ada 95 version of the
+language.
+Since Ada 95 is almost completely upwards
+compatible with Ada 83, Ada 83 programs may generally be compiled using
+this switch (see the description of the @option{-gnat83} switch for further
+information about Ada 83 mode).
+If an Ada 2005 program is compiled in Ada 95 mode,
+uses of the new Ada 2005 features will cause error
+messages or warnings.
 
-In Ada 95 mode, the use of Ada 2005 features will in general cause error
-messages or warnings. Some specialized releases of GNAT (notably the GPL
-edition) operate in Ada 2005 mode by default (see section below
-describing the use of @option{-gnat05} to run in Ada 2005 mode). For such
-versions the @option{-gnat95} switch may be used to enforce Ada 95 mode.
-This option also can be used to cancel the effect of a previous
+This switch also can be used to cancel the effect of a previous
 @option{-gnat83} or @option{-gnat05} switch earlier in the command line.
 
 @item -gnat05 (Ada 2005 mode)
 @cindex @option{-gnat05} (@command{gcc})
+@cindex Ada 2005 mode
 
 @noindent
-Although GNAT is primarily an Ada 95 compiler, it can be set to operate
-in Ada 2005 mode using this option. Although the new standard has not
-yet been issued (as of early 2005), many features have been discussed and
-approved in ``Ada Issues'' (AI's). For the text of these AI's, see
-@url{www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs}. Included with GNAT
-releases is a file @file{features-ada0y} that describes the current set
-of implemented Ada 2005 features.
-
-If these features are used in Ada 95 mode (which is the normal default),
-then error messages or warnings may be
-generated, reflecting the fact that these new features are otherwise
-unauthorized extensions to Ada 95. The use of the @option{-gnat05}
-switch (or an equivalent pragma) causes these messages to be suppressed.
-
-Note that some specialized releases of GNAT (notably the GPL edition)
-have Ada 2005 mode on by default, and in such environments,
-the Ada 2005 features can be used freely without the use of switches.
+This switch directs the compiler to implement the Ada 2005 version of the
+language.
+Since Ada 2005 is almost completely upwards
+compatible with Ada 95 (and thus also with Ada 83), Ada 83 and Ada 95 programs
+may generally be compiled using this switch (see the description of the
+@option{-gnat83} and @option{-gnat95} switches for further
+information).
 
+For information about the approved ``Ada Issues'' that have been incorporated
+into Ada 2005, see @url{http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs}.
+Included with GNAT releases is a file @file{features-ada0y} that describes
+the set of implemented Ada 2005 features.
 @end table
 
+
 @node Character Set Control
 @subsection Character Set Control
 @table @option
@@ -6221,7 +6608,7 @@ the Ada 2005 features can be used freely without the use of switches.
 
 @noindent
 Normally GNAT recognizes the Latin-1 character set in source program
-identifiers, as described in the Ada 95 Reference Manual.
+identifiers, as described in the Ada Reference Manual.
 This switch causes
 GNAT to recognize alternate character sets in identifiers. @var{c} is a
 single character ^^or word^ indicating the character set, as follows:
@@ -6294,15 +6681,20 @@ For full details on these encoding
 methods see @ref{Wide Character Encodings}.
 Note that brackets coding is always accepted, even if one of the other
 options is specified, so for example @option{-gnatW8} specifies that both
-brackets and @code{UTF-8} encodings will be recognized. The units that are
+brackets and UTF-8 encodings will be recognized. The units that are
 with'ed directly or indirectly will be scanned using the specified
 representation scheme, and so if one of the non-brackets scheme is
 used, it must be used consistently throughout the program. However,
 since brackets encoding is always recognized, it may be conveniently
 used in standard libraries, allowing these libraries to be used with
 any of the available coding schemes.
-scheme. If no @option{-gnatW?} parameter is present, then the default
-representation is Brackets encoding only.
+scheme.
+
+If no @option{-gnatW?} parameter is present, then the default
+representation is normally Brackets encoding only. However, if the
+first three characters of the file are 16#EF# 16#BB# 16#BF# (the standard
+byte order mark or BOM for UTF-8), then these three characters are
+skipped and the default representation for the file is set to UTF-8.
 
 Note that the wide character representation that is specified (explicitly
 or by default) for the main program also acts as the default encoding used
@@ -6352,12 +6744,14 @@ see @ref{Inlining of Subprograms}.
 
 @item -gnatN
 @cindex @option{-gnatN} (@command{gcc})
-The front end inlining activated by this switch is generally more extensive,
-and quite often more effective than the standard @option{-gnatn} inlining mode.
-It will also generate additional dependencies.
-Note that
-@option{-gnatN} automatically implies @option{-gnatn} so it is not necessary
-to specify both options.
+This switch activates front-end inlining which also
+generates additional dependencies.
+
+When using a gcc-based back end (in practice this means using any version
+of GNAT other than the JGNAT, .NET or GNAAMP versions), then the use of
+@option{-gnatN} is deprecated, and the use of @option{-gnatn} is preferred.
+Historically front end inlining was more extensive than the gcc back end
+inlining, but that is no longer the case.
 @end table
 
 @node Auxiliary Output Control
@@ -6422,7 +6816,7 @@ switches in the body of the @code{Debug} unit in the compiler source
 file @file{debug.adb}.
 @end ifclear
 
-@item -gnatG
+@item -gnatG[=nn]
 @cindex @option{-gnatG} (@command{gcc})
 This switch causes the compiler to generate auxiliary output containing
 a pseudo-source listing of the generated expanded code. Like most Ada
@@ -6432,16 +6826,21 @@ into calls to the tasking run-time routines. A unique capability of GNAT
 is to list this expanded code in a form very close to normal Ada source.
 This is very useful in understanding the implications of various Ada
 usage on the efficiency of the generated code. There are many cases in
-Ada (e.g. the use of controlled types), where simple Ada statements can
+Ada (e.g.@: the use of controlled types), where simple Ada statements can
 generate a lot of run-time code. By using @option{-gnatG} you can identify
 these cases, and consider whether it may be desirable to modify the coding
 approach to improve efficiency.
 
+The optional parameter @code{nn} if present after -gnatG specifies an
+alternative maximum line length that overrides the normal default of 72.
+This value is in the range 40-999999, values less than 40 being silently
+reset to 40. The equal sign is optional.
+
 The format of the output is very similar to standard Ada source, and is
 easily understood by an Ada programmer. The following special syntactic
 additions correspond to low level features used in the generated code that
 do not have any exact analogies in pure Ada source form. The following
-is a partial list of these special constructions. See the specification
+is a partial list of these special constructions. See the spec
 of package @code{Sprint} in file @file{sprint.ads} for a full list.
 
 If the switch @option{-gnatL} is used in conjunction with
@@ -6450,7 +6849,7 @@ If the switch @option{-gnatL} is used in conjunction with
 in the expanded source (as comment lines with the original line number).
 
 @table @code
-@item new @var{xxx} [storage_pool = @var{yyy}]
+@item new @var{xxx} @r{[}storage_pool = @var{yyy}@r{]}
 Shows the storage pool being used for an allocator.
 
 @item at end @var{procedure-name};
@@ -6476,14 +6875,14 @@ Combines the above two cases.
 A division or multiplication of fixed-point values which are treated as
 integers without any kind of scaling.
 
-@item free @var{expr} [storage_pool = @var{xxx}]
+@item free @var{expr} @r{[}storage_pool = @var{xxx}@r{]}
 Shows the storage pool associated with a @code{free} statement.
 
 @item [subtype or type declaration]
 Used to list an equivalent declaration for an internally generated
 type that is referenced elsewhere in the listing.
 
-@item freeze @var{type-name} [@var{actions}]
+@item freeze @var{type-name} @ovar{actions}
 Shows the point at which @var{type-name} is frozen, with possible
 associated actions to be performed at the freeze point.
 
@@ -6501,7 +6900,7 @@ An implicit call to a run-time support routine
 (to meet the requirement of H.3.1(9) in a
 convenient manner).
 
-@item @var{expr} && @var{expr} && @var{expr} ... && @var{expr}
+@item @var{expr} && @var{expr} && @var{expr} @dots{} && @var{expr}
 A multiple concatenation (same effect as @var{expr} & @var{expr} &
 @var{expr}, but handled more efficiently).
 
@@ -6520,7 +6919,7 @@ representation in base 2-16 (for example, the result of compile time
 evaluation of the expression 1.0/27.0).
 @end table
 
-@item -gnatD
+@item -gnatD[=nn]
 @cindex @option{-gnatD} (@command{gcc})
 When used in conjunction with @option{-gnatG}, this switch causes
 the expanded source, as described above for
@@ -6548,8 +6947,23 @@ If the switch @option{-gnatL} is used in conjunction with
 @option{-gnatDG}, then the original source lines are interspersed
 in the expanded source (as comment lines with the original line number).
 
+The optional parameter @code{nn} if present after -gnatD specifies an
+alternative maximum line length that overrides the normal default of 72.
+This value is in the range 40-999999, values less than 40 being silently
+reset to 40. The equal sign is optional.
+
+@item -gnatr
+@cindex @option{-gnatr} (@command{gcc})
+@cindex pragma Restrictions
+This switch causes pragma Restrictions to be treated as Restriction_Warnings
+so that violation of restrictions causes warnings rather than illegalities.
+This is useful during the development process when new restrictions are added
+or investigated. The switch also causes pragma Profile to be treated as
+Profile_Warnings, and pragma Restricted_Run_Time and pragma Ravenscar set
+restriction warnings rather than restrictions.
+
 @ifclear vms
-@item -gnatR[0|1|2|3[s]]
+@item -gnatR@r{[}0@r{|}1@r{|}2@r{|}3@r{[}s@r{]]}
 @cindex @option{-gnatR} (@command{gcc})
 This switch controls output from the compiler of a listing showing
 representation information for declared types and objects. For
@@ -6558,12 +6972,13 @@ the @option{-gnatR} switch). For @option{-gnatR1} (which is the default,
 so @option{-gnatR} with no parameter has the same effect), size and alignment
 information is listed for declared array and record types. For
 @option{-gnatR2}, size and alignment information is listed for all
+declared types and objects. Finally @option{-gnatR3} includes symbolic
 expressions for values that are computed at run time for
 variant records. These symbolic expressions have a mostly obvious
 format with #n being used to represent the value of the n'th
 discriminant. See source files @file{repinfo.ads/adb} in the
 @code{GNAT} sources for full details on the format of @option{-gnatR3}
-output. If the switch is followed by an s (e.g. @option{-gnatR2s}), then
+output. If the switch is followed by an s (e.g.@: @option{-gnatR2s}), then
 the output is to a file with the name @file{^file.rep^file_REP^} where
 file is the name of the corresponding source file.
 @end ifclear
@@ -6586,7 +7001,7 @@ discriminant. See source files @file{REPINFO.ADS/ADB} in the
 @code{GNAT} sources for full details on the format of
 @option{/REPRESENTATION_INFO=SYMBOLIC} output.
 If _FILE is added at the end of an option
-(e.g. @option{/REPRESENTATION_INFO=ARRAYS_FILE}),
+(e.g.@: @option{/REPRESENTATION_INFO=ARRAYS_FILE}),
 then the output is to a file with the name @file{file_REP} where
 file is the name of the corresponding source file.
 @end ifset
@@ -6594,6 +7009,12 @@ Note that it is possible for record components to have zero size. In
 this case, the component clause uses an obvious extension of permitted
 Ada syntax, for example @code{at 0 range 0 .. -1}.
 
+Representation information requires that code be generated (since it is the
+code generator that lays out complex data structures). If an attempt is made
+to output representation information when no code is generated, for example
+when a subunit is compiled on its own, then no information can be generated
+and the compiler outputs a message to this effect.
+
 @item -gnatS
 @cindex @option{-gnatS} (@command{gcc})
 The use of the switch @option{-gnatS} for an
@@ -6642,7 +7063,7 @@ to propagate an exception through a C/C++ code, the C/C++ code
 must be compiled with the @option{-funwind-tables} GCC's
 option.
 
-The following switches can be used to control which of the
+The following switches may be used to control which of the
 two exception handling methods is used.
 
 @table @option
@@ -6650,9 +7071,8 @@ two exception handling methods is used.
 
 @item --RTS=sjlj
 @cindex @option{--RTS=sjlj} (@command{gnatmake})
-This switch causes the setjmp/longjmp run-time to be used
-for exception handling. If this is the default mechanism for the
-target (see below), then this has no effect. If the default
+This switch causes the setjmp/longjmp run-time (when available) to be used
+for exception handling. If the default
 mechanism for the target is zero cost exceptions, then
 this switch can be used to modify this default, and must be
 used for all units in the partition.
@@ -6666,12 +7086,12 @@ application is improved by favoring exception propagation.
 @cindex Zero Cost Exceptions
 This switch causes the zero cost approach to be used
 for exception handling. If this is the default mechanism for the
-target (see below), then this has no effect. If the default
+target (see below), then this switch is unneeded. If the default
 mechanism for the target is setjmp/longjmp exceptions, then
 this switch can be used to modify this default, and must be
 used for all units in the partition.
 This option can only be used if the zero cost approach
-is available for the target in use (see below).
+is available for the target in use, otherwise it will generate an error.
 @end table
 
 @noindent
@@ -6680,18 +7100,6 @@ and @command{gnatbind}. Passing this option to @command{gnatmake}
 (@pxref{Switches for gnatmake}) will ensure the required consistency
 through the compilation and binding steps.
 
-The @code{setjmp/longjmp} approach is available on all targets, while
-the @code{zero cost} approach is available on selected targets.
-To determine whether zero cost exceptions can be used for a
-particular target, look at the private part of the file system.ads.
-Either @code{GCC_ZCX_Support} or @code{Front_End_ZCX_Support} must
-be True to use the zero cost approach. If both of these switches
-are set to False, this means that zero cost exception handling
-is not yet available for that target. The switch
-@code{ZCX_By_Default} indicates the default approach. If this
-switch is set to True, then the @code{zero cost} approach is
-used by default.
-
 @node Units to Sources Mapping Files
 @subsection Units to Sources Mapping Files
 
@@ -6717,7 +7125,7 @@ for completeness and for possible use by other tools.
 A mapping file is a sequence of sets of three lines. In each set,
 the first line is the unit name, in lower case, with ``@code{%s}''
 appended for
-specifications and ``@code{%b}'' appended for bodies; the second line is the
+specs and ``@code{%b}'' appended for bodies; the second line is the
 file name; and the third line is the path name.
 
 Example:
@@ -6729,8 +7137,8 @@ Example:
 
 When the switch @option{-gnatem} is specified, the compiler will create
 in memory the two mappings from the specified file. If there is any problem
-(non existent file, truncated file or duplicate entries), no mapping
-will be created.
+(nonexistent file, truncated file or duplicate entries), no mapping will
+be created.
 
 Several @option{-gnatem} switches may be specified; however, only the last
 one on the command line will be taken into account.
@@ -6744,7 +7152,8 @@ and communicates it to the compiler using this switch.
 @subsection Integrated Preprocessing
 
 @noindent
-GNAT sources may be preprocessed immediately before compilation; the actual
+GNAT sources may be preprocessed immediately before compilation.
+In this case, the actual
 text of the source is not the text of the source file, but is derived from it
 through a process called preprocessing. Integrated preprocessing is specified
 through switches @option{-gnatep} and/or @option{-gnateD}. @option{-gnatep}
@@ -6752,6 +7161,13 @@ indicates, through a text file, the preprocessing data to be used.
 @option{-gnateD} specifies or modifies the values of preprocessing symbol.
 
 @noindent
+Note that when integrated preprocessing is used, the output from the
+preprocessor is not written to any external file. Instead it is passed
+internally to the compiler. If you need to preserve the result of
+preprocessing in a file, then you should use @command{gnatprep}
+to perform the desired preprocessing in stand-alone mode.
+
+@noindent
 It is recommended that @command{gnatmake} switch ^-s^/SWITCH_CHECK^ should be
 used when Integrated Preprocessing is used. The reason is that preprocessing
 with another Preprocessing Data file without changing the sources will
@@ -6779,7 +7195,7 @@ should be found in the source directories.
 @noindent
 A preprocessing data file is a text file with significant lines indicating
 how should be preprocessed either a specific source or all sources not
-mentioned in other lines. A significant line is a non empty, non comment line.
+mentioned in other lines. A significant line is a nonempty, non-comment line.
 Comments are similar to Ada comments.
 
 @noindent
@@ -6854,7 +7270,7 @@ Examples of valid lines in a preprocessor data file:
   --  list all symbols with their values.
 @end smallexample
 
-@item ^-gnateD^/DATA_PREPROCESSING=^symbol[=value]
+@item ^-gnateD^/DATA_PREPROCESSING=^symbol@r{[}=value@r{]}
 @cindex @option{-gnateD} (@command{gcc})
 Define or redefine a preprocessing symbol, associated with value. If no value
 is given on the command line, then the value of the symbol is @code{True}.
@@ -6872,6 +7288,11 @@ symbol with the same name either in a definition file or specified with a
 @noindent
 This switch is similar to switch @option{^-D^/ASSOCIATE^} of @code{gnatprep}.
 
+@item -gnateG
+When integrated preprocessing is performed and the preprocessor modifies
+the source text, write the result of this preprocessing into a file
+<source>^.prep^_prep^.
+
 @end table
 
 @node Code Generation Control
@@ -6882,9 +7303,9 @@ This switch is similar to switch @option{^-D^/ASSOCIATE^} of @code{gnatprep}.
 The GCC technology provides a wide range of target dependent
 @option{-m} switches for controlling
 details of code generation with respect to different versions of
-architectures. This includes variations in instruction sets (e.g.
+architectures. This includes variations in instruction sets (e.g.@:
 different members of the power pc family), and different requirements
-for optimal arrangement of instructions (e.g. different members of
+for optimal arrangement of instructions (e.g.@: different members of
 the x86 family). The list of available @option{-m} switches may be
 found in the GCC documentation.
 
@@ -6911,7 +7332,7 @@ unless you actually see a performance improvement.
 
 @noindent
 On VMS, GNAT compiled programs return POSIX-style codes by default,
-e.g. @option{/RETURN_CODES=POSIX}.
+e.g.@: @option{/RETURN_CODES=POSIX}.
 
 To enable VMS style return codes, use GNAT BIND and LINK with the option
 @option{/RETURN_CODES=VMS}. For example:
@@ -6954,20 +7375,20 @@ Each directory named by an @option{^-I^/SOURCE_SEARCH^} switch given on the
 @item
 @findex ADA_PRJ_INCLUDE_FILE
 Each of the directories listed in the text file whose name is given
-by the @code{ADA_PRJ_INCLUDE_FILE} ^environment variable^logical name^.
+by the @env{ADA_PRJ_INCLUDE_FILE} ^environment variable^logical name^.
 
 @noindent
-@code{ADA_PRJ_INCLUDE_FILE} is normally set by gnatmake or by the ^gnat^GNAT^
+@env{ADA_PRJ_INCLUDE_FILE} is normally set by gnatmake or by the ^gnat^GNAT^
 driver when project files are used. It should not normally be set
 by other means.
 
 @item
 @findex ADA_INCLUDE_PATH
 Each of the directories listed in the value of the
-@code{ADA_INCLUDE_PATH} ^environment variable^logical name^.
+@env{ADA_INCLUDE_PATH} ^environment variable^logical name^.
 @ifclear vms
 Construct this value
-exactly as the @code{PATH} environment variable: a list of directory
+exactly as the @env{PATH} environment variable: a list of directory
 names separated by colons (semicolons when working with the NT version).
 @end ifclear
 @ifset vms
@@ -6984,11 +7405,11 @@ DEFINE ADA_INCLUDE_PATH ANOTHER_PATH,FOO:[BAM],FOO:[BAR]
 @end smallexample
 
 By default, the path includes GNU:[LIB.OPENVMS7_x.2_8_x.DECLIB]
-first, followed by the standard Ada 95
+first, followed by the standard Ada
 libraries in GNU:[LIB.OPENVMS7_x.2_8_x.ADAINCLUDE].
 If this is not redefined, the user will obtain the HP Ada 83 IO packages
 (Text_IO, Sequential_IO, etc)
-instead of the Ada95 packages. Thus, in order to get the Ada 95
+instead of the standard Ada packages. Thus, in order to get the standard Ada
 packages by default, ADA_INCLUDE_PATH must be redefined.
 @end ifset
 
@@ -7034,8 +7455,8 @@ the built-in defaults cause these files to be found.
 In addition to the language-defined hierarchies (@code{System}, @code{Ada} and
 @code{Interfaces}), the GNAT distribution provides a fourth hierarchy,
 consisting of child units of @code{GNAT}. This is a collection of generally
-useful types, subprograms, etc. See the @cite{GNAT Reference Manual} for
-further details.
+useful types, subprograms, etc. @xref{Top, GNAT Reference Manual, About
+This Guid, gnat_rm, GNAT Reference Manual}, for further details.
 
 Besides simplifying access to the RTL, a major use of search paths is
 in compiling sources from multiple directories. This can make
@@ -7119,20 +7540,24 @@ mode.
 
 @noindent
 This chapter describes the GNAT binder, @code{gnatbind}, which is used
-to bind compiled GNAT objects. The @code{gnatbind} program performs
-four separate functions:
+to bind compiled GNAT objects.
+
+Note: to invoke @code{gnatbind} with a project file, use the @code{gnat}
+driver (see @ref{The GNAT Driver and Project Files}).
+
+The @code{gnatbind} program performs four separate functions:
 
 @enumerate
 @item
 Checks that a program is consistent, in accordance with the rules in
-Chapter 10 of the Ada 95 Reference Manual. In particular, error
+Chapter 10 of the Ada Reference Manual. In particular, error
 messages are generated if a program uses inconsistent versions of a
 given unit.
 
 @item
 Checks that an acceptable order of elaboration exists for the program
 and issues an error message if it cannot find an order of elaboration
-that satisfies the rules in Chapter 10 of the Ada 95 Language Manual.
+that satisfies the rules in Chapter 10 of the Ada Language Manual.
 
 @item
 Generates a main program incorporating the given elaboration order.
@@ -7157,14 +7582,14 @@ to be read by the @command{gnatlink} utility used to link the Ada application.
 The form of the @code{gnatbind} command is
 
 @smallexample
-$ gnatbind [@i{switches}] @i{mainprog}[.ali] [@i{switches}]
+$ gnatbind @ovar{switches} @var{mainprog}@r{[}.ali@r{]} @ovar{switches}
 @end smallexample
 
 @noindent
-where @file{@i{mainprog}.adb} is the Ada file containing the main program
+where @file{@var{mainprog}.adb} is the Ada file containing the main program
 unit body. If no switches are specified, @code{gnatbind} constructs an Ada
 package in two files whose names are
-@file{b~@i{mainprog}.ads}, and @file{b~@i{mainprog}.adb}.
+@file{b~@var{mainprog}.ads}, and @file{b~@var{mainprog}.adb}.
 For example, if given the
 parameter @file{hello.ali}, for a main program contained in file
 @file{hello.adb}, the binder output files would be @file{b~hello.ads}
@@ -7259,6 +7684,23 @@ be presented in subsequent sections.
 
 @table @option
 @c !sort!
+
+@item --version
+@cindex @option{--version} @command{gnatbind}
+Display Copyright and version, then exit disregarding all other options.
+
+@item --help
+@cindex @option{--help} @command{gnatbind}
+If @option{--version} was not used, display usage, then exit disregarding
+all other options.
+
+@item -a
+@cindex @option{-a} @command{gnatbind}
+Indicates that, if supported by the platform, the adainit procedure should
+be treated as an initialisation routine by the linker (a constructor). This
+is intended to be used by the Project Manager to automatically initialize
+shared Stand-Alone Libraries.
+
 @item ^-aO^/OBJECT_SEARCH^
 @cindex @option{^-aO^/OBJECT_SEARCH^} (@command{gnatbind})
 Specify directory to be searched for ALI files.
@@ -7283,20 +7725,20 @@ Check only, no generation of binder output file.
 @cindex @option{^-C^/BIND_FILE=C^} (@command{gnatbind})
 Generate binder program in C
 
-@item ^-d^/DEFAULT_STACK_SIZE=^@var{nn}[k|m]
-@cindex @option{^-d^/DEFAULT_STACK_SIZE=^@var{nn}[k|m]} (@command{gnatbind})
+@item ^-d^/DEFAULT_STACK_SIZE=^@var{nn}@r{[}k@r{|}m@r{]}
+@cindex @option{^-d^/DEFAULT_STACK_SIZE=^@var{nn}@r{[}k@r{|}m@r{]}} (@command{gnatbind})
 This switch can be used to change the default task stack size value
 to a specified size @var{nn}, which is expressed in bytes by default, or
 in kilobytes when suffixed with @var{k} or in megabytes when suffixed
 with @var{m}.
-In the absence of a [k|m] suffix, this switch is equivalent, in effect,
-to completing all task specs with
+In the absence of a @samp{@r{[}k@r{|}m@r{]}} suffix, this switch is equivalent,
+in effect, to completing all task specs with
 @smallexample @c ada
    pragma Storage_Size (nn);
 @end smallexample
 When they do not already have such a pragma.
 
-@item ^-D^/DEFAULT_SECONDARY_STACK_SIZE=^@var{nn}[k|m]
+@item ^-D^/DEFAULT_SECONDARY_STACK_SIZE=^@var{nn}@r{[}k@r{|}m@r{]}
 @cindex @option{^-D^/DEFAULT_SECONDARY_STACK_SIZE=nnnnn^} (@command{gnatbind})
 This switch can be used to change the default secondary stack size value
 to a specified size @var{nn}, which is expressed in bytes by default, or
@@ -7315,7 +7757,7 @@ and the actual size needed for the current allocation request).
 
 For certain targets, notably VxWorks 653,
 the secondary stack is allocated by carving off a fixed ratio chunk of the
-primary task stack. The -D option is used to defined the
+primary task stack. The -D option is used to define the
 size of the environment task's secondary stack.
 
 @item ^-e^/ELABORATION_DEPENDENCIES^
@@ -7366,12 +7808,12 @@ ALI file named in the @code{gnatbind} command line.
 @cindex @option{^-l^/ORDER_OF_ELABORATION^} (@command{gnatbind})
 Output chosen elaboration order.
 
-@item ^-Lxxx^/BUILD_LIBRARY=xxx^
+@item ^-L@var{xxx}^/BUILD_LIBRARY=@var{xxx}^
 @cindex @option{^-L^/BUILD_LIBRARY^} (@command{gnatbind})
 Bind the units for library building. In this case the adainit and
 adafinal procedures (@pxref{Binding with Non-Ada Main Programs})
-are renamed to ^xxxinit^XXXINIT^ and
-^xxxfinal^XXXFINAL^.
+are renamed to ^@var{xxx}init^@var{XXX}INIT^ and
+^@var{xxx}final^@var{XXX}FINAL^.
 Implies ^-n^/NOCOMPILE^.
 @ifclear vms
 (@xref{GNAT and Libraries}, for more details.)
@@ -7390,9 +7832,15 @@ supported on cross environments only.
 
 @item ^-m^/ERROR_LIMIT=^@var{n}
 @cindex @option{^-m^/ERROR_LIMIT^} (@command{gnatbind})
-Limit number of detected errors to @var{n}, where @var{n} is
-in the range 1..999_999. The default value if no switch is
-given is 9999. Binding is terminated if the limit is exceeded.
+Limit number of detected errors or warnings to @var{n}, where @var{n} is
+in the range 1..999999. The default value if no switch is
+given is 9999. If the number of warnings reaches this limit, then a
+message is output and further warnings are suppressed, the bind
+continues in this case. If the number of errors reaches this
+limit, then a message is output and the bind is abandoned.
+A value of zero means that no limit is enforced. The equal
+sign is optional.
+
 @ifset unw
 Furthermore, under Windows, the sources pointed to by the libraries path
 set in the registry are not searched for.
@@ -7429,6 +7877,10 @@ Output object list.
 @cindex @option{^-p^/PESSIMISTIC_ELABORATION^} (@command{gnatbind})
 Pessimistic (worst-case) elaboration order
 
+@item ^-R^-R^
+@cindex @option{^-R^-R^} (@command{gnatbind})
+Output closure source list.
+
 @item ^-s^/READ_SOURCES=ALL^
 @cindex @option{^-s^/READ_SOURCES=ALL^} (@command{gnatbind})
 Require all source files to be present.
@@ -7442,15 +7894,15 @@ The @var{xxx} ^string specified with the switch^option^ may be either
 @item ``@option{^in^INVALID^}'' requesting an invalid value where possible
 @item ``@option{^lo^LOW^}'' for the lowest possible value
 @item ``@option{^hi^HIGH^}'' for the highest possible value
-@item ``@option{xx}'' for a value consisting of repeated bytes with the
-value 16#xx# (i.e. xx is a string of two hexadecimal digits).
+@item ``@option{@var{xx}}'' for a value consisting of repeated bytes with the
+value @code{16#@var{xx}#} (i.e., @var{xx} is a string of two hexadecimal digits).
 @end itemize
 
 In addition, you can specify @option{-Sev} to indicate that the value is
 to be set at run time. In this case, the program will look for an environment
 @cindex GNAT_INIT_SCALARS
-variable of the form @code{GNAT_INIT_SCALARS=xx}, where xx is one
-of @option{in/lo/hi/xx} with the same meanings as above.
+variable of the form @env{GNAT_INIT_SCALARS=@var{xx}}, where @var{xx} is one
+of @option{in/lo/hi/@var{xx}} with the same meanings as above.
 If no environment variable is found, or if it does not have a valid value,
 then the default is @option{in} (invalid values).
 
@@ -7484,9 +7936,11 @@ scheduling policy to @code{FIFO_Within_Priorities}.
 
 @item ^-u@var{n}^/DYNAMIC_STACK_USAGE=@var{n}^
 @cindex @option{^-u^/DYNAMIC_STACK_USAGE^} (@code{gnatbind})
-Enable dynamic stack usage, with n result stored and displayed at program
-termination. Results that can't be stored are displayed on the fly, at task
-termination. This option is currently not supported on OpenVMS I64 platforms.
+Enable dynamic stack usage, with @var{n} results stored and displayed
+at program termination. A result is generated when a task
+terminates. Results that can't be stored are displayed on the fly, at
+task termination. This option is currently not supported on Itanium
+platforms. (See @ref{Dynamic Stack Usage Analysis} for details.)
 
 @item ^-v^/REPORT_ERRORS=VERBOSE^
 @cindex @option{^-v^/REPORT_ERRORS=VERBOSE^} (@code{gnatbind})
@@ -7513,6 +7967,10 @@ All warning messages are suppressed
 Warning messages are treated as fatal errors
 @end ifset
 
+@item ^-Wx^/WIDE_CHARACTER_ENCODING=^@var{e}
+@cindex @option{^-Wx^/WIDE_CHARACTER_ENCODING^} (@code{gnatbind})
+Override default wide character encoding for standard Text_IO files.
+
 @item ^-x^/READ_SOURCES=NONE^
 @cindex @option{^-x^/READ_SOURCES^} (@code{gnatbind})
 Exclude source files (check object consistency only).
@@ -7524,6 +7982,10 @@ Default mode, in which sources are checked for consistency only if
 they are available.
 @end ifset
 
+@item ^-y^/ENABLE_LEAP_SECONDS^
+@cindex @option{^-y^/ENABLE_LEAP_SECONDS^} (@code{gnatbind})
+Enable leap seconds support in @code{Ada.Calendar} and its children.
+
 @item ^-z^/ZERO_MAIN^
 @cindex @option{^-z^/ZERO_MAIN^} (@code{gnatbind})
 No main subprogram.
@@ -7554,6 +8016,16 @@ their consistency. In normal mode, if a source file cannot be located it
 is simply ignored. If you specify this switch, a missing source
 file is an error.
 
+@item ^-Wx^/WIDE_CHARACTER_ENCODING=^@var{e}
+@cindex @option{^-Wx^/WIDE_CHARACTER_ENCODING^} (@code{gnatbind})
+Override default wide character encoding for standard Text_IO files.
+Normally the default wide character encoding method used for standard
+[Wide_[Wide_]]Text_IO files is taken from the encoding specified for
+the main source input (see description of switch
+@option{^-gnatWx^/WIDE_CHARACTER_ENCODING^} for the compiler). The
+use of this switch for the binder (which has the same set of
+possible arguments) overrides this default as specified.
+
 @item ^-x^/READ_SOURCES=NONE^
 @cindex @option{^-x^/READ_SOURCES=NONE^} (@code{gnatbind})
 Exclude source files. In this mode, the binder only checks that ALI
@@ -7565,7 +8037,7 @@ specify this switch, the binder will not detect that the object
 file is out of date with respect to the source file. Note that this is the
 mode that is automatically used by @command{gnatmake} because in this
 case the checking against sources has already been performed by
-@command{gnatmake} in the course of compilation (i.e. before binding).
+@command{gnatmake} in the course of compilation (i.e.@: before binding).
 
 @ifset vms
 @item /READ_SOURCES=AVAILABLE
@@ -7854,7 +8326,11 @@ The following switch is used to bind programs organized in this manner:
 Normally the binder checks that the unit name given on the command line
 corresponds to a suitable main subprogram. When this switch is used,
 a list of ALI files can be given, and the execution of the program
-consists of elaboration of these units in an appropriate order.
+consists of elaboration of these units in an appropriate order. Note
+that the default wide character encoding method for standard Text_IO
+files is always set to Brackets if this switch is set (you can use
+the binder switch
+@option{^-Wx^WIDE_CHARACTER_ENCODING^} to override this default).
 @end table
 
 @node Command-Line Access
@@ -7911,20 +8387,20 @@ command line, in the order given.
 @item
 @findex ADA_PRJ_OBJECTS_FILE
 Each of the directories listed in the text file whose name is given
-by the @code{ADA_PRJ_OBJECTS_FILE} ^environment variable^logical name^.
+by the @env{ADA_PRJ_OBJECTS_FILE} ^environment variable^logical name^.
 
 @noindent
-@code{ADA_PRJ_OBJECTS_FILE} is normally set by gnatmake or by the ^gnat^GNAT^
+@env{ADA_PRJ_OBJECTS_FILE} is normally set by gnatmake or by the ^gnat^GNAT^
 driver when project files are used. It should not normally be set
 by other means.
 
 @item
 @findex ADA_OBJECTS_PATH
 Each of the directories listed in the value of the
-@code{ADA_OBJECTS_PATH} ^environment variable^logical name^.
+@env{ADA_OBJECTS_PATH} ^environment variable^logical name^.
 @ifset unw
 Construct this value
-exactly as the @code{PATH} environment variable: a list of directory
+exactly as the @env{PATH} environment variable: a list of directory
 names separated by colons (semicolons when working with the NT version
 of GNAT).
 @end ifset
@@ -7942,11 +8418,11 @@ DEFINE ADA_OBJECTS_PATH ANOTHER_PATH,FOO:[BAM],FOO:[BAR]
 @end smallexample
 
 By default, the path includes GNU:[LIB.OPENVMS7_x.2_8_x.DECLIB]
-first, followed by the standard Ada 95
+first, followed by the standard Ada
 libraries in GNU:[LIB.OPENVMS7_x.2_8_x.ADALIB].
 If this is not redefined, the user will obtain the HP Ada 83 IO packages
 (Text_IO, Sequential_IO, etc)
-instead of the Ada95 packages. Thus, in order to get the Ada 95
+instead of the standard Ada packages. Thus, in order to get the standard Ada
 packages by default, ADA_OBJECTS_PATH must be redefined.
 @end ifset
 
@@ -8070,6 +8546,9 @@ with a correct list of object files and library references.
 references for the Ada part of a program. It uses the binder file
 generated by the @command{gnatbind} to determine this list.
 
+Note: to invoke @code{gnatlink} with a project file, use the @code{gnat}
+driver (see @ref{The GNAT Driver and Project Files}).
+
 @menu
 * Running gnatlink::
 * Switches for gnatlink::
@@ -8082,8 +8561,8 @@ generated by the @command{gnatbind} to determine this list.
 The form of the @command{gnatlink} command is
 
 @smallexample
-$ gnatlink [@var{switches}] @var{mainprog}[.ali]
-           [@var{non-Ada objects}] [@var{linker options}]
+$ gnatlink @ovar{switches} @var{mainprog}@r{[}.ali@r{]}
+           @ovar{non-Ada objects} @ovar{linker options}
 @end smallexample
 
 @noindent
@@ -8112,13 +8591,13 @@ units, or in @code{Import} pragmas in any Ada units.
 
 @var{linker options} is an optional list of linker specific
 switches.
-The default linker called by gnatlink is @var{gcc} which in
+The default linker called by gnatlink is @command{gcc} which in
 turn calls the appropriate system linker.
 Standard options for the linker such as @option{-lmy_lib} or
 @option{-Ldir} can be added as is.
 For options that are not recognized by
-@var{gcc} as linker options, use the @var{gcc} switches @option{-Xlinker} or
-@option{-Wl,}.
+@command{gcc} as linker options, use the @command{gcc} switches
+@option{-Xlinker} or @option{-Wl,}.
 Refer to the GCC documentation for
 details. Here is an example showing how to generate a linker map:
 
@@ -8128,10 +8607,10 @@ $ ^gnatlink my_prog -Wl,-Map,MAPFILE^GNAT LINK my_prog.ali /MAP^
 
 Using @var{linker options} it is possible to set the program stack and
 heap size.
-@ifclear vms
+@ifset unw
 See @ref{Setting Stack Size from gnatlink} and
 @ref{Setting Heap Size from gnatlink}.
-@end ifclear
+@end ifset
 
 @command{gnatlink} determines the list of objects required by the Ada
 program and prepends them to the list of objects passed to the linker.
@@ -8141,9 +8620,9 @@ presented to the linker.
 
 @ifset vms
 @command{gnatlink} accepts the following types of extra files on the command
-line: objects (.OBJ), libraries (.OLB), sharable images (.EXE), and
-options files (.OPT). These are recognized and handled according to their
-extension.
+line: objects (@file{.OBJ}), libraries (@file{.OLB}), sharable images
+(@file{.EXE}), and options files (@file{.OPT}). These are recognized and
+handled according to their extension.
 @end ifset
 
 @node Switches for gnatlink
@@ -8155,6 +8634,15 @@ The following switches are available with the @command{gnatlink} utility:
 @table @option
 @c !sort!
 
+@item --version
+@cindex @option{--version} @command{gnatlink}
+Display Copyright and version, then exit disregarding all other options.
+
+@item --help
+@cindex @option{--help} @command{gnatlink}
+If @option{--version} was not used, display usage, then exit disregarding
+all other options.
+
 @item ^-A^/BIND_FILE=ADA^
 @cindex @option{^-A^/BIND_FILE=ADA^} (@command{gnatlink})
 The binder has generated code in Ada. This is the default.
@@ -8225,9 +8713,10 @@ system configuration. You must have a GNAT cross-compiler built if
 @cindex @option{-B} (@command{gnatlink})
 Load compiler executables (for example, @code{gnat1}, the Ada compiler)
 from @var{dir} instead of the default location. Only use this switch
-when multiple versions of the GNAT compiler are available. See the
-@command{gcc} manual page for further details. You would normally use the
-@option{-b} or @option{-V} switch instead.
+when multiple versions of the GNAT compiler are available.
+@xref{Directory Options,,, gcc, The GNU Compiler Collection},
+for further details. You would normally use the @option{-b} or
+@option{-V} switch instead.
 
 @item --GCC=@var{compiler_name}
 @cindex @option{--GCC=compiler_name} (@command{gnatlink})
@@ -8239,7 +8728,11 @@ use @code{foo -x -y} as your compiler. Note that switch @option{-c} is always
 inserted after your command name. Thus in the above example the compiler
 command that will be used by @command{gnatlink} will be @code{foo -c -x -y}.
 A limitation of this syntax is that the name and path name of the executable
-itself must not include any embedded spaces. If several
+itself must not include any embedded spaces. If the compiler executable is
+different from the default one (gcc or <prefix>-gcc), then the back-end
+switches in the ALI file are not used to compile the binder generated source.
+For example, this is the case with @option{--GCC="foo -x -y"}. But the back end
+switches will be used for @option{--GCC="gcc -gnatv"}. If several
 @option{--GCC=compiler_name} are used, only the last @var{compiler_name}
 is taken into account. However, all the additional switches are also taken
 into account. Thus,
@@ -8347,8 +8840,8 @@ dependencies, they will always be tracked exactly correctly by
 The usual form of the @command{gnatmake} command is
 
 @smallexample
-$ gnatmake [@var{switches}] @var{file_name}
-      [@var{file_names}] [@var{mode_switches}]
+$ gnatmake @ovar{switches} @var{file_name}
+      @ovar{file_names} @ovar{mode_switches}
 @end smallexample
 
 @noindent
@@ -8360,7 +8853,7 @@ If @code{switches} are present, they can be placed before the first
 If @var{mode_switches} are present, they must always be placed after
 the last @var{file_name} and all @code{switches}.
 
-If you are using standard file extensions (.adb and .ads), then the
+If you are using standard file extensions (@file{.adb} and @file{.ads}), then the
 extension may be omitted from the @var{file_name} arguments. However, if
 you are using non-standard extensions, then it is required that the
 extension be given. A relative or absolute directory path can be
@@ -8385,6 +8878,16 @@ You may specify any of the following switches to @command{gnatmake}:
 
 @table @option
 @c !sort!
+
+@item --version
+@cindex @option{--version} @command{gnatmake}
+Display Copyright and version, then exit disregarding all other options.
+
+@item --help
+@cindex @option{--help} @command{gnatmake}
+If @option{--version} was not used, display usage, then exit disregarding
+all other options.
+
 @ifclear vms
 @item --GCC=@var{compiler_name}
 @cindex @option{--GCC=compiler_name} (@command{gnatmake})
@@ -8472,7 +8975,7 @@ Project File is specified, with the ALI file extension.
 Compile only. Do not perform binding, except when @option{^-b^/ACTIONS=BIND^}
 is also specified. Do not perform linking, except if both
 @option{^-b^/ACTIONS=BIND^} and
- @option{^-l^/ACTIONS=LINK^} are also specified.
+@option{^-l^/ACTIONS=LINK^} are also specified.
 If the root unit specified by @var{file_name} is not a main unit, this is the
 default. Otherwise @command{gnatmake} will attempt binding and linking
 unless all objects are up to date and the executable is more recent than
@@ -8500,6 +9003,17 @@ This switch is not compatible with a project file
 (^-P^/PROJECT_FILE=^@var{file}) or with multiple compiling processes
 (^-j^/PROCESSES=^nnn, when nnn is greater than 1).
 
+@item ^-d^/DISPLAY_PROGRESS^
+@cindex @option{^-d^/DISPLAY_PROGRESS^} (@command{gnatmake})
+Display progress for each source, up to date or not, as a single line
+
+@smallexample
+completed x out of y (zz%)
+@end smallexample
+
+If the file needs to be compiled this is displayed after the invocation of
+the compiler. These lines are displayed even in quiet output mode.
+
 @item ^-D ^/DIRECTORY_OBJECTS=^@var{dir}
 @cindex @option{^-D^/DIRECTORY_OBJECTS^} (@command{gnatmake})
 Put all object files and ALI file in directory @var{dir}.
@@ -8514,6 +9028,12 @@ This switch cannot be used when using a project file.
 Follow all symbolic links when processing project files.
 @end ifclear
 
+@item ^-eS^/STANDARD_OUTPUT_FOR_COMMANDS^
+@cindex @option{^-eS^/STANDARD_OUTPUT_FOR_COMMANDS^} (@command{gnatmake})
+Output the commands for the compiler, the binder and the linker
+on ^standard output^SYS$OUTPUT^,
+instead of ^standard error^SYS$ERROR^.
+
 @item ^-f^/FORCE_COMPILE^
 @cindex @option{^-f^/FORCE_COMPILE^} (@command{gnatmake})
 Force recompilations. Recompile all sources, even though some object
@@ -8528,6 +9048,11 @@ parsing and verbose mode is not in effect (no use of switch
 ^-v^/VERBOSE^), then error lines start with the full path name of the project
 file, rather than its simple file name.
 
+@item ^-g^/DEBUG^
+@cindex @option{^-g^/DEBUG^} (@command{gnatmake})
+Enable debugging. This switch is simply passed to the compiler and to the
+linker.
+
 @item ^-i^/IN_PLACE^
 @cindex @option{^-i^/IN_PLACE^} (@command{gnatmake})
 In normal mode, @command{gnatmake} compiles all object files and ALI files
@@ -8587,7 +9112,7 @@ stamp differences when the only
 modifications to a source file consist in adding/removing comments,
 empty lines, spaces or tabs. This means that if you have changed the
 comments in a source file or have simply reformatted it, using this
-switch will tell gnatmake not to recompile files that depend on it
+switch will tell @command{gnatmake} not to recompile files that depend on it
 (provided other sources on which these files depend have undergone no
 semantic modifications). Note that the debugging information may be
 out of date with respect to the sources if the @option{-m} switch causes
@@ -8634,6 +9159,12 @@ for an executable file on the host system.
 This switch cannot be used when invoking @command{gnatmake} with several
 @file{file_names}.
 
+@item ^-p or --create-missing-dirs^/CREATE_MISSING_DIRS^
+@cindex @option{^-p^/CREATE_MISSING_DIRS^} (@command{gnatmake})
+When using project files (^-P^/PROJECT_FILE=^@var{project}), create
+automatically missing object directories, library directories and exec
+directories.
+
 @item ^-P^/PROJECT_FILE=^@var{project}
 @cindex @option{^-P^/PROJECT_FILE^} (@command{gnatmake})
 Use project file @var{project}. Only one such switch can be used.
@@ -8698,7 +9229,9 @@ Normally, when using Project Files, only sources that are part of a Project
 File may be compile. When this switch is used, a source outside of all Project
 Files may be compiled. The ALI file and the object file will be put in the
 object directory of the main Project. The compilation switches used will only
-be those specified on the command line.
+be those specified on the command line. Even when
+@option{^-x^/NON_PROJECT_UNIT_COMPILATION^} is used, mains specified on the
+command line need to be sources of a project file.
 
 @item ^-X^/EXTERNAL_REFERENCE=^@var{name=value}
 Indicate that external variable @var{name} has the value @var{value}.
@@ -8713,18 +9246,13 @@ given on the command line is a package name. The resulting executable
 will execute the elaboration routines of the package and its closure,
 then the finalization routines.
 
-@item ^-g^/DEBUG^
-@cindex @option{^-g^/DEBUG^} (@command{gnatmake})
-Enable debugging. This switch is simply passed to the compiler and to the
-linker.
-
 @end table
 
 @table @asis
 @item @command{gcc} @asis{switches}
 @ifclear vms
 Any uppercase or multi-character switch that is not a @command{gnatmake} switch
-is passed to @command{gcc} (e.g. @option{-O}, @option{-gnato,} etc.)
+is passed to @command{gcc} (e.g.@: @option{-O}, @option{-gnato,} etc.)
 @end ifclear
 @ifset vms
 Any qualifier that cannot be recognized as a qualifier for @code{GNAT MAKE}
@@ -8923,7 +9451,7 @@ $ gnatmake /SOURCE_SEARCH=@i{[INCLUDE_DIR]}
 @item
 Using @command{gnatmake} along with the
 @option{^-m (minimal recompilation)^/MINIMAL_RECOMPILATION^}
-switch provides a mechanism for avoiding unnecessary rcompilations. Using
+switch provides a mechanism for avoiding unnecessary recompilations. Using
 this switch,
 you can update the comments/format of your
 source files without having to recompile everything. Note, however, that
@@ -9006,8 +9534,8 @@ and @file{^main3^MAIN3.EXE^}.
 
 @ifset vms
 @item gnatmake Main_Unit /QUIET
-   /COMPILER_QUALIFIERS /OPTIMIZE=ALL
-   /BINDER_QUALIFIERS /ORDER_OF_ELABORATION
+/COMPILER_QUALIFIERS /OPTIMIZE=ALL
+/BINDER_QUALIFIERS /ORDER_OF_ELABORATION
 @end ifset
 Compile all files necessary to bind and link the main program unit
 @code{Main_Unit} (from file @file{main_unit.adb}). All compilations will
@@ -9028,9 +9556,13 @@ and some of the techniques for making your program run faster.
 It then documents the @command{gnatelim} tool and unused subprogram/data
 elimination feature, which can reduce the size of program executables.
 
+Note: to invoke @command{gnatelim} with a project file, use the @code{gnat}
+driver (see @ref{The GNAT Driver and Project Files}).
+
 @ifnottex
 @menu
 * Performance Considerations::
+* Text_IO Suggestions::
 * Reducing Size of Ada Executables with gnatelim::
 * Reducing Size of Executables with unused subprogram/data elimination::
 @end menu
@@ -9097,8 +9629,8 @@ some guidelines on debugging optimized code.
 @subsection Controlling Run-Time Checks
 
 @noindent
-By default, GNAT generates all run-time checks, except arithmetic overflow
-checking for integer operations and checks for access before elaboration on
+By default, GNAT generates all run-time checks, except integer overflow
+checks, stack overflow checks, and checks for access before elaboration on
 subprogram calls. The latter are not required in default mode, because all
 necessary checking is done at compile time.
 @cindex @option{-gnatp} (@command{gcc})
@@ -9156,7 +9688,7 @@ exception handlers are used. The reason is that certain sections of code
 have to be marked as non-abortable.
 
 If you use neither the @code{abort} statement, nor asynchronous transfer
-of control (@code{select .. then abort}), then this distributed overhead
+of control (@code{select @dots{} then abort}), then this distributed overhead
 is removed, which may have a general positive effect in improving
 overall performance.  Especially code involving frequent use of tasking
 constructs and controlled types will show much improved performance.
@@ -9177,12 +9709,30 @@ possibility of an immediate abort at any point.
 @cindex @option{^-O^/OPTIMIZE^} (@command{gcc})
 
 @noindent
+Without any optimization ^option,^qualifier,^
+the compiler's goal is to reduce the cost of
+compilation and to make debugging produce the expected results.
+Statements are independent: if you stop the program with a breakpoint between
+statements, you can then assign a new value to any variable or change
+the program counter to any other statement in the subprogram and get exactly
+the results you would expect from the source code.
+
+Turning on optimization makes the compiler attempt to improve the
+performance and/or code size at the expense of compilation time and
+possibly the ability to debug the program.
+
+If you use multiple
+^-O options, with or without level numbers,^/OPTIMIZE qualifiers,^
+the last such option is the one that is effective.
+
+@noindent
 The default is optimization off. This results in the fastest compile
 times, but GNAT makes absolutely no attempt to optimize, and the
 generated programs are considerably larger and slower than when
 optimization is enabled. You can use the
 @ifclear vms
-@option{-O@var{n}} switch, where @var{n} is an integer from 0 to 3,
+@option{-O} switch (the permitted forms are @option{-O0}, @option{-O1}
+@option{-O2}, @option{-O3}, and @option{-Os})
 @end ifclear
 @ifset vms
 @code{OPTIMIZE} qualifier
@@ -9196,7 +9746,7 @@ generates unoptimized code but has
 the fastest compilation time.
 
 Note that many other compilers do fairly extensive optimization
-even if "no optimization" is specified. When using gcc, it is
+even if ``no optimization'' is specified. With gcc, it is
 very unusual to use ^-O0^/OPTIMIZE=NONE^ for production if
 execution time is of any concern, since ^-O0^/OPTIMIZE=NONE^
 really does mean no optimization at all. This difference between
@@ -9220,6 +9770,9 @@ the slowest compilation time.
 Full optimization as in @option{-O2},
 and also attempts automatic inlining of small
 subprograms within a unit (@pxref{Inlining of Subprograms}).
+
+@item ^-Os^/OPTIMIZE=SPACE^
+Optimize space usage of resulting program.
 @end table
 
 @noindent
@@ -9233,7 +9786,8 @@ You should experiment to find the best level for your application.
 Since the precise set of optimizations done at each level will vary from
 release to release (and sometime from target to target), it is best to think
 of the optimization settings in general terms.
-The @cite{Using GNU GCC} manual contains details about
+@xref{Optimize Options,, Options That Control Optimization, gcc, Using
+the GNU Compiler Collection (GCC)}, for details about
 ^the @option{-O} settings and a number of @option{-f} options that^how to^
 individually enable or disable specific optimizations.
 
@@ -9391,18 +9945,15 @@ The optimization level is at least @option{-O1}.
 
 @item
 The called subprogram is suitable for inlining: It must be small enough
-and not contain nested subprograms or anything else that @command{gcc}
-cannot support in inlined subprograms.
-
-@item
-The call occurs after the definition of the body of the subprogram.
+and not contain something that @command{gcc} cannot support in inlined
+subprograms.
 
 @item
 @cindex pragma Inline
 @findex Inline
-Either @code{pragma Inline} applies to the subprogram or it is
-small and automatic inlining (optimization level @option{-O3}) is
-specified.
+Either @code{pragma Inline} applies to the subprogram, or it is local
+to the unit and called once from within it, or it is small and automatic
+inlining (optimization level @option{-O3}) is specified.
 @end itemize
 
 @noindent
@@ -9416,8 +9967,8 @@ The optimization level is at least @option{-O1}.
 
 @item
 The called subprogram is suitable for inlining: It must be small enough
-and not contain nested subprograms or anything else @command{gcc} cannot
-support in inlined subprograms.
+and not contain something that @command{gcc} cannot support in inlined
+subprograms.
 
 @item
 The call appears in a body (not in a package spec).
@@ -9446,13 +9997,13 @@ package R is
    pragma Inline (Q);
 end R;
 package body R is
-   ...
+   @dots{}
 end R;
 
 with R;
 procedure Main is
 begin
-   ...
+   @dots{}
    R.Q;
 end Main;
 @end cartouche
@@ -9484,6 +10035,15 @@ that no inlining occurs. The extra dependences resulting from
 @option{-gnatn} will still be active, even if
 this switch is used to suppress the resulting inlining actions.
 
+@cindex @option{-fno-inline-functions} (@command{gcc})
+Note: The @option{-fno-inline-functions} switch can be used to prevent
+automatic inlining of small subprograms if @option{-O3} is used.
+
+@cindex @option{-fno-inline-functions-called-once} (@command{gcc})
+Note: The @option{-fno-inline-functions-called-once} switch
+can be used to prevent inlining of subprograms local to the unit
+and called once from within it if @option{-O1} is used.
+
 Note regarding the use of @option{-O3}: There is no difference in inlining
 behavior between @option{-O2} and @option{-O3} for subprograms with an explicit
 pragma @code{Inline} assuming the use of @option{-gnatn}
@@ -9502,15 +10062,16 @@ it actually improves performance.
 @subsection Other Optimization Switches
 @cindex Optimization Switches
 
-Since @code{GNAT} uses the @code{gcc} back end, all the specialized
-@code{gcc} optimization switches are potentially usable. These switches
+Since @code{GNAT} uses the @command{gcc} back end, all the specialized
+@command{gcc} optimization switches are potentially usable. These switches
 have not been extensively tested with GNAT but can generally be expected
 to work. Examples of switches in this category are
 @option{-funroll-loops} and
 the various target-specific @option{-m} options (in particular, it has been
 observed that @option{-march=pentium4} can significantly improve performance
-on appropriate machines). For full details of these switches, see the
-@code{gcc} manual.
+on appropriate machines). For full details of these switches, see
+@ref{Submodel Options,, Hardware Models and Configurations, gcc, Using
+the GNU Compiler Collection (GCC)}.
 
 @node Optimization and Strict Aliasing
 @subsection Optimization and Strict Aliasing
@@ -9533,16 +10094,16 @@ procedure R is
    type Int2A is access Int2;
    Int1V : Int1A;
    Int2V : Int2A;
-   ...
+   @dots{}
 
 begin
-   ...
+   @dots{}
    for J in Data'Range loop
       if Data (J) = Int1V.all then
          Int2V.all := Int2V.all + 1;
       end if;
    end loop;
-   ...
+   @dots{}
 end R;
 @end cartouche
 @end smallexample
@@ -9605,8 +10166,8 @@ end;
 @end smallexample
 
 @noindent
-This program prints out 0 in @code{-O0} or @code{-O1}
-mode, but it prints out 1 in @code{-O2} mode. That's
+This program prints out 0 in @option{-O0} or @option{-O1}
+mode, but it prints out 1 in @option{-O2} mode. That's
 because in strict aliasing mode, the compiler can and
 does assume that the assignment to @code{v2.all} could not
 affect the value of @code{v1.all}, since different types
@@ -9644,19 +10205,19 @@ the suspicious @code{Unchecked_Conversion}.
 As implied by the warning message, there are approaches you can use to
 avoid the unwanted strict aliasing optimization in a case like this.
 
-One possibility is to simply avoid the use of @code{-O2}, but
+One possibility is to simply avoid the use of @option{-O2}, but
 that is a bit drastic, since it throws away a number of useful
 optimizations that do not involve strict aliasing assumptions.
 
 A less drastic approach is to compile the program using the
-option @code{-fno-strict-aliasing}. Actually it is only the
+option @option{-fno-strict-aliasing}. Actually it is only the
 unit containing the dereferencing of the suspicious pointer
 that needs to be compiled. So in this case, if we compile
 unit @code{m} with this switch, then we get the expected
 value of zero printed. Analyzing which units might need
 the switch can be painful, so a more reasonable approach
-is to compile the entire program with options @code{-O2}
-and @code{-fno-strict-aliasing}. If the performance is
+is to compile the entire program with options @option{-O2}
+and @option{-fno-strict-aliasing}. If the performance is
 satisfactory with this combination of options, then the
 advantage is that the entire issue of possible "wrong"
 optimization due to strict aliasing is avoided.
@@ -9737,6 +10298,30 @@ the user to determine the distribution of execution time across a program,
 @pxref{Profiling} for details of usage.
 @end ifset
 
+
+@node Text_IO Suggestions
+@section @code{Text_IO} Suggestions
+@cindex @code{Text_IO} and performance
+
+@noindent
+The @code{Ada.Text_IO} package has fairly high overheads due in part to
+the requirement of maintaining page and line counts. If performance
+is critical, a recommendation is to use @code{Stream_IO} instead of
+@code{Text_IO} for volume output, since this package has less overhead.
+
+If @code{Text_IO} must be used, note that by default output to the standard
+output and standard error files is unbuffered (this provides better
+behavior when output statements are used for debugging, or if the
+progress of a program is observed by tracking the output, e.g. by
+using the Unix @command{tail -f} command to watch redirected output.
+
+If you are generating large volumes of output with @code{Text_IO} and
+performance is an important factor, use a designated file instead
+of the standard output file, or change the standard output file to
+be buffered using @code{Interfaces.C_Streams.setvbuf}.
+
+
+
 @node Reducing Size of Ada Executables with gnatelim
 @section Reducing Size of Ada Executables with @code{gnatelim}
 @findex gnatelim
@@ -9769,7 +10354,8 @@ subprograms that are declared but never called. By placing the list of
 @code{Eliminate} pragmas in the GNAT configuration file @file{gnat.adc} and
 recompiling your program, you may decrease the size of its executable,
 because the compiler will not generate the code for 'eliminated' subprograms.
-See GNAT Reference Manual for more information about this pragma.
+@xref{Pragma Eliminate,,, gnat_rm, GNAT Reference Manual}, for more
+information about this pragma.
 
 @code{gnatelim} needs as its input data the name of the main subprogram
 and a bind file for a main subprogram.
@@ -9793,7 +10379,7 @@ Note that @code{gnatelim} needs neither object nor ALI files.
 @code{gnatelim} has the following command-line interface:
 
 @smallexample
-$ gnatelim [options] name
+$ gnatelim @ovar{options} name
 @end smallexample
 
 @noindent
@@ -9944,7 +10530,7 @@ Generate a list of @code{Eliminate} pragmas
 $ PIPE GNAT ELIM MAIN_PROG > GNAT.ADC
 @end ifset
 @ifclear vms
-$ gnatelim main_prog >[>] gnat.adc
+$ gnatelim main_prog >@r{[}>@r{]} gnat.adc
 @end ifclear
 @end smallexample
 
@@ -9982,8 +10568,9 @@ never used by this executable.
 This feature will allow you to eliminate such unused code from your
 executable, making it smaller (in disk and in memory).
 
-This functionality is available on all platforms using elf binary format and
-having GNU binutils version 2.16.1.
+This functionality is available on all Linux platforms except for the IA-64
+architecture and on all cross platforms using the ELF binary file format.
+In both cases GNU binutils version 2.16 or later are required to enable it.
 
 @node Compilation options
 @subsection Compilation options
@@ -10004,8 +10591,8 @@ function or data in a separate section in the resulting object file.
 Once the objects and static libraries are created with these options, the
 linker can perform the dead code elimination. You can do this by setting
 the @option{-Wl,--gc-sections} option to gcc command or in the
-@option{-largs} section of gnatmake. This will perform a garbage collection of
-code and data never referenced.
+@option{-largs} section of @command{gnatmake}. This will perform a
+garbage collection of code and data never referenced.
 
 If the linker performs a partial link (@option{-r} ld linker option), then you
 will need to provide one or several entry point using the
@@ -10125,6 +10712,11 @@ system, you can set up a procedure where you use @command{gnatchop} each
 time you compile, regarding the source files that it writes as temporary
 files that you throw away.
 
+Note that if your file containing multiple units starts with a byte order
+mark (BOM) specifying UTF-8 encoding, then the files generated by gnatchop
+will each start with a copy of this BOM, meaning that they can be compiled
+automatically in UTF-8 mode without needing to specify an explicit encoding.
+
 @node Operating gnatchop in Compilation Mode
 @section Operating gnatchop in Compilation Mode
 
@@ -10191,8 +10783,8 @@ in which GNAT processes the ACVC tests.
 The @code{gnatchop} command has the form:
 
 @smallexample
-$ gnatchop switches @var{file name} [@var{file name} @var{file name} ...]
-      [@var{directory}]
+$ gnatchop switches @var{file name} @r{[}@var{file name} @dots{}@r{]}
+      @ovar{directory}
 @end smallexample
 
 @noindent
@@ -10280,6 +10872,15 @@ no source files written
 @table @option
 @c !sort!
 
+@item --version
+@cindex @option{--version} @command{gnatchop}
+Display Copyright and version, then exit disregarding all other options.
+
+@item --help
+@cindex @option{--help} @command{gnatchop}
+If @option{--version} was not used, display usage, then exit disregarding
+all other options.
+
 @item ^-c^/COMPILATION^
 @cindex @option{^-c^/COMPILATION^} (@code{gnatchop})
 Causes @code{gnatchop} to operate in compilation mode, in which
@@ -10287,9 +10888,9 @@ configuration pragmas are handled according to strict RM rules. See
 previous section for a full description of this mode.
 
 @ifclear vms
-@item -gnatxxx
-This passes the given @option{-gnatxxx} switch to @code{gnat} which is
-used to parse the given file. Not all @code{xxx} options make sense,
+@item -gnat@var{xxx}
+This passes the given @option{-gnat@var{xxx}} switch to @code{gnat} which is
+used to parse the given file. Not all @var{xxx} options make sense,
 but for example, the use of @option{-gnati2} allows @code{gnatchop} to
 process a source file that uses Latin-2 coding for identifiers.
 @end ifclear
@@ -10373,7 +10974,7 @@ check, and causes all but the last instance of such duplicated
 units to be skipped.
 
 @ifclear vms
-@item --GCC=xxxx
+@item --GCC=@var{xxxx}
 @cindex @option{--GCC=} (@code{gnatchop})
 Specify the path of the GNAT parser to be used. When this switch is used,
 no attempt is made to add the prefix to the GNAT parser executable.
@@ -10404,7 +11005,7 @@ useful application of @code{gnatchop} is in sending sets of sources
 around, for example in email messages. The required sources are simply
 concatenated (for example, using a ^Unix @code{cat}^VMS @code{APPEND/NEW}^
 command), and then
-@code{gnatchop} is used at the other end to reconstitute the original
+@command{gnatchop} is used at the other end to reconstitute the original
 file names.
 
 @item gnatchop file1 file2 file3 direc
@@ -10424,37 +11025,52 @@ unit will be skipped.
 @cindex Pragmas, configuration
 
 @noindent
-In Ada 95, configuration pragmas include those pragmas described as
-such in the Ada 95 Reference Manual, as well as
-implementation-dependent pragmas that are configuration pragmas. See the
-individual descriptions of pragmas in the GNAT Reference Manual for
-details on these additional GNAT-specific configuration pragmas. Most
-notably, the pragma @code{Source_File_Name}, which allows
+Configuration pragmas include those pragmas described as
+such in the Ada Reference Manual, as well as
+implementation-dependent pragmas that are configuration pragmas.
+@xref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference Manual},
+for details on these additional GNAT-specific configuration pragmas.
+Most notably, the pragma @code{Source_File_Name}, which allows
 specifying non-default names for source files, is a configuration
 pragma. The following is a complete list of configuration pragmas
-recognized by @code{GNAT}:
+recognized by GNAT:
 
 @smallexample
    Ada_83
    Ada_95
    Ada_05
+   Ada_2005
+   Assertion_Policy
    C_Pass_By_Copy
+   Check_Name
+   Check_Policy
+   Compile_Time_Error
+   Compile_Time_Warning
+   Compiler_Unit
    Component_Alignment
+   Debug_Policy
    Detect_Blocking
    Discard_Names
    Elaboration_Checks
    Eliminate
    Extend_System
    External_Name_Casing
+   Fast_Math
+   Favor_Top_Level
    Float_Representation
+   Implicit_Packing
    Initialize_Scalars
    Interrupt_State
    License
    Locking_Policy
    Long_Float
+   No_Run_Time
+   No_Strict_Aliasing
    Normalize_Scalars
+   Optimize_Alignment
    Persistent_BSS
    Polling
+   Priority_Specific_Dispatching
    Profile
    Profile_Warnings
    Propagate_Exceptions
@@ -10465,14 +11081,18 @@ recognized by @code{GNAT}:
    Restrictions_Warnings
    Reviewable
    Source_File_Name
+   Source_File_Name_Project
    Style_Checks
    Suppress
+   Suppress_Exception_Locations
    Task_Dispatching_Policy
    Universal_Data
    Unsuppress
    Use_VADS_Size
-   Warnings
    Validity_Checks
+   Warnings
+   Wide_Character_Encoding
+
 @end smallexample
 
 @menu
@@ -10514,15 +11134,15 @@ configuration pragmas, or more conveniently  by
 direct editing of the @file{gnat.adc} file, which is a standard format
 source file.
 
-In addition to @file{gnat.adc}, one additional file containing configuration
+In addition to @file{gnat.adc}, additional files containing configuration
 pragmas may be applied to the current compilation using the switch
 @option{-gnatec}@var{path}. @var{path} must designate an existing file that
 contains only configuration pragmas. These configuration pragmas are
 in addition to those found in @file{gnat.adc} (provided @file{gnat.adc}
 is present and switch @option{-gnatA} is not used).
 
-It is allowed to specify several switches @option{-gnatec}, however only
-the last one on the command line will be taken into account.
+It is allowed to specify several switches @option{-gnatec}, all of which
+will be taken into account.
 
 If you are using project file, a separate mechanism is provided using
 project attributes, see @ref{Specifying Configuration Pragmas} for more
@@ -10569,7 +11189,7 @@ When the source file names do not follow the standard GNAT default file naming
 conventions, the GNAT compiler must be given additional information through
 a configuration pragmas file (@pxref{Configuration Pragmas})
 or a project file.
-When the non standard file naming conventions are well-defined,
+When the non-standard file naming conventions are well-defined,
 a small number of pragmas @code{Source_File_Name} specifying a naming pattern
 (@pxref{Alternative File Naming Schemes}) may be sufficient. However,
 if the file naming conventions are irregular or arbitrary, a number
@@ -10587,7 +11207,8 @@ set of files.
 The usual form of the @code{gnatname} command is
 
 @smallexample
-$ gnatname [@var{switches}] @var{naming_pattern} [@var{naming_patterns}]
+$ gnatname @ovar{switches} @var{naming_pattern} @ovar{naming_patterns}
+      @r{[}--and @ovar{switches} @var{naming_pattern} @ovar{naming_patterns}@r{]}
 @end smallexample
 
 @noindent
@@ -10608,6 +11229,14 @@ A Naming Pattern is a regular expression similar to the wildcard patterns
 used in file names by the Unix shells or the DOS prompt.
 
 @noindent
+@code{gnatname} may be called with several sections of directories/patterns.
+Sections are separated by switch @code{--and}. In each section, there must be
+at least one pattern. If no directory is specified in a section, the current
+directory (or the project directory is @code{-P} is used) is implied.
+The options other that the directory switches and the patterns apply globally
+even if they are in different sections.
+
+@noindent
 Examples of Naming Patterns are
 
 @smallexample
@@ -10622,9 +11251,10 @@ see the second kind of regular expressions described in @file{g-regexp.ads}
 (the ``Glob'' regular expressions).
 
 @noindent
-When invoked with no switches, @code{gnatname} will create a configuration
-pragmas file @file{gnat.adc} in the current working directory, with pragmas
-@code{Source_File_Name} for each file that contains a valid Ada unit.
+When invoked with no switch @code{-P}, @code{gnatname} will create a
+configuration pragmas file @file{gnat.adc} in the current working directory,
+with pragmas @code{Source_File_Name} for each file that contains a valid Ada
+unit.
 
 @node Switches for gnatname
 @section Switches for @code{gnatname}
@@ -10638,6 +11268,18 @@ You may specify any of the following switches to @code{gnatname}:
 @table @option
 @c !sort!
 
+@item --version
+@cindex @option{--version} @command{gnatname}
+Display Copyright and version, then exit disregarding all other options.
+
+@item --help
+@cindex @option{--help} @command{gnatname}
+If @option{--version} was not used, display usage, then exit disregarding
+all other options.
+
+@item --and
+Start another section of directories/patterns.
+
 @item ^-c^/CONFIG_FILE=^@file{file}
 @cindex @option{^-c^/CONFIG_FILE^} (@code{gnatname})
 Create a configuration pragmas file @file{file} (instead of the default
@@ -10676,9 +11318,9 @@ Look for source files in all directories listed in text file @file{file}.
 There may be zero, one or more spaces between @option{^-D^/DIRS_FILE=^}
 and @file{file}.
 @file{file} must be an existing, readable text file.
-Each non empty line in @file{file} must be a directory.
+Each nonempty line in @file{file} must be a directory.
 Specifying switch @option{^-D^/DIRS_FILE^} is equivalent to specifying as many
-switches @option{^-d^/SOURCE_DIRS^} as there are non empty lines in
+switches @option{^-d^/SOURCE_DIRS^} as there are nonempty lines in
 @file{file}.
 
 @item ^-f^/FOREIGN_PATTERN=^@file{pattern}
@@ -10693,7 +11335,7 @@ gnatname ^-Pprj -f"*.c"^/PROJECT_FILE=PRJ /FOREIGN_PATTERN=*.C^ "*.ada"
 @noindent
 will look for Ada units in all files with the @file{.ada} extension,
 and will add to the list of file for project @file{prj.gpr} the C files
-with extension ".^c^C^".
+with extension @file{.^c^C^}.
 
 @item ^-h^/HELP^
 @cindex @option{^-h^/HELP^} (@code{gnatname})
@@ -10928,7 +11570,8 @@ that might be used by the developers.
 The next section introduces the main features of GNAT's project facility
 through a sequence of examples; subsequent sections will present the syntax
 and semantics in more detail. A more formal description of the project
-facility appears in the GNAT Reference Manual.
+facility appears in @ref{Project File Reference,,, gnat_rm, GNAT
+Reference Manual}.
 
 @c *****************************
 @c * Examples of Project Files *
@@ -11198,7 +11841,7 @@ Attribute @code{Executable_Suffix}, when specified, may change the suffix
 of the executable files, when no attribute @code{Executable} applies:
 its value replace the platform-specific executable suffix.
 Attributes @code{Executable} and @code{Executable_Suffix} are the only ways to
-specify a non default executable file name when several mains are built at once
+specify a non-default executable file name when several mains are built at once
 in a single @command{gnatmake} command.
 
 @node Source File Naming Conventions
@@ -11384,7 +12027,7 @@ files is located in its respective project file directory.  Schematically:
 @noindent
 We want to develop an application in directory @file{^/app^[APP]^} that
 @code{with} the packages @code{GUI} and @code{Comm}, using the properties of
-the corresponding project files (e.g. the ^switch^switch^ settings
+the corresponding project files (e.g.@: the ^switch^switch^ settings
 and object directory).
 Skeletal code for a main procedure might be something like the following:
 
@@ -11392,9 +12035,9 @@ Skeletal code for a main procedure might be something like the following:
 @group
 with GUI, Comm;
 procedure App_Main is
-   ...
+   @dots{}
 begin
-   ...
+   @dots{}
 end App_Main;
 @end group
 @end smallexample
@@ -11468,7 +12111,7 @@ relaxed in a future release.
 @noindent
 In large software systems it is common to have multiple
 implementations of a common interface; in Ada terms, multiple versions of a
-package body for the same specification.  For example, one implementation
+package body for the same spec.  For example, one implementation
 might be safe for use in tasking programs, while another might only be used
 in sequential applications.  This can be modeled in GNAT using the concept
 of @emph{project extension}.  If one project (the ``child'') @emph{extends}
@@ -11548,20 +12191,22 @@ and no longer requires a body: in this case, it is necessary to indicate that
 the inherited body is not part of the sources of the project, otherwise there
 will be a compilation error when compiling the spec.
 
-For that purpose, the attribute @code{Locally_Removed_Files} is used.
-Its value is a string list: a list of file names.
+For that purpose, the attribute @code{Excluded_Source_Files} is used.
+Its value is a string list: a list of file names. It is also possible to use
+attribute @code{Excluded_Source_List_File}. Its value is a single string:
+the file name of a text file containing a list of file names, one per line.
 
 @smallexample @c @projectfile
 project B extends "a" is
    for Source_Files use ("pkg.ads");
    --  New spec of Pkg does not need a completion
-   for Locally_Removed_Files use ("pkg.adb");
+   for Excluded_Source_Files use ("pkg.adb");
 end B;
 @end smallexample
 
-Attribute @code{Locally_Removed_Files} may also be used to check if a source
+Attribute @code{Excluded_Source_Files} may also be used to check if a source
 is still needed: if it is possible to build using @command{gnatmake} when such
-a source is put in attribute @code{Locally_Removed_Files} of a project P, then
+a source is put in attribute @code{Excluded_Source_Files} of a project P, then
 it is possible to remove the source completely from a system that includes
 project P.
 
@@ -11574,6 +12219,7 @@ project P.
 
 @menu
 * Basic Syntax::
+* Qualified Projects::
 * Packages::
 * Expressions::
 * String Types::
@@ -11631,12 +12277,16 @@ word @code{end} at the end of the project file, followed by a semi-colon.
 Any name in a project file, such as the project name or a variable name,
 has the same syntax as an Ada identifier.
 
-The reserved words of project files are the Ada reserved words plus
+The reserved words of project files are the Ada 95 reserved words plus
 @code{extends}, @code{external}, and @code{project}.  Note that the only Ada
 reserved words currently used in project file syntax are:
 
 @itemize @bullet
 @item
+@code{all}
+@item
+@code{at}
+@item
 @code{case}
 @item
 @code{end}
@@ -11645,6 +12295,10 @@ reserved words currently used in project file syntax are:
 @item
 @code{is}
 @item
+@code{limited}
+@item
+@code{null}
+@item
 @code{others}
 @item
 @code{package}
@@ -11661,9 +12315,42 @@ reserved words currently used in project file syntax are:
 @end itemize
 
 @noindent
-Comments in project files have the same syntax as in Ada, two consecutives
+Comments in project files have the same syntax as in Ada, two consecutive
 hyphens through the end of the line.
 
+@node Qualified Projects
+@subsection Qualified Projects
+
+@noindent
+Before the reserved @code{project}, there may be one or two "qualifiers", that
+is identifiers or other reserved words, to qualify the project.
+
+The current list of qualifiers is:
+
+@itemize @bullet
+@item
+@code{abstract}: qualify a project with no sources. An abstract project must
+have a declaration specifying that there are no sources in the project, and,
+if it extends another project, the project it extends must also be a qualified
+abstract project.
+
+@item
+@code{standard}: a standard project is a non library project with sources.
+
+@item
+@code{aggregate}: for future extension
+
+@item
+@code{aggregate library}: for future extension
+
+@item
+@code{library}: a library project must declare both attributes
+@code{Library_Name} and @code{Library_Dir}.
+
+@item
+@code{configuration}: a configuration project cannot be in a project tree.
+@end itemize
+
 @node Packages
 @subsection Packages
 
@@ -11738,7 +12425,7 @@ A @emph{string expression} is either a @emph{simple string expression} or a
 
 A @emph{simple string expression} is one of the following:
 @itemize @bullet
-@item A literal string; e.g.@code{"comm/my_proj.gpr"}
+@item A literal string; e.g.@: @code{"comm/my_proj.gpr"}
 @item A string-valued variable reference (@pxref{Variables})
 @item A string-valued attribute reference (@pxref{Attributes})
 @item An external reference (@pxref{External References in Project Files})
@@ -11926,8 +12613,12 @@ The following attributes are defined on projects (all are simple attributes):
 @tab string
 @item @code{Exec_Dir}
 @tab string
-@item @code{Locally_Removed_Files}
+@item @code{Excluded_Source_Dirs}
+@tab string list
+@item @code{Excluded_Source_Files}
 @tab string list
+@item @code{Excluded_Source_List_File}
+@tab string
 @item @code{Languages}
 @tab string list
 @item @code{Main}
@@ -12069,7 +12760,7 @@ The prefix of an attribute may be:
 @item The name of an imported project
 @item The name of a parent project that is extended by the current project
 @item An expanded name whose prefix is imported/parent project name,
-      and whose selector is a package name
+and whose selector is a package name
 @end itemize
 
 @noindent
@@ -12190,9 +12881,10 @@ case variable.
 An @code{others} alternative, if present, must occur last.
 
 After each @code{=>}, there are zero or more constructions.  The only
-constructions allowed in a case construction are other case constructions and
-attribute declarations. String type declarations, variable declarations and
-package declarations are not allowed.
+constructions allowed in a case construction are other case constructions,
+attribute declarations and variable declarations. String type declarations and
+package declarations are not allowed. Variable declarations are restricted to
+variables that have already been declared before the case construction.
 
 The value of the case variable is often given by an external reference
 (@pxref{External References in Project Files}).
@@ -12233,7 +12925,7 @@ in the project file.
 @end smallexample
 
 @noindent
-The attribute @var{Object_Dir} has a string value, the path name of the object
+The attribute @code{Object_Dir} has a string value, the path name of the object
 directory. The path name may be absolute or relative to the directory of the
 project file. This directory must already exist, and be readable and writable.
 
@@ -12256,7 +12948,7 @@ in the project file.
 @end smallexample
 
 @noindent
-The attribute @var{Exec_Dir} has a string value, the path name of the exec
+The attribute @code{Exec_Dir} has a string value, the path name of the exec
 directory. The path name may be absolute or relative to the directory of the
 project file. This directory must already exist, and be writable.
 
@@ -12403,7 +13095,7 @@ source files.
   with "project1", "utilities.gpr";
   with "/namings/apex.gpr";
   project Main is
-    ...
+    @dots{}
 @end group
 @end smallexample
 
@@ -12530,7 +13222,7 @@ modified versions of some of the source files, without changing the original
 sources. This can be achieved through the @emph{project extension} facility.
 
 @smallexample @c projectfile
-   project Modified_Utilities extends "/baseline/utilities.gpr" is ...
+   project Modified_Utilities extends "/baseline/utilities.gpr" is @dots{}
 @end smallexample
 
 @noindent
@@ -12546,15 +13238,15 @@ of the child project; see @ref{Project File Syntax}.
 
 An inherited source file retains any switches specified in the parent project.
 
-For example if the project @code{Utilities} contains the specification and the
+For example if the project @code{Utilities} contains the spec and the
 body of an Ada package @code{Util_IO}, then the project
 @code{Modified_Utilities} can contain a new body for package @code{Util_IO}.
 The original body of @code{Util_IO} will not be considered in program builds.
-However, the package specification will still be found in the project
+However, the package spec will still be found in the project
 @code{Utilities}.
 
-A child project can have only one parent but it may import any number of other
-projects.
+A child project can have only one parent, except when it is qualified as
+abstract. But it may import any number of other projects.
 
 A project is not allowed to import directly or indirectly at the same time a
 child project and any of its ancestors.
@@ -12609,7 +13301,7 @@ This project hierarchy will need to be extended as follows:
 Create project A1 that extends A, placing modified P1 there:
 
 @smallexample @c 0projectfile
-project A1 extends "(...)/A" is
+project A1 extends "(@dots{})/A" is
 end A1;
 @end smallexample
 
@@ -12618,8 +13310,8 @@ Create project C1 that "extends all" C and imports A1, placing modified
 P3 there:
 
 @smallexample @c 0projectfile
-with "(...)/A1";
-project C1 extends all "(...)/C" is
+with "(@dots{})/A1";
+project C1 extends all "(@dots{})/C" is
 end C1;
 @end smallexample
 @end enumerate
@@ -12684,7 +13376,7 @@ an attribute declaration.
    Mode : Mode_Type := external ("MODE");
    case Mode is
      when "Debug" =>
-        ...
+        @dots{}
 @end group
 @end smallexample
 
@@ -12744,7 +13436,7 @@ the project file for an imported project.
   with "/global/apex.gpr";
   project Example is
     package Naming renames Apex.Naming;
-    ...
+    @dots{}
   end Example;
 @end group
 @end smallexample
@@ -12784,7 +13476,7 @@ a project.
 @group
      package Builder is
         for ^Default_Switches^Default_Switches^ ("Ada")
-            use Imported.Builder.Ada_^Switches^Switches^ &
+            use Imported.Builder'Ada_^Switches^Switches^ &
                 "^-gnatg^-gnatg^" &
                 "^-v^-v^";
      end Builder;
@@ -12793,7 +13485,7 @@ a project.
 @group
      package Compiler is
         for ^Default_Switches^Default_Switches^ ("Ada")
-            use Base.Compiler.Ada_^Switches^Switches^;
+            use Base.Compiler'Ada_^Switches^Switches^;
      end Compiler;
   end Main;
 @end group
@@ -12884,14 +13576,14 @@ You can define the following attributes in package @code{Naming}:
 
 @table @code
 
-@item @var{Casing}
+@item @code{Casing}
 This must be a string with one of the three values @code{"lowercase"},
 @code{"uppercase"} or @code{"mixedcase"}; these strings are case insensitive.
 
 @noindent
-If @var{Casing} is not specified, then the default is @code{"lowercase"}.
+If @code{Casing} is not specified, then the default is @code{"lowercase"}.
 
-@item @var{Dot_Replacement}
+@item @code{Dot_Replacement}
 This must be a string whose value satisfies the following conditions:
 
 @itemize @bullet
@@ -12906,7 +13598,7 @@ is @code{"."}
 @noindent
 If @code{Dot_Replacement} is not specified, then the default is @code{"-"}.
 
-@item @var{Spec_Suffix}
+@item @code{Spec_Suffix}
 This is an associative array (indexed by the programming language name, case
 insensitive) whose value is a string that must satisfy the following
 conditions:
@@ -12919,7 +13611,7 @@ conditions:
 If @code{Spec_Suffix ("Ada")} is not specified, then the default is
 @code{"^.ads^.ADS^"}.
 
-@item @var{Body_Suffix}
+@item @code{Body_Suffix}
 This is an associative array (indexed by the programming language name, case
 insensitive) whose value is a string that must satisfy the following
 conditions:
@@ -12927,21 +13619,26 @@ conditions:
 @itemize @bullet
 @item It must not be empty
 @item It must include at least one dot
-@item It cannot end with the same string as @code{Spec_Suffix ("Ada")}
+@item It cannot be the same as @code{Spec_Suffix ("Ada")}
 @end itemize
 @noindent
+If @code{Body_Suffix ("Ada")} and @code{Spec_Suffix ("Ada")} end with the
+same string, then a file name that ends with the longest of these two suffixes
+will be a body if the longest suffix is @code{Body_Suffix ("Ada")} or a spec
+if the longest suffix is @code{Spec_Suffix ("Ada")}.
+
 If @code{Body_Suffix ("Ada")} is not specified, then the default is
 @code{"^.adb^.ADB^"}.
 
-@item @var{Separate_Suffix}
+@item @code{Separate_Suffix}
 This must be a string whose value satisfies the same conditions as
-@code{Body_Suffix}.
+@code{Body_Suffix}. The same "longest suffix" rules apply.
 
 @noindent
 If @code{Separate_Suffix ("Ada")} is not specified, then it defaults to same
 value as @code{Body_Suffix ("Ada")}.
 
-@item @var{Spec}
+@item @code{Spec}
 @noindent
 You can use the associative array attribute @code{Spec}  to define
 the source file name for an individual Ada compilation unit's spec. The array
@@ -12954,7 +13651,7 @@ operating system).
    for Spec ("MyPack.MyChild") use "mypack.mychild.spec";
 @end smallexample
 
-@item @var{Body}
+@item @code{Body}
 
 You can use the associative array attribute @code{Body} to
 define the source file name for an individual Ada compilation unit's body
@@ -13017,7 +13714,7 @@ to indicate what kind of library should be build.
 
 The @code{Library_ALI_Dir} attribute may be specified to indicate the
 directory where the ALI files of the library will be copied. When it is
-not specified, the ALI files are copied ti the directory specified in
+not specified, the ALI files are copied to the directory specified in
 attribute @code{Library_Dir}. The directory specified by @code{Library_ALI_Dir}
 must be writable and different from the project's object directory and from
 any source directory in the project tree.
@@ -13124,7 +13821,7 @@ that make a project a Library Project (@code{Library_Name} and
 @end group
 @end smallexample
 
-Attribute @code{Library_Interface} has a non empty string list value,
+Attribute @code{Library_Interface} has a nonempty string list value,
 each string in the list designating a unit contained in an immediate source
 of the project file.
 
@@ -13147,7 +13844,7 @@ two possible values: "false" or "true" (case-insensitive). Specifying
 "false" for attribute @code{Library_Auto_Init} will prevent automatic
 initialization of dynamic or relocatable libraries.
 
-When a non automatically initialized Stand-alone Library is used
+When a non-automatically initialized Stand-alone Library is used
 in an executable, its initialization procedure must be called before
 any service of the library is used.
 When the main subprogram is in Ada, it may mean that the initialization
@@ -13192,7 +13889,7 @@ The following switches are used by GNAT tools that support project files:
 @table @option
 
 @item ^-P^/PROJECT_FILE=^@var{project}
-@cindex @option{^-P^/PROJECT_FILE^} (any tool supporting project files)
+@cindex @option{^-P^/PROJECT_FILE^} (any project-aware tool)
 Indicates the name of a project file. This project file will be parsed with
 the verbosity indicated by @option{^-vP^MESSAGE_PROJECT_FILES=^@emph{x}},
 if any, and using the external references indicated
@@ -13212,7 +13909,7 @@ on the command line are checked, the order of the switches
 or @option{^-X^/EXTERNAL_REFERENCE^} is not significant.
 
 @item ^-X^/EXTERNAL_REFERENCE=^@var{name=value}
-@cindex @option{^-X^/EXTERNAL_REFERENCE^} (any tool supporting project files)
+@cindex @option{^-X^/EXTERNAL_REFERENCE^} (any project-aware tool)
 Indicates that external variable @var{name} has the value @var{value}.
 The Project Manager will use this value for occurrences of
 @code{external(name)} when parsing the project file.
@@ -13237,8 +13934,7 @@ An external variable specified with a @option{^-X^/EXTERNAL_REFERENCE^} switch
 takes precedence over the value of the same name in the environment.
 
 @item ^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}
-@cindex @code{^-vP^/MESSAGES_PROJECT_FILE^} (any tool supporting project files)
-@c Previous line uses code vs option command, to stay less than 80 chars
+@cindex @option{^-vP^/MESSAGES_PROJECT_FILE^} (any project-aware tool)
 Indicates the verbosity of the parsing of GNAT project files.
 
 @ifclear vms
@@ -13259,6 +13955,25 @@ project files.
 If several @option{^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}} switches are present,
 only the last one is used.
 
+@item ^-aP^/ADD_PROJECT_SEARCH_DIR=^<dir>
+@cindex @option{^-aP^/ADD_PROJECT_SEARCH_DIR=^} (any project-aware tool)
+Add directory <dir> at the beginning of the project search path, in order,
+after the current working directory.
+
+@ifclear vms
+@item -eL
+@cindex @option{-eL} (any project-aware tool)
+Follow all symbolic links when processing project files.
+@end ifclear
+
+@item ^--subdirs^/SUBDIRS^=<subdir>
+@cindex @option{^--subdirs^/SUBDIRS^=} (gnatmake and gnatclean)
+This switch is recognized by gnatmake and gnatclean. It indicate that the real
+directories (except the source directories) are the subdirectories <subdir>
+of the directories specified in the project files. This applies in particular
+to object directories, library directories and exec directories. If the
+subdirectories do not exist, they are created automatically.
+
 @end table
 
 @c **********************************
@@ -13271,9 +13986,6 @@ only the last one is used.
 @menu
 * gnatmake and Project Files::
 * The GNAT Driver and Project Files::
-@ifclear vms
-* Glide and Project Files::
-@end ifclear
 @end menu
 
 @node gnatmake and Project Files
@@ -13512,7 +14224,7 @@ end Proj4;
 -- Ada source file:
 with Pack;
 procedure Foo_Main is
-   ...
+   @dots{}
 end Foo_Main;
 @end group
 @end smallexample
@@ -13678,25 +14390,27 @@ to @command{gnatmake} that the binder generated file should be compiled
 
 @noindent
 A number of GNAT tools, other than @command{^gnatmake^gnatmake^}
-are project-aware:
+can benefit from project files:
 @command{^gnatbind^gnatbind^},
+@command{^gnatcheck^gnatcheck^}),
+@command{^gnatclean^gnatclean^}),
+@command{^gnatelim^gnatelim^},
 @command{^gnatfind^gnatfind^},
 @command{^gnatlink^gnatlink^},
 @command{^gnatls^gnatls^},
-@command{^gnatelim^gnatelim^},
-@command{^gnatpp^gnatpp^},
 @command{^gnatmetric^gnatmetric^},
+@command{^gnatpp^gnatpp^},
 @command{^gnatstub^gnatstub^},
 and @command{^gnatxref^gnatxref^}. However, none of these tools can be invoked
 directly with a project file switch (@option{^-P^/PROJECT_FILE=^}).
 They must be invoked through the @command{gnat} driver.
 
-The @command{gnat} driver is a front-end that accepts a number of commands and
-call the corresponding tool. It has been designed initially for VMS to convert
-VMS style qualifiers to Unix style switches, but it is now available to all
-the GNAT supported platforms.
+The @command{gnat} driver is a wrapper that accepts a number of commands and
+calls the corresponding tool. It was designed initially for VMS platforms (to
+convert VMS qualifiers to Unix-style switches), but it is now available on all
+GNAT platforms.
 
-On non VMS platforms, the @command{gnat} driver accepts the following commands
+On non-VMS platforms, the @command{gnat} driver accepts the following commands
 (case insensitive):
 
 @itemize @bullet
@@ -13739,7 +14453,7 @@ XREF to invoke @command{^gnatxref^gnatxref^}
 @command{^gnatmake -f -u -c^gnatmake -f -u -c^}).
 
 @noindent
-On non VMS platforms, between @command{gnat} and the command, two
+On non-VMS platforms, between @command{gnat} and the command, two
 special switches may be used:
 
 @itemize @bullet
@@ -13809,19 +14523,31 @@ package in the main project.
 package @code{Binder} for command BIND (invoking @code{^gnatbind^gnatbind^})
 
 @item
+package @code{Check} for command CHECK (invoking
+@code{^gnatcheck^gnatcheck^})
+
+@item
 package @code{Compiler} for command COMP or COMPILE (invoking the compiler)
 
 @item
-package @code{Finder} for command FIND (invoking @code{^gnatfind^gnatfind^})
+package @code{Cross_Reference} for command XREF (invoking
+@code{^gnatxref^gnatxref^})
 
 @item
 package @code{Eliminate} for command ELIM (invoking
 @code{^gnatelim^gnatelim^})
 
 @item
+package @code{Finder} for command FIND (invoking @code{^gnatfind^gnatfind^})
+
+@item
 package @code{Gnatls} for command LS or LIST (invoking @code{^gnatls^gnatls^})
 
 @item
+package @code{Gnatstub} for command STUB
+(invoking @code{^gnatstub^gnatstub^})
+
+@item
 package @code{Linker} for command LINK (invoking @code{^gnatlink^gnatlink^})
 
 @item
@@ -13832,14 +14558,6 @@ package @code{Metrics} for command METRIC
 package @code{Pretty_Printer} for command PP or PRETTY
 (invoking @code{^gnatpp^gnatpp^})
 
-@item
-package @code{Gnatstub} for command STUB
-(invoking @code{^gnatstub^gnatstub^})
-
-@item
-package @code{Cross_Reference} for command XREF (invoking
-@code{^gnatxref^gnatxref^})
-
 @end itemize
 
 @noindent
@@ -13864,7 +14582,7 @@ All other packages have two attribute @code{^Switches^Switches^} and
 @code{^Default_Switches^Default_Switches^}.
 
 @noindent
-@code{^Switches^Switches^} is an associated array attribute, indexed by the
+@code{^Switches^Switches^} is an associative array attribute, indexed by the
 source file name, that has a string list value: the ^switches^switches^ to be
 used when the tool corresponding to the package is invoked for the specific
 source file.
@@ -13954,23 +14672,29 @@ found in the package corresponding to the tool:
 @code{^Default_Switches^Default_Switches^ ("Ada")} for all tools,
 except @code{^Switches^Switches^ ("main.adb")}
 for @code{^gnatlink^gnatlink^}.
-
-@ifclear vms
-@node Glide and Project Files
-@subsection Glide and Project Files
-
-@noindent
-Glide will automatically recognize the @file{.gpr} extension for
-project files, and will
-convert them to its own internal format automatically. However, it
-doesn't provide a syntax-oriented editor for modifying these
-files.
-The project file will be loaded as text when you select the menu item
-@code{Ada} @result{} @code{Project} @result{} @code{Edit}.
-You can edit this text and save the @file{gpr} file;
-when you next select this project file in Glide it
-will be automatically reloaded.
-@end ifclear
+It is also possible to invoke some of the tools,
+@code{^gnatcheck^gnatcheck^}),
+@code{^gnatmetric^gnatmetric^}),
+and @code{^gnatpp^gnatpp^})
+on a set of project units thanks to the combination of the switches
+@option{-P}, @option{-U} and possibly the main unit when one is interested
+in its closure. For instance,
+@smallexample
+gnat metric -Pproj
+@end smallexample
+will compute the metrics for all the immediate units of project
+@code{proj}.
+@smallexample
+gnat metric -Pproj -U
+@end smallexample
+will compute the metrics for all the units of the closure of projects
+rooted at @code{proj}.
+@smallexample
+gnat metric -Pproj -U main_unit
+@end smallexample
+will compute the metrics for the closure of units rooted at
+@code{main_unit}. This last possibility relies implicitly
+on @command{gnatbind}'s option @option{-R}.
 
 @c **********************
 @node An Extended Example
@@ -14158,9 +14882,9 @@ declarative_item ::=
   other_declarative_item
 
 package_declaration ::=
-  package_specification | package_renaming
+  package_spec | package_renaming
 
-package_specification ::=
+package_spec ::=
   @b{package} package_identifier @b{is}
     @{simple_declarative_item@}
   @b{end} package_identifier ;
@@ -14279,6 +15003,9 @@ To use these tools, you must not compile your application using the
 (@pxref{The GNAT Make Program gnatmake}). Otherwise, cross-referencing
 information will not be generated.
 
+Note: to invoke @code{gnatxref} or @code{gnatfind} with a project file,
+use the @code{gnat} driver (see @ref{The GNAT Driver and Project Files}).
+
 @menu
 * gnatxref Switches::
 * gnatfind Switches::
@@ -14294,14 +15021,15 @@ information will not be generated.
 @noindent
 The command invocation for @code{gnatxref} is:
 @smallexample
-$ gnatxref [switches] sourcefile1 [sourcefile2 ...]
+$ gnatxref @ovar{switches} @var{sourcefile1} @r{[}@var{sourcefile2} @dots{}@r{]}
 @end smallexample
 
 @noindent
 where
 
-@table @code
-@item sourcefile1, sourcefile2
+@table @var
+@item sourcefile1
+@itemx sourcefile2
 identifies the source files for which a report is to be generated. The
 ``with''ed units will be processed too. You must provide at least one file.
 
@@ -14317,9 +15045,18 @@ the source path. If you specify directories, no result is produced.
 @end table
 
 @noindent
-The switches can be :
+The switches can be:
 @table @option
 @c !sort!
+@item --version
+@cindex @option{--version} @command{gnatxref}
+Display Copyright and version, then exit disregarding all other options.
+
+@item --help
+@cindex @option{--help} @command{gnatxref}
+If @option{--version} was not used, display usage, then exit disregarding
+all other options.
+
 @item ^-a^/ALL_FILES^
 @cindex @option{^-a^/ALL_FILES^} (@command{gnatxref})
 If this switch is present, @code{gnatfind} and @code{gnatxref} will parse
@@ -14376,8 +15113,8 @@ Equivalent to @samp{-aODIR -aIDIR}.
 
 @item -pFILE
 @cindex @option{-pFILE} (@command{gnatxref})
-Specify a project file to use @xref{Project Files}. These project files are
-the @file{.adp} files used by Glide. If you need to use the @file{.gpr}
+Specify a project file to use @xref{Project Files}.
+If you need to use the @file{.gpr}
 project files, you should use gnatxref through the GNAT driver
 (@command{gnat xref -Pproject}).
 
@@ -14416,17 +15153,17 @@ you can say @samp{gnatxref ^-ag^/ALL_FILES/IGNORE_LOCALS^} instead of
 The command line for @code{gnatfind} is:
 
 @smallexample
-$ gnatfind [switches] pattern[:sourcefile[:line[:column]]]
-      [file1 file2 ...]
+$ gnatfind @ovar{switches} @var{pattern}@r{[}:@var{sourcefile}@r{[}:@var{line}@r{[}:@var{column}@r{]]]}
+      @r{[}@var{file1} @var{file2} @dots{}]
 @end smallexample
 
 @noindent
 where
 
-@table @code
+@table @var
 @item pattern
 An entity will be output only if it matches the regular expression found
-in @samp{pattern}, see @ref{Regular Expressions in gnatfind and gnatxref}.
+in @var{pattern}, see @ref{Regular Expressions in gnatfind and gnatxref}.
 
 Omitting the pattern is equivalent to specifying @samp{*}, which
 will match any entity. Note that if you do not provide a pattern, you
@@ -14438,8 +15175,8 @@ for matching purposes. At the current time there is no support for
 
 @item sourcefile
 @code{gnatfind} will look for references, bodies or declarations
-of symbols referenced in @file{sourcefile}, at line @samp{line}
-and column @samp{column}. See @ref{Examples of gnatfind Usage}
+of symbols referenced in @file{@var{sourcefile}}, at line @var{line}
+and column @var{column}. See @ref{Examples of gnatfind Usage}
 for syntax examples.
 
 @item line
@@ -14451,21 +15188,23 @@ is a decimal integer identifying the exact location on the
 line of the first character of the identifier for the
 entity reference. Columns are numbered from 1.
 
-@item file1 file2 ...
+@item file1 file2 @dots{}
 The search will be restricted to these source files. If none are given, then
 the search will be done for every library file in the search path.
 These file must appear only after the pattern or sourcefile.
 
 These file names are considered to be regular expressions, so for instance
-specifying 'source*.adb' is the same as giving every file in the current
-directory whose name starts with 'source' and whose extension is 'adb'.
+specifying @file{source*.adb} is the same as giving every file in the current
+directory whose name starts with @file{source} and whose extension is
+@file{adb}.
 
 The location of the spec of the entity will always be displayed, even if it
-isn't in one of file1, file2,... The occurrences of the entity in the
-separate units of the ones given on the command line will also be displayed.
+isn't in one of @file{@var{file1}}, @file{@var{file2}},@enddots{}  The
+occurrences of the entity in the separate units of the ones given on the
+command line will also be displayed.
 
 Note that if you specify at least one file in this part, @code{gnatfind} may
-sometimes not be able to find the body of the subprograms...
+sometimes not be able to find the body of the subprograms.
 
 @end table
 
@@ -14477,6 +15216,14 @@ The following switches are available:
 @table @option
 @c !sort!
 
+@cindex @option{--version} @command{gnatfind}
+Display Copyright and version, then exit disregarding all other options.
+
+@item --help
+@cindex @option{--help} @command{gnatfind}
+If @option{--version} was not used, display usage, then exit disregarding
+all other options.
+
 @item ^-a^/ALL_FILES^
 @cindex @option{^-a^/ALL_FILES^} (@command{gnatfind})
 If this switch is present, @code{gnatfind} and @code{gnatxref} will parse
@@ -14587,7 +15334,7 @@ you specify @code{*} at the end of the command line.
 Project files allow a programmer to specify how to compile its
 application, where to find sources, etc.  These files are used
 @ifclear vms
-primarily by the Glide Ada mode, but they can also be used
+primarily by GPS, but they can also be used
 @end ifclear
 by the two tools
 @code{gnatxref} and @code{gnatfind}.
@@ -14661,8 +15408,8 @@ specifies the command used to compile a single file in the application.
 @ifclear vms
 @item make_cmd=COMMAND
 [default: @code{"gnatmake $@{main@} -aI$@{src_dir@}
- -aO$@{obj_dir@} -g -gnatq -cargs $@{comp_opt@}
- -bargs $@{bind_opt@} -largs $@{link_opt@}"}]
+-aO$@{obj_dir@} -g -gnatq -cargs $@{comp_opt@}
+-bargs $@{bind_opt@} -largs $@{link_opt@}"}]
 @end ifclear
 specifies the command used to recompile the whole application.
 
@@ -14686,14 +15433,14 @@ specifies the command used to debug the application
 @noindent
 As specified in the section about @command{gnatfind}, the pattern can be a
 regular expression. Actually, there are to set of regular expressions
-which are recognized by the program :
+which are recognized by the program:
 
 @table @code
 @item globbing patterns
 These are the most usual regular expression. They are the same that you
 generally used in a Unix shell command line, or in a DOS session.
 
-Here is a more formal grammar :
+Here is a more formal grammar:
 @smallexample
 @group
 @iftex
@@ -14704,7 +15451,7 @@ term   ::= elmt            -- matches elmt
 term   ::= elmt elmt       -- concatenation (elmt then elmt)
 term   ::= *               -- any string of 0 or more characters
 term   ::= ?               -- matches any character
-term   ::= [char @{char@}] -- matches any character listed
+term   ::= [char @{char@}]   -- matches any character listed
 term   ::= [char - char]   -- matches any character in range
 @end group
 @end smallexample
@@ -14721,9 +15468,9 @@ reference manual style BNF is as follows
 @leftskip=.5cm
 @end iftex
 @group
-regexp ::= term @{| term@} -- alternation (term or term ...)
+regexp ::= term @{| term@}   -- alternation (term or term @dots{})
 
-term ::= item @{item@}     -- concatenation (item then item)
+term ::= item @{item@}       -- concatenation (item then item)
 
 item ::= elmt              -- match elmt
 item ::= elmt *            -- zero or more elmt's
@@ -14744,18 +15491,19 @@ nschar ::= any character except ()[].*+?^^^
 @end group
 @end smallexample
 
-Following are a few examples :
+Following are a few examples:
 
 @table @samp
 @item abcde|fghi
-will match any of the two strings 'abcde' and 'fghi'.
+will match any of the two strings @samp{abcde} and @samp{fghi},
 
 @item abc*d
-will match any string like 'abd', 'abcd', 'abccd', 'abcccd', and so on
+will match any string like @samp{abd}, @samp{abcd}, @samp{abccd},
+@samp{abcccd}, and so on,
 
 @item [a-z]+
 will match any string which has only lowercase characters in it (and at
-least one character
+least one character.
 
 @end table
 @end table
@@ -14766,7 +15514,7 @@ least one character
 @subsection General Usage
 
 @noindent
-For the following examples, we will consider the following units :
+For the following examples, we will consider the following units:
 
 @smallexample @c ada
 @group
@@ -14862,9 +15610,9 @@ of these.
 @subsection Using gnatxref with vi
 
 @code{gnatxref} can generate a tags file output, which can be used
-directly from @file{vi}. Note that the standard version of @file{vi}
+directly from @command{vi}. Note that the standard version of @command{vi}
 will not work properly with overloaded symbols. Consider using another
-free implementation of @file{vi}, such as @file{vim}.
+free implementation of @command{vi}, such as @command{vim}.
 
 @smallexample
 $ gnatxref -v gnatfind.adb > tags
@@ -14874,8 +15622,8 @@ $ gnatxref -v gnatfind.adb > tags
 will generate the tags file for @code{gnatfind} itself (if the sources
 are in the search path!).
 
-From @file{vi}, you can then use the command @samp{:tag @i{entity}}
-(replacing @i{entity} by whatever you are looking for), and vi will
+From @command{vi}, you can then use the command @samp{:tag @var{entity}}
+(replacing @var{entity} by whatever you are looking for), and vi will
 display a new file with the corresponding declaration of entity.
 @end ifclear
 
@@ -14965,6 +15713,13 @@ semantically legal.
 If this condition is not met, @command{gnatpp} will terminate with an
 error message; no output file will be generated.
 
+If the source files presented to @command{gnatpp} contain
+preprocessing directives, then the output file will
+correspond to the generated source after all
+preprocessing is carried out. There is no way
+using @command{gnatpp} to obtain pretty printed files that
+include the preprocessing directives.
+
 If the compilation unit
 contained in the input source depends semantically upon units located
 outside the current directory, you have to provide the source search path
@@ -14978,7 +15733,7 @@ call @command{gnatpp} through the @command{gnat} driver
 The @command{gnatpp} command has the form
 
 @smallexample
-$ gnatpp [@var{switches}] @var{filename}
+$ gnatpp @ovar{switches} @var{filename}
 @end smallexample
 
 @noindent
@@ -15221,6 +15976,11 @@ GNAT-style comment beginning
 @item ^-c4^/COMMENTS_LAYOUT=REFORMAT^
 Reformat comment blocks
 
+@item ^-c5^/COMMENTS_LAYOUT=KEEP_SPECIAL^
+Keep unchanged special form comments
+
+Reformat comment blocks
+
 @cindex @option{^-l@var{n}^/CONSTRUCT_LAYOUT^} (@command{gnatpp})
 @item ^-l1^/CONSTRUCT_LAYOUT=GNAT^
 GNAT-style layout (this is the default)
@@ -15240,7 +16000,27 @@ stops.
 @cindex @option{^--no-separate-is^/NO_SEPARATE_IS^} (@command{gnatpp})
 @item ^--no-separate-is^/NO_SEPARATE_IS^
 Do not place the keyword @code{is} on a separate line in a subprogram body in
-case if the specification occupies more then one line.
+case if the spec occupies more then one line.
+
+@cindex @option{^--separate-loop-then^/SEPARATE_LOOP_THEN^} (@command{gnatpp})
+@item ^--separate-loop-then^/SEPARATE_LOOP_THEN^
+Place the keyword @code{loop} in FOR and WHILE loop statements and the
+keyword @code{then} in IF statements on a separate line.
+
+@cindex @option{^--no-separate-loop-then^/NO_SEPARATE_LOOP_THEN^} (@command{gnatpp})
+@item ^--no-separate-loop-then^/NO_SEPARATE_LOOP_THEN^
+Do not place the keyword @code{loop} in FOR and WHILE loop statements and the
+keyword @code{then} in IF statements on a separate line. This option is
+incompatible with @option{^--separate-loop-then^/SEPARATE_LOOP_THEN^} option.
+
+@cindex @option{^--use-on-new-line^/USE_ON_NEW_LINE^} (@command{gnatpp})
+@item ^--use-on-new-line^/USE_ON_NEW_LINE^
+Start each USE clause in a context clause from a separate line.
+
+@cindex @option{^--separate-stmt-name^/STMT_NAME_ON_NEW_LINE^} (@command{gnatpp})
+@item ^--separate-stmt-name^/STMT_NAME_ON_NEW_LINE^
+Use a separate line for a loop or block statement name, but do not use an extra
+indentation level for the statement itself.
 
 @end table
 
@@ -15277,18 +16057,18 @@ The @option{GNAT}, @option{COMPACT}, and @option{UNCOMPACT} options for the
 These switches allow control over line length and indentation.
 
 @table @option
-@item ^-M@i{nnn}^/LINE_LENGTH_MAX=@i{nnn}^
+@item ^-M@var{nnn}^/LINE_LENGTH_MAX=@var{nnn}^
 @cindex @option{^-M^/LINE_LENGTH^} (@command{gnatpp})
-Maximum line length, @i{nnn} from 32 ..256, the default value is 79
+Maximum line length, @var{nnn} from 32@dots{}256, the default value is 79
 
-@item ^-i@i{nnn}^/INDENTATION_LEVEL=@i{nnn}^
+@item ^-i@var{nnn}^/INDENTATION_LEVEL=@var{nnn}^
 @cindex @option{^-i^/INDENTATION_LEVEL^} (@command{gnatpp})
-Indentation level, @i{nnn} from 1 .. 9, the default value is 3
+Indentation level, @var{nnn} from 1@dots{}9, the default value is 3
 
-@item ^-cl@i{nnn}^/CONTINUATION_INDENT=@i{nnn}^
+@item ^-cl@var{nnn}^/CONTINUATION_INDENT=@var{nnn}^
 @cindex @option{^-cl^/CONTINUATION_INDENT^} (@command{gnatpp})
 Indentation level for continuation lines (relative to the line being
-continued), @i{nnn} from 1 .. 9.
+continued), @var{nnn} from 1@dots{}9.
 The default
 value is one less then the (normal) indentation level, unless the
 indentation is set to 1 (in which case the default value for continuation
@@ -15319,12 +16099,12 @@ insertion, so that the formatted source reflects the original.
 @cindex @option{^-ff^/FORM_FEED_AFTER_PRAGMA_PAGE^} (@command{gnatpp})
 Insert a Form Feed character after a pragma Page.
 
-@item ^-T@i{nnn}^/MAX_INDENT=@i{nnn}^
+@item ^-T@var{nnn}^/MAX_INDENT=@var{nnn}^
 @cindex @option{^-T^/MAX_INDENT^} (@command{gnatpp})
 Do not use an additional indentation level for @b{case} alternatives
-and variants if there are @i{nnn} or more (the default
+and variants if there are @var{nnn} or more (the default
 value is 10).
-If @i{nnn} is 0, an additional indentation level is
+If @var{nnn} is 0, an additional indentation level is
 used for @b{case} alternatives and variants regardless of their number.
 @end table
 
@@ -15395,8 +16175,8 @@ reading or processing the input file.
 Like @option{^-r^/REPLACE^} except that if the file with the specified name
 already exists, it is overwritten.
 
-@item ^-rnb^/NO_BACKUP^
-@cindex @option{^-rnb^/NO_BACKUP^} (@code{gnatpp})
+@item ^-rnb^/REPLACE_NO_BACKUP^
+@cindex @option{^-rnb^/REPLACE_NO_BACKUP^} (@code{gnatpp})
 Replace the input source file with the reformatted output without
 creating any backup copy of the input source.
 
@@ -15413,6 +16193,33 @@ the same as @option{^crlf^CRLF^}
 the same as @option{^unix^UNIX^}
 @end itemize
 
+@item ^-W^/RESULT_ENCODING=^@var{e}
+@cindex @option{^-W^/RESULT_ENCODING=^} (@command{gnatpp})
+Specify the wide character encoding method used to write the code in the
+result file
+@var{e} is one of the following:
+
+@itemize @bullet
+
+@item ^h^HEX^
+Hex encoding
+
+@item ^u^UPPER^
+Upper half encoding
+
+@item ^s^SHIFT_JIS^
+Shift/JIS encoding
+
+@item ^e^EUC^
+EUC encoding
+
+@item ^8^UTF8^
+UTF-8 encoding
+
+@item ^b^BRACKETS^
+Brackets encoding (default value)
+@end itemize
+
 @end table
 
 @noindent
@@ -15422,6 +16229,8 @@ Options @option{^-pipe^/STANDARD_OUTPUT^},
 contains only one file to reformat.
 Option
 @option{^--eol^/END_OF_LINE^}
+and
+@option{^-W^/RESULT_ENCODING^}
 cannot be used together
 with @option{^-pipe^/STANDARD_OUTPUT^} option.
 
@@ -15644,6 +16453,14 @@ comments may be reformatted in typical
 word processor style (that is, moving words between lines and putting as
 many words in a line as possible).
 
+@noindent
+The @option{^-c5^/COMMENTS_LAYOUT=KEEP_SPECIAL^} switch specifies, that comments
+that has a special format (that is, a character that is neither a letter nor digit
+not white space nor line break immediately following the leading @code{--} of
+the comment) should be without any change moved from the argument source
+into reformatted source. This switch allows to preserve comments that are used
+as a special marks in the code (e.g.@: SPARK annotation).
+
 @node Construct Layout
 @subsection Construct Layout
 
@@ -15788,6 +16605,13 @@ A further difference between GNAT style layout and compact layout is that
 GNAT style layout inserts empty lines as separation for
 compound statements, return statements and bodies.
 
+Note that the layout specified by
+@option{^--separate-stmt-name^/STMT_NAME_ON_NEW_LINE^}
+for named block and loop statements overrides the layout defined by these
+constructs by @option{^-l1^/CONSTRUCT_LAYOUT=GNAT^},
+@option{^-l2^/CONSTRUCT_LAYOUT=COMPACT^} or
+@option{^-l3^/CONSTRUCT_LAYOUT=UNCOMPACT^} option.
+
 @node Name Casing
 @subsection Name Casing
 
@@ -16006,28 +16830,28 @@ through the @command{gnat} driver.
 The @command{gnatmetric} command has the form
 
 @smallexample
-$ gnatmetric [@i{switches}] @{@i{filename}@} [@i{-cargs gcc_switches}]
+$ gnatmetric @ovar{switches} @{@var{filename}@} @r{[}-cargs @var{gcc_switches}@r{]}
 @end smallexample
 
 @noindent
 where
 @itemize @bullet
 @item
-@i{switches} specify the metrics to compute and define the destination for
+@var{switches} specify the metrics to compute and define the destination for
 the output
 
 @item
-Each @i{filename} is the name (including the extension) of a source
+Each @var{filename} is the name (including the extension) of a source
 file to process. ``Wildcards'' are allowed, and
 the file name may contain path information.
-If no @i{filename} is supplied, then the @i{switches} list must contain
+If no @var{filename} is supplied, then the @var{switches} list must contain
 at least one
 @option{-files} switch (@pxref{Other gnatmetric Switches}).
 Including both a @option{-files} switch and one or more
-@i{filename} arguments is permitted.
+@var{filename} arguments is permitted.
 
 @item
-@i{-cargs gcc_switches} is a list of switches for
+@samp{-cargs @var{gcc_switches}} is a list of switches for
 @command{gcc}. They will be passed on to all compiler invocations made by
 @command{gnatmetric} to generate the ASIS trees. Here you can provide
 @option{^-I^/INCLUDE_DIRS=^} switches to form the source search path,
@@ -16048,10 +16872,9 @@ The following subsections describe the various switches accepted by
 @menu
 * Output Files Control::
 * Disable Metrics For Local Units::
-* Line Metrics Control::
-* Syntax Metrics Control::
-* Complexity Metrics Control::
+* Specifying a set of metrics to compute::
 * Other gnatmetric Switches::
+* Generate project-wide metrics::
 @end menu
 
 @node Output Files Control
@@ -16065,9 +16888,11 @@ output is generated.
 
 When generating the output in textual form, @command{gnatmetric} creates
 for each Ada source file a corresponding text file
-containing the computed metrics. By default, this file
-is placed in the same directory as where the source file is located, and
-its name is obtained
+containing the computed metrics, except for the case when the set of metrics
+specified by gnatmetric parameters consists only of metrics that are computed
+for the whole set of analyzed sources, but not for each Ada source.
+By default, this file is placed in the same directory as where the source
+file is located, and its name is obtained
 by appending the ^@file{.metrix}^@file{$METRIX}^ suffix to the name of the
 input file.
 
@@ -16137,7 +16962,7 @@ kinds of locally declared program units:
 subprogram (and generic subprogram) bodies;
 
 @item
-package (and generic package) specifications and bodies;
+package (and generic package) specs and bodies;
 
 @item
 task object and type specifications and bodies;
@@ -16167,18 +16992,37 @@ Do not compute detailed metrics for eligible local program units
 
 @end table
 
-@node Line Metrics Control
-@subsection Line Metrics Control
-@cindex Line metrics control in @command{gnatmetric}
+@node Specifying a set of metrics to compute
+@subsection Specifying a set of metrics to compute
 
 @noindent
-For any (legal) source file, and for each of its
-eligible local program units, @command{gnatmetric} computes the following
-metrics:
+By default all the metrics are computed and reported. The switches
+described in this subsection allow you to control, on an individual
+basis, whether metrics are computed and
+reported. If at least one positive metric
+switch is specified (that is, a switch that defines that a given
+metric or set of metrics is to be computed), then only
+explicitly specified metrics are reported.
 
-@itemize @bullet
-@item
-the total number of lines;
+@menu
+* Line Metrics Control::
+* Syntax Metrics Control::
+* Complexity Metrics Control::
+* Object-Oriented Metrics Control::
+@end menu
+
+@node Line Metrics Control
+@subsubsection Line Metrics Control
+@cindex Line metrics control in @command{gnatmetric}
+
+@noindent
+For any (legal) source file, and for each of its
+eligible local program units, @command{gnatmetric} computes the following
+metrics:
+
+@itemize @bullet
+@item
+the total number of lines;
 
 @item
 the total number of code lines (i.e., non-blank lines that are not comments)
@@ -16190,46 +17034,93 @@ the number of comment lines
 the number of code lines containing end-of-line comments;
 
 @item
+the comment percentage: the ratio between the number of lines that contain
+comments and the number of all non-blank lines, expressed as a percentage;
+
+@item
 the number of empty lines and lines containing only space characters and/or
 format effectors (blank lines)
 
+@item
+the average number of code lines in subprogram bodies, task bodies, entry
+bodies and statement sequences in package bodies (this metric is only computed
+across the whole set of the analyzed units)
+
 @end itemize
 
-If @command{gnatmetric} is invoked on more than one source file, it sums the
-values of the line metrics for all the files being processed and then
-generates the cumulative results.
+@noindent
+@command{gnatmetric} sums the values of the line metrics for all the
+files being processed and then generates the cumulative results. The tool
+also computes for all the files being processed the average number of code
+lines in bodies.
 
-By default, all the line metrics are computed and reported. You can use the
-following switches to select the specific line metrics to be computed and
-reported (if any of these parameters is set, only explicitly specified line
-metrics are computed).
+You can use the following switches to select the specific line metrics
+to be computed and reported.
 
 @table @option
-@cindex @option{^-la^/LINES_ALL^} (@command{gnatmetric})
-@item ^-la^/LINES_ALL^
-The number of all lines
+@cindex @option{^--lines@var{x}^/LINE_COUNT_METRICS^} (@command{gnatmetric})
+
+@ifclear vms
+@cindex @option{--no-lines@var{x}}
+@end ifclear
+
+@item ^--lines-all^/LINE_COUNT_METRICS=ALL_ON^
+Report all the line metrics
+
+@item ^--no-lines-all^/LINE_COUNT_METRICS=ALL_OFF^
+Do not report any of line metrics
+
+@item ^--lines^/LINE_COUNT_METRICS=ALL_LINES_ON^
+Report the number of all lines
+
+@item ^--no-lines^/LINE_COUNT_METRICS=ALL_LINES_OFF^
+Do not report the number of all lines
+
+@item ^--lines-code^/LINE_COUNT_METRICS=CODE_LINES_ON^
+Report the number of code lines
+
+@item ^--no-lines-code^/LINE_COUNT_METRICS=CODE_LINES_OFF^
+Do not report the number of code lines
+
+@item ^--lines-comment^/LINE_COUNT_METRICS=COMMENT_LINES_ON^
+Report the number of comment lines
 
-@cindex @option{^-lcode^/CODE_LINES^} (@command{gnatmetric})
-@item ^-lcode^/CODE_LINES^
-The number of code lines
+@item ^--no-lines-comment^/LINE_COUNT_METRICS=COMMENT_LINES_OFF^
+Do not report the number of comment lines
 
-@cindex @option{^-lcomm^/COMMENT_LINES^} (@command{gnatmetric})
-@item ^-lcomm^/COMENT_LINES^
-The number of comment lines
+@item ^--lines-eol-comment^/LINE_COUNT_METRICS=CODE_COMMENT_LINES_ON^
+Report the number of code lines containing
+end-of-line comments
 
-@cindex @option{^-leol^/MIXED_CODE_COMMENTS^} (@command{gnatmetric})
-@item ^-leol^/MIXED_CODE_COMMENTS^
-The number of code lines containing
+@item ^--no-lines-eol-comment^/LINE_COUNT_METRICS=CODE_COMMENT_LINES_OFF^
+Do not report the number of code lines containing
 end-of-line comments
 
-@cindex @option{^-lb^/BLANK_LINES^} (@command{gnatmetric})
-@item ^-lb^/BLANK_LINES^
-The number of blank lines
+@item ^--lines-ratio^/LINE_COUNT_METRICS=COMMENT_PERCENTAGE_ON^
+Report the comment percentage in the program text
+
+@item ^--no-lines-ratio^/LINE_COUNT_METRICS=COMMENT_PERCENTAGE_OFF^
+Do not report the comment percentage in the program text
+
+@item ^--lines-blank^/LINE_COUNT_METRICS=BLANK_LINES_ON^
+Report the number of blank lines
+
+@item ^--no-lines-blank^/LINE_COUNT_METRICS=BLANK_LINES_OFF^
+Do not report the number of blank lines
+
+@item ^--lines-average^/LINE_COUNT_METRICS=AVERAGE_BODY_LINES_ON^
+Report the average number of code lines in subprogram bodies, task bodies,
+entry bodies and statement sequences in package bodies. The metric is computed
+and reported for the whole set of processed Ada sources only.
+
+@item ^--no-lines-average^/LINE_COUNT_METRICS=AVERAGE_BODY_LINES_OFF^
+Do not report the average number of code lines in subprogram bodies,
+task bodies, entry bodies and statement sequences in package bodies.
 
 @end table
 
 @node Syntax Metrics Control
-@subsection Syntax Metrics Control
+@subsubsection Syntax Metrics Control
 @cindex Syntax metrics control in @command{gnatmetric}
 
 @noindent
@@ -16242,7 +17133,7 @@ The total number of declarations and the total number of statements
 
 @item Maximal static nesting level of inner program units
 According to
-@cite{Ada 95 Language Reference Manual}, 10.1(1), ``A program unit is either a
+@cite{Ada Reference Manual}, 10.1(1), ``A program unit is either a
 package, a task unit, a protected unit, a
 protected entry, a generic unit, or an explicitly declared subprogram other
 than an enumeration literal.''
@@ -16259,9 +17150,9 @@ the following metrics:
 
 @table @emph
 @item Public subprograms
-This metric is computed for package specifications. It is the
+This metric is computed for package specs. It is the
 number of subprograms and generic subprograms declared in the visible
-part (including in nested packages, protected objects, and
+part (including the visible part of nested packages, protected objects, and
 protected types).
 
 @item All subprograms
@@ -16274,11 +17165,11 @@ level and enclosing constructs. Generic bodies and bodies of protected
 subprograms are counted in the same way as ``usual'' subprogram bodies.
 
 @item Public types
-This metric is computed for package specifications and
+This metric is computed for package specs and
 generic package declarations. It is the total number of types
 that can be referenced from outside this compilation unit, plus the
-number of types from all the visible parts of all the visible generic packages.
-Generic formal types are not counted.  Only types, not subtypes,
+number of types from all the visible parts of all the visible generic
+packages. Generic formal types are not counted.  Only types, not subtypes,
 are included.
 
 @noindent
@@ -16317,52 +17208,80 @@ private etc.); the total number of types is computed and reported.
 
 @noindent
 By default, all the syntax metrics are computed and reported. You can use the
-following switches to select specific syntax metrics;
-if any of these is set, only the explicitly specified metrics are computed.
+following switches to select specific syntax metrics.
 
 @table @option
-@cindex @option{^-ed^/DECLARATION_TOTAL^} (@command{gnatmetric})
-@item ^-ed^/DECLARATION_TOTAL^
-The total number of declarations
 
-@cindex @option{^-es^/STATEMENT_TOTAL^} (@command{gnatmetric})
-@item ^-es^/STATEMENT_TOTAL^
-The total number of statements
+@cindex @option{^--syntax@var{x}^/SYNTAX_METRICS^} (@command{gnatmetric})
+
+@ifclear vms
+@cindex @option{--no-syntax@var{x}} (@command{gnatmetric})
+@end ifclear
+
+@item ^--syntax-all^/SYNTAX_METRICS=ALL_ON^
+Report all the syntax metrics
+
+@item ^--no-syntax-all^/ALL_OFF^
+Do not report any of syntax metrics
+
+@item ^--declarations^/SYNTAX_METRICS=DECLARATIONS_ON^
+Report the total number of declarations
+
+@item ^--no-declarations^/SYNTAX_METRICS=DECLARATIONS_OFF^
+Do not report the total number of declarations
+
+@item ^--statements^/SYNTAX_METRICS=STATEMENTS_ON^
+Report the total number of statements
+
+@item ^--no-statements^/SYNTAX_METRICS=STATEMENTS_OFF^
+Do not report the total number of statements
+
+@item ^--public-subprograms^/SYNTAX_METRICS=PUBLIC_SUBPROGRAMS_ON^
+Report the number of public subprograms in a compilation unit
 
-@cindex @option{^-eps^/^} (@command{gnatmetric})
-@item ^-eps^/INT_SUBPROGRAMS^
-The number of public subprograms in a compilation unit
+@item ^--no-public-subprograms^/SYNTAX_METRICS=PUBLIC_SUBPROGRAMS_OFF^
+Do not report the number of public subprograms in a compilation unit
 
-@cindex @option{^-eas^/SUBPROGRAMS_ALL^} (@command{gnatmetric})
-@item ^-eas^/SUBPROGRAMS_ALL^
-The number of all the subprograms in a compilation unit
+@item ^--all-subprograms^/SYNTAX_METRICS=ALL_SUBPROGRAMS_ON^
+Report the number of all the subprograms in a compilation unit
 
-@cindex @option{^-ept^/INT_TYPES^} (@command{gnatmetric})
-@item ^-ept^/INT_TYPES^
-The number of public types in a compilation unit
+@item ^--no-all-subprograms^/SYNTAX_METRICS=ALL_SUBPROGRAMS_OFF^
+Do not report the number of all the subprograms in a compilation unit
 
-@cindex @option{^-eat^/TYPES_ALL^} (@command{gnatmetric})
-@item ^-eat^/TYPES_ALL^
-The number of all the types in a compilation unit
+@item ^--public-types^/SYNTAX_METRICS=PUBLIC_TYPES_ON^
+Report the number of public types in a compilation unit
 
-@cindex @option{^-enu^/PROGRAM_NESTING_MAX^} (@command{gnatmetric})
-@item ^-enu^/PROGRAM_NESTING_MAX^
-The maximal program unit nesting level
+@item ^--no-public-types^/SYNTAX_METRICS=PUBLIC_TYPES_OFF^
+Do not report the number of public types in a compilation unit
 
-@cindex @option{^-ec^/CONSTRUCT_NESTING_MAX^} (@command{gnatmetric})
-@item ^-ec^/CONSTRUCT_NESTING_MAX^
-The maximal construct nesting level
+@item ^--all-types^/SYNTAX_METRICS=ALL_TYPES_ON^
+Report the number of all the types in a compilation unit
+
+@item ^--no-all-types^/SYNTAX_METRICS=ALL_TYPES_OFF^
+Do not report the number of all the types in a compilation unit
+
+@item ^--unit-nesting^/SYNTAX_METRICS=UNIT_NESTING_ON^
+Report the maximal program unit nesting level
+
+@item ^--no-unit-nesting^/SYNTAX_METRICS=UNIT_NESTING_OFF^
+Do not report the maximal program unit nesting level
+
+@item ^--construct-nesting^/SYNTAX_METRICS=CONSTRUCT_NESTING_ON^
+Report the maximal construct nesting level
+
+@item ^--no-construct-nesting^/SYNTAX_METRICS=CONSTRUCT_NESTING_OFF^
+Do not report the maximal construct nesting level
 
 @end table
 
 @node Complexity Metrics Control
-@subsection Complexity Metrics Control
+@subsubsection Complexity Metrics Control
 @cindex Complexity metrics control in @command{gnatmetric}
 
 @noindent
 For a program unit that is an executable body (a subprogram body (including
 generic bodies), task body, entry body or a package body containing
-its own statement sequence ) @command{gnatmetric} computes the following
+its own statement sequence) @command{gnatmetric} computes the following
 complexity metrics:
 
 @itemize @bullet
@@ -16379,7 +17298,7 @@ maximal loop nesting level
 
 @noindent
 The McCabe complexity metrics are defined
-in @url{www.mccabe.com/pdf/nist235r.pdf}
+in @url{http://www.mccabe.com/pdf/nist235r.pdf}
 
 According to McCabe, both control statements and short-circuit control forms
 should be taken into account when computing cyclomatic complexity. For each
@@ -16403,27 +17322,158 @@ When computing cyclomatic and essential complexity, @command{gnatmetric} skips
 the code in the exception handlers and in all the nested program units.
 
 By default, all the complexity metrics are computed and reported.
-For more finely-grained control you can use
+For more fine-grained control you can use
 the following switches:
 
 @table @option
-@cindex @option{^-n@var{x}^/SUPPRESS^} (@command{gnatmetric})
+@cindex @option{^-complexity@var{x}^/COMPLEXITY_METRICS^} (@command{gnatmetric})
+
+@ifclear vms
+@cindex @option{--no-complexity@var{x}}
+@end ifclear
+
+@item ^--complexity-all^/COMPLEXITY_METRICS=ALL_ON^
+Report all the complexity metrics
+
+@item ^--no-complexity-all^/COMPLEXITY_METRICS=ALL_OFF^
+Do not report any of complexity metrics
+
+@item ^--complexity-cyclomatic^/COMPLEXITY_METRICS=CYCLOMATIC_ON^
+Report the McCabe Cyclomatic Complexity
+
+@item ^--no-complexity-cyclomatic^/COMPLEXITY_METRICS=CYCLOMATIC_OFF^
+Do not report the McCabe Cyclomatic Complexity
+
+@item ^--complexity-essential^/COMPLEXITY_METRICS=ESSENTIAL_ON^
+Report the Essential Complexity
+
+@item ^--no-complexity-essential^/COMPLEXITY_METRICS=ESSENTIAL_OFF^
+Do not report the Essential Complexity
+
+@item ^--loop-nesting^/COMPLEXITY_METRICS=LOOP_NESTING_ON^
+Report maximal loop nesting level
 
-@item ^-nocc^/SUPPRESS=CYCLOMATIC_COMPLEXITY^
-Do not compute the McCabe Cyclomatic Complexity
+@item ^--no-loop-nesting^/COMPLEXITY_METRICS=LOOP_NESTING_OFF^
+Do not report maximal loop nesting level
 
-@item ^-noec^/SUPPRESS=ESSENTIAL_COMPLEXITY^
-Do not compute the Essential Complexity
+@item ^--complexity-average^/COMPLEXITY_METRICS=AVERAGE_COMPLEXITY_ON^
+Report the average McCabe Cyclomatic Complexity for all the subprogram bodies,
+task bodies, entry bodies and statement sequences in package bodies.
+The metric is computed and reported for whole set of processed Ada sources
+only.
 
-@item ^-nonl^/SUPPRESS=MAXIMAL_LOOP_NESTING^
-Do not compute maximal loop nesting level
+@item ^--no-complexity-average^/COMPLEXITY_METRICS=AVERAGE_COMPLEXITY_OFF^
+Do not report the average McCabe Cyclomatic Complexity for all the subprogram
+bodies, task bodies, entry bodies and statement sequences in package bodies
 
-@item ^-ne^/SUPPRESS=EXITS_AS_GOTOS^
+@cindex @option{^-ne^/NO_EXITS_AS_GOTOS^} (@command{gnatmetric})
+@item ^-ne^/NO_EXITS_AS_GOTOS^
 Do not consider @code{exit} statements as @code{goto}s when
 computing Essential Complexity
 
 @end table
 
+
+@node Object-Oriented Metrics Control
+@subsubsection Object-Oriented Metrics Control
+@cindex Object-Oriented metrics control in @command{gnatmetric}
+
+@noindent
+@cindex Coupling metrics (in in @command{gnatmetric})
+Coupling metrics are object-oriented metrics that measure the
+dependencies between a given class (or a group of classes) and the
+``external world'' (that is, the other classes in the program). In this
+subsection the term ``class'' is used in its
+traditional object-oriented programming sense
+(an instantiable module that contains data and/or method members).
+A @emph{category} (of classes)
+is a group of closely related classes that are reused and/or
+modified together.
+
+A class @code{K}'s @emph{efferent coupling} is the number of classes
+that @code{K} depends upon.
+A category's efferent coupling is the number of classes outside the
+category that the classes inside the category depend upon.
+
+A class @code{K}'s @emph{afferent coupling} is the number of classes
+that depend upon @code{K}.
+A category's afferent coupling is the number of classes outside the
+category that depend on classes belonging to the category.
+
+Ada's implementation of the object-oriented paradigm does not use the
+traditional class notion, so the definition of the coupling
+metrics for Ada maps the class and class category notions
+onto Ada constructs.
+
+For the coupling metrics, several kinds of modules -- a library package,
+a library generic package, and a library generic package instantiation --
+that define a tagged type or an interface type are
+considered to be a class. A category consists of a library package (or
+a library generic package) that defines a tagged or an interface type,
+together with all its descendant (generic) packages that define tagged
+or interface types. For any package counted as a class,
+its body (if any) is considered
+together with its spec when counting the dependencies. For dependencies
+between classes, the Ada semantic dependencies are considered.
+For coupling metrics, only dependencies on units that are considered as
+classes, are considered.
+
+When computing coupling metrics, @command{gnatmetric} counts only
+dependencies between units that are arguments of the gnatmetric call.
+Coupling metrics are program-wide (or project-wide) metrics, so to
+get a valid result, you should call @command{gnatmetric} for
+the whole set of sources that make up your program. It can be done
+by calling @command{gnatmetric} from the GNAT driver with @option{-U}
+option (see See @ref{The GNAT Driver and Project Files} for details.
+
+By default, all the coupling metrics are disabled. You can use the following
+switches to specify the coupling metrics to be computed and reported:
+
+@table @option
+
+@ifclear vms
+@cindex @option{--package@var{x}} (@command{gnatmetric})
+@cindex @option{--no-package@var{x}} (@command{gnatmetric})
+@cindex @option{--category@var{x}} (@command{gnatmetric})
+@cindex @option{--no-category@var{x}} (@command{gnatmetric})
+@end ifclear
+
+@ifset vms
+@cindex @option{/COUPLING_METRICS} (@command{gnatmetric})
+@end ifset
+
+@item ^--coupling-all^/COUPLING_METRICS=ALL_ON^
+Report all the coupling metrics
+
+@item ^--no-coupling-all^/COUPLING_METRICS=ALL_OFF^
+Do not report any of  metrics
+
+@item ^--package-efferent-coupling^/COUPLING_METRICS=PACKAGE_EFFERENT_ON^
+Report package efferent coupling
+
+@item ^--no-package-efferent-coupling^/COUPLING_METRICS=PACKAGE_EFFERENT_OFF^
+Do not report package efferent coupling
+
+@item ^--package-afferent-coupling^/COUPLING_METRICS=PACKAGE_AFFERENT_ON^
+Report package afferent coupling
+
+@item ^--no-package-afferent-coupling^/COUPLING_METRICS=PACKAGE_AFFERENT_OFF^
+Do not report package afferent coupling
+
+@item ^--category-efferent-coupling^/COUPLING_METRICS=CATEGORY_EFFERENT_ON^
+Report category efferent coupling
+
+@item ^--no-category-efferent-coupling^/COUPLING_METRICS=CATEGORY_EFFERENT_OFF^
+Do not report category efferent coupling
+
+@item ^--category-afferent-coupling^/COUPLING_METRICS=CATEGORY_AFFERENT_ON^
+Report category afferent coupling
+
+@item ^--no-category-afferent-coupling^/COUPLING_METRICS=CATEGORY_AFFERENT_OFF^
+Do not report category afferent coupling
+
+@end table
+
 @node Other gnatmetric Switches
 @subsection Other @code{gnatmetric} Switches
 
@@ -16434,7 +17484,7 @@ Additional @command{gnatmetric} switches are as follows:
 @item ^-files @var{filename}^/FILES=@var{filename}^
 @cindex @option{^-files^/FILES^} (@code{gnatmetric})
 Take the argument source files from the specified file. This file should be an
-ordinary textual file containing file names separated by spaces or
+ordinary text file containing file names separated by spaces or
 line breaks. You can use this switch more then once in the same call to
 @command{gnatmetric}. You also can combine this switch with
 an explicit list of files.
@@ -16456,6 +17506,32 @@ happens during the metrics computation
 Quiet mode.
 @end table
 
+@node Generate project-wide metrics
+@subsection Generate project-wide metrics
+
+In order to compute metrics on all units of a given project, you can use
+the @command{gnat} driver along with the @option{-P} option:
+@smallexample
+   gnat metric -Pproj
+@end smallexample
+
+@noindent
+If the project @code{proj} depends upon other projects, you can compute
+the metrics on the project closure using the @option{-U} option:
+@smallexample
+   gnat metric -Pproj -U
+@end smallexample
+
+@noindent
+Finally, if not all the units are relevant to a particular main
+program in the project closure, you can generate metrics for the set
+of units needed to create a given main program (unit closure) using
+the @option{-U} option followed by the name of the main unit:
+@smallexample
+   gnat metric -Pproj -U main
+@end smallexample
+
+
 @c ***********************************
 @node File Name Krunching Using gnatkr
 @chapter File Name Krunching Using @code{gnatkr}
@@ -16487,13 +17563,15 @@ Take the unit name and replace all dots by hyphens.
 @item
 If such a replacement occurs in the
 second character position of a name, and the first character is
-^a, g, s, or i^A, G, S, or I^ then replace the dot by the character
-^~ (tilde)^$ (dollar sign)^
+^@samp{a}, @samp{g}, @samp{s}, or @samp{i}, ^@samp{A}, @samp{G}, @samp{S}, or @samp{I},^
+then replace the dot by the character
+^@samp{~} (tilde)^@samp{$} (dollar sign)^
 instead of a minus.
 @end itemize
 The reason for this exception is to avoid clashes
 with the standard names for children of System, Ada, Interfaces,
-and GNAT, which use the prefixes ^s- a- i- and g-^S- A- I- and G-^
+and GNAT, which use the prefixes
+^@samp{s-}, @samp{a-}, @samp{i-}, and @samp{g-},^@samp{S-}, @samp{A-}, @samp{I-}, and @samp{G-},^
 respectively.
 
 The @option{^-gnatk^/FILE_NAME_MAX_LENGTH=^@var{nn}}
@@ -16517,7 +17595,7 @@ The @code{gnatkr} command has the form
 
 @ifclear vms
 @smallexample
-$ gnatkr @var{name} [@var{length}]
+$ gnatkr @var{name} @ovar{length}
 @end smallexample
 @end ifclear
 
@@ -16529,7 +17607,7 @@ $ gnatkr @var{name} /COUNT=nn
 
 @noindent
 @var{name} is the uncrunched file name, derived from the name of the unit
-in the standard manner described in the previous section (i.e. in particular
+in the standard manner described in the previous section (i.e., in particular
 all dots are replaced by hyphens). The file name may or may not have an
 extension (defined as a suffix of the form period followed by arbitrary
 characters other than period). If an extension is present then it will
@@ -16565,9 +17643,9 @@ unit and replacing the separating dots with hyphens and
 using ^lowercase^uppercase^
 for all letters, except that a hyphen in the second character position is
 replaced by a ^tilde^dollar sign^ if the first character is
-^a, i, g, or s^A, I, G, or S^.
+^@samp{a}, @samp{i}, @samp{g}, or @samp{s}^@samp{A}, @samp{I}, @samp{G}, or @samp{S}^.
 The extension is @code{.ads} for a
-specification and @code{.adb} for a body.
+spec and @code{.adb} for a body.
 Krunching does not affect the extension, but the file name is shortened to
 the specified length by following these rules:
 
@@ -16674,18 +17752,30 @@ $ gnatkr very_long_unit_name.ads/count=0 --> very_long_unit_name.ads
 @findex gnatprep
 
 @noindent
-The @code{gnatprep} utility provides
-a simple preprocessing capability for Ada programs.
-It is designed for use with GNAT, but is not dependent on any special
-features of GNAT.
+This chapter discusses how to use GNAT's @code{gnatprep} utility for simple
+preprocessing.
+Although designed for use with GNAT, @code{gnatprep} does not depend on any
+special GNAT features.
+For further discussion of conditional compilation in general, see
+@ref{Conditional Compilation}.
 
 @menu
+* Preprocessing Symbols::
 * Using gnatprep::
 * Switches for gnatprep::
 * Form of Definitions File::
 * Form of Input Text for gnatprep::
 @end menu
 
+@node Preprocessing Symbols
+@section Preprocessing Symbols
+
+@noindent
+Preprocessing symbols are defined in definition files and referred to in
+sources to be preprocessed. A Preprocessing symbol is an identifier, following
+normal Ada (case-insensitive) rules for its syntax, with the restriction that
+all characters need to be in the ASCII set (no accented letters).
+
 @node Using gnatprep
 @section Using @code{gnatprep}
 
@@ -16693,12 +17783,12 @@ features of GNAT.
 To call @code{gnatprep} use
 
 @smallexample
-$ gnatprep [switches] infile outfile [deffile]
+$ gnatprep @ovar{switches} @var{infile} @var{outfile} @ovar{deffile}
 @end smallexample
 
 @noindent
 where
-@table @code
+@table @var
 @item switches
 is an optional sequence of switches as described in the next section.
 
@@ -16713,7 +17803,7 @@ normally have an ads or adb suffix.
 
 @item deffile
 is the full name of a text file containing definitions of
-symbols to be referenced by the preprocessor. This argument is
+preprocessing symbols to be referenced by the preprocessor. This argument is
 optional, and can be replaced by the use of the @option{-D} switch.
 
 @end table
@@ -16742,15 +17832,15 @@ being preserved in the output file.
 Causes comments to be scanned. Normally comments are ignored by gnatprep.
 If this option is specified, then comments are scanned and any $symbol
 substitutions performed as in program text. This is particularly useful
-when structured comments are used (e.g. when writing programs in the
+when structured comments are used (e.g., when writing programs in the
 SPARK dialect of Ada). Note that this switch is not available when
 doing integrated preprocessing (it would be useless in this context
 since comments are ignored by the compiler in any case).
 
 @item ^-Dsymbol=value^/ASSOCIATE="symbol=value"^
 @cindex @option{^-D^/ASSOCIATE^} (@command{gnatprep})
-Defines a new symbol, associated with value. If no value is given on the
-command line, then symbol is considered to be @code{True}. This switch
+Defines a new preprocessing symbol, associated with value. If no value is given
+on the command line, then symbol is considered to be @code{True}. This switch
 can be used in place of a definition file.
 
 @ifset vms
@@ -16810,8 +17900,7 @@ symbol := value
 @end smallexample
 
 @noindent
-where symbol is an identifier, following normal Ada (case-insensitive)
-rules for its syntax, and value is one of the following:
+where symbol is a preprocessing symbol, and value is one of the following:
 
 @itemize @bullet
 @item
@@ -16840,13 +17929,13 @@ The preprocessor conditional inclusion commands have the form
 @smallexample
 @group
 @cartouche
-#if @i{expression} [then]
+#if @i{expression} @r{[}then@r{]}
    lines
-#elsif @i{expression} [then]
+#elsif @i{expression} @r{[}then@r{]}
    lines
-#elsif @i{expression} [then]
+#elsif @i{expression} @r{[}then@r{]}
    lines
-...
+@dots{}
 #else
    lines
 #end if;
@@ -16869,6 +17958,21 @@ In this example, @i{expression} is defined by the following grammar:
 @i{expression} ::=  ( @i{expression} )
 @end smallexample
 
+The following restriction exists: it is not allowed to have "and" or "or"
+following "not" in the same expression without parentheses. For example, this
+is not allowed:
+
+@smallexample
+   not X or Y
+@end smallexample
+
+This should be one of the following:
+
+@smallexample
+   (not X) or Y
+   not (X or Y)
+@end smallexample
+
 @noindent
 For the first test (@i{expression} ::= <symbol>) the symbol must have
 either the value true or false, that is to say the right-hand of the
@@ -16891,8 +17995,11 @@ it is an error to reference an undefined symbol. It is also an error to
 reference a symbol that is defined with a value other than @code{True}
 or @code{False}.
 
-The use of the @code{not} operator inverts the sense of this logical test, so
-that the lines are included only if the symbol is not defined.
+The use of the @code{not} operator inverts the sense of this logical test.
+The @code{not} operator cannot be combined with the @code{or} or @code{and}
+operators, without parentheses. For example, "if not X or Y then" is not
+allowed, but "if (not X) or Y then" and "if not (X or Y) then" are.
+
 The @code{then} keyword is optional as shown
 
 The @code{#} must be the first non-blank character on a line, but
@@ -16904,7 +18011,7 @@ preprocessor line. Any number of @code{elsif} clauses can be present,
 including none at all. The @code{else} is optional, as in Ada.
 
 The @code{#} marking the start of a preprocessor line must be the first
-non-blank character on the line, i.e. it must be preceded only by
+non-blank character on the line, i.e., it must be preceded only by
 spaces or horizontal tabs.
 
 Symbol substitution outside of preprocessor lines is obtained by using
@@ -16962,7 +18069,7 @@ supplied configuration pragmas.
 The @code{gnatlbr} command has the form
 
 @smallexample
-$ GNAT LIBRARY /[CREATE | SET | DELETE]=directory [/CONFIG=file]
+$ GNAT LIBRARY /@r{[}CREATE@r{|}SET@r{|}DELETE@r{]}=directory @r{[}/CONFIG=file@r{]}
 @end smallexample
 
 @node Switches for gnatlbr
@@ -16975,25 +18082,23 @@ $ GNAT LIBRARY /[CREATE | SET | DELETE]=directory [/CONFIG=file]
 @c !sort!
 @item /CREATE=directory
 @cindex @code{/CREATE} (@code{gnatlbr})
-     Create the new run-time library in the specified directory.
+Create the new run-time library in the specified directory.
 
 @item /SET=directory
 @cindex @code{/SET} (@code{gnatlbr})
-     Make the library in the specified directory the current run-time
-     library.
+Make the library in the specified directory the current run-time library.
 
 @item /DELETE=directory
 @cindex @code{/DELETE} (@code{gnatlbr})
-     Delete the run-time library in the specified directory.
+Delete the run-time library in the specified directory.
 
 @item /CONFIG=file
 @cindex @code{/CONFIG} (@code{gnatlbr})
-     With /CREATE:
-     Use the configuration pragmas in the specified file when building
-     the library.
+With /CREATE: Use the configuration pragmas in the specified file when
+building the library.
 
-     With /SET:
-     Use the configuration pragmas in the specified file when compiling.
+With /SET: Use the configuration pragmas in the specified file when
+compiling.
 
 @end table
 
@@ -17022,6 +18127,9 @@ units. It gives the relationship between objects, unit names and source
 files. It can also be used to check the source dependencies of a unit
 as well as various characteristics.
 
+Note: to invoke @code{gnatls} with a project file, use the @code{gnat}
+driver (see @ref{The GNAT Driver and Project Files}).
+
 @menu
 * Running gnatls::
 * Switches for gnatls::
@@ -17105,6 +18213,14 @@ version of the same source that has been modified.
 
 @table @option
 @c !sort!
+@cindex @option{--version} @command{gnatls}
+Display Copyright and version, then exit disregarding all other options.
+
+@item --help
+@cindex @option{--help} @command{gnatls}
+If @option{--version} was not used, display usage, then exit disregarding
+all other options.
+
 @item ^-a^/ALL_UNITS^
 @cindex @option{^-a^/ALL_UNITS^} (@code{gnatls})
 Consider all units, including those of the predefined Ada library.
@@ -17134,7 +18250,7 @@ Only output information about compilation units.
 @cindex @option{^-files^/FILES^} (@code{gnatls})
 Take as arguments the files listed in text file @var{file}.
 Text file @var{file} may contain empty lines that are ignored.
-Each non empty line should contain the name of an existing file.
+Each nonempty line should contain the name of an existing file.
 Several such switches may be specified simultaneously.
 
 @item ^-aO^/OBJECT_SEARCH=^@var{dir}
@@ -17163,13 +18279,13 @@ characteristics such as:
 
 @table @code
 @item  Preelaborable
-The unit is preelaborable in the Ada 95 sense.
+The unit is preelaborable in the Ada sense.
 
 @item No_Elab_Code
 No elaboration code has been produced by the compiler for this unit.
 
 @item Pure
-The unit is pure in the Ada 95 sense.
+The unit is pure in the Ada sense.
 
 @item Elaborate_Body
 The unit contains a pragma Elaborate_Body.
@@ -17343,6 +18459,14 @@ normal mode is listed, but no file is actually deleted.
 
 @table @option
 @c !sort!
+@cindex @option{--version} @command{gnatclean}
+Display Copyright and version, then exit disregarding all other options.
+
+@item --help
+@cindex @option{--help} @command{gnatclean}
+If @option{--version} was not used, display usage, then exit disregarding
+all other options.
+
 @item ^-c^/COMPILER_FILES_ONLY^
 @cindex @option{^-c^/COMPILER_FILES_ONLY^} (@code{gnatclean})
 Only attempt to delete the files produced by the compiler, not those produced
@@ -17608,9 +18732,9 @@ $ chmod -w *.ali
 @end smallexample
 
 @noindent
-Please note that the library must have a name of the form @file{libxxx.a} or
-@file{libxxx.so} (or @file{libxxx.dll} on Windows) in order to be accessed by
-the directive @option{-lxxx} at link time.
+Please note that the library must have a name of the form @file{lib@var{xxx}.a}
+or @file{lib@var{xxx}.so} (or @file{lib@var{xxx}.dll} on Windows) in order to
+be accessed by the directive @option{-l@var{xxx}} at link time.
 
 @node Installing a library
 @subsection Installing a library
@@ -17654,7 +18778,7 @@ responsibility of the library provider to install the necessary sources, ALI
 files and libraries in the directories mentioned in the project file. For
 convenience, the user's library project file should be installed in a location
 that will be searched automatically by the GNAT
-builder. These are the directories referenced in the @code{ADA_PROJECT_PATH}
+builder. These are the directories referenced in the @env{ADA_PROJECT_PATH}
 environment variable (@pxref{Importing Projects}), and also the default GNAT
 library location that can be queried with @command{gnatls -v} and is usually of
 the form $gnat_install_root/lib/gnat.
@@ -17715,7 +18839,7 @@ write:
 @smallexample @c projectfile
 with "my_lib";
 project My_Proj is
-  ...
+  @dots{}
 end My_Proj;
 @end smallexample
 
@@ -17728,6 +18852,7 @@ third-party library @file{liba.a}:
 @group
 project Liba is
    for Externally_Built use "true";
+   for Source_Files use ();
    for Library_Dir use "lib";
    for Library_Name use "a";
    for Library_Kind use "static";
@@ -17765,11 +18890,11 @@ when the following conditions are met:
 @itemize @bullet
 @item
 @file{/dir/my_lib_src} has been added by the user to the environment
-variable @code{ADA_INCLUDE_PATH}, or by the administrator to the file
+variable @env{ADA_INCLUDE_PATH}, or by the administrator to the file
 @file{ada_source_path}
 @item
 @file{/dir/my_lib_obj} has been added by the user to the environment
-variable @code{ADA_OBJECTS_PATH}, or by the administrator to the file
+variable @env{ADA_OBJECTS_PATH}, or by the administrator to the file
 @file{ada_object_path}
 @item
 a pragma @code{Linker_Options} has been added to one of the sources.
@@ -17915,7 +19040,7 @@ the object directory.
 @item
 Copy the @code{ALI} files of the interface to the library directory,
 add in this copy an indication that it is an interface to a SAL
-(i.e. add a word @option{SL} on the line in the @file{ALI} file that starts
+(i.e., add a word @option{SL} on the line in the @file{ALI} file that starts
 with letter ``P'') and make the modified copy of the @file{ALI} file
 read-only.
 @end itemize
@@ -18069,12 +19194,12 @@ to use it.
 
 @noindent
 This chapter offers some examples of makefiles that solve specific
-problems. It does not explain how to write a makefile (see the GNU make
-documentation), nor does it try to replace the @command{gnatmake} utility
-(@pxref{The GNAT Make Program gnatmake}).
+problems. It does not explain how to write a makefile (@pxref{Top,, GNU
+make, make, GNU @code{make}}), nor does it try to replace the
+@command{gnatmake} utility (@pxref{The GNAT Make Program gnatmake}).
 
 All the examples in this section are specific to the GNU version of
-make. Although @code{make} is a standard utility, and the basic language
+make. Although @command{make} is a standard utility, and the basic language
 is the same, these examples use some advanced features found only in
 @code{GNU make}.
 
@@ -18124,7 +19249,7 @@ which might help you in case your project has a lot of subdirectories.
 ##    csc is put in the top level directory (where the Makefile is).
 ##       toplevel_dir __ first_csc  (sources) __ lib (will contain the library)
 ##                    \_ second_csc (sources) __ lib (will contain the library)
-##                    \_ ...
+##                    \_ @dots{}
 ## Although this Makefile is build for shared library, it is easy to modify
 ## to build partial link objects instead (modify the lines with -shared and
 ## gnatlink below)
@@ -18146,11 +19271,11 @@ MAIN=main
 # The following variable should give the directory containing libgnat.so
 # You can get this directory through 'gnatls -v'. This is usually the last
 # directory in the Object_Path.
-GLIB=...
+GLIB=@dots{}
 
 # The directories for the libraries
 # (This macro expands the list of CSC to the list of shared libraries, you
-# could simply use the expanded form :
+# could simply use the expanded form:
 # LIB_DIR=aa/lib/libaa.so bb/lib/libbb.so cc/lib/libcc.so
 LIB_DIR=$@{foreach dir,$@{CSC_LIST@},$@{dir@}/lib/lib$@{dir@}.so@}
 
@@ -18166,8 +19291,8 @@ objects::
 # by a new tool, gnatmlib
 $@{LIB_DIR@}:
     mkdir -p $@{dir $@@ @}
-    cd $@{dir $@@ @}; gcc -shared -o $@{notdir $@@ @} ../*.o -L$@{GLIB@} -lgnat
-    cd $@{dir $@@ @}; cp -f ../*.ali .
+    cd $@{dir $@@ @} && gcc -shared -o $@{notdir $@@ @} ../*.o -L$@{GLIB@} -lgnat
+    cd $@{dir $@@ @} && cp -f ../*.ali .
 
 # The dependencies for the modules
 # Note that we have to force the expansion of *.o, since in some cases
@@ -18196,7 +19321,7 @@ In most makefiles, you will have to specify a list of directories, and
 store it in a variable. For small projects, it is often easier to
 specify each of them by hand, since you then have full control over what
 is the proper order for these directories, which ones should be
-included...
+included.
 
 However, in larger projects, which might involve hundreds of
 subdirectories, it might be more convenient to generate this list
@@ -18204,13 +19329,13 @@ automatically.
 
 The example below presents two methods. The first one, although less
 general, gives you more control over the list. It involves wildcard
-characters, that are automatically expanded by @code{make}. Its
+characters, that are automatically expanded by @command{make}. Its
 shortcoming is that you need to explicitly specify some of the
 organization of your project, such as for instance the directory tree
-depth, whether some directories are found in a separate tree,...
+depth, whether some directories are found in a separate tree, @enddots{}
 
 The second method is the most general one. It requires an external
-program, called @code{find}, which is standard on all Unix systems. All
+program, called @command{find}, which is standard on all Unix systems. All
 the directories found under a given root directory will be added to the
 list.
 
@@ -18593,12 +19718,13 @@ Debug Pool info:
 The @code{gnatmem} utility monitors dynamic allocation and
 deallocation activity in a program, and displays information about
 incorrect deallocations and possible sources of memory leaks.
-It provides three type of information:
+It is designed to work in association with a static runtime library
+only and in this context provides three types of information:
 @itemize @bullet
 @item
 General information concerning memory management, such as the total
 number of allocations and deallocations, the amount of allocated
-memory and the high water mark, i.e. the largest amount of allocated
+memory and the high water mark, i.e.@: the largest amount of allocated
 memory in the course of program execution.
 
 @item
@@ -18624,14 +19750,14 @@ leak.
 allocation and deallocation routines that record call information. This
 allows to obtain accurate dynamic memory usage history at a minimal cost to
 the execution speed. Note however, that @code{gnatmem} is not supported on
-all platforms (currently, it is supported on AIX, HP-UX, GNU/Linux x86,
-32-bit Solaris (sparc and x86) and Windows NT/2000/XP (x86).
+all platforms (currently, it is supported on AIX, HP-UX, GNU/Linux,
+Solaris and Windows NT/2000/XP (x86).
 
 @noindent
 The @code{gnatmem} command has the form
 
 @smallexample
-   $ gnatmem [switches] user_program
+   $ gnatmem @ovar{switches} user_program
 @end smallexample
 
 @noindent
@@ -18664,7 +19790,7 @@ version of that library that has been compiled with the @option{-g} switch
 
 Gnatmem must be supplied with the @file{gmem.out} file and the executable to
 examine. If the location of @file{gmem.out} file was not explicitly supplied by
-@code{-i} switch, gnatmem will assume that this file can be found in the
+@option{-i} switch, gnatmem will assume that this file can be found in the
 current directory. For example, after you have executed @file{my_program},
 @file{gmem.out} can be analyzed by @code{gnatmem} using the command:
 
@@ -18865,7 +19991,7 @@ Allocation Root # 3
 Note that the GNAT run time contains itself a certain number of
 allocations that have no  corresponding deallocation,
 as shown here for root #2 and root
-#3. This is a normal behavior when the number of non freed allocations
+#3. This is a normal behavior when the number of non-freed allocations
 is one, it allocates dynamic data structures that the run time needs for
 the complete lifetime of the program. Note also that there is only one
 allocation root in the user program with a single line back trace:
@@ -18990,9 +20116,10 @@ For the environment task, the stack size depends on
 system defaults and is unknown to the compiler. Stack checking
 may still work correctly if a fixed
 size stack is allocated, but this cannot be guaranteed.
+@ifclear vms
 To ensure that a clean exception is signalled for stack
 overflow, set the environment variable
-@code{GNAT_STACK_LIMIT} to indicate the maximum
+@env{GNAT_STACK_LIMIT} to indicate the maximum
 stack area that can be used, as in:
 @cindex GNAT_STACK_LIMIT
 
@@ -19008,6 +20135,27 @@ of stack used by the environment task. If it is necessary to
 increase the amount of stack for the environment task, then this
 is an operating systems issue, and must be addressed with the
 appropriate operating systems commands.
+@end ifclear
+@ifset vms
+To have a fixed size stack in the environment task, the stack must be put
+in the P0 address space and its size specified.  Use these switches to
+create a p0 image:
+
+@smallexample
+gnatmake my_progs -largs "-Wl,--opt=STACK=4000,/p0image"
+@end smallexample
+
+@noindent
+The quotes are required to keep case.  The number after @samp{STACK=} is the
+size of the environmental task stack in pagelets (512 bytes).  In this example
+the stack size is about 2 megabytes.
+
+@noindent
+A consequence of the @option{/p0image} qualifier is also to makes RMS buffers
+be placed in P0 space.  Refer to @cite{HP OpenVMS Linker Utility Manual} for
+more details about the @option{/p0image} qualifier and the @option{stack}
+option.
+@end ifset
 
 @node Static Stack Usage Analysis
 @section Static Stack Usage Analysis
@@ -19064,7 +20212,7 @@ With this option, at each task termination, its stack usage is  output on
 It is not always convenient to output the stack usage when the program
 is still running. Hence, it is possible to delay this output until program
 termination. for a given number of tasks specified as the argument of the
-@code{-u} option. For instance:
+@option{-u} option. For instance:
 
 @smallexample
 $ gnatbind -u100 file
@@ -19076,7 +20224,7 @@ output this info at program termination. Results are displayed in four
 columns:
 
 @noindent
-Index | Task Name | Stack Size | Actual Use
+Index | Task Name | Stack Size | Actual Use [min - max]
 
 @noindent
 where:
@@ -19089,27 +20237,33 @@ is a number associated with each task.
 is the name of the task analyzed.
 
 @item Stack Size
-is the maximum size for the stack. In order to prevent overflow,
-the real stack limit  is slightly larger than the Stack Size in order to allow
-proper recovery.
+is the maximum size for the stack.
 
 @item Actual Use
-is the measure done by the stack analyzer.
+is the measure done by the stack analyzer. In order to prevent overflow,
+the stack is not entirely analyzed, and it's not possible to know exactly how
+much has actually been used. The real amount of stack used is between the min
+and max values.
 
 @end table
 
 @noindent
-The environment task stack, e.g. the stack that contains the main unit, is
+The environment task stack, e.g., the stack that contains the main unit, is
 only processed when the environment variable GNAT_STACK_LIMIT is set.
 
+
 @c *********************************
-@node Verifying properties using gnatcheck
-@chapter Verifying properties using @command{gnatcheck}
+@c *            GNATCHECK          *
+@c *********************************
+@node Verifying Properties Using gnatcheck
+@chapter Verifying Properties Using @command{gnatcheck}
 @findex gnatcheck
+@cindex @command{gnatcheck}
 
 @noindent
 The @command{gnatcheck} tool is an ASIS-based utility that checks properties
 of Ada source files according to a given set of semantic rules.
+@cindex ASIS
 
 In order to check compliance with a given rule, @command{gnatcheck} has to
 semantically analyze the Ada sources.
@@ -19119,64 +20273,66 @@ outside the current directory, the source search path has to be provided when
 calling @command{gnatcheck}, either through a specified project file or
 through @command{gnatcheck} switches as described below.
 
-The project support for @command{gnatcheck} is provided by the @command{gnat}
-driver.
+A number of rules are predefined in @command{gnatcheck} and are described
+later in this chapter.
+You can also add new rules, by modifying the @command{gnatcheck} code and
+rebuilding the tool. In order to add a simple rule making some local checks,
+a small amount of straightforward ASIS-based programming is usually needed.
 
-Several rules are already implemented in @command{gnatcheck}. The list of such
-rules can be obtained with option @option{^-h^/HELP^} as described in the next
-section. A user can add new rules by modifying the @command{gnatcheck} code and
-rebuilding the tool. For adding a simple rule making some local checks, a small
-amount of straightforward ASIS-based programming is usually needed.
+Project support for @command{gnatcheck} is provided by the GNAT
+driver (see @ref{The GNAT Driver and Project Files}).
 
-@noindent
-@command{gnatcheck} has the command-line interface of the form
+Invoking @command{gnatcheck} on the command line has the form:
 
 @smallexample
-$ gnatcheck [@i{switches}]  @{@i{filename}@}
-      [@i{^-files^/FILES^=@{arg_list_filename@}}]
-      [@i{-cargs gcc_switches}] [@i{-rules rule_options}]
+$ gnatcheck @ovar{switches}  @{@var{filename}@}
+      @r{[}^-files^/FILES^=@{@var{arg_list_filename}@}@r{]}
+      @r{[}-cargs @var{gcc_switches}@r{]} @r{[}-rules @var{rule_options}@r{]}
 @end smallexample
 
 @noindent
 where
 @itemize @bullet
 @item
-@i{switches} specify the general tool options
+@var{switches} specify the general tool options
 
 @item
-Each @i{filename} is the name (including the extension) of a source
+Each @var{filename} is the name (including the extension) of a source
 file to process. ``Wildcards'' are allowed, and
 the file name may contain path information.
 
 @item
-Each @i{arg_list_filename} is the name (including the extension) of a text
+Each @var{arg_list_filename} is the name (including the extension) of a text
 file containing the names of the source files to process, separated by spaces
 or line breaks.
 
 @item
-@i{-cargs gcc_switches} is a list of switches for
+@var{gcc_switches} is a list of switches for
 @command{gcc}. They will be passed on to all compiler invocations made by
 @command{gnatcheck} to generate the ASIS trees. Here you can provide
 @option{^-I^/INCLUDE_DIRS=^} switches to form the source search path,
 and use the @option{-gnatec} switch to set the configuration file.
 
 @item
-@i{-rules rule_options} is a list of options for controlling a set of
-rules to be checked by @command{gnatcheck} (@pxref{gnatcheck Rule Options})
+@var{rule_options} is a list of options for controlling a set of
+rules to be checked by @command{gnatcheck} (@pxref{gnatcheck Rule Options}).
 @end itemize
 
 @noindent
-Either a @i{filename} or an @i{arg_list_filename} needs to be supplied.
+Either a @file{@var{filename}} or an @file{@var{arg_list_filename}} must be supplied.
 
 @menu
 * Format of the Report File::
 * General gnatcheck Switches::
 * gnatcheck Rule Options::
-* Add the Results of Compiler Checks to gnatcheck Output::
+* Adding the Results of Compiler Checks to gnatcheck Output::
+* Project-Wide Checks::
+* Predefined Rules::
 @end menu
 
 @node Format of the Report File
 @section Format of the Report File
+@cindex Report file (for @code{gnatcheck})
 
 @noindent
 The @command{gnatcheck} tool outputs on @file{stdout} all messages concerning
@@ -19202,15 +20358,28 @@ Section 3 contains messages ordered by source files.
 The following switches control the general @command{gnatcheck} behavior
 
 @table @option
+@c !sort!
 @cindex @option{^-a^/ALL^} (@command{gnatcheck})
 @item ^-a^/ALL^
 Process all units including those with read-only ALI files such as
 those from GNAT Run-Time library.
 
+@ifclear vms
+@ignore
+@cindex @option{-d} (@command{gnatcheck})
+@item -d
+Debug mode
+@end ignore
+
+@cindex @option{-dd} (@command{gnatcheck})
+@item -dd
+Progress indicator mode (for use in GPS)
+@end ifclear
+
 @cindex @option{^-h^/HELP^} (@command{gnatcheck})
 @item ^-h^/HELP^
-Print out the list of the currently implemented rules. For more details see
-the README file in the @command{gnatcheck} sources.
+List the predefined and user-defined rules. For more details see
+@ref{Predefined Rules}.
 
 @cindex @option{^-l^/LOCS^} (@command{gnatcheck})
 @item ^-l^/LOCS^
@@ -19219,6 +20388,12 @@ a generic instantiation a full source location is a chain from the location
 of this construct in the generic unit to the place where this unit is
 instantiated.
 
+@cindex @option{^-m^/DIAGNOSTIC_LIMIT^} (@command{gnatcheck})
+@item ^-m@i{nnn}^/DIAGNOSTIC_LIMIT=@i{nnn}^
+Maximum number of diagnoses to be sent to Stdout, @i{nnn} from o@dots{}1000,
+the default value is 500. Zero means that there is no limitation on
+the number of diagnostic messages to be printed into Stdout.
+
 @cindex @option{^-q^/QUIET^} (@command{gnatcheck})
 @item ^-q^/QUIET^
 Quiet mode. All the diagnoses about rule violations are placed in the
@@ -19250,11 +20425,11 @@ a trace of sources being processed.
 @end table
 
 @noindent
-Note, that if either of the options @option{^-s1^/COMPILER_STYLE^},
+Note that if any of the options @option{^-s1^/COMPILER_STYLE^},
 @option{^-s2^/BY_RULES^} or
 @option{^-s3^/BY_FILES_BY_RULES^} is specified,
-then the  @command{gnatcheck} report file will contain only sections
-explicitly stated by these options.
+then the  @command{gnatcheck} report file will only contain sections
+explicitly denoted by these options.
 
 @node gnatcheck Rule Options
 @section @command{gnatcheck} Rule Options
@@ -19266,30 +20441,54 @@ The following options control the processing performed by
 @table @option
 @cindex @option{+ALL} (@command{gnatcheck})
 @item +ALL
-Turn all the rule checks ON
+Turn all the rule checks ON.
 
 @cindex @option{-ALL} (@command{gnatcheck})
 @item -ALL
-Turn all the rule checks OFF
+Turn all the rule checks OFF.
 
 @cindex @option{+R} (@command{gnatcheck})
-@item +R@i{rule_id[:param]}
+@item +R@var{rule_id}@r{[}:@var{param}@r{]}
 Turn on the check for a specified rule with the specified parameter, if any.
-@i{rule_id} should be the identifier of one of the currently implemented rules
+@var{rule_id} must be the identifier of one of the currently implemented rules
 (use @option{^-h^/HELP^} for the list of implemented rules). Rule identifiers
-are not case-sensitive. The @i{:param} item should
+are not case-sensitive. The @var{param} item must
 be a string representing a valid parameter(s) for the specified rule.
 If it contains any space characters then this string must be enclosed in
 quotation marks.
 
 @cindex @option{-R} (@command{gnatcheck})
-@item -R@i{rule_id}
-Turn off the check for a specified rule
+@item -R@var{rule_id}@r{[}:@var{param}@r{]}
+Turn off the check for a specified rule with the specified parameter, if any.
+
+@cindex @option{-from} (@command{gnatcheck})
+@item -from=@var{rule_option_filename}
+Read the rule options from the text file @var{rule_option_filename}, referred as
+``rule file'' below.
 
 @end table
 
-@node Add the Results of Compiler Checks to gnatcheck Output
-@section Add the Results of Compiler Checks to @command{gnatcheck} Output
+@noindent
+The default behavior is that all the rule checks are disabled.
+
+A rule file is a text file containing a set of rule options.
+@cindex Rule file (for @code{gnatcheck})
+The file may contain empty lines and Ada-style comments (comment
+lines and end-of-line comments). The rule file has free format; that is,
+you do not have to start a new rule option on a new line.
+
+A rule file may contain other @option{-from=@var{rule_option_filename}}
+options, each such option being replaced with the content of the
+corresponding rule file during the rule files processing. In case a
+cycle is detected (that is, @file{@var{rule_file_1}} reads rule options
+from @file{@var{rule_file_2}}, and @file{@var{rule_file_2}} reads
+(directly or indirectly) rule options from @file{@var{rule_file_1}}),
+the processing of rule files is interrupted and a part of their content
+is ignored.
+
+
+@node Adding the Results of Compiler Checks to gnatcheck Output
+@section Adding the Results of Compiler Checks to @command{gnatcheck} Output
 
 @noindent
 The @command{gnatcheck} tool can include in the generated diagnostic messages
@@ -19303,111 +20502,1667 @@ the following rule identifiers and parameters:
 To record restrictions violations (that are performed by the compiler if the
 pragma @code{Restrictions} or @code{Restriction_Warnings} are given),
 use the rule named
-@i{Restrictions} with the same parameters as pragma
-@code{Restrictions} or @code{Restriction_Warnings}
+@code{Restrictions} with the same parameters as pragma
+@code{Restrictions} or @code{Restriction_Warnings}.
 
 @item Style_Checks
-To record compiler style checks, use the rule named
-@i{Style_Checks}. A parameter of this rule can be either @i{All_Checks}, that
-turns ON all the style checks, or a string that has exactly the same structure
-and semantics as @code{string_LITERAL} parameter of GNAT pragma
-@code{Style_Checks}.
+To record compiler style checks(@pxref{Style Checking}), use the rule named
+@code{Style_Checks}. A parameter of this rule can be either @code{All_Checks},
+which enables all the standard style checks that corresponds to @option{-gnatyy}
+GNAT style check option, or a string that has exactly the same
+structure and semantics as the @code{string_LITERAL} parameter of GNAT pragma
+@code{Style_Checks} (for further information about this pragma,
+@pxref{Pragma Style_Checks,,, gnat_rm, GNAT Reference Manual}).
 
 @item Warnings
 To record compiler warnings (@pxref{Warning Message Control}), use the rule
-named @i{Warnings} with a parameter that is a valid
-@code{static_string_expression} argument of GNAT pragma @code{Warnings}.
+named @code{Warnings} with a parameter that is a valid
+@i{static_string_expression} argument of GNAT pragma @code{Warnings}
+(for further information about this pragma, @pxref{Pragma Warnings,,,
+gnat_rm, GNAT Reference Manual}). Note, that in case of gnatcheck
+'s' parameter, that corresponds to the GNAT @option{-gnatws} option, disables
+all the specific warnings, but not suppresses the warning mode,
+and 'e' parameter, corresponding to @option{-gnatwe} that means
+"treat warnings as errors", does not have any effect.
 
 @end table
 
-@c *********************************
-@node Creating Sample Bodies Using gnatstub
-@chapter Creating Sample Bodies Using @command{gnatstub}
-@findex gnatstub
+To disable a specific restriction check, use @code{-RStyle_Checks} gnatcheck
+option with the corresponding restriction name as a parameter. @code{-R} is
+not available for @code{Style_Checks} and @code{Warnings} options, to disable
+warnings and style checks, use the corresponding warning and style options.
+
+@node Project-Wide Checks
+@section Project-Wide Checks
+@cindex Project-wide checks (for @command{gnatcheck})
 
 @noindent
-@command{gnatstub} creates body stubs, that is, empty but compilable bodies
-for library unit declarations.
+In order to perform checks on all units of a given project, you can use
+the GNAT driver along with the @option{-P} option:
+@smallexample
+   gnat check -Pproj -rules -from=my_rules
+@end smallexample
+
+@noindent
+If the project @code{proj} depends upon other projects, you can perform
+checks on the project closure using the @option{-U} option:
+@smallexample
+   gnat check -Pproj -U -rules -from=my_rules
+@end smallexample
+
+@noindent
+Finally, if not all the units are relevant to a particular main
+program in the project closure, you can perform checks for the set
+of units needed to create a given main program (unit closure) using
+the @option{-U} option followed by the name of the main unit:
+@smallexample
+   gnat check -Pproj -U main -rules -from=my_rules
+@end smallexample
+
+
+@node Predefined Rules
+@section Predefined Rules
+@cindex Predefined rules (for @command{gnatcheck})
+
+@ignore
+@c (Jan 2007) Since the global rules are still under development and are not
+@c documented, there is no point in explaining the difference between
+@c global and local rules
+@noindent
+A rule in @command{gnatcheck} is either local or global.
+A @emph{local rule} is a rule that applies to a well-defined section
+of a program and that can be checked by analyzing only this section.
+A @emph{global rule} requires analysis of some global properties of the
+whole program (mostly related to the program call graph).
+As of @value{NOW}, the implementation of global rules should be
+considered to be at a preliminary stage. You can use the
+@option{+GLOBAL} option to enable all the global rules, and the
+@option{-GLOBAL} rule option to disable all the global rules.
+
+All the global rules in the list below are
+so indicated by marking them ``GLOBAL''.
+This +GLOBAL and -GLOBAL options are not
+included in the list of gnatcheck options above, because at the moment they
+are considered as a temporary debug options.
+
+@command{gnatcheck} performs rule checks for generic
+instances only for global rules.  This limitation may be relaxed in a later
+release.
+@end ignore
+
+@noindent
+The following subsections document the rules implemented in
+@command{gnatcheck}.
+The subsection title is the same as the rule identifier, which may be
+used as a parameter of the @option{+R} or @option{-R} options.
 
-To create a body stub, @command{gnatstub} has to compile the library
-unit declaration. Therefore, bodies can be created only for legal
-library units. Moreover, if a library unit depends semantically upon
-units located outside the current directory, you have to provide
-the source search path when calling @command{gnatstub}, see the description
-of @command{gnatstub} switches below.
 
 @menu
-* Running gnatstub::
-* Switches for gnatstub::
+* Abstract_Type_Declarations::
+* Anonymous_Arrays::
+* Anonymous_Subtypes::
+* Blocks::
+* Boolean_Relational_Operators::
+@ignore
+* Ceiling_Violations::
+@end ignore
+* Controlled_Type_Declarations::
+* Declarations_In_Blocks::
+* Default_Parameters::
+* Discriminated_Records::
+* Enumeration_Ranges_In_CASE_Statements::
+* Exceptions_As_Control_Flow::
+* EXIT_Statements_With_No_Loop_Name::
+* Expanded_Loop_Exit_Names::
+* Explicit_Full_Discrete_Ranges::
+* Float_Equality_Checks::
+* Forbidden_Pragmas::
+* Function_Style_Procedures::
+* Generics_In_Subprograms::
+* GOTO_Statements::
+* Implicit_IN_Mode_Parameters::
+* Implicit_SMALL_For_Fixed_Point_Types::
+* Improperly_Located_Instantiations::
+* Improper_Returns::
+* Library_Level_Subprograms::
+* Local_Packages::
+@ignore
+* Improperly_Called_Protected_Entries::
+@end ignore
+* Metrics::
+* Misnamed_Identifiers::
+* Multiple_Entries_In_Protected_Definitions::
+* Name_Clashes::
+* Non_Qualified_Aggregates::
+* Non_Short_Circuit_Operators::
+* Non_SPARK_Attributes::
+* Non_Tagged_Derived_Types::
+* Non_Visible_Exceptions::
+* Numeric_Literals::
+* OTHERS_In_Aggregates::
+* OTHERS_In_CASE_Statements::
+* OTHERS_In_Exception_Handlers::
+* Outer_Loop_Exits::
+* Overloaded_Operators::
+* Overly_Nested_Control_Structures::
+* Parameters_Out_Of_Order::
+* Positional_Actuals_For_Defaulted_Generic_Parameters::
+* Positional_Actuals_For_Defaulted_Parameters::
+* Positional_Components::
+* Positional_Generic_Parameters::
+* Positional_Parameters::
+* Predefined_Numeric_Types::
+* Raising_External_Exceptions::
+* Raising_Predefined_Exceptions::
+* Separate_Numeric_Error_Handlers::
+@ignore
+* Recursion::
+* Side_Effect_Functions::
+@end ignore
+* Slices::
+* Unassigned_OUT_Parameters::
+* Uncommented_BEGIN_In_Package_Bodies::
+* Unconstrained_Array_Returns::
+* Universal_Ranges::
+* Unnamed_Blocks_And_Loops::
+@ignore
+* Unused_Subprograms::
+@end ignore
+* USE_PACKAGE_Clauses::
+* Volatile_Objects_Without_Address_Clauses::
 @end menu
 
-@node Running gnatstub
-@section Running @command{gnatstub}
+
+@node Abstract_Type_Declarations
+@subsection @code{Abstract_Type_Declarations}
+@cindex @code{Abstract_Type_Declarations} rule (for @command{gnatcheck})
 
 @noindent
-@command{gnatstub} has the command-line interface of the form
+Flag all declarations of abstract types. For an abstract private
+type, both the private and full type declarations are flagged.
 
-@smallexample
-$ gnatstub [switches] filename [directory]
-@end smallexample
+This rule has no parameters.
+
+
+@node Anonymous_Arrays
+@subsection @code{Anonymous_Arrays}
+@cindex @code{Anonymous_Arrays} rule (for @command{gnatcheck})
 
 @noindent
-where
-@table @emph
-@item filename
-is the name of the source file that contains a library unit declaration
-for which a body must be created. The file name may contain the path
-information.
-The file name does not have to follow the GNAT file name conventions. If the
-name
-does not follow GNAT file naming conventions, the name of the body file must
-be provided
-explicitly as the value of the @option{^-o^/BODY=^@var{body-name}} option.
-If the file name follows the GNAT file naming
-conventions and the name of the body file is not provided,
-@command{gnatstub}
-creates the name
-of the body file from the argument file name by replacing the @file{.ads}
-suffix
-with the @file{.adb} suffix.
+Flag all anonymous array type definitions (by Ada semantics these can only
+occur in object declarations).
 
-@item directory
-indicates the directory in which the body stub is to be placed (the default
-is the
-current directory)
+This rule has no parameters.
 
-@item switches
-is an optional sequence of switches as described in the next section
-@end table
+@node Anonymous_Subtypes
+@subsection @code{Anonymous_Subtypes}
+@cindex @code{Anonymous_Subtypes} rule (for @command{gnatcheck})
 
-@node Switches for gnatstub
-@section Switches for @command{gnatstub}
+@noindent
+Flag all uses of anonymous subtypes. A use of an anonymous subtype is
+any instance of a subtype indication with a constraint, other than one
+that occurs immediately within a subtype declaration. Any use of a range
+other than as a constraint used immediately within a subtype declaration
+is considered as an anonymous subtype.
 
-@table @option
-@c !sort!
+An effect of this rule is that @code{for} loops such as the following are
+flagged (since @code{1..N} is formally a ``range''):
 
-@item ^-f^/FULL^
-@cindex @option{^-f^/FULL^} (@command{gnatstub})
-If the destination directory already contains a file with the name of the
-body file
-for the argument spec file, replace it with the generated body stub.
+@smallexample @c ada
+for I in 1 .. N loop
+   @dots{}
+end loop;
+@end smallexample
 
-@item ^-hs^/HEADER=SPEC^
-@cindex @option{^-hs^/HEADER=SPEC^} (@command{gnatstub})
-Put the comment header (i.e., all the comments preceding the
-compilation unit) from the source of the library unit declaration
-into the body stub.
+@noindent
+Declaring an explicit subtype solves the problem:
 
-@item ^-hg^/HEADER=GENERAL^
-@cindex @option{^-hg^/HEADER=GENERAL^} (@command{gnatstub})
-Put a sample comment header into the body stub.
+@smallexample @c ada
+subtype S is Integer range 1..N;
+@dots{}
+for I in S loop
+   @dots{}
+end loop;
+@end smallexample
 
-@ifclear vms
-@item -IDIR
-@cindex @option{-IDIR} (@command{gnatstub})
-@itemx -I-
-@cindex @option{-I-} (@command{gnatstub})
-@end ifclear
+@noindent
+This rule has no parameters.
+
+@node Blocks
+@subsection @code{Blocks}
+@cindex @code{Blocks} rule (for @command{gnatcheck})
+
+@noindent
+Flag each block statement.
+
+This rule has no parameters.
+
+@node Boolean_Relational_Operators
+@subsection @code{Boolean_Relational_Operators}
+@cindex @code{Boolean_Relational_Operators} rule (for @command{gnatcheck})
+
+@noindent
+Flag each call to a predefined relational operator (``<'', ``>'', ``<='',
+``>='', ``='' and ``/='') for the predefined Boolean type.
+(This rule is useful in enforcing the SPARK language restrictions.)
+
+Calls to predefined relational operators of any type derived from
+@code{Standard.Boolean} are not detected.  Calls to user-defined functions
+with these designators, and uses of operators that are renamings
+of the predefined relational operators for @code{Standard.Boolean},
+are likewise not detected.
+
+This rule has no parameters.
+
+@ignore
+@node Ceiling_Violations
+@subsection @code{Ceiling_Violations} (under construction, GLOBAL)
+@cindex @code{Ceiling_Violations} rule (for @command{gnatcheck})
+
+@noindent
+Flag invocations of a protected operation by a task whose priority exceeds
+the protected object's ceiling.
+
+As of @value{NOW}, this rule has the following limitations:
+
+@itemize @bullet
+
+@item
+ We consider only pragmas Priority and Interrupt_Priority as means to define
+  a task/protected operation priority. We do not consider the effect of using
+  Ada.Dynamic_Priorities.Set_Priority procedure;
+
+@item
+ We consider only base task priorities, and no priority inheritance. That is,
+  we do not make a difference between calls issued during task activation and
+  execution of the sequence of statements from task body;
+
+@item
+ Any situation when the priority of protected operation caller is set by a
+  dynamic expression (that is, the corresponding Priority or
+  Interrupt_Priority pragma has a non-static expression as an argument) we
+  treat as a priority inconsistency (and, therefore, detect this situation).
+@end itemize
+
+@noindent
+At the moment the notion of the main subprogram is not implemented in
+gnatcheck, so any pragma Priority in a library level subprogram body (in case
+if this subprogram can be a main subprogram of a partition) changes the
+priority of an environment task. So if we have more then one such pragma in
+the set of processed sources, the pragma that is processed last, defines the
+priority of an environment task.
+
+This rule has no parameters.
+@end ignore
+
+@node Controlled_Type_Declarations
+@subsection @code{Controlled_Type_Declarations}
+@cindex @code{Controlled_Type_Declarations} rule (for @command{gnatcheck})
+
+@noindent
+Flag all declarations of controlled types. A declaration of a private type
+is flagged if its full declaration declares a controlled type. A declaration
+of a derived type is flagged if its ancestor type is controlled. Subtype
+declarations are not checked. A declaration of a type that itself is not a
+descendant of a type declared in @code{Ada.Finalization} but has a controlled
+component is not checked.
+
+This rule has no parameters.
+
+
+
+@node Declarations_In_Blocks
+@subsection @code{Declarations_In_Blocks}
+@cindex @code{Declarations_In_Blocks} rule (for @command{gnatcheck})
+
+@noindent
+Flag all block statements containing local declarations. A @code{declare}
+block with an empty @i{declarative_part} or with a @i{declarative part}
+containing only pragmas and/or @code{use} clauses is not flagged.
+
+This rule has no parameters.
+
+
+@node Default_Parameters
+@subsection @code{Default_Parameters}
+@cindex @code{Default_Parameters} rule (for @command{gnatcheck})
+
+@noindent
+Flag all default expressions for subprogram parameters. Parameter
+declarations of formal and generic subprograms are also checked.
+
+This rule has no parameters.
+
+
+@node Discriminated_Records
+@subsection @code{Discriminated_Records}
+@cindex @code{Discriminated_Records} rule (for @command{gnatcheck})
+
+@noindent
+Flag all declarations of record types with discriminants. Only the
+declarations of record and record extension types are checked. Incomplete,
+formal, private, derived and private extension type declarations are not
+checked. Task and protected type declarations also are not checked.
+
+This rule has no parameters.
+
+
+@node Enumeration_Ranges_In_CASE_Statements
+@subsection @code{Enumeration_Ranges_In_CASE_Statements}
+@cindex @code{Enumeration_Ranges_In_CASE_Statements} (for @command{gnatcheck})
+
+@noindent
+Flag each use of a range of enumeration literals as a choice in a
+@code{case} statement.
+All forms for specifying a range (explicit ranges
+such as @code{A .. B}, subtype marks and @code{'Range} attributes) are flagged.
+An enumeration range is
+flagged even if contains exactly one enumeration value or no values at all. A
+type derived from an enumeration type is considered as an enumeration type.
+
+This rule helps prevent maintenance problems arising from adding an
+enumeration value to a type and having it implicitly handled by an existing
+@code{case} statement with an enumeration range that includes the new literal.
+
+This rule has no parameters.
+
+
+@node Exceptions_As_Control_Flow
+@subsection @code{Exceptions_As_Control_Flow}
+@cindex @code{Exceptions_As_Control_Flow} (for @command{gnatcheck})
+
+@noindent
+Flag each place where an exception is explicitly raised and handled in the
+same subprogram body. A @code{raise} statement in an exception handler,
+package body, task body or entry body is not flagged.
+
+The rule has no parameters.
+
+@node EXIT_Statements_With_No_Loop_Name
+@subsection @code{EXIT_Statements_With_No_Loop_Name}
+@cindex @code{EXIT_Statements_With_No_Loop_Name} (for @command{gnatcheck})
+
+@noindent
+Flag each @code{exit} statement that does not specify the name of the loop
+being exited.
+
+The rule has no parameters.
+
+
+@node Expanded_Loop_Exit_Names
+@subsection @code{Expanded_Loop_Exit_Names}
+@cindex @code{Expanded_Loop_Exit_Names} rule (for @command{gnatcheck})
+
+@noindent
+Flag all expanded loop names in @code{exit} statements.
+
+This rule has no parameters.
+
+@node Explicit_Full_Discrete_Ranges
+@subsection @code{Explicit_Full_Discrete_Ranges}
+@cindex @code{Explicit_Full_Discrete_Ranges} rule (for @command{gnatcheck})
+
+@noindent
+Flag each discrete range that has the form @code{A'First .. A'Last}.
+
+This rule has no parameters.
+
+@node Float_Equality_Checks
+@subsection @code{Float_Equality_Checks}
+@cindex @code{Float_Equality_Checks} rule (for @command{gnatcheck})
+
+@noindent
+Flag all calls to the predefined equality operations for floating-point types.
+Both ``@code{=}'' and ``@code{/=}'' operations are checked.
+User-defined equality operations are not flagged, nor are ``@code{=}''
+and ``@code{/=}'' operations for fixed-point types.
+
+This rule has no parameters.
+
+
+@node Forbidden_Pragmas
+@subsection @code{Forbidden_Pragmas}
+@cindex @code{Forbidden_Pragmas} rule (for @command{gnatcheck})
+
+@noindent
+Flag each use of the specified pragmas.  The pragmas to be detected
+are named in the rule's  parameters.
+
+This rule has the following parameters:
+
+@itemize @bullet
+@item For the @option{+R} option
+
+@table @asis
+@item @emph{Pragma_Name}
+Adds the specified pragma to the set of pragmas to be
+checked and sets the checks for all the specified pragmas
+ON. @emph{Pragma_Name} is treated as a name of a pragma. If it
+does not correspond to any pragma name defined in the Ada
+standard or to the name of a GNAT-specific pragma defined
+in @ref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference
+Manual}, it is treated as the name of unknown pragma.
+
+@item @code{GNAT}
+All the GNAT-specific pragmas are detected; this sets
+the checks for all the specified pragmas ON.
+
+@item @code{ALL}
+All pragmas are detected; this sets the rule ON.
+@end table
+
+@item For the @option{-R} option
+@table @asis
+@item @emph{Pragma_Name}
+Removes the specified pragma from the set of pragmas to be
+checked without affecting checks for
+other pragmas. @emph{Pragma_Name} is treated as a name
+of a pragma. If it does not correspond to any pragma
+defined in the Ada standard or to any name defined in
+@ref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference Manual},
+this option is treated as turning OFF detection of all unknown pragmas.
+
+@item GNAT
+Turn OFF detection of all GNAT-specific pragmas
+
+@item ALL
+Clear the list of the pragmas to be detected and
+turn the rule OFF.
+@end table
+@end itemize
+
+@noindent
+Parameters are not case sensitive. If @emph{Pragma_Name} does not have
+the syntax of an Ada identifier and therefore can not be considered
+as a pragma name, a diagnostic message is generated and the corresponding
+parameter is ignored.
+
+When more then one parameter is given in the same rule option, the parameters
+must be separated by a comma.
+
+If more then one option for this rule is specified for the @command{gnatcheck}
+call, a new option overrides the previous one(s).
+
+The @option{+R} option with no parameters turns the rule ON with the set of
+pragmas to be detected defined by the previous rule options.
+(By default this set is empty, so if the only option specified for the rule is
+@option{+RForbidden_Pragmas} (with
+no parameter), then the rule is enabled, but it does not detect anything).
+The @option{-R} option with no parameter turns the rule OFF, but it does not
+affect the set of pragmas to be detected.
+
+
+
+
+@node Function_Style_Procedures
+@subsection @code{Function_Style_Procedures}
+@cindex @code{Function_Style_Procedures} rule (for @command{gnatcheck})
+
+@noindent
+Flag each procedure that can be rewritten as a function. A procedure can be
+converted into a function if it has exactly one parameter of mode @code{out}
+and no parameters of mode @code{in out}. Procedure declarations,
+formal procedure declarations, and generic procedure declarations are always
+checked. Procedure
+bodies and body stubs are flagged only if they do not have corresponding
+separate declarations. Procedure renamings and procedure instantiations are
+not flagged.
+
+If a procedure can be rewritten as a function, but its @code{out} parameter is
+of a limited type, it is not flagged.
+
+Protected procedures are not flagged. Null procedures also are not flagged.
+
+This rule has no parameters.
+
+
+@node Generics_In_Subprograms
+@subsection @code{Generics_In_Subprograms}
+@cindex @code{Generics_In_Subprograms} rule (for @command{gnatcheck})
+
+@noindent
+Flag each declaration of a generic unit in a subprogram. Generic
+declarations in the bodies of generic subprograms are also flagged.
+A generic unit nested in another generic unit is not flagged.
+If a generic unit is
+declared in a local package that is declared in a subprogram body, the
+generic unit is flagged.
+
+This rule has no parameters.
+
+
+@node GOTO_Statements
+@subsection @code{GOTO_Statements}
+@cindex @code{GOTO_Statements} rule (for @command{gnatcheck})
+
+@noindent
+Flag each occurrence of a @code{goto} statement.
+
+This rule has no parameters.
+
+
+@node Implicit_IN_Mode_Parameters
+@subsection @code{Implicit_IN_Mode_Parameters}
+@cindex @code{Implicit_IN_Mode_Parameters} rule (for @command{gnatcheck})
+
+@noindent
+Flag each occurrence of a formal parameter with an implicit @code{in} mode.
+Note that @code{access} parameters, although they technically behave
+like @code{in} parameters, are not flagged.
+
+This rule has no parameters.
+
+
+@node Implicit_SMALL_For_Fixed_Point_Types
+@subsection @code{Implicit_SMALL_For_Fixed_Point_Types}
+@cindex @code{Implicit_SMALL_For_Fixed_Point_Types} rule (for @command{gnatcheck})
+
+@noindent
+Flag each fixed point type declaration that lacks an explicit
+representation  clause to define its @code{'Small} value.
+Since @code{'Small} can be  defined only for ordinary fixed point types,
+decimal fixed point type declarations are not checked.
+
+This rule has no parameters.
+
+
+@node Improperly_Located_Instantiations
+@subsection @code{Improperly_Located_Instantiations}
+@cindex @code{Improperly_Located_Instantiations} rule (for @command{gnatcheck})
+
+@noindent
+Flag all generic instantiations in library-level package specs
+(including library generic packages) and in all subprogram bodies.
+
+Instantiations in task and entry bodies are not flagged. Instantiations in the
+bodies of protected subprograms are flagged.
+
+This rule has no parameters.
+
+
+
+@node Improper_Returns
+@subsection @code{Improper_Returns}
+@cindex @code{Improper_Returns} rule (for @command{gnatcheck})
+
+@noindent
+Flag each explicit @code{return} statement in procedures, and
+multiple @code{return} statements in functions.
+Diagnostic messages are generated for all @code{return} statements
+in a procedure (thus each procedure must be written so that it
+returns implicitly at the end of its statement part),
+and for all @code{return} statements in a function after the first one.
+This rule supports the stylistic convention that each subprogram
+should have no more than one point of normal return.
+
+This rule has no parameters.
+
+
+@node Library_Level_Subprograms
+@subsection @code{Library_Level_Subprograms}
+@cindex @code{Library_Level_Subprograms} rule (for @command{gnatcheck})
+
+@noindent
+Flag all library-level subprograms (including generic subprogram instantiations).
+
+This rule has no parameters.
+
+
+@node Local_Packages
+@subsection @code{Local_Packages}
+@cindex @code{Local_Packages} rule (for @command{gnatcheck})
+
+@noindent
+Flag all local packages declared in package and generic package
+specs.
+Local packages in bodies are not flagged.
+
+This rule has no parameters.
+
+@ignore
+@node Improperly_Called_Protected_Entries
+@subsection @code{Improperly_Called_Protected_Entries} (under construction, GLOBAL)
+@cindex @code{Improperly_Called_Protected_Entries} rule (for @command{gnatcheck})
+
+@noindent
+Flag each protected entry that can be called from more than one task.
+
+This rule has no parameters.
+@end ignore
+
+@node Metrics
+@subsection @code{Metrics}
+@cindex @code{Metrics} rule (for @command{gnatcheck})
+
+@noindent
+There is a set of checks based on computing a metric value and comparing the
+result with the specified upper (or lower, depending on a specific metric)
+value specified for a given metric. A construct is flagged if a given metric
+is applicable (can be computed) for it and the computed value is greater
+then (lover then) the specified upper (lower) bound.
+
+The name of any metric-based rule consists of the prefix @code{Metrics_}
+followed by the name of the corresponding metric (see the table below).
+For @option{+R} option, each metric-based rule has a numeric parameter
+specifying the bound (integer or real, depending on a metric), @option{-R}
+option for metric rules does not have a parameter.
+
+The following table shows the metric names for that the corresponding
+metrics-based checks are supported by gnatcheck, including the
+constraint that must be satisfied by the bound that is specified for the check
+and what bound - upper (U) or lower (L) - should be specified.
+
+@multitable {@code{Cyclomatic_Complexity}}{Cyclomatic complexity}{Positive integer}
+@ifnothtml
+@headitem Check Name @tab Description @tab Bounds Value
+@end ifnothtml
+@ifhtml
+@item @b{Check Name} @tab @b{Description} @tab @b{Bounds Value}
+@end ifhtml
+@c Above conditional code is workaround to bug in texi2html (Feb 2008)
+@item @code{Essential_Complexity} @tab Essential complexity @tab Positive integer (U)
+@item @code{Cyclomatic_Complexity} @tab Cyclomatic complexity @tab Positive integer (U)
+@item @code{LSLOC} @tab Logical Source Lines of Code @tab Positive integer (U)
+@end multitable
+
+@noindent
+The meaning and the computed values for all these metrics are exactly
+the same as for the corresponding metrics in @command{gnatmetric}.
+
+@emph{Example:} the rule
+@smallexample
++RMetrics_Cyclomatic_Complexity : 7
+@end smallexample
+@noindent
+means that all bodies with cyclomatic complexity exceeding 7 will be flagged.
+
+To turn OFF the check for cyclomatic complexity metric, use the following option:
+@smallexample
+-RMetrics_Cyclomatic_Complexity
+@end smallexample
+
+@node Misnamed_Identifiers
+@subsection @code{Misnamed_Identifiers}
+@cindex @code{Misnamed_Identifiers} rule (for @command{gnatcheck})
+
+@noindent
+Flag the declaration of each identifier that does not have a suffix
+corresponding to the kind of entity being declared.
+The following declarations are checked:
+
+@itemize @bullet
+@item
+type declarations
+
+@item
+constant declarations (but not number declarations)
+
+@item
+package renaming declarations (but not generic package renaming
+declarations)
+@end itemize
+
+@noindent
+This rule may have parameters. When used without parameters, the rule enforces
+the following checks:
+
+@itemize @bullet
+@item
+type-defining names end with @code{_T}, unless the type is an access type,
+in which case the suffix must be @code{_A}
+@item
+constant names end with @code{_C}
+@item
+names defining package renamings end with @code{_R}
+@end itemize
+
+@noindent
+For a private or incomplete type declaration the following checks are
+made for the defining name suffix:
+
+@itemize @bullet
+@item
+For an incomplete type declaration: if the corresponding full type
+declaration is available, the defining identifier from the full type
+declaration is checked, but the defining identifier from the incomplete type
+declaration is not; otherwise the defining identifier from the incomplete
+type declaration is checked against the suffix specified for type
+declarations.
+
+@item
+For a private type declaration (including private extensions),  the defining
+identifier from the private type declaration is checked against the type
+suffix (even if the corresponding full declaration is an access type
+declaration), and the defining identifier from the corresponding full type
+declaration is not checked.
+@end itemize
+
+@noindent
+For a deferred constant, the defining name in the corresponding full constant
+declaration is not checked.
+
+Defining names of formal types are not checked.
+
+The rule may have the following parameters:
+
+@itemize @bullet
+@item
+For the @option{+R} option:
+@table @code
+@item Default
+Sets the default listed above for all the names to be checked.
+
+@item Type_Suffix=@emph{string}
+Specifies the suffix for a type name.
+
+@item Access_Suffix=@emph{string}
+Specifies the suffix for an access type name. If
+this parameter is set, it overrides for access
+types the suffix set by the @code{Type_Suffix} parameter.
+
+@item Constant_Suffix=@emph{string}
+Specifies the suffix for a constant name.
+
+@item Renaming_Suffix=@emph{string}
+Specifies the suffix for a package renaming name.
+@end table
+
+@item
+For the @option{-R} option:
+@table @code
+@item All_Suffixes
+Remove all the suffixes specified for the
+identifier suffix checks, whether by default or
+as specified by other rule parameters. All the
+checks for this rule are disabled as a result.
+
+@item Type_Suffix
+Removes the suffix specified for types. This
+disables checks for types but does not disable
+any other checks for this rule (including the
+check for access type names if @code{Access_Suffix} is
+set).
+
+@item Access_Suffix
+Removes the suffix specified for access types.
+This disables checks for access type names but
+does not disable any other checks for this rule.
+If @code{Type_Suffix} is set, access type names are
+checked as ordinary type names.
+
+@item Constant_Suffix
+Removes the suffix specified for constants. This
+disables checks for constant names but does not
+disable any other checks for this rule.
+
+@item Renaming_Suffix
+Removes the suffix specified for package
+renamings. This disables checks for package
+renamings but does not disable any other checks
+for this rule.
+@end table
+@end itemize
+
+@noindent
+If more than one parameter is used, parameters must be separated by commas.
+
+If more than one  option is specified for the @command{gnatcheck} invocation,
+a new option overrides the previous one(s).
+
+The @option{+RMisnamed_Identifiers} option (with no parameter) enables
+checks for all the
+name suffixes specified by previous options used for this rule.
+
+The @option{-RMisnamed_Identifiers} option (with no parameter) disables
+all the checks but keeps
+all the suffixes specified by previous options used for this rule.
+
+The @emph{string} value must be a valid suffix for an Ada identifier (after
+trimming all the leading and trailing space characters, if any).
+Parameters are not case sensitive, except the @emph{string} part.
+
+If any error is detected in a rule parameter, the parameter is ignored.
+In such a case the options that are set for the rule are not
+specified.
+
+
+
+@node Multiple_Entries_In_Protected_Definitions
+@subsection @code{Multiple_Entries_In_Protected_Definitions}
+@cindex @code{Multiple_Entries_In_Protected_Definitions} rule (for @command{gnatcheck})
+
+@noindent
+Flag each protected definition (i.e., each protected object/type declaration)
+that defines more than one entry.
+Diagnostic messages are generated for all the entry declarations
+except the first one. An entry family is counted as one entry. Entries from
+the private part of the protected definition are also checked.
+
+This rule has no parameters.
+
+@node Name_Clashes
+@subsection @code{Name_Clashes}
+@cindex @code{Name_Clashes} rule (for @command{gnatcheck})
+
+@noindent
+Check that certain names are not used as defining identifiers. To activate
+this rule, you need to supply a reference to the dictionary file(s) as a rule
+parameter(s) (more then one dictionary file can be specified). If no
+dictionary file is set, this rule will not cause anything to be flagged.
+Only defining occurrences, not references, are checked.
+The check is not case-sensitive.
+
+This rule is enabled by default, but without setting any corresponding
+dictionary file(s); thus the default effect is to do no checks.
+
+A dictionary file is a plain text file. The maximum line length for this file
+is 1024 characters.  If the line is longer then this limit, extra characters
+are ignored.
+
+Each line can be either an empty line, a comment line, or a line containing
+a list of identifiers separated by space or HT characters.
+A comment is an Ada-style comment (from @code{--} to end-of-line).
+Identifiers must follow the Ada syntax for identifiers.
+A line containing one or more identifiers may end with a comment.
+
+@node Non_Qualified_Aggregates
+@subsection @code{Non_Qualified_Aggregates}
+@cindex @code{Non_Qualified_Aggregates} rule (for @command{gnatcheck})
+
+@noindent
+Flag each non-qualified aggregate.
+A non-qualified aggregate is an
+aggregate that is not the expression of a qualified expression. A
+string literal is not considered an aggregate, but an array
+aggregate of a string type is considered as a normal aggregate.
+Aggregates of anonymous array types are not flagged.
+
+This rule has no parameters.
+
+
+@node Non_Short_Circuit_Operators
+@subsection @code{Non_Short_Circuit_Operators}
+@cindex @code{Non_Short_Circuit_Operators} rule (for @command{gnatcheck})
+
+@noindent
+Flag all calls to predefined @code{and} and @code{or} operators for
+any boolean type. Calls to
+user-defined @code{and} and @code{or} and to operators defined by renaming
+declarations are not flagged. Calls to predefined @code{and} and @code{or}
+operators for modular types or boolean array types are not flagged.
+
+This rule has no parameters.
+
+
+
+@node Non_SPARK_Attributes
+@subsection @code{Non_SPARK_Attributes}
+@cindex @code{Non_SPARK_Attributes} rule (for @command{gnatcheck})
+
+@noindent
+The SPARK language defines the following subset of Ada 95 attribute
+designators as those that can be used in SPARK programs. The use of
+any other attribute is flagged.
+
+@itemize @bullet
+@item @code{'Adjacent}
+@item @code{'Aft}
+@item @code{'Base}
+@item @code{'Ceiling}
+@item @code{'Component_Size}
+@item @code{'Compose}
+@item @code{'Copy_Sign}
+@item @code{'Delta}
+@item @code{'Denorm}
+@item @code{'Digits}
+@item @code{'Exponent}
+@item @code{'First}
+@item @code{'Floor}
+@item @code{'Fore}
+@item @code{'Fraction}
+@item @code{'Last}
+@item @code{'Leading_Part}
+@item @code{'Length}
+@item @code{'Machine}
+@item @code{'Machine_Emax}
+@item @code{'Machine_Emin}
+@item @code{'Machine_Mantissa}
+@item @code{'Machine_Overflows}
+@item @code{'Machine_Radix}
+@item @code{'Machine_Rounds}
+@item @code{'Max}
+@item @code{'Min}
+@item @code{'Model}
+@item @code{'Model_Emin}
+@item @code{'Model_Epsilon}
+@item @code{'Model_Mantissa}
+@item @code{'Model_Small}
+@item @code{'Modulus}
+@item @code{'Pos}
+@item @code{'Pred}
+@item @code{'Range}
+@item @code{'Remainder}
+@item @code{'Rounding}
+@item @code{'Safe_First}
+@item @code{'Safe_Last}
+@item @code{'Scaling}
+@item @code{'Signed_Zeros}
+@item @code{'Size}
+@item @code{'Small}
+@item @code{'Succ}
+@item @code{'Truncation}
+@item @code{'Unbiased_Rounding}
+@item @code{'Val}
+@item @code{'Valid}
+@end itemize
+
+@noindent
+This rule has no parameters.
+
+
+@node Non_Tagged_Derived_Types
+@subsection @code{Non_Tagged_Derived_Types}
+@cindex @code{Non_Tagged_Derived_Types} rule (for @command{gnatcheck})
+
+@noindent
+Flag all derived type declarations that do not have a record extension part.
+
+This rule has no parameters.
+
+
+
+@node Non_Visible_Exceptions
+@subsection @code{Non_Visible_Exceptions}
+@cindex @code{Non_Visible_Exceptions} rule (for @command{gnatcheck})
+
+@noindent
+Flag constructs leading to the possibility of propagating an exception
+out of the scope in which the exception is declared.
+Two cases are detected:
+
+@itemize @bullet
+@item
+An exception declaration in a subprogram body, task body or block
+statement is flagged if the body or statement does not contain a handler for
+that exception or a handler with an @code{others} choice.
+
+@item
+A @code{raise} statement in an exception handler of a subprogram body,
+task body or block statement is flagged if it (re)raises a locally
+declared exception.  This may occur under the following circumstances:
+@itemize @minus
+@item
+it explicitly raises a locally declared exception, or
+@item
+it does not specify an exception name (i.e., it is simply @code{raise;})
+and the enclosing handler contains a locally declared exception in its
+exception choices.
+@end itemize
+@end itemize
+
+@noindent
+Renamings of local exceptions are not flagged.
+
+This rule has no parameters.
+
+
+@node Numeric_Literals
+@subsection @code{Numeric_Literals}
+@cindex @code{Numeric_Literals} rule (for @command{gnatcheck})
+
+@noindent
+Flag each use of a numeric literal in an index expression, and in any
+circumstance except for the following:
+
+@itemize @bullet
+@item
+a literal occurring in the initialization expression for a constant
+declaration or a named number declaration, or
+
+@item
+an integer literal that is less than or equal to a value
+specified by the @option{N} rule parameter.
+@end itemize
+
+@noindent
+This rule may have the following parameters for the @option{+R} option:
+
+@table @asis
+@item @emph{N}
+@emph{N} is an integer literal used as the maximal value that is not flagged
+(i.e., integer literals not exceeding this value are allowed)
+
+@item @code{ALL}
+All integer literals are flagged
+@end table
+
+@noindent
+If no parameters are set, the maximum unflagged value is 1.
+
+The last specified check limit (or the fact that there is no limit at
+all) is used when multiple @option{+R} options appear.
+
+The @option{-R} option for this rule has no parameters.
+It disables the rule but retains the last specified maximum unflagged value.
+If the @option{+R} option subsequently appears, this value is used as the
+threshold for the check.
+
+
+@node OTHERS_In_Aggregates
+@subsection @code{OTHERS_In_Aggregates}
+@cindex @code{OTHERS_In_Aggregates} rule (for @command{gnatcheck})
+
+@noindent
+Flag each use of an @code{others} choice in extension aggregates.
+In record and array aggregates, an @code{others} choice is flagged unless
+it is used to refer to all components, or to all but one component.
+
+If, in case of a named array aggregate, there are two associations, one
+with an @code{others} choice and another with a discrete range, the
+@code{others} choice is flagged even if the discrete range specifies
+exactly one component; for example, @code{(1..1 => 0, others => 1)}.
+
+This rule has no parameters.
+
+@node OTHERS_In_CASE_Statements
+@subsection @code{OTHERS_In_CASE_Statements}
+@cindex @code{OTHERS_In_CASE_Statements} rule (for @command{gnatcheck})
+
+@noindent
+Flag any use of an @code{others} choice in a @code{case} statement.
+
+This rule has no parameters.
+
+@node OTHERS_In_Exception_Handlers
+@subsection @code{OTHERS_In_Exception_Handlers}
+@cindex @code{OTHERS_In_Exception_Handlers} rule (for @command{gnatcheck})
+
+@noindent
+Flag any use of an @code{others} choice in an exception handler.
+
+This rule has no parameters.
+
+
+@node Outer_Loop_Exits
+@subsection @code{Outer_Loop_Exits}
+@cindex @code{Outer_Loop_Exits} rule (for @command{gnatcheck})
+
+@noindent
+Flag each @code{exit} statement containing a loop name that is not the name
+of the immediately enclosing @code{loop} statement.
+
+This rule has no parameters.
+
+
+@node Overloaded_Operators
+@subsection @code{Overloaded_Operators}
+@cindex @code{Overloaded_Operators} rule (for @command{gnatcheck})
+
+@noindent
+Flag each function declaration that overloads an operator symbol.
+A function body is checked only if the body does not have a
+separate spec. Formal functions are also checked. For a
+renaming declaration, only renaming-as-declaration is checked
+
+This rule has no parameters.
+
+
+@node Overly_Nested_Control_Structures
+@subsection @code{Overly_Nested_Control_Structures}
+@cindex @code{Overly_Nested_Control_Structures} rule (for @command{gnatcheck})
+
+@noindent
+Flag each control structure whose nesting level exceeds the value provided
+in the rule parameter.
+
+The control structures checked are the following:
+
+@itemize @bullet
+@item    @code{if} statement
+@item    @code{case} statement
+@item    @code{loop} statement
+@item    Selective accept statement
+@item    Timed entry call statement
+@item    Conditional entry call
+@item    Asynchronous select statement
+@end itemize
+
+@noindent
+The rule has the following parameter for the @option{+R} option:
+
+@table @emph
+@item N
+Positive integer specifying the maximal control structure nesting
+level that is not flagged
+@end table
+
+@noindent
+If the parameter for the @option{+R} option is not specified or
+if it is not a positive integer, @option{+R} option is ignored.
+
+If more then one  option is specified for the gnatcheck call, the later option and
+new parameter override the previous one(s).
+
+
+@node Parameters_Out_Of_Order
+@subsection @code{Parameters_Out_Of_Order}
+@cindex @code{Parameters_Out_Of_Order} rule (for @command{gnatcheck})
+
+@noindent
+Flag each subprogram and entry declaration whose formal parameters are not
+ordered according to the following scheme:
+
+@itemize @bullet
+
+@item @code{in} and @code{access} parameters first,
+then @code{in out} parameters,
+and then @code{out} parameters;
+
+@item for @code{in} mode, parameters with default initialization expressions
+occur last
+@end itemize
+
+@noindent
+Only the first violation of the described order is flagged.
+
+The following constructs are checked:
+
+@itemize @bullet
+@item   subprogram declarations (including null procedures);
+@item   generic subprogram declarations;
+@item   formal subprogram declarations;
+@item   entry declarations;
+@item   subprogram bodies and subprogram body stubs that do not
+have separate specifications
+@end itemize
+
+@noindent
+Subprogram renamings are not checked.
+
+This rule has no parameters.
+
+
+@node Positional_Actuals_For_Defaulted_Generic_Parameters
+@subsection @code{Positional_Actuals_For_Defaulted_Generic_Parameters}
+@cindex @code{Positional_Actuals_For_Defaulted_Generic_Parameters} rule (for @command{gnatcheck})
+
+@noindent
+Flag each generic actual parameter corresponding to a generic formal
+parameter with a default initialization, if positional notation is used.
+
+This rule has no parameters.
+
+@node Positional_Actuals_For_Defaulted_Parameters
+@subsection @code{Positional_Actuals_For_Defaulted_Parameters}
+@cindex @code{Positional_Actuals_For_Defaulted_Parameters} rule (for @command{gnatcheck})
+
+@noindent
+Flag each actual parameter to a subprogram or entry call where the
+corresponding formal parameter has a default expression, if positional
+notation is used.
+
+This rule has no parameters.
+
+@node Positional_Components
+@subsection @code{Positional_Components}
+@cindex @code{Positional_Components} rule (for @command{gnatcheck})
+
+@noindent
+Flag each array, record and extension aggregate that includes positional
+notation.
+
+This rule has no parameters.
+
+
+@node Positional_Generic_Parameters
+@subsection @code{Positional_Generic_Parameters}
+@cindex @code{Positional_Generic_Parameters} rule (for @command{gnatcheck})
+
+@noindent
+Flag each instantiation using positional parameter notation.
+
+This rule has no parameters.
+
+
+@node Positional_Parameters
+@subsection @code{Positional_Parameters}
+@cindex @code{Positional_Parameters} rule (for @command{gnatcheck})
+
+@noindent
+Flag each subprogram or entry call using positional parameter notation,
+except for the following:
+
+@itemize @bullet
+@item
+Invocations of prefix or infix operators are not flagged
+@item
+If the called subprogram or entry has only one formal parameter,
+the call is not flagged;
+@item
+If a subprogram call uses the @emph{Object.Operation} notation, then
+@itemize @minus
+@item
+the first parameter (that is, @emph{Object}) is not flagged;
+@item
+if the called subprogram has only two parameters, the second parameter
+of the call is not flagged;
+@end itemize
+@end itemize
+
+@noindent
+This rule has no parameters.
+
+
+
+
+@node Predefined_Numeric_Types
+@subsection @code{Predefined_Numeric_Types}
+@cindex @code{Predefined_Numeric_Types} rule (for @command{gnatcheck})
+
+@noindent
+Flag each explicit use of the name of any numeric type or subtype defined
+in package @code{Standard}.
+
+The rationale for this rule is to detect when the
+program may depend on platform-specific characteristics of the implementation
+of the predefined numeric types. Note that this rule is over-pessimistic;
+for example, a program that uses @code{String} indexing
+likely needs a variable of type @code{Integer}.
+Another example is the flagging of predefined numeric types with explicit
+constraints:
+
+@smallexample @c ada
+    subtype My_Integer is Integer range Left .. Right;
+    Vy_Var : My_Integer;
+@end smallexample
+
+@noindent
+This rule detects only numeric types and subtypes defined in
+@code{Standard}. The use of numeric types and subtypes defined in other
+predefined packages (such as @code{System.Any_Priority} or
+@code{Ada.Text_IO.Count}) is not flagged
+
+This rule has no parameters.
+
+
+
+@node Raising_External_Exceptions
+@subsection @code{Raising_External_Exceptions}
+@cindex @code{Raising_External_Exceptions} rule (for @command{gnatcheck})
+
+@noindent
+Flag any @code{raise} statement, in a program unit declared in a library
+package or in a generic library package, for an exception that is
+neither a predefined exception nor an exception that is also declared (or
+renamed) in the visible part of the package.
+
+This rule has no parameters.
+
+
+
+@node Raising_Predefined_Exceptions
+@subsection @code{Raising_Predefined_Exceptions}
+@cindex @code{Raising_Predefined_Exceptions} rule (for @command{gnatcheck})
+
+@noindent
+Flag each @code{raise} statement that raises a predefined exception
+(i.e., one of the exceptions @code{Constraint_Error}, @code{Numeric_Error},
+@code{Program_Error}, @code{Storage_Error}, or @code{Tasking_Error}).
+
+This rule has no parameters.
+
+@node Separate_Numeric_Error_Handlers
+@subsection @code{Separate_Numeric_Error_Handlers}
+@cindex @code{Separate_Numeric_Error_Handlers} rule (for @command{gnatcheck})
+
+@noindent
+Flags each exception handler that contains a choice for
+the predefined @code{Constraint_Error} exception, but does not contain
+the choice for the predefined @code{Numeric_Error} exception, or
+that contains the choice for @code{Numeric_Error}, but does not contain the
+choice for @code{Constraint_Error}.
+
+This rule has no parameters.
+
+@ignore
+@node Recursion
+@subsection @code{Recursion} (under construction, GLOBAL)
+@cindex @code{Recursion} rule (for @command{gnatcheck})
+
+@noindent
+Flag recursive subprograms (cycles in the call graph). Declarations, and not
+calls, of recursive subprograms are detected.
+
+This rule has no parameters.
+@end ignore
+
+@ignore
+@node Side_Effect_Functions
+@subsection @code{Side_Effect_Functions} (under construction, GLOBAL)
+@cindex @code{Side_Effect_Functions} rule (for @command{gnatcheck})
+
+@noindent
+Flag functions with side effects.
+
+We define a side effect as changing any data object that is not local for the
+body of this function.
+
+At the moment, we do NOT consider a side effect any input-output operations
+(changing a state or a content of any file).
+
+We do not consider protected functions for this rule (???)
+
+There are the following sources of side effect:
+
+@enumerate
+@item Explicit (or direct) side-effect:
+
+@itemize @bullet
+@item
+direct assignment to a non-local variable;
+
+@item
+direct call to an entity that is known to change some data object that is
+     not local for the body of this function (Note, that if F1 calls F2 and F2
+     does have a side effect, this does not automatically mean that F1 also
+     have a side effect, because it may be the case that F2 is declared in
+     F1's body and it changes some data object that is global for F2, but
+     local for F1);
+@end itemize
+
+@item Indirect side-effect:
+@itemize @bullet
+@item
+Subprogram calls implicitly issued by:
+@itemize @bullet
+@item
+computing initialization expressions from type declarations as a part
+         of object elaboration or allocator evaluation;
+@item
+computing implicit parameters of subprogram or entry calls or generic
+         instantiations;
+@end itemize
+
+@item
+activation of a task that change some non-local data object (directly or
+     indirectly);
+
+@item
+elaboration code of a package that is a result of a package instantiation;
+
+@item
+controlled objects;
+@end itemize
+
+@item Situations when we can suspect a side-effect, but the full static check
+is either impossible or too hard:
+@itemize @bullet
+@item
+assignment to access variables or to the objects pointed by access
+     variables;
+
+@item
+call to a subprogram pointed by access-to-subprogram value
+
+@item
+dispatching calls;
+@end itemize
+@end enumerate
+
+@noindent
+This rule has no parameters.
+@end ignore
+
+@node Slices
+@subsection @code{Slices}
+@cindex @code{Slices} rule (for @command{gnatcheck})
+
+@noindent
+Flag all uses of array slicing
+
+This rule has no parameters.
+
+
+@node Unassigned_OUT_Parameters
+@subsection @code{Unassigned_OUT_Parameters}
+@cindex @code{Unassigned_OUT_Parameters} rule (for @command{gnatcheck})
+
+@noindent
+Flags procedures' @code{out} parameters that are not assigned, and
+identifies the contexts in which the assignments are missing.
+
+An @code{out} parameter is flagged in the statements in the procedure
+body's handled sequence of statements (before the procedure body's
+@code{exception} part, if any) if this sequence of statements contains
+no assignments to the parameter.
+
+An @code{out} parameter is flagged in an exception handler in the exception
+part of the procedure body's handled sequence of statements if the handler
+contains no assignment to the parameter.
+
+Bodies of generic procedures are also considered.
+
+The following are treated as assignments to an @code{out} parameter:
+
+@itemize @bullet
+@item
+an assignment statement, with the parameter or some component as the target;
+
+@item
+passing the parameter (or one of its components) as an @code{out} or
+@code{in out} parameter.
+@end itemize
+
+@noindent
+This rule does not have any parameters.
+
+
+
+@node Uncommented_BEGIN_In_Package_Bodies
+@subsection @code{Uncommented_BEGIN_In_Package_Bodies}
+@cindex @code{Uncommented_BEGIN_In_Package_Bodies} rule (for @command{gnatcheck})
+
+@noindent
+Flags each package body with declarations and a statement part that does not
+include a trailing comment on the line containing the @code{begin} keyword;
+this trailing comment needs to specify the package name and nothing else.
+The @code{begin} is not flagged if the package body does not
+contain any declarations.
+
+If the @code{begin} keyword is placed on the
+same line as the last declaration or the first statement, it is flagged
+independently of whether the line contains a trailing comment. The
+diagnostic message is attached to the line containing the first statement.
+
+This rule has no parameters.
+
+
+@node Unconstrained_Array_Returns
+@subsection @code{Unconstrained_Array_Returns}
+@cindex @code{Unconstrained_Array_Returns} rule (for @command{gnatcheck})
+
+@noindent
+Flag each function returning an unconstrained array. Function declarations,
+function bodies (and body stubs) having no separate specifications,
+and generic function instantiations are checked.
+Generic function declarations, function calls and function renamings are
+not checked.
+
+This rule has no parameters.
+
+@node Universal_Ranges
+@subsection @code{Universal_Ranges}
+@cindex @code{Universal_Ranges} rule (for @command{gnatcheck})
+
+@noindent
+Flag discrete ranges that are a part of an index constraint, constrained
+array definition, or @code{for}-loop parameter specification, and whose bounds
+are both of type @i{universal_integer}. Ranges that have at least one
+bound of a specific type (such as @code{1 .. N}, where @code{N} is a variable
+or an expression of non-universal type) are not flagged.
+
+This rule has no parameters.
+
+
+@node Unnamed_Blocks_And_Loops
+@subsection @code{Unnamed_Blocks_And_Loops}
+@cindex @code{Unnamed_Blocks_And_Loops} rule (for @command{gnatcheck})
+
+@noindent
+Flag each unnamed block statement and loop statement.
+
+The rule has no parameters.
+
+
+
+@ignore
+@node Unused_Subprograms
+@subsection @code{Unused_Subprograms} (under construction, GLOBAL)
+@cindex @code{Unused_Subprograms} rule (for @command{gnatcheck})
+
+@noindent
+Flag all unused subprograms.
+
+This rule has no parameters.
+@end ignore
+
+
+
+
+@node USE_PACKAGE_Clauses
+@subsection @code{USE_PACKAGE_Clauses}
+@cindex @code{USE_PACKAGE_Clauses} rule (for @command{gnatcheck})
+
+@noindent
+Flag all @code{use} clauses for packages; @code{use type} clauses are
+not flagged.
+
+This rule has no parameters.
+
+
+
+@node Volatile_Objects_Without_Address_Clauses
+@subsection @code{Volatile_Objects_Without_Address_Clauses}
+@cindex @code{Volatile_Objects_Without_Address_Clauses} rule (for @command{gnatcheck})
+
+@noindent
+Flag each volatile object that does not have an address clause.
+
+The following check is made: if the pragma @code{Volatile} is applied to a
+data object or to its type, then an address clause must
+be supplied for this object.
+
+This rule does not check the components of data objects,
+array components that are volatile as a result of the pragma
+@code{Volatile_Components}, or objects that are volatile because
+they are atomic as a result of pragmas @code{Atomic} or
+@code{Atomic_Components}.
+
+Only variable declarations, and not constant declarations, are checked.
+
+This rule has no parameters.
+
+
+@c *********************************
+@node Creating Sample Bodies Using gnatstub
+@chapter Creating Sample Bodies Using @command{gnatstub}
+@findex gnatstub
+
+@noindent
+@command{gnatstub} creates body stubs, that is, empty but compilable bodies
+for library unit declarations.
+
+Note: to invoke @code{gnatstub} with a project file, use the @code{gnat}
+driver (see @ref{The GNAT Driver and Project Files}).
+
+To create a body stub, @command{gnatstub} has to compile the library
+unit declaration. Therefore, bodies can be created only for legal
+library units. Moreover, if a library unit depends semantically upon
+units located outside the current directory, you have to provide
+the source search path when calling @command{gnatstub}, see the description
+of @command{gnatstub} switches below.
+
+By default, all the program unit body stubs generated by @code{gnatstub}
+raise the predefined @code{Program_Error} exception, which will catch
+accidental calls of generated stubs. This behavior can be changed with
+option @option{^--no-exception^/NO_EXCEPTION^} (see below).
+
+@menu
+* Running gnatstub::
+* Switches for gnatstub::
+@end menu
+
+@node Running gnatstub
+@section Running @command{gnatstub}
+
+@noindent
+@command{gnatstub} has the command-line interface of the form
+
+@smallexample
+$ gnatstub @ovar{switches} @var{filename} @ovar{directory}
+@end smallexample
+
+@noindent
+where
+@table @var
+@item filename
+is the name of the source file that contains a library unit declaration
+for which a body must be created. The file name may contain the path
+information.
+The file name does not have to follow the GNAT file name conventions. If the
+name
+does not follow GNAT file naming conventions, the name of the body file must
+be provided
+explicitly as the value of the @option{^-o^/BODY=^@var{body-name}} option.
+If the file name follows the GNAT file naming
+conventions and the name of the body file is not provided,
+@command{gnatstub}
+creates the name
+of the body file from the argument file name by replacing the @file{.ads}
+suffix
+with the @file{.adb} suffix.
+
+@item directory
+indicates the directory in which the body stub is to be placed (the default
+is the
+current directory)
+
+@item switches
+is an optional sequence of switches as described in the next section
+@end table
+
+@node Switches for gnatstub
+@section Switches for @command{gnatstub}
+
+@table @option
+@c !sort!
+
+@item ^-f^/FULL^
+@cindex @option{^-f^/FULL^} (@command{gnatstub})
+If the destination directory already contains a file with the name of the
+body file
+for the argument spec file, replace it with the generated body stub.
+
+@item ^-hs^/HEADER=SPEC^
+@cindex @option{^-hs^/HEADER=SPEC^} (@command{gnatstub})
+Put the comment header (i.e., all the comments preceding the
+compilation unit) from the source of the library unit declaration
+into the body stub.
+
+@item ^-hg^/HEADER=GENERAL^
+@cindex @option{^-hg^/HEADER=GENERAL^} (@command{gnatstub})
+Put a sample comment header into the body stub.
+
+@item ^--header-file=@var{filename}^/FROM_HEADER_FILE=@var{filename}^
+@cindex @option{^--header-file^/FROM_HEADER_FILE=^} (@command{gnatstub})
+Use the content of the file as the comment header for a generated body stub.
+
+@ifclear vms
+@item -IDIR
+@cindex @option{-IDIR} (@command{gnatstub})
+@itemx -I-
+@cindex @option{-I-} (@command{gnatstub})
+@end ifclear
 @ifset vms
 @item /NOCURRENT_DIRECTORY
 @cindex @option{/NOCURRENT_DIRECTORY} (@command{gnatstub})
@@ -19433,68 +22188,307 @@ specified is 32767. Note that in the special case of configuration
 pragma files, the maximum is always 32767 regardless of whether or
 not this switch appears.
 
-@item ^-gnaty^/STYLE_CHECKS=^@var{n}
-@cindex @option{^-gnaty^/STYLE_CHECKS=^} (@command{gnatstub})
-(@var{n} is a non-negative integer from 1 to 9). Set the indentation level in
-the generated body sample to @var{n}.
-The default indentation is 3.
+@item ^-gnaty^/STYLE_CHECKS=^@var{n}
+@cindex @option{^-gnaty^/STYLE_CHECKS=^} (@command{gnatstub})
+(@var{n} is a non-negative integer from 1 to 9). Set the indentation level in
+the generated body sample to @var{n}.
+The default indentation is 3.
+
+@item ^-gnatyo^/ORDERED_SUBPROGRAMS^
+@cindex @option{^-gnato^/ORDERED_SUBPROGRAMS^} (@command{gnatstub})
+Order local bodies alphabetically. (By default local bodies are ordered
+in the same way as the corresponding local specs in the argument spec file.)
+
+@item ^-i^/INDENTATION=^@var{n}
+@cindex @option{^-i^/INDENTATION^} (@command{gnatstub})
+Same as @option{^-gnaty^/STYLE_CHECKS=^@var{n}}
+
+@item ^-k^/TREE_FILE=SAVE^
+@cindex @option{^-k^/TREE_FILE=SAVE^} (@command{gnatstub})
+Do not remove the tree file (i.e., the snapshot of the compiler internal
+structures used by @command{gnatstub}) after creating the body stub.
+
+@item ^-l^/LINE_LENGTH=^@var{n}
+@cindex @option{^-l^/LINE_LENGTH^} (@command{gnatstub})
+Same as @option{^-gnatyM^/MAX_LINE_LENGTH=^@var{n}}
+
+@item ^--no-exception^/NO_EXCEPTION^
+@cindex @option{^--no-exception^/NO_EXCEPTION^} (@command{gnatstub})
+Avoind raising PROGRAM_ERROR in the generated bodies of program unit stubs.
+This is not always possible for function stubs.
+
+@item ^-o ^/BODY=^@var{body-name}
+@cindex @option{^-o^/BODY^} (@command{gnatstub})
+Body file name.  This should be set if the argument file name does not
+follow
+the GNAT file naming
+conventions. If this switch is omitted the default name for the body will be
+obtained
+from the argument file name according to the GNAT file naming conventions.
+
+@item ^-q^/QUIET^
+@cindex @option{^-q^/QUIET^} (@command{gnatstub})
+Quiet mode: do not generate a confirmation when a body is
+successfully created, and do not generate a message when a body is not
+required for an
+argument unit.
+
+@item ^-r^/TREE_FILE=REUSE^
+@cindex @option{^-r^/TREE_FILE=REUSE^} (@command{gnatstub})
+Reuse the tree file (if it exists) instead of creating it.  Instead of
+creating the tree file for the library unit declaration, @command{gnatstub}
+tries to find it in the current directory and use it for creating
+a body. If the tree file is not found, no body is created. This option
+also implies @option{^-k^/SAVE^}, whether or not
+the latter is set explicitly.
+
+@item ^-t^/TREE_FILE=OVERWRITE^
+@cindex @option{^-t^/TREE_FILE=OVERWRITE^} (@command{gnatstub})
+Overwrite the existing tree file.  If the current directory already
+contains the file which, according to the GNAT file naming rules should
+be considered as a tree file for the argument source file,
+@command{gnatstub}
+will refuse to create the tree file needed to create a sample body
+unless this option is set.
+
+@item ^-v^/VERBOSE^
+@cindex @option{^-v^/VERBOSE^} (@command{gnatstub})
+Verbose mode: generate version information.
+
+@end table
+
+@c *********************************
+@node Generating Ada Bindings for C and C++ headers
+@chapter Generating Ada Bindings for C and C++ headers
+@findex binding
+
+@noindent
+GNAT now comes with a new experimental binding generator for C and C++
+headers which is intended to do 95% of the tedious work of generating
+Ada specs from C or C++ header files. Note that this still is a work in
+progress, not designed to generate 100% correct Ada specs.
+
+The code generated is using the Ada 2005 syntax, which makes it
+easier to interface with other languages than previous versions of Ada.
+
+@menu
+* Running the binding generator::
+* Generating bindings for C++ headers::
+* Switches::
+@end menu
+
+@node Running the binding generator
+@section Running the binding generator
+
+@noindent
+The binding generator is part of the @command{gcc} compiler and can be
+invoked via the @option{-fdump-ada-spec} switch, which will generate Ada
+spec files for the header files specified on the command line, and all
+header files needed by these files transitivitely. For example:
+
+@smallexample
+$ g++ -c -fdump-ada-spec -C /usr/include/time.h
+$ gcc -c -gnat05 *.ads
+@end smallexample
+
+will generate, under GNU/Linux, the following files: @file{time_h.ads},
+@file{bits_time_h.ads}, @file{stddef_h.ads}, @file{bits_types_h.ads} which
+correspond to the files @file{/usr/include/time.h},
+@file{/usr/include/bits/time.h}, etc@dots{}, and will then compile in Ada 2005
+mode these Ada specs.
+
+The @code{-C} switch tells @command{gcc} to extract comments from headers,
+and will attempt to generate corresponding Ada comments.
+
+If you want to generate a single Ada file and not the transitive closure, you
+can use instead the @option{-fdump-ada-spec-slim} switch.
+
+Note that we recommend when possible to use the @command{g++} driver to
+generate bindings, even for most C headers, since this will in general
+generate better Ada specs. For generating bindings for C++ headers, it is
+mandatory to use the @command{g++} command, or @command{gcc -x c++} which
+is equivalent in this case. If @command{g++} cannot work on your C headers
+because of incompatibilities between C and C++, then you can fallback to
+@command{gcc} instead.
+
+For an example of better bindings generated from the C++ front-end,
+the name of the parameters (when available) are actually ignored by the C
+front-end. Consider the following C header:
+
+@smallexample
+extern void foo (int variable);
+@end smallexample
+
+with the C front-end, @code{variable} is ignored, and the above is handled as:
+
+@smallexample
+extern void foo (int);
+@end smallexample
+
+generating a generic:
+
+@smallexample
+procedure foo (param1 : int);
+@end smallexample
+
+with the C++ front-end, the name is available, and we generate:
+
+@smallexample
+procedure foo (variable : int);
+@end smallexample
+
+In some cases, the generated bindings will be more complete or more meaningful
+when defining some macros, which you can do via the @option{-D} switch. This
+is for example the case with @file{Xlib.h} under GNU/Linux:
+
+@smallexample
+g++ -c -fdump-ada-spec -DXLIB_ILLEGAL_ACCESS -C /usr/include/X11/Xlib.h
+@end smallexample
+
+The above will generate more complete bindings than a straight call without
+the @option{-DXLIB_ILLEGAL_ACCESS} switch.
+
+In other cases, it is not possible to parse a header file in a stand alone
+manner, because other include files need to be included first. In this
+case, the solution is to create a small header file including the needed
+@code{#include} and possible @code{#define} directives. For example, to
+generate Ada bindings for @file{readline/readline.h}, you need to first
+include @file{stdio.h}, so you can create a file with the following two
+lines in e.g. @file{readline1.h}:
+
+@smallexample
+#include <stdio.h>
+#include <readline/readline.h>
+@end smallexample
+
+and then generate Ada bindings from this file:
+
+@smallexample
+$ g++ -c -fdump-ada-spec readline1.h
+@end smallexample
+
+@node Generating bindings for C++ headers
+@section Generating bindings for C++ headers
+
+@noindent
+Generating bindings for C++ headers is done using the same options, always
+with the @command{g++} compiler.
+
+In this mode, C++ classes will be mapped to Ada tagged types, constructors
+will be mapped using the @code{CPP_Constructor} pragma, and when possible,
+multiple inheritance of abstract classes will be mapped to Ada interfaces
+(@xref{Interfacing to C++,,,gnat_rm, GNAT Reference Manual}, for additional
+information on interfacing to C++).
+
+For example, given the following C++ header file:
+
+@smallexample
+@group
+@cartouche
+class Carnivore @{
+public:
+   virtual int Number_Of_Teeth () = 0;
+@};
+
+class Domestic @{
+public:
+   virtual void Set_Owner (char* Name) = 0;
+@};
+
+class Animal @{
+public:
+  int Age_Count;
+  virtual void Set_Age (int New_Age);
+@};
+
+class Dog : Animal, Carnivore, Domestic @{
+ public:
+  int  Tooth_Count;
+  char *Owner;
+
+  virtual int  Number_Of_Teeth ();
+  virtual void Set_Owner (char* Name);
+
+  Dog();
+@};
+@end cartouche
+@end group
+@end smallexample
+
+The corresponding Ada code is generated:
+
+@smallexample @c ada
+@group
+@cartouche
+  package Class_Carnivore is
+    type Carnivore is limited interface;
+    pragma Import (CPP, Carnivore);
+
+    function Number_Of_Teeth (this : access Carnivore) return int is abstract;
+  end;
+  use Class_Carnivore;
+
+  package Class_Domestic is
+    type Domestic is limited interface;
+    pragma Import (CPP, Domestic);
 
-@item ^-gnatyo^/ORDERED_SUBPROGRAMS^
-@cindex @option{^-gnato^/ORDERED_SUBPROGRAMS^} (@command{gnatstub})
-Order local bodies alphabetically. (By default local bodies are ordered
-in the same way as the corresponding local specs in the argument spec file.)
+    procedure Set_Owner
+      (this : access Domestic;
+       Name : Interfaces.C.Strings.chars_ptr) is abstract;
+  end;
+  use Class_Domestic;
 
-@item ^-i^/INDENTATION=^@var{n}
-@cindex @option{^-i^/INDENTATION^} (@command{gnatstub})
-Same as @option{^-gnaty^/STYLE_CHECKS=^@var{n}}
+  package Class_Animal is
+    type Animal is tagged limited record
+      Age_Count : aliased int;
+    end record;
+    pragma Import (CPP, Animal);
 
-@item ^-k^/TREE_FILE=SAVE^
-@cindex @option{^-k^/TREE_FILE=SAVE^} (@command{gnatstub})
-Do not remove the tree file (i.e., the snapshot of the compiler internal
-structures used by @command{gnatstub}) after creating the body stub.
+    procedure Set_Age (this : access Animal; New_Age : int);
+    pragma Import (CPP, Set_Age, "_ZN6Animal7Set_AgeEi");
+  end;
+  use Class_Animal;
 
-@item ^-l^/LINE_LENGTH=^@var{n}
-@cindex @option{^-l^/LINE_LENGTH^} (@command{gnatstub})
-Same as @option{^-gnatyM^/MAX_LINE_LENGTH=^@var{n}}
+  package Class_Dog is
+    type Dog is new Animal and Carnivore and Domestic with record
+      Tooth_Count : aliased int;
+      Owner : Interfaces.C.Strings.chars_ptr;
+    end record;
+    pragma Import (CPP, Dog);
 
-@item ^-o^/BODY=^@var{body-name}
-@cindex @option{^-o^/BODY^} (@command{gnatstub})
-Body file name.  This should be set if the argument file name does not
-follow
-the GNAT file naming
-conventions. If this switch is omitted the default name for the body will be
-obtained
-from the argument file name according to the GNAT file naming conventions.
+    function Number_Of_Teeth (this : access Dog) return int;
+    pragma Import (CPP, Number_Of_Teeth, "_ZN3Dog15Number_Of_TeethEv");
 
-@item ^-q^/QUIET^
-@cindex @option{^-q^/QUIET^} (@command{gnatstub})
-Quiet mode: do not generate a confirmation when a body is
-successfully created, and do not generate a message when a body is not
-required for an
-argument unit.
+    procedure Set_Owner
+      (this : access Dog; Name : Interfaces.C.Strings.chars_ptr);
+    pragma Import (CPP, Set_Owner, "_ZN3Dog9Set_OwnerEPc");
 
-@item ^-r^/TREE_FILE=REUSE^
-@cindex @option{^-r^/TREE_FILE=REUSE^} (@command{gnatstub})
-Reuse the tree file (if it exists) instead of creating it.  Instead of
-creating the tree file for the library unit declaration, @command{gnatstub}
-tries to find it in the current directory and use it for creating
-a body. If the tree file is not found, no body is created. This option
-also implies @option{^-k^/SAVE^}, whether or not
-the latter is set explicitly.
+    function New_Dog return Dog'Class;
+    pragma CPP_Constructor (New_Dog);
+    pragma Import (CPP, New_Dog, "_ZN3DogC1Ev");
+  end;
+  use Class_Dog;
+@end cartouche
+@end group
+@end smallexample
 
-@item ^-t^/TREE_FILE=OVERWRITE^
-@cindex @option{^-t^/TREE_FILE=OVERWRITE^} (@command{gnatstub})
-Overwrite the existing tree file.  If the current directory already
-contains the file which, according to the GNAT file naming rules should
-be considered as a tree file for the argument source file,
-@command{gnatstub}
-will refuse to create the tree file needed to create a sample body
-unless this option is set.
+@node Switches
+@section Switches
 
-@item ^-v^/VERBOSE^
-@cindex @option{^-v^/VERBOSE^} (@command{gnatstub})
-Verbose mode: generate version information.
+@table @option
+@item -fdump-ada-spec
+@cindex @option{-fdump-ada-spec} (@command{gcc})
+Generate Ada spec files for the given header files transitively (including
+all header files that these headers depend upon).
+
+@item -fdump-ada-spec-slim
+@cindex @option{-fdump-ada-spec-slim} (@command{gcc})
+Generate Ada spec files for the header files specified on the command line
+only.
 
+@item -C
+@cindex @option{-C} (@command{gcc})
+Extract comments from headers and generate Ada comments in the Ada spec files.
 @end table
 
 @node Other Utility Programs
@@ -19507,9 +22501,6 @@ environment.
 @menu
 * Using Other Utility Programs with GNAT::
 * The External Symbol Naming Scheme of GNAT::
-@ifclear vms
-* Ada Mode for Glide::
-@end ifclear
 * Converting Ada Files to html with gnathtml::
 * Installing gnathtml::
 @ifset vms
@@ -19605,91 +22596,6 @@ procedure Hello (S : String);
 @noindent
 the external name of this procedure will be @var{_ada_hello}.
 
-@ifclear vms
-@node Ada Mode for Glide
-@section Ada Mode for @code{Glide}
-@cindex Ada mode (for Glide)
-
-@noindent
-The Glide mode for programming in Ada (both Ada83 and Ada95) helps the
-user to understand and navigate existing code, and facilitates writing
-new code. It furthermore provides some utility functions for easier
-integration of standard Emacs features when programming in Ada.
-
-Its general features include:
-
-@itemize @bullet
-@item
-An Integrated Development Environment with functionality such as the
-following
-
-@itemize @bullet
-@item
-``Project files'' for configuration-specific aspects
-(e.g. directories and compilation options)
-
-@item
-Compiling and stepping through error messages.
-
-@item
-Running and debugging an applications within Glide.
-@end itemize
-
-@item
-Pull-down menus
-
-@item
-User configurability
-@end itemize
-
-Some of the specific Ada mode features are:
-
-@itemize @bullet
-@item
-Functions for easy and quick stepping through Ada code
-
-@item
-Getting cross reference information for identifiers (e.g., finding a
-defining occurrence)
-
-@item
-Displaying an index menu of types and subprograms, allowing
-direct selection for browsing
-
-@item
-Automatic color highlighting of the various Ada entities
-@end itemize
-
-Glide directly supports writing Ada code, via several facilities:
-
-@itemize @bullet
-@item
-Switching between spec and body files with possible
-autogeneration of body files
-
-@item
-Automatic formating of subprogram parameter lists
-
-@item
-Automatic indentation according to Ada syntax
-
-@item
-Automatic completion of identifiers
-
-@item
-Automatic (and configurable) casing of identifiers, keywords, and attributes
-
-@item
-Insertion of syntactic templates
-
-@item
-Block commenting / uncommenting
-@end itemize
-
-@noindent
-For more information, please refer to the online documentation
-available in the @code{Glide} @result{} @code{Help} menu.
-@end ifclear
 
 @node Converting Ada Files to html with gnathtml
 @section Converting Ada Files to HTML with @code{gnathtml}
@@ -19707,7 +22613,7 @@ be able to click on any identifier and go to its declaration.
 
 The command line is as follow:
 @smallexample
-$ perl gnathtml.pl [^switches^options^] ada-files
+$ perl gnathtml.pl @ovar{^switches^options^} @var{ada-files}
 @end smallexample
 
 @noindent
@@ -19715,13 +22621,12 @@ You can pass it as many Ada files as you want. @code{gnathtml} will generate
 an html file for every ada file, and a global file called @file{index.htm}.
 This file is an index of every identifier defined in the files.
 
-The available ^switches^options^ are the following ones :
+The available ^switches^options^ are the following ones:
 
 @table @option
 @item -83
 @cindex @option{-83} (@code{gnathtml})
-Only the subset on the Ada 83 keywords will be highlighted, not the full
-Ada 95 keywords set.
+Only the Ada 83 subset of keywords will be highlighted.
 
 @item -cc @var{color}
 @cindex @option{-cc} (@code{gnathtml})
@@ -19748,7 +22653,7 @@ If you do not specify an extension, it will default to @file{htm}.
 @item -f
 @cindex @option{-f} (@code{gnathtml})
 By default, gnathtml will generate html links only for global entities
-('with'ed units, global variables and types,...). If you specify
+('with'ed units, global variables and types,@dots{}).  If you specify
 @option{-f} on the command line, then links will be generated for local
 entities too.
 
@@ -19805,7 +22710,7 @@ Operating System via the Internet.
 
 On Unix systems, you  may want to modify  the  first line of  the script
 @code{gnathtml},  to explicitly  tell  the Operating  system  where Perl
-is. The syntax of this line is :
+is. The syntax of this line is:
 @smallexample
 #!full_path_name_to_perl
 @end smallexample
@@ -19814,7 +22719,7 @@ is. The syntax of this line is :
 Alternatively, you may run the script using the following command line:
 
 @smallexample
-$ perl gnathtml.pl [switches] files
+$ perl gnathtml.pl @ovar{switches} @var{files}
 @end smallexample
 
 @ifset vms
@@ -19844,6 +22749,294 @@ $ RUN/DEBUG <PROGRAM_NAME>
 @noindent
 @end ifset
 
+@ifclear vms
+@c ******************************
+@node Code Coverage and Profiling
+@chapter Code Coverage and Profiling
+@cindex Code Coverage
+@cindex Profiling
+
+@noindent
+This chapter describes how to use @code{gcov} - coverage testing tool - and
+@code{gprof} - profiler tool - on your Ada programs.
+
+@menu
+* Code Coverage of Ada Programs using gcov::
+* Profiling an Ada Program using gprof::
+@end menu
+
+@node Code Coverage of Ada Programs using gcov
+@section Code Coverage of Ada Programs using gcov
+@cindex gcov
+@cindex -fprofile-arcs
+@cindex -ftest-coverage
+@cindex -coverage
+@cindex Code Coverage
+
+@noindent
+@code{gcov} is a test coverage program: it analyzes the execution of a given
+program on selected tests, to help you determine the portions of the program
+that are still untested.
+
+@code{gcov} is part of the GCC suite, and is described in detail in the GCC
+User's Guide. You can refer to this documentation for a more complete
+description.
+
+This chapter provides a quick startup guide, and
+details some Gnat-specific features.
+
+@menu
+* Quick startup guide::
+* Gnat specifics::
+@end menu
+
+@node Quick startup guide
+@subsection Quick startup guide
+
+In order to perform coverage analysis of a program using @code{gcov}, 3
+steps are needed:
+
+@itemize @bullet
+@item
+Code instrumentation during the compilation process
+@item
+Execution of the instrumented program
+@item
+Execution of the @code{gcov} tool to generate the result.
+@end itemize
+
+The code instrumentation needed by gcov is created at the object level:
+The source code is not modified in any way, because the instrumentation code is
+inserted by gcc during the compilation process. To compile your code with code
+coverage activated, you need to recompile your whole project using the
+switches
+@code{-fprofile-arcs} and @code{-ftest-coverage}, and link it using
+@code{-fprofile-arcs}.
+
+@smallexample
+$ gnatmake -P my_project.gpr -f -cargs -fprofile-arcs -ftest-coverage \
+   -largs -fprofile-arcs
+@end smallexample
+
+This compilation process will create @file{.gcno} files together with
+the usual object files.
+
+Once the program is compiled with coverage instrumentation, you can
+run it as many times as needed - on portions of a test suite for
+example. The first execution will produce @file{.gcda} files at the
+same location as the @file{.gcno} files.  The following executions
+will update those files, so that a cumulative result of the covered
+portions of the program is generated.
+
+Finally, you need to call the @code{gcov} tool. The different options of
+@code{gcov} are available in the GCC User's Guide, section 'Invoking gcov'.
+
+This will create annotated source files with a @file{.gcov} extension:
+@file{my_main.adb} file will be analysed in @file{my_main.adb.gcov}.
+
+@node Gnat specifics
+@subsection Gnat specifics
+
+Because Ada semantics, portions of the source code may be shared among
+several object files. This is the case for example when generics are
+involved, when inlining is active  or when declarations generate  initialisation
+calls. In order to take
+into account this shared code, you need to call @code{gcov} on all
+source files of the tested program at once.
+
+The list of source files might exceed the system's maximum command line
+length. In order to bypass this limitation, a new mechanism has been
+implemented in @code{gcov}: you can now list all your project's files into a
+text file, and provide this file to gcov as a parameter,  preceded by a @@
+(e.g. @samp{gcov @@mysrclist.txt}).
+
+Note that on AIX compiling a static library with @code{-fprofile-arcs} is
+not supported as there can be unresolved symbols during the final link.
+
+@node Profiling an Ada Program using gprof
+@section Profiling an Ada Program using gprof
+@cindex gprof
+@cindex -pg
+@cindex Profiling
+
+@noindent
+This section is not meant to be an exhaustive documentation of @code{gprof}.
+Full documentation for it can be found in the GNU Profiler User's Guide
+documentation that is part of this GNAT distribution.
+
+Profiling a program helps determine the parts of a program that are executed
+most often, and are therefore the most time-consuming.
+
+@code{gprof} is the standard GNU profiling tool; it has been enhanced to
+better handle Ada programs and multitasking.
+It is currently supported on the following platforms
+@itemize @bullet
+@item
+linux x86/x86_64
+@item
+solaris sparc/sparc64/x86
+@item
+windows x86
+@end itemize
+
+@noindent
+In order to profile a program using @code{gprof}, 3 steps are needed:
+
+@itemize @bullet
+@item
+Code instrumentation, requiring a full recompilation of the project with the
+proper switches.
+@item
+Execution of the program under the analysis conditions, i.e. with the desired
+input.
+@item
+Analysis of the results using the @code{gprof} tool.
+@end itemize
+
+@noindent
+The following sections detail the different steps, and indicate how
+to interpret the results:
+@menu
+* Compilation for profiling::
+* Program execution::
+* Running gprof::
+* Interpretation of profiling results::
+@end menu
+
+@node Compilation for profiling
+@subsection Compilation for profiling
+@cindex -pg
+@cindex Profiling
+
+In order to profile a program the first step is to tell the compiler
+to generate the necessary profiling information. The compiler switch to be used
+is @code{-pg}, which must be added to other compilation switches. This
+switch needs to be specified both during compilation and link stages, and can
+be specified once when using gnatmake:
+
+@smallexample
+gnatmake -f -pg -P my_project
+@end smallexample
+
+@noindent
+Note that only the objects that were compiled with the @samp{-pg} switch will be
+profiled; if you need to profile your whole project, use the
+@samp{-f} gnatmake switch to force full recompilation.
+
+@node Program execution
+@subsection Program execution
+
+@noindent
+Once the program has been compiled for profiling, you can run it as usual.
+
+The only constraint imposed by profiling is that the program must terminate
+normally. An interrupted program (via a Ctrl-C, kill, etc.) will not be
+properly analyzed.
+
+Once the program completes execution, a data file called @file{gmon.out} is
+generated in the directory where the program was launched from. If this file
+already exists, it will be overwritten.
+
+@node Running gprof
+@subsection Running gprof
+
+@noindent
+The @code{gprof} tool is called as follow:
+
+@smallexample
+gprof my_prog gmon.out
+@end smallexample
+
+@noindent
+or simpler:
+
+@smallexample
+gprof my_prog
+@end smallexample
+
+@noindent
+The complete form of the gprof command line is the following:
+
+@smallexample
+gprof [^switches^options^] [executable [data-file]]
+@end smallexample
+
+@noindent
+@code{gprof} supports numerous ^switch^options^. The order of these
+^switch^options^ does not matter. The full list of options can be found in
+the GNU Profiler User's Guide documentation that comes with this documentation.
+
+The following is the subset of those switches that is most relevant:
+
+@table @option
+
+@item --demangle[=@var{style}]
+@itemx --no-demangle
+@cindex @option{--demangle} (@code{gprof})
+These options control whether symbol names should be demangled when
+printing output.  The default is to demangle C++ symbols.  The
+@code{--no-demangle} option may be used to turn off demangling. Different
+compilers have different mangling styles.  The optional demangling style
+argument can be used to choose an appropriate demangling style for your
+compiler, in particular Ada symbols generated by GNAT can be demangled using
+@code{--demangle=gnat}.
+
+@item -e @var{function_name}
+@cindex @option{-e} (@code{gprof})
+The @samp{-e @var{function}} option tells @code{gprof} not to print
+information about the function @var{function_name} (and its
+children@dots{}) in the call graph.  The function will still be listed
+as a child of any functions that call it, but its index number will be
+shown as @samp{[not printed]}.  More than one @samp{-e} option may be
+given; only one @var{function_name} may be indicated with each @samp{-e}
+option.
+
+@item -E @var{function_name}
+@cindex @option{-E} (@code{gprof})
+The @code{-E @var{function}} option works like the @code{-e} option, but
+execution time spent in the function (and children who were not called from
+anywhere else), will not be used to compute the percentages-of-time for
+the call graph.  More than one @samp{-E} option may be given; only one
+@var{function_name} may be indicated with each @samp{-E} option.
+
+@item -f @var{function_name}
+@cindex @option{-f} (@code{gprof})
+The @samp{-f @var{function}} option causes @code{gprof} to limit the
+call graph to the function @var{function_name} and its children (and
+their children@dots{}).  More than one @samp{-f} option may be given;
+only one @var{function_name} may be indicated with each @samp{-f}
+option.
+
+@item -F @var{function_name}
+@cindex @option{-F} (@code{gprof})
+The @samp{-F @var{function}} option works like the @code{-f} option, but
+only time spent in the function and its children (and their
+children@dots{}) will be used to determine total-time and
+percentages-of-time for the call graph.  More than one @samp{-F} option
+may be given; only one @var{function_name} may be indicated with each
+@samp{-F} option.  The @samp{-F} option overrides the @samp{-E} option.
+
+@end table
+
+@node Interpretation of profiling results
+@subsection Interpretation of profiling results
+
+@noindent
+
+The results of the profiling analysis are represented by two arrays: the
+'flat profile' and the 'call graph'. Full documentation of those outputs
+can be found in the GNU Profiler User's Guide.
+
+The flat profile shows the time spent in each function of the program, and how
+many time it has been called. This allows you to locate easily the most
+time-consuming functions.
+
+The call graph shows, for each subprogram, the subprograms that call it,
+and the subprograms that it calls. It also provides an estimate of the time
+spent in each of those callers/called subprograms.
+@end ifclear
+
+@c ******************************
 @node Running and Debugging Ada Programs
 @chapter Running and Debugging Ada Programs
 @cindex Debugging
@@ -19851,8 +23044,9 @@ $ RUN/DEBUG <PROGRAM_NAME>
 @noindent
 This chapter discusses how to debug Ada programs.
 @ifset vms
-It applies to the Alpha OpenVMS platform;
-the debugger for I64 OpenVMS is scheduled for a subsequent release.
+It applies to GNAT on the Alpha OpenVMS platform;
+for I64 OpenVMS please refer to the @cite{OpenVMS Debugger Manual},
+since HP has implemented Ada support in the OpenVMS debugger on I64.
 @end ifset
 
 An incorrect Ada program may be handled in three ways by the GNAT compiler:
@@ -19904,11 +23098,11 @@ and in particular is capable of debugging Ada programs compiled with
 GNAT. The latest versions of @code{GDB} are Ada-aware and can handle
 complex Ada data structures.
 
-The manual @cite{Debugging with GDB}
+@xref{Top,, Debugging with GDB, gdb, Debugging with GDB},
 @ifset vms
-located in the GNU:[DOCS] directory,
+located in the GNU:[DOCS] directory,
 @end ifset
-contains full details on the usage of @code{GDB}, including a section on
+for full details on the usage of @code{GDB}, including a section on
 its usage on programs. This manual should be consulted for full
 details. The section that follows is a brief introduction to the
 philosophy and use of @code{GDB}.
@@ -19920,9 +23114,9 @@ separate from the generated code. It makes the object files considerably
 larger, but it does not add to the size of the actual executable that
 will be loaded into memory, and has no impact on run-time performance. The
 generation of debug information is triggered by the use of the
-^-g^/DEBUG^ switch in the gcc or gnatmake command used to carry out
-the compilations. It is important to emphasize that the use of these
-options does not change the generated code.
+^-g^/DEBUG^ switch in the @command{gcc} or @command{gnatmake} command
+used to carry out the compilations. It is important to emphasize that
+the use of these options does not change the generated code.
 
 The debugging information is written in standard system formats that
 are used by many tools, including debuggers and profilers. The format
@@ -19958,26 +23152,22 @@ variables, and more generally to report on the state of execution.
 @section Running GDB
 
 @noindent
-The debugger can be launched directly and simply from @code{glide} or
-through its graphical interface: @code{gvd}. It can also be used
-directly in text mode. Here is described the basic use of @code{GDB}
-in text mode. All the commands described below can be used in the
-@code{gvd} console window even though there is usually other more
-graphical ways to achieve the same goals.
+This section describes how to initiate the debugger.
+@c The above sentence is really just filler, but it was otherwise
+@c clumsy to get the first paragraph nonindented given the conditional
+@c nature of the description
 
 @ifclear vms
-@noindent
-The command to run the graphical interface of the debugger is
-@smallexample
-$ gvd program
-@end smallexample
+The debugger can be launched from a @code{GPS} menu or
+directly from the command line. The description below covers the latter use.
+All the commands shown can be used in the @code{GPS} debug console window,
+but there are usually more GUI-based ways to achieve the same effect.
 @end ifclear
 
-@noindent
-The command to run @code{GDB} in text mode is
+The command to run @code{GDB} is
 
 @smallexample
-$ ^gdb program^GDB PROGRAM^
+$ ^gdb program^GDB PROGRAM^
 @end smallexample
 
 @noindent
@@ -19992,14 +23182,14 @@ describes some of the additional commands that can be given to @code{GDB}.
 @section Introduction to GDB Commands
 
 @noindent
-@code{GDB} contains a large repertoire of commands. The manual
-@cite{Debugging with GDB}
+@code{GDB} contains a large repertoire of commands.  @xref{Top,,
+Debugging with GDB, gdb, Debugging with GDB},
 @ifset vms
-located in the GNU:[DOCS] directory,
+located in the GNU:[DOCS] directory,
 @end ifset
-includes extensive documentation on the use
+for extensive documentation on the use
 of these commands, together with examples of their use. Furthermore,
-the command @var{help} invoked from within @code{GDB} activates a simple help
+the command @command{help} invoked from within GDB activates a simple help
 facility which summarizes the available commands and their options.
 In this section we summarize a few of the most commonly
 used commands to give an idea of what @code{GDB} is about. You should create
@@ -20087,12 +23277,13 @@ of the current breakpoint, that is to say the top of the call stack.
 
 @end table
 
+@noindent
 The above list is a very short introduction to the commands that
 @code{GDB} provides. Important additional capabilities, including conditional
 breakpoints, the ability to execute command sequences on a breakpoint,
 the ability to debug at the machine instruction level and many other
-features are described in detail in @cite{Debugging with GDB}.
-Note that most commands can be abbreviated
+features are described in detail in @ref{Top,, Debugging with GDB, gdb,
+Debugging with GDB}.  Note that most commands can be abbreviated
 (for example, c for continue, bt for backtrace).
 
 @node Using Ada Expressions
@@ -20118,13 +23309,15 @@ are not particularly important to the @code{GDB} user.
 That brevity is important to the @code{GDB} user.
 @end itemize
 
+@noindent
 Thus, for brevity, the debugger acts as if there were
 implicit @code{with} and @code{use} clauses in effect for all user-written
 packages, thus making it unnecessary to fully qualify most names with
 their packages, regardless of context. Where this causes ambiguity,
 @code{GDB} asks the user's intent.
 
-For details on the supported Ada syntax, see @cite{Debugging with GDB}.
+For details on the supported Ada syntax, see @ref{Top,, Debugging with
+GDB, gdb, Debugging with GDB}.
 
 @node Calling User-Defined Subprograms
 @section Calling User-Defined Subprograms
@@ -20284,7 +23477,7 @@ perturbed.
 
 @noindent
 For more detailed information on the tasking support,
-see @cite{Debugging with GDB}.
+see @ref{Top,, Debugging with GDB, gdb, Debugging with GDB}.
 
 @node Debugging Generic Units
 @section Debugging Generic Units
@@ -20413,7 +23606,7 @@ Files with prefix @file{^sc^SC^} contain the lexical scanner.
 
 @item
 All files prefixed with @file{^par^PAR^} are components of the parser. The
-numbers correspond to chapters of the Ada 95 Reference Manual. For example,
+numbers correspond to chapters of the Ada Reference Manual. For example,
 parsing of select statements can be found in @file{par-ch9.adb}.
 
 @item
@@ -20472,7 +23665,7 @@ both language-defined children and GNAT run-time routines.
 @item
 @findex GNAT
 Files with prefix @file{^g-^G-^} are children of @code{GNAT}. These are useful
-general-purpose packages, fully documented in their specifications. All
+general-purpose packages, fully documented in their specs. All
 the other @file{.c} files are modifications of common @command{gcc} files.
 @end itemize
 
@@ -20607,8 +23800,8 @@ $ addr2line --exe=stb 0x401373 0x40138b 0x40139c 0x401335 0x4011c4
 0040138B at d:/stb/stb.adb:10
 0040139C at d:/stb/stb.adb:14
 00401335 at d:/stb/b~stb.adb:104
-004011C4 at /build/.../crt1.c:200
-004011F1 at /build/.../crt1.c:222
+004011C4 at /build/@dots{}/crt1.c:200
+004011F1 at /build/@dots{}/crt1.c:222
 77E892A4 in ?? at ??:0
 @end smallexample
 
@@ -20632,8 +23825,8 @@ $ addr2line --exe=stb --functions --demangle=gnat 0x401373 0x40138b
 0040138B in stb.p2 at d:/stb/stb.adb:10
 0040139C in stb at d:/stb/stb.adb:14
 00401335 in main at d:/stb/b~stb.adb:104
-004011C4 in <__mingw_CRTStartup> at /build/.../crt1.c:200
-004011F1 in <mainCRTStartup> at /build/.../crt1.c:222
+004011C4 in <__mingw_CRTStartup> at /build/@dots{}/crt1.c:200
+004011F1 in <mainCRTStartup> at /build/@dots{}/crt1.c:222
 @end smallexample
 
 @noindent
@@ -20675,7 +23868,7 @@ of calls with the same program compiled with debug information.
 Non-symbolic tracebacks are obtained by using the @option{-E} binder argument.
 The stack traceback is attached to the exception information string, and can
 be retrieved in an exception handler within the Ada program, by means of the
-Ada95 facilities defined in @code{Ada.Exceptions}. Here is a simple example:
+Ada facilities defined in @code{Ada.Exceptions}. Here is a simple example:
 
 @smallexample @c ada
 with Ada.Text_IO;
@@ -20943,12 +24136,12 @@ GNAT always follows the Alpha implementation.
 
 For GNAT running on other than VMS systems, all the HP Ada 83 pragmas and
 attributes are recognized, although only a subset of them can sensibly
-be implemented.  The description of pragmas in the
-@cite{GNAT Reference Manual} indicates whether or not they are applicable
-to non-VMS systems.
+be implemented.  The description of pragmas in
+@xref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference Manual}
+indicates whether or not they are applicable to non-VMS systems.
 
 @menu
-* Ada 95 Compatibility::
+* Ada Language Compatibility::
 * Differences in the Definition of Package System::
 * Language-Related Features::
 * The Package STANDARD::
@@ -20966,16 +24159,16 @@ to non-VMS systems.
 * Tools and Utilities::
 @end menu
 
-@node Ada 95 Compatibility
-@section Ada 95 Compatibility
+@node Ada Language Compatibility
+@section Ada Language Compatibility
 
 @noindent
-GNAT is an Ada 95 compiler, and HP Ada is an Ada 83
-compiler. Ada 95 is almost completely upwards compatible
+GNAT handles Ada 95 and Ada 2005 as well as Ada 83, whereas HP Ada is only
+for Ada 83. Ada 95 and Ada 2005 are almost completely upwards compatible
 with Ada 83, and therefore Ada 83 programs will compile
 and run under GNAT with
-no changes or only minor changes. The Ada 95 Reference
-Manual provides details on specific incompatibilities.
+no changes or only minor changes. The @cite{Annotated Ada Reference Manual}
+provides details on specific incompatibilities.
 
 GNAT provides the switch @option{/83} on the @command{GNAT COMPILE} command,
 as well as the pragma @code{ADA_83}, to force the compiler to
@@ -20983,7 +24176,7 @@ operate in Ada 83 mode. This mode does not guarantee complete
 conformance to Ada 83, but in practice is sufficient to
 eliminate most sources of incompatibilities.
 In particular, it eliminates the recognition of the
-additional Ada 95 keywords, so that their use as identifiers
+additional Ada 95 and Ada 2005 keywords, so that their use as identifiers
 in Ada 83 programs is legal, and handles the cases of packages
 with optional bodies, and generics that instantiate unconstrained
 types without the use of @code{(<>)}.
@@ -20992,11 +24185,12 @@ types without the use of @code{(<>)}.
 @section Differences in the Definition of Package @code{System}
 
 @noindent
-Both Ada 95 and Ada 83 permit a compiler to add
+An Ada compiler is allowed to add
 implementation-dependent declarations to package @code{System}.
 In normal mode,
 GNAT does not take advantage of this permission, and the version of
-@code{System} provided by GNAT exactly matches that in Ada 95.
+@code{System} provided by GNAT exactly matches that defined in the Ada
+Reference Manual.
 
 However, HP Ada adds an extensive set of declarations to package
 @code{System},
@@ -21021,7 +24215,7 @@ package @code{System.Aux_DEC}.
 @cindex @code{Aux_DEC} package (child of @code{System})
 These definitions are incorporated directly into package @code{System},
 as though they had been declared there. For a
-list of the declarations added, see the specification of this package,
+list of the declarations added, see the spec of this package,
 which can be found in the file @file{s-auxdec.ads} in the GNAT library.
 @cindex @file{s-auxdec.ads} file
 The pragma @code{Extend_System} is a configuration pragma, which means that
@@ -21044,7 +24238,7 @@ use  System.Aux_DEC;
 The effect is not quite semantically identical to incorporating
 the declarations directly into package @code{System},
 but most programs will not notice a difference
-unless they use prefix notation (e.g. @code{System.Integer_8})
+unless they use prefix notation (e.g.@: @code{System.Integer_8})
 to reference the entities directly in package @code{System}.
 For units containing such references,
 the prefixes must either be removed, or the pragma @code{Extend_System}
@@ -21100,7 +24294,7 @@ following additional integer types in package @code{System}:
 
 @noindent
 In GNAT, the first four of these types may be obtained from the
-standard Ada 95 package @code{Interfaces}.
+standard Ada package @code{Interfaces}.
 Alternatively, by use of the pragma @code{Extend_System}, identical
 declarations can be referenced directly in package @code{System}.
 On both GNAT and HP Ada, the maximum integer size is 64 bits.
@@ -21222,7 +24416,7 @@ Therefore, @code{+0.5} rounds to @code{1},
 and @code{-0.5} rounds to @code{-1}.
 
 On GNAT the results of operations
-on fixed-point types are in accordance with the Ada 95
+on fixed-point types are in accordance with the Ada
 rules. In particular, results of operations on decimal
 fixed-point types are truncated.
 
@@ -21230,7 +24424,7 @@ fixed-point types are truncated.
 @subsection Record and Array Component Alignment
 
 @noindent
-On HP Ada for OpenVMS Alpha, all non composite components
+On HP Ada for OpenVMS Alpha, all non-composite components
 are aligned on natural boundaries. For example, 1-byte
 components are aligned on byte boundaries, 2-byte
 components on 2-byte boundaries, 4-byte components on 4-byte
@@ -21249,7 +24443,7 @@ objects and imported subprograms.
 The predefined type @code{System.Address} is a private type
 in both compilers on Alpha OpenVMS, with the same representation
 (it is simply a machine pointer). Addition, subtraction, and comparison
-operations are available in the standard Ada 95 package
+operations are available in the standard Ada package
 @code{System.Storage_Elements}, or in package @code{System}
 if it is extended to include @code{System.Aux_DEC} using a
 pragma @code{Extend_System} as previously described.
@@ -21257,7 +24451,7 @@ pragma @code{Extend_System} as previously described.
 Note that code that @code{with}'s both this extended package @code{System}
 and the package @code{System.Storage_Elements} should not @code{use}
 both packages, or ambiguities will result. In general it is better
-not to mix these two sets of facilities. The Ada 95 package was
+not to mix these two sets of facilities. The Ada package was
 designed specifically to provide the kind of features that HP Ada
 adds directly to package @code{System}.
 
@@ -21270,14 +24464,14 @@ clauses, except for some limitations in
 the form of address clauses for composite objects with
 initialization. Such address clauses are easily replaced
 by the use of an explicitly-defined constant as described
-in the Ada 95 Reference Manual (13.1(22)). For example, the sequence
+in the Ada Reference Manual (13.1(22)). For example, the sequence
 of declarations:
 
 @smallexample @c ada
 @cartouche
 X, Y : Integer := Init_Func;
 Q : String (X .. Y) := "abc";
-...
+@dots{}
 for Q'Address use Compute_Address;
 @end cartouche
 @end smallexample
@@ -21292,16 +24486,17 @@ that @code{Q} is declared. To achieve the intended effect, write instead:
 X, Y : Integer := Init_Func;
 Q_Address : constant Address := Compute_Address;
 Q : String (X .. Y) := "abc";
-...
+@dots{}
 for Q'Address use Q_Address;
 @end cartouche
 @end group
 @end smallexample
 
 @noindent
-which will be accepted by GNAT (and other Ada 95 compilers), and is also
+which will be accepted by GNAT (and other Ada compilers), and is also
 compatible with Ada 83. A fuller description of the restrictions
-on address specifications is found in the @cite{GNAT Reference Manual}.
+on address specifications is found in @ref{Top, GNAT Reference Manual,
+About This Guide, gnat_rm, GNAT Reference Manual}.
 
 @node Other Representation Clauses
 @subsection Other Representation Clauses
@@ -21317,10 +24512,9 @@ including @code{COMPONENT_SIZE} and @code{SIZE} clauses for objects.
 
 @noindent
 The package @code{STANDARD}, as implemented by HP Ada, is fully
-described in the Ada 95 Reference Manual and in the HP Ada
-Language Reference Manual. As implemented by GNAT, the
-package @code{STANDARD} is described in the Ada 95 Reference
-Manual.
+described in the @cite{Ada Reference Manual} and in the
+@cite{HP Ada Language Reference Manual}. As implemented by GNAT, the
+package @code{STANDARD} is described in the @cite{Ada Reference Manual}.
 
 In addition, HP Ada supports the Latin-1 character set in
 the type @code{CHARACTER}. GNAT supports the Latin-1 character set
@@ -21337,7 +24531,7 @@ pragmas. See @ref{Floating-Point Types and Representations}, for details.
 @noindent
 HP Ada provides a specific version of the package
 @code{SYSTEM} for each platform on which the language is implemented.
-For the complete specification of the package @code{SYSTEM}, see
+For the complete spec of the package @code{SYSTEM}, see
 Appendix F of the @cite{HP Ada Language Reference Manual}.
 
 On HP Ada, the package @code{SYSTEM} includes the following conversion
@@ -21354,12 +24548,12 @@ functions:
 @item @code{TO_UNSIGNED_LONGWORD(ADDRESS)}
 
 @item Function @code{IMPORT_VALUE return UNSIGNED_LONGWORD} and the
-              functions @code{IMPORT_ADDRESS} and @code{IMPORT_LARGEST_VALUE}
+functions @code{IMPORT_ADDRESS} and @code{IMPORT_LARGEST_VALUE}
 @end itemize
 
 @noindent
 By default, GNAT supplies a version of @code{SYSTEM} that matches
-the definition given in the Ada 95 Reference Manual.
+the definition given in the @cite{Ada Reference Manual}.
 This
 is a subset of the HP system definitions, which is as
 close as possible to the original definitions. The only difference
@@ -21373,7 +24567,7 @@ System_Name : constant Name := SYSTEM_NAME_GNAT;
 @end smallexample
 
 @noindent
-Also, GNAT adds the new Ada 95 declarations for
+Also, GNAT adds the Ada declarations for
 @code{BIT_ORDER} and @code{DEFAULT_BIT_ORDER}.
 
 However, the use of the following pragma causes GNAT
@@ -21389,8 +24583,8 @@ pragma Extend_System (Aux_DEC);
 
 @noindent
 The pragma @code{Extend_System} is a configuration pragma that
-is most conveniently placed in the @file{gnat.adc} file. See the
-@cite{GNAT Reference Manual} for further details.
+is most conveniently placed in the @file{gnat.adc} file. @xref{Pragma
+Extend_System,,, gnat_rm, GNAT Reference Manual} for further details.
 
 HP Ada does not allow the recompilation of the package
 @code{SYSTEM}. Instead HP Ada provides several pragmas
@@ -21421,8 +24615,8 @@ are virtually identical to those provided by the HP Ada 83 package
 @code{TO_ADDRESS}
 function for type @code{UNSIGNED_LONGWORD} is changed to
 @code{TO_ADDRESS_LONG}.
-See the @cite{GNAT Reference Manual} for a discussion of why this change was
-necessary.
+@xref{Address Clauses,,, gnat_rm, GNAT Reference Manual} for a
+discussion of why this change was necessary.
 
 @noindent
 The version of @code{TO_ADDRESS} taking a @i{universal_integer} argument
@@ -21547,16 +24741,15 @@ GNAT supplies the following task-related pragmas:
 @itemize @bullet
 @item  @code{TASK_INFO}
 
-              This pragma appears within a task definition and
-              applies to the task in which it appears. The argument
-              must be of type @code{SYSTEM.TASK_INFO.TASK_INFO_TYPE}.
+This pragma appears within a task definition and
+applies to the task in which it appears. The argument
+must be of type @code{SYSTEM.TASK_INFO.TASK_INFO_TYPE}.
 
 @item  @code{TASK_STORAGE}
 
-              GNAT implements pragma @code{TASK_STORAGE} in the same way as
-              HP Ada.
-              Both HP Ada and GNAT supply the pragmas @code{PASSIVE},
-              @code{SUPPRESS}, and @code{VOLATILE}.
+GNAT implements pragma @code{TASK_STORAGE} in the same way as HP Ada.
+Both HP Ada and GNAT supply the pragmas @code{PASSIVE},
+@code{SUPPRESS}, and @code{VOLATILE}.
 @end itemize
 @node Scheduling and Task Priority
 @subsection Scheduling and Task Priority
@@ -21583,7 +24776,7 @@ information on using the pragmas to control HP Ada task
 scheduling.
 
 GNAT follows the scheduling rules of Annex D (Real-Time
-Annex) of the Ada 95 Reference Manual. In general, this
+Annex) of the @cite{Ada Reference Manual}. In general, this
 scheduling strategy is fully compatible with HP Ada
 although it provides some additional constraints (as
 fully documented in Annex D).
@@ -21608,7 +24801,7 @@ management purposes. On OpenVMS Alpha systems, at least
 one page is allocated.
 
 GNAT handles task stacks in a similar manner. In accordance with
-the Ada 95 rules, it provides the pragma @code{STORAGE_SIZE} as
+the Ada rules, it provides the pragma @code{STORAGE_SIZE} as
 an alternative method for controlling the task stack size.
 The specification of the attribute @code{T'STORAGE_SIZE} is also
 supported in a manner compatible with HP Ada.
@@ -21626,7 +24819,7 @@ GNAT is compatible with HP Ada in its handling of external interrupts.
 @noindent
 Both HP Ada and GNAT supply all language-defined pragmas
 as specified by the Ada 83 standard. GNAT also supplies all
-language-defined pragmas specified in the Ada 95 Reference Manual.
+language-defined pragmas introduced by Ada 95 and Ada 2005.
 In addition, GNAT implements the implementation-defined pragmas
 from HP Ada 83.
 
@@ -21671,7 +24864,7 @@ from HP Ada 83.
 
 @item  @code{PASSIVE}
 
-@item  @code{PSET_OBJECT}
+@item  @code{PSECT_OBJECT}
 
 @item  @code{SHARE_GENERIC}
 
@@ -21689,7 +24882,7 @@ These pragmas are all fully implemented, with the exception of @code{TITLE},
 @code{PASSIVE}, and @code{SHARE_GENERIC}, which are
 recognized, but which have no
 effect in GNAT. The effect of @code{PASSIVE} may be obtained by the
-use of protected objects in Ada 95. In GNAT, all generics are inlined.
+use of Ada protected objects. In GNAT, all generics are inlined.
 
 Unlike HP Ada, the GNAT ``@code{EXPORT_}@i{subprogram}'' pragmas require
 a separate subprogram specification which must appear before the
@@ -21717,10 +24910,6 @@ GNAT also supplies a number of implementation-defined pragmas as follows:
 
 @item  @code{CPP_DESTRUCTOR}
 
-@item  @code{CPP_VIRTUAL}
-
-@item  @code{CPP_VTABLE}
-
 @item  @code{DEBUG}
 
 @item  @code{EXTEND_SYSTEM}
@@ -21755,8 +24944,9 @@ GNAT also supplies a number of implementation-defined pragmas as follows:
 @end itemize
 
 @noindent
-For full details on these GNAT implementation-defined pragmas, see
-the GNAT Reference Manual.
+For full details on these GNAT implementation-defined pragmas,
+see @ref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference
+Manual}.
 
 @menu
 * Restrictions on the Pragma INLINE::
@@ -21856,7 +25046,7 @@ assembler code.
 The GNAT versions of the HP Ada Run-Time Library (@code{ADA$PREDEFINED:})
 units are taken from the OpenVMS Alpha version, not the OpenVMS VAX
 version.
-The HP Ada Predefined Library units are modified to remove Ada 95
+The HP Ada Predefined Library units are modified to remove post-Ada 83
 incompatibilities and to make them interoperable with GNAT
 (@pxref{Changes to DECLIB}, for details).
 The units are located in the @file{DECLIB} directory.
@@ -21875,17 +25065,17 @@ to @code{ADALIB} units with the same name (@code{TEXT_IO},
 @subsection Changes to @code{DECLIB}
 
 @noindent
-The changes made to the HP Ada predefined library for GNAT and Ada 95
+The changes made to the HP Ada predefined library for GNAT and post-Ada 83
 compatibility are minor and include the following:
 
 @itemize @bullet
 @item  Adjusting the location of pragmas and record representation
-clauses to obey Ada 95 rules
+clauses to obey Ada 95 (and thus Ada 2005) rules
 
 @item  Adding the proper notation to generic formal parameters
 that take unconstrained types in instantiation
 
-@item  Adding pragma @code{ELABORATE_BODY} to package specifications
+@item  Adding pragma @code{ELABORATE_BODY} to package specs
 that have package bodies not otherwise allowed
 
 @item  Replacing occurrences of the identifier ``@code{PROTECTED}'' by
@@ -21940,7 +25130,7 @@ On OpenVMS Alpha, HP Ada provides the following strongly-typed bindings:
 
 @noindent
 GNAT provides implementations of these HP bindings in the @code{DECLIB}
-directory.
+directory, on both the Alpha and I64 OpenVMS platforms.
 
 The X/Motif bindings used to build @code{DECLIB} are whatever versions are
 in the
@@ -21996,10 +25186,9 @@ provides the following Ada types and operations:
 @noindent
 Interfacing to C with GNAT, you can use the above approach
 described for HP Ada or the facilities of Annex B of
-the Ada 95 Reference Manual (packages @code{INTERFACES.C},
+the @cite{Ada Reference Manual} (packages @code{INTERFACES.C},
 @code{INTERFACES.C.STRINGS} and @code{INTERFACES.C.POINTERS}). For more
-information, see the section ``Interfacing to C'' in the
-@cite{GNAT Reference Manual}.
+information, see @ref{Interfacing to C,,, gnat_rm, GNAT Reference Manual}.
 
 The @option{-gnatF} qualifier forces default and explicit
 @code{External_Name} parameters in pragmas @code{Import} and @code{Export}
@@ -22016,17 +25205,16 @@ On HP Ada, main programs are defined to meet the
 following conditions:
 @itemize @bullet
 @item  Procedure with no formal parameters (returns @code{0} upon
-       normal completion)
+normal completion)
 
 @item  Procedure with no formal parameters (returns @code{42} when
-       an unhandled exception is raised)
+an unhandled exception is raised)
 
 @item  Function with no formal parameters whose returned value
-       is of a discrete type
+is of a discrete type
 
 @item  Procedure with one @code{out} formal of a discrete type for
-       which a specification of pragma @code{EXPORT_VALUED_PROCEDURE}
-       is given.
+which a specification of pragma @code{EXPORT_VALUED_PROCEDURE} is given.
 
 @end itemize
 
@@ -22063,11 +25251,11 @@ HP Ada provides the following qualifiers to pass options to the linker
 
 @item  @option{/COMMAND}
 
-@item  @option{/[NO]MAP}
+@item  @option{/@r{[}NO@r{]}MAP}
 
-@item  @option{/OUTPUT=@i{file-spec}}
+@item  @option{/OUTPUT=@var{file-spec}}
 
-@item  @option{/[NO]DEBUG} and @option{/[NO]TRACEBACK}
+@item  @option{/@r{[}NO@r{]}DEBUG} and @option{/@r{[}NO@r{]}TRACEBACK}
 @end itemize
 
 @noindent
@@ -22075,11 +25263,11 @@ To pass options to the linker, GNAT provides the following
 switches:
 
 @itemize @bullet
-@item   @option{/EXECUTABLE=@i{exec-name}}
+@item   @option{/EXECUTABLE=@var{exec-name}}
 
 @item   @option{/VERBOSE}
 
-@item   @option{/[NO]DEBUG} and @option{/[NO]TRACEBACK}
+@item   @option{/@r{[}NO@r{]}DEBUG} and @option{/@r{[}NO@r{]}TRACEBACK}
 @end itemize
 
 @noindent
@@ -22197,7 +25385,7 @@ program library.
 @item @command{ACS ENTER FOREIGN}
 @tab Copy (*)@*
 Allows the import of a foreign body as an Ada library
-specification and enters a reference to a pointer.
+spec and enters a reference to a pointer.
 
 @item @command{ACS ENTER UNIT}
 @tab Copy (*)@*
@@ -22350,7 +25538,7 @@ standard HP Ada versions of all I/O packages, operating
 in a manner compatible with HP Ada. In particular, the
 following packages are by default the HP Ada (Ada 83)
 versions of these packages rather than the renamings
-suggested in Annex J of the Ada 95 Reference Manual:
+suggested in Annex J of the Ada Reference Manual:
 @itemize @bullet
 @item  @code{TEXT_IO}
 
@@ -22360,18 +25548,18 @@ suggested in Annex J of the Ada 95 Reference Manual:
 @end itemize
 
 @noindent
-The use of the standard Ada 95 syntax for child packages (for
-example, @code{ADA.TEXT_IO}) retrieves the Ada 95 versions of these
-packages, as defined in the Ada 95 Reference Manual.
+The use of the standard child package syntax (for
+example, @code{ADA.TEXT_IO}) retrieves the post-Ada 83 versions of these
+packages.
 GNAT provides HP-compatible predefined instantiations
 of the @code{TEXT_IO} packages, and also
 provides the standard predefined instantiations required
-by the Ada 95 Reference Manual.
+by the @cite{Ada Reference Manual}.
 
 For further information on how GNAT interfaces to the file
 system or how I/O is implemented in programs written in
-mixed languages, see the chapter ``Implementation of the
-Standard I/O'' in the @cite{GNAT Reference Manual}.
+mixed languages, see @ref{Implementation of the Standard I/O,,,
+gnat_rm, GNAT Reference Manual}.
 This chapter covers the following:
 @itemize @bullet
 @item  Standard I/O packages
@@ -22411,19 +25599,19 @@ and GNAT systems.
 @sp 1
 
 @item  In a subprogram or entry  declaration, maximum number of
-       formal parameters that are of an unconstrained record type
+formal parameters that are of an unconstrained record type
 @tab   32
 @tab   No set limit
 @sp 1
 
 @item  Maximum identifier length (number of characters)
 @tab   255
-@tab   255
+@tab   32766
 @sp 1
 
 @item  Maximum number of characters in a source line
 @tab   255
-@tab   255
+@tab   32766
 @sp 1
 
 @item  Maximum collection size   (number of bytes)
@@ -22437,7 +25625,7 @@ and GNAT systems.
 @sp 1
 
 @item  Maximum number of formal parameters in an entry or
-       subprogram declaration
+subprogram declaration
 @tab   246
 @tab    No set limit
 @sp 1
@@ -22458,13 +25646,13 @@ and GNAT systems.
 @sp 1
 
 @item  Maximum number of objects declared with the pragma @code{COMMON_OBJECT}
-       or @code{PSECT_OBJECT}
+or @code{PSECT_OBJECT}
 @tab   32757
 @tab   No set limit
 @sp 1
 
 @item  Maximum number of enumeration literals in an enumeration type
-       definition
+definition
 @tab   65535
 @tab   No set limit
 @sp 1
@@ -22563,35 +25751,35 @@ of the DECset package.
 @c @multitable @columnfractions .3 .4 .4
 @multitable {Source Code Analyzer /}{Tool with HP Ada}{Tool with GNAT Pro}
 @item @i{Tool}
- @tab @i{Tool with HP Ada}
- @tab @i{Tool with @value{EDITION}}
+@tab @i{Tool with HP Ada}
+@tab @i{Tool with @value{EDITION}}
 @item Code Management@*System
- @tab HP CMS
- @tab HP CMS
+@tab HP CMS
+@tab HP CMS
 @item Language-Sensitive@*Editor
- @tab HP LSE
- @tab emacs or HP LSE (Alpha)
+@tab HP LSE
+@tab emacs or HP LSE (Alpha)
 @item
- @tab
- @tab HP LSE (I64)
+@tab
+@tab HP LSE (I64)
 @item Debugger
- @tab OpenVMS Debug
- @tab gdb (Alpha),
+@tab OpenVMS Debug
+@tab gdb (Alpha),
 @item
- @tab
- @tab OpenVMS Debug (I64)
+@tab
+@tab OpenVMS Debug (I64)
 @item Source Code Analyzer /@*Cross Referencer
- @tab HP SCA
- @tab GNAT XREF
+@tab HP SCA
+@tab GNAT XREF
 @item Test Manager
- @tab HP Digital Test@*Manager (DTM)
- @tab HP DTM
+@tab HP Digital Test@*Manager (DTM)
+@tab HP DTM
 @item Performance and@*Coverage Analyzer
- @tab HP PCA
- @tab HP PCA
+@tab HP PCA
+@tab HP PCA
 @item Module Management@*System
- @tab HP MMS
- @tab Not applicable
+@tab HP MMS
+@tab Not applicable
 @end multitable
 @end flushleft
 @end ifnottex
@@ -22653,6 +25841,8 @@ information about several specific platforms.
 * Solaris-Specific Considerations::
 * Linux-Specific Considerations::
 * AIX-Specific Considerations::
+* Irix-Specific Considerations::
+* RTX-Specific Considerations::
 @end menu
 
 @node Summary of Run-Time Configurations
@@ -22722,13 +25912,6 @@ information about several specific platforms.
 @item @code{@ @ @ @ }Tasking    @tab native Solaris threads library
 @item @code{@ @ @ @ }Exceptions @tab ZCX
 @*
-@item @code{@ @ }@i{rts-m64}
-@item @code{@ @ @ @ }Tasking     @tab native Solaris threads library
-@item @code{@ @ @ @ }Exceptions  @tab ZCX
-@item @code{@ @ @ @ }Constraints @tab Use only when compiling in 64-bit mode;
-@item    @tab Use only on Solaris 8 or later.
-@item    @tab @xref{Building and Debugging 64-bit Applications}, for details.
-@*
 @item @code{@ @ }@i{rts-pthread}
 @item @code{@ @ @ @ }Tasking    @tab pthread library
 @item @code{@ @ @ @ }Exceptions @tab ZCX
@@ -22737,6 +25920,11 @@ information about several specific platforms.
 @item @code{@ @ @ @ }Tasking    @tab native Solaris threads library
 @item @code{@ @ @ @ }Exceptions @tab SJLJ
 @*
+@item @b{sparc64-solaris}  @tab
+@item @code{@ @ }@i{rts-native (default)}
+@item @code{@ @ @ @ }Tasking    @tab native Solaris threads library
+@item @code{@ @ @ @ }Exceptions @tab ZCX
+@*
 @item @b{x86-linux}
 @item @code{@ @ }@i{rts-native (default)}
 @item @code{@ @ @ @ }Tasking    @tab pthread library
@@ -22751,6 +25939,11 @@ information about several specific platforms.
 @item @code{@ @ @ @ }Tasking    @tab native LynxOS threads
 @item @code{@ @ @ @ }Exceptions @tab SJLJ
 @*
+@item @b{x86-solaris}
+@item @code{@ @ }@i{rts-native (default)}
+@item @code{@ @ @ @ }Tasking    @tab native Solaris threads
+@item @code{@ @ @ @ }Exceptions @tab SJLJ
+@*
 @item @b{x86-windows}
 @item @code{@ @ }@i{rts-native (default)}
 @item @code{@ @ @ @ }Tasking    @tab native Win32 threads
@@ -22760,6 +25953,15 @@ information about several specific platforms.
 @item @code{@ @ @ @ }Tasking    @tab native Win32 threads
 @item @code{@ @ @ @ }Exceptions @tab SJLJ
 @*
+@item @b{x86-windows-rtx}
+@item @code{@ @ }@i{rts-rtx-rtss (default)}
+@item @code{@ @ @ @ }Tasking    @tab RTX real-time subsystem RTSS threads (kernel mode)
+@item @code{@ @ @ @ }Exceptions @tab SJLJ
+@*
+@item @code{@ @ }@i{rts-rtx-w32}
+@item @code{@ @ @ @ }Tasking    @tab RTX Win32 threads (user mode)
+@item @code{@ @ @ @ }Exceptions @tab ZCX
+@*
 @item @b{x86_64-linux}
 @item @code{@ @ }@i{rts-native (default)}
 @item @code{@ @ @ @ }Tasking    @tab pthread library
@@ -22781,7 +25983,7 @@ run-time library, and the @file{adalib} subdirectory containing the
 in the gcc target-dependent area:
 
 @smallexample
-target=$prefix/lib/gcc-lib/gcc-@i{dumpmachine}/gcc-@i{dumpversion}/
+target=$prefix/lib/gcc/gcc-@i{dumpmachine}/gcc-@i{dumpversion}/
 @end smallexample
 
 @noindent
@@ -22834,27 +26036,8 @@ Alternatively, you can specify @file{rts-sjlj/adainclude} in the file
 @file{$target/ada_object_path}.
 
 Selecting another run-time library temporarily can be
-achieved by the regular mechanism for GNAT object or source path selection:
-
-@itemize @bullet
-@item
-Set the environment variables:
-
-@smallexample
-$ ADA_INCLUDE_PATH=$target/rts-sjlj/adainclude:$ADA_INCLUDE_PATH
-$ ADA_OBJECTS_PATH=$target/rts-sjlj/adalib:$ADA_OBJECTS_PATH
-$ export ADA_INCLUDE_PATH ADA_OBJECTS_PATH
-@end smallexample
-
-@item
-Use @option{-aI$target/rts-sjlj/adainclude}
-and @option{-aO$target/rts-sjlj/adalib}
-on the @command{gnatmake} command line
-
-@item
-Use the switch @option{--RTS}; e.g., @option{--RTS=sjlj}
+achieved by using the @option{--RTS} switch, e.g., @option{--RTS=sjlj}
 @cindex @option{--RTS} option
-@end itemize
 
 @node Choosing the Scheduling Policy
 @section Choosing the Scheduling Policy
@@ -22900,20 +26083,18 @@ binder option.
 
 @noindent
 This section addresses some topics related to the various threads libraries
-on Sparc Solaris and then provides some information on building and
-debugging 64-bit applications.
+on Sparc Solaris.
 
 @menu
 * Solaris Threads Issues::
-* Building and Debugging 64-bit Applications::
 @end menu
 
 @node Solaris Threads Issues
 @subsection Solaris Threads Issues
 
 @noindent
-GNAT under Solaris comes with an alternate tasking run-time library
-based on POSIX threads --- @emph{rts-pthread}.
+GNAT under Solaris/Sparc 32 bits comes with an alternate tasking run-time
+library based on POSIX threads --- @emph{rts-pthread}.
 @cindex rts-pthread threads library
 This run-time library has the advantage of being mostly shared across all
 POSIX-compliant thread implementations, and it also provides under
@@ -22938,47 +26119,26 @@ and can thus execute on multiple processors.
 The user can alternatively specify a processor on which the program should run
 to emulate a single-processor system. The multiprocessor / uniprocessor choice
 is made by
-setting the environment variable @code{GNAT_PROCESSOR}
-@cindex @code{GNAT_PROCESSOR} environment variable (on Sparc Solaris)
+setting the environment variable @env{GNAT_PROCESSOR}
+@cindex @env{GNAT_PROCESSOR} environment variable (on Sparc Solaris)
 to one of the following:
 
 @table @code
 @item -2
 Use the default configuration (run the program on all
-         available processors) - this is the same as having
-         @code{GNAT_PROCESSOR} unset
+available processors) - this is the same as having @code{GNAT_PROCESSOR}
+unset
 
 @item -1
 Let the run-time implementation choose one processor and run the program on
-         that processor
+that processor
 
 @item 0 .. Last_Proc
 Run the program on the specified processor.
-  @code{Last_Proc} is equal to @code{_SC_NPROCESSORS_CONF - 1}
+@code{Last_Proc} is equal to @code{_SC_NPROCESSORS_CONF - 1}
 (where @code{_SC_NPROCESSORS_CONF} is a system variable).
 @end table
 
-@node Building and Debugging 64-bit Applications
-@subsection Building and Debugging 64-bit Applications
-
-@noindent
-In a 64-bit application, all the sources involved must be compiled with the
-@option{-m64} command-line option, and a specific GNAT library (compiled with
-this option) is required.
-The easiest way to build a 64bit application is to add
-@option{-m64 --RTS=m64} to the @command{gnatmake} flags.
-
-To debug these applications, a special version of gdb called @command{gdb64}
-needs to be used.
-
-To summarize, building and debugging a ``Hello World'' program in 64-bit mode
-amounts to:
-
-@smallexample
-     $ gnatmake -m64 -g --RTS=m64 hello.adb
-     $ gdb64 hello
-@end smallexample
-
 @node Linux-Specific Considerations
 @section Linux-Specific Considerations
 @cindex Linux threads libraries
@@ -22987,7 +26147,7 @@ amounts to:
 On GNU/Linux without NPTL support (usually system with GNU C Library
 older than 2.3), the signal model is not POSIX compliant, which means
 that to send a signal to the process, you need to send the signal to all
-threads, e.g. by using @code{killpg()}.
+threads, e.g.@: by using @code{killpg()}.
 
 @node AIX-Specific Considerations
 @section AIX-Specific Considerations
@@ -22997,7 +26157,7 @@ threads, e.g. by using @code{killpg()}.
 On AIX, the resolver library initializes some internal structure on
 the first call to @code{get*by*} functions, which are used to implement
 @code{GNAT.Sockets.Get_Host_By_Name} and
-@code{GNAT.Sockets.Get_Host_By_Addrss}.
+@code{GNAT.Sockets.Get_Host_By_Address}.
 If such initialization occurs within an Ada task, and the stack size for
 the task is the default size, a stack overflow may occur.
 
@@ -23008,6 +26168,44 @@ occurs in the environment task, or use @code{pragma Storage_Size} to
 specify a sufficiently large size for the stack of the task that contains
 this call.
 
+@node Irix-Specific Considerations
+@section Irix-Specific Considerations
+@cindex Irix libraries
+
+@noindent
+The GCC support libraries coming with the Irix compiler have moved to
+their canonical place with respect to the general Irix ABI related
+conventions. Running applications built with the default shared GNAT
+run-time now requires the LD_LIBRARY_PATH environment variable to
+include this location. A possible way to achieve this is to issue the
+following command line on a bash prompt:
+
+@smallexample
+@group
+$  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`dirname \`gcc --print-file-name=libgcc_s.so\``
+@end group
+@end smallexample
+
+@node RTX-Specific Considerations
+@section RTX-Specific Considerations
+@cindex RTX libraries
+
+@noindent
+The Real-time Extension (RTX) to Windows is based on the Windows Win32
+API. Applications can be built to work in two different modes:
+
+@itemize @bullet
+@item
+Windows executables that run in Ring 3 to utilize memory protection
+(@emph{rts-rtx-w32}).
+
+@item
+Real-time subsystem (RTSS) executables that run in Ring 0, where
+performance can be optimized with RTSS applications taking precedent
+over all Windows applications (@emph{rts-rtx-rtss}).
+
+@end itemize
+
 @c *******************************
 @node Example of Binder Output File
 @appendix Example of Binder Output File
@@ -23054,7 +26252,7 @@ package ada_main is
    pragma Import (C, gnat_exit_status);
 
    GNAT_Version : constant String :=
-                    "GNAT Version: 3.15w (20010315)";
+                    "GNAT Version: 6.0.0w (20061115)";
    pragma Export (C, GNAT_Version, "__gnat_version");
 
    --  This is the generated adafinal routine that performs
@@ -23385,7 +26583,7 @@ package body ada_main is
       --  a-except.ads/adb for full details of how zero cost
       --  exception handling works. This procedure, the call to
       --  it, and the two following tables are all omitted if the
-      --  build is in longjmp/setjump exception mode.
+      --  build is in longjmp/setjmp exception mode.
 
 @findex SDP_Table_Build
 @findex Zero Cost Exceptions
@@ -23460,7 +26658,7 @@ package body ada_main is
 
       --  Call SDP_Table_Build to build the top level procedure
       --  table for zero cost exception handling (omitted in
-      --  longjmp/setjump mode).
+      --  longjmp/setjmp mode).
 
       SDP_Table_Build (ST'Address, 23, EA'Address, 23);
 
@@ -23644,7 +26842,7 @@ package body ada_main is
       --  pragma Import because if we try to with the unit and
       --  call it Ada style, then not only do we waste time
       --  recompiling it, but also, we don't really know the right
-      --  switches (e.g. identifier character set) to be used
+      --  switches (e.g.@: identifier character set) to be used
       --  to compile it.
 
       procedure Ada_Main_Program;
@@ -23738,9 +26936,9 @@ elaboration code in your own application).
 @cindex Elaboration control
 
 @menu
-* Elaboration Code in Ada 95::
-* Checking the Elaboration Order in Ada 95::
-* Controlling the Elaboration Order in Ada 95::
+* Elaboration Code::
+* Checking the Elaboration Order::
+* Controlling the Elaboration Order::
 * Controlling Elaboration in GNAT - Internal Calls::
 * Controlling Elaboration in GNAT - External Calls::
 * Default Behavior in GNAT - Ensuring Safety::
@@ -23754,16 +26952,16 @@ elaboration code in your own application).
 @end menu
 
 @noindent
-This chapter describes the handling of elaboration code in Ada 95 and
+This chapter describes the handling of elaboration code in Ada and
 in GNAT, and discusses how the order of elaboration of program units can
 be controlled in GNAT, either automatically or with explicit programming
 features.
 
-@node Elaboration Code in Ada 95
-@section Elaboration Code in Ada 95
+@node Elaboration Code
+@section Elaboration Code
 
 @noindent
-Ada 95 provides rather general mechanisms for executing code at elaboration
+Ada provides rather general mechanisms for executing code at elaboration
 time, that is to say before the main program starts executing. Such code arises
 in three contexts:
 
@@ -23814,7 +27012,7 @@ of that unit before elaborating the unit doing the @code{with}'ing:
 @group
 @cartouche
 with Unit_1;
-package Unit_2 is ...
+package Unit_2 is @dots{}
 @end cartouche
 @end group
 @end smallexample
@@ -23915,9 +27113,9 @@ and in fact there is no correct order.
 
 If one of the two expressions is true, and the other is false, then one
 of the above orders is correct, and the other is incorrect. For example,
-if @code{expression_1} = 1 and @code{expression_2} /= 2,
-then the call to @code{Func_2}
-will occur, but not the call to @code{Func_1.}
+if @code{expression_1} /= 1 and @code{expression_2} = 2,
+then the call to @code{Func_1}
+will occur, but not the call to @code{Func_2.}
 This means that it is essential
 to elaborate the body of @code{Unit_1} before
 the body of @code{Unit_2}, so the first
@@ -23929,17 +27127,17 @@ the time of day, we can make it impossible for the compiler or binder
 to figure out which of these expressions will be true, and hence it
 is impossible to guarantee a safe order of elaboration at run time.
 
-@node Checking the Elaboration Order in Ada 95
-@section Checking the Elaboration Order in Ada 95
+@node Checking the Elaboration Order
+@section Checking the Elaboration Order
 
 @noindent
 In some languages that involve the same kind of elaboration problems,
-e.g. Java and C++, the programmer is expected to worry about these
+e.g.@: Java and C++, the programmer is expected to worry about these
 ordering problems himself, and it is common to
 write a program in which an incorrect elaboration order  gives
 surprising results, because it references variables before they
 are initialized.
-Ada 95 is designed to be a safe language, and a programmer-beware approach is
+Ada is designed to be a safe language, and a programmer-beware approach is
 clearly not sufficient. Consequently, the language provides three lines
 of defense:
 
@@ -23967,7 +27165,7 @@ Let's look at these facilities in more detail. First, the rules for
 dynamic checking. One possible rule would be simply to say that the
 exception is raised if you access a variable which has not yet been
 elaborated. The trouble with this approach is that it could require
-expensive checks on every variable reference. Instead Ada 95 has two
+expensive checks on every variable reference. Instead Ada has two
 rules which are a little more restrictive, but easier to check, and
 easier to state:
 
@@ -24012,15 +27210,15 @@ some of the Boolean variables as unnecessary, and @code{GNAT} indeed
 does such optimizations, but still the easiest conceptual model is to
 think of there being one variable per subprogram.
 
-@node Controlling the Elaboration Order in Ada 95
-@section Controlling the Elaboration Order in Ada 95
+@node Controlling the Elaboration Order
+@section Controlling the Elaboration Order
 
 @noindent
-In the previous section we discussed the rules in Ada 95 which ensure
+In the previous section we discussed the rules in Ada which ensure
 that @code{Program_Error} is raised if an incorrect elaboration order is
 chosen. This prevents erroneous executions, but we need mechanisms to
 specify a correct execution and avoid the exception altogether.
-To achieve this, Ada 95 provides a number of features for controlling
+To achieve this, Ada provides a number of features for controlling
 the order of elaboration. We discuss these features in this section.
 
 First, there are several ways of indicating to the compiler that a given
@@ -24028,8 +27226,9 @@ unit has no elaboration problems:
 
 @table @asis
 @item packages that do not require a body
-In Ada 95, a library package that does not require a body does not permit
-a body. This means that if we have a such a package, as in:
+A library package that does not require a body does not permit
+a body (this rule was introduced in Ada 95).
+Thus if we have a such a package, as in:
 
 @smallexample @c ada
 @group
@@ -24123,8 +27322,8 @@ we marked both of them as having pragma @code{Elaborate_Body}, then
 clearly there would be no possible elaboration order.
 
 The above pragmas allow a server to guarantee safe use by clients, and
-clearly this is the preferable approach. Consequently a good rule in
-Ada 95 is to mark units as @code{Pure} or @code{Preelaborate} if possible,
+clearly this is the preferable approach. Consequently a good rule
+is to mark units as @code{Pure} or @code{Preelaborate} if possible,
 and if this is not possible,
 mark them as @code{Elaborate_Body} if possible.
 As we have seen, there are situations where neither of these
@@ -24173,7 +27372,7 @@ body of @code{C}, because @code{B} @code{with}'s @code{C}.
 @end table
 
 @noindent
-We are now in a position to give a usage rule in Ada 95 for avoiding
+We are now in a position to give a usage rule in Ada for avoiding
 elaboration problems, at least if dynamic dispatching and access to
 subprogram values are not used. We will handle these cases separately
 later.
@@ -24201,11 +27400,11 @@ states:
 No order of elaboration exists which follows the rules, taking into
 account any @code{Elaborate}, @code{Elaborate_All},
 or @code{Elaborate_Body} pragmas. In
-this case, an Ada 95 compiler must diagnose the situation at bind
+this case, an Ada compiler must diagnose the situation at bind
 time, and refuse to build an executable program.
 
 @item One or more orders exist, all incorrect
-One or more acceptable elaboration orders exists, and all of them
+One or more acceptable elaboration orders exist, and all of them
 generate an elaboration order problem. In this case, the binder
 can build an executable program, but @code{Program_Error} will be raised
 when the program is run.
@@ -24245,7 +27444,7 @@ to use @code{Elaborate_All} on such units.
 @section Controlling Elaboration in GNAT - Internal Calls
 
 @noindent
-In the case of internal calls, i.e. calls within a single package, the
+In the case of internal calls, i.e., calls within a single package, the
 programmer has full control over the order of elaboration, and it is up
 to the programmer to elaborate declarations in an appropriate order. For
 example writing:
@@ -24297,13 +27496,13 @@ generate a warning that the call will raise @code{Program_Error}:
 @noindent
 Note that in this particular case, it is likely that the call is safe, because
 the function @code{One} does not access any global variables.
-Nevertheless in Ada 95, we do not want the validity of the check to depend on
+Nevertheless in Ada, we do not want the validity of the check to depend on
 the contents of the body (think about the separate compilation case), so this
 is still wrong, as we discussed in the previous sections.
 
 The error is easily corrected by rearranging the declarations so that the
-body of One appears before the declaration containing the call
-(note that in Ada 95,
+body of @code{One} appears before the declaration containing the call
+(note that in Ada 95 and Ada 2005,
 declarations can appear in any order, so there is no restriction that
 would prevent this reordering, and if we write:
 
@@ -24472,7 +27671,7 @@ end Math;
 package body Math is
    function Sqrt (Arg : Float) return Float is
    begin
-         ...
+         @dots{}
    end Sqrt;
 end Math;
 @end group
@@ -24485,7 +27684,7 @@ end Stuff;
 with Stuff;
 procedure Main is
 begin
-   ...
+   @dots{}
 end Main;
 @end group
 @end cartouche
@@ -24532,15 +27731,15 @@ that is not a general rule that can be followed in all cases. Consider
 @smallexample @c ada
 @group
 @cartouche
-package X is ...
+package X is @dots{}
 
-package Y is ...
+package Y is @dots{}
 
 with X;
-package body Y is ...
+package body Y is @dots{}
 
 with Y;
-package body X is ...
+package body X is @dots{}
 @end cartouche
 @end group
 @end smallexample
@@ -24554,7 +27753,7 @@ the body of @code{X} @code{with}'s @code{Y},
 which means you would have to
 elaborate the body of @code{Y} first, but that @code{with}'s @code{X},
 which means
-you have to elaborate the body of @code{X} first, but ... and we have a
+you have to elaborate the body of @code{X} first, but @dots{} and we have a
 loop that cannot be broken.
 
 It is true that the binder can in many cases guess an order of elaboration
@@ -24705,8 +27904,8 @@ pragma Elaborate statements from the source.
 
 @noindent
 The use of @code{pragma Elaborate}
-should generally be avoided in Ada 95 programs.
-The reason for this is that there is no guarantee that transitive calls
+should generally be avoided in Ada 95 and Ada 2005 programs,
+since there is no guarantee that transitive calls
 will be properly handled. Indeed at one point, this pragma was placed
 in Annex J (Obsolescent Features), on the grounds that it is never useful.
 
@@ -24838,7 +28037,7 @@ Here is the exact chain of events we are worrying about:
 In the body of @code{Decls} a call is made from within the body of a library
 task to a subprogram in the package @code{Utils}. Since this call may
 occur at elaboration time (given that the task is activated at elaboration
-time), we have to assume the worst, i.e. that the
+time), we have to assume the worst, i.e., that the
 call does happen at elaboration time.
 
 @item
@@ -24970,9 +28169,9 @@ Declare separate task types.
 
 A significant part of the problem arises because of the use of the
 single task declaration form. This means that the elaboration of
-the task type, and the elaboration of the task itself (i.e. the
+the task type, and the elaboration of the task itself (i.e.@: the
 creation of the task) happen at the same time. A good rule
-of style in Ada 95 is to always create explicit task types. By
+of style in Ada is to always create explicit task types. By
 following the additional step of placing task objects in separate
 packages from the task type declaration, many elaboration problems
 are avoided. Here is another modified example of the example program:
@@ -25214,7 +28413,8 @@ If the compilations are done using the
 manner. Dynamic checks are generated for all calls that could possibly result
 in raising an exception. With this switch, the compiler does not generate
 implicit @code{Elaborate} or @code{Elaborate_All} pragmas. The behavior then is
-exactly as specified in the Ada 95 Reference Manual. The binder will generate
+exactly as specified in the @cite{Ada Reference Manual}.
+The binder will generate
 an executable program that may or may not raise @code{Program_Error}, and then
 it is the programmer's job to ensure that it does not raise an exception. Note
 that it is important to compile all units with the switch, it cannot be used
@@ -25379,8 +28579,8 @@ of errors. One switch that is useful in this testing is the
 @option{^-p (pessimistic elaboration order)^/PESSIMISTIC_ELABORATION_ORDER^}
 switch for
 @code{gnatbind}.
-Normally the binder tries to find an order that has the best chance of
-of avoiding elaboration problems. With this switch, the binder
+Normally the binder tries to find an order that has the best chance
+of avoiding elaboration problems. However, if this switch is used, the binder
 plays a devil's advocate role, and tries to choose the order that
 has the best chance of failing. If your program works even with this
 switch, then it has a better chance of being error free, but this is still
@@ -25408,7 +28608,7 @@ not a factor in running the ACVC tests.)
 @cindex Access-to-subprogram
 
 @noindent
-The introduction of access-to-subprogram types in Ada 95 complicates
+Access-to-subprogram types (introduced in Ada 95) complicate
 the handling of elaboration. The trouble is that it becomes
 impossible to tell at compile time which procedure
 is being called. This means that it is not possible for the binder
@@ -25608,15 +28808,480 @@ difference, by looking at the two elaboration orders that are chosen,
 and figuring out which is correct, and then adding the necessary
 @code{Elaborate} or @code{Elaborate_All} pragmas to ensure the desired order.
 
+
+
+@c *******************************
+@node Conditional Compilation
+@appendix Conditional Compilation
+@c *******************************
+@cindex Conditional compilation
+
+@noindent
+It is often necessary to arrange for a single source program
+to serve multiple purposes, where it is compiled in different
+ways to achieve these different goals. Some examples of the
+need for this feature are
+
+@itemize @bullet
+@item  Adapting a program to a different hardware environment
+@item  Adapting a program to a different target architecture
+@item  Turning debugging features on and off
+@item  Arranging for a program to compile with different compilers
+@end itemize
+
+@noindent
+In C, or C++, the typical approach would be to use the preprocessor
+that is defined as part of the language. The Ada language does not
+contain such a feature. This is not an oversight, but rather a very
+deliberate design decision, based on the experience that overuse of
+the preprocessing features in C and C++ can result in programs that
+are extremely difficult to maintain. For example, if we have ten
+switches that can be on or off, this means that there are a thousand
+separate programs, any one of which might not even be syntactically
+correct, and even if syntactically correct, the resulting program
+might not work correctly. Testing all combinations can quickly become
+impossible.
+
+Nevertheless, the need to tailor programs certainly exists, and in
+this Appendix we will discuss how this can
+be achieved using Ada in general, and GNAT in particular.
+
+@menu
+* Use of Boolean Constants::
+* Debugging - A Special Case::
+* Conditionalizing Declarations::
+* Use of Alternative Implementations::
+* Preprocessing::
+@end menu
+
+@node Use of Boolean Constants
+@section Use of Boolean Constants
+
+@noindent
+In the case where the difference is simply which code
+sequence is executed, the cleanest solution is to use Boolean
+constants to control which code is executed.
+
+@smallexample @c ada
+@group
+FP_Initialize_Required : constant Boolean := True;
+@dots{}
+if FP_Initialize_Required then
+@dots{}
+end if;
+@end group
+@end smallexample
+
+@noindent
+Not only will the code inside the @code{if} statement not be executed if
+the constant Boolean is @code{False}, but it will also be completely
+deleted from the program.
+However, the code is only deleted after the @code{if} statement
+has been checked for syntactic and semantic correctness.
+(In contrast, with preprocessors the code is deleted before the
+compiler ever gets to see it, so it is not checked until the switch
+is turned on.)
+@cindex Preprocessors (contrasted with conditional compilation)
+
+Typically the Boolean constants will be in a separate package,
+something like:
+
+@smallexample @c ada
+@group
+package Config is
+   FP_Initialize_Required : constant Boolean := True;
+   Reset_Available        : constant Boolean := False;
+   @dots{}
+end Config;
+@end group
+@end smallexample
+
+@noindent
+The @code{Config} package exists in multiple forms for the various targets,
+with an appropriate script selecting the version of @code{Config} needed.
+Then any other unit requiring conditional compilation can do a @code{with}
+of @code{Config} to make the constants visible.
+
+
+@node Debugging - A Special Case
+@section Debugging - A Special Case
+
+@noindent
+A common use of conditional code is to execute statements (for example
+dynamic checks, or output of intermediate results) under control of a
+debug switch, so that the debugging behavior can be turned on and off.
+This can be done using a Boolean constant to control whether the code
+is active:
+
+@smallexample @c ada
+@group
+if Debugging then
+   Put_Line ("got to the first stage!");
+end if;
+@end group
+@end smallexample
+
+@noindent
+or
+
+@smallexample @c ada
+@group
+if Debugging and then Temperature > 999.0 then
+   raise Temperature_Crazy;
+end if;
+@end group
+@end smallexample
+
+@noindent
+Since this is a common case, there are special features to deal with
+this in a convenient manner. For the case of tests, Ada 2005 has added
+a pragma @code{Assert} that can be used for such tests. This pragma is modeled
+@cindex pragma @code{Assert}
+on the @code{Assert} pragma that has always been available in GNAT, so this
+feature may be used with GNAT even if you are not using Ada 2005 features.
+The use of pragma @code{Assert} is described in
+@ref{Pragma Assert,,, gnat_rm, GNAT Reference Manual}, but as an
+example, the last test could be written:
+
+@smallexample @c ada
+pragma Assert (Temperature <= 999.0, "Temperature Crazy");
+@end smallexample
+
+@noindent
+or simply
+
+@smallexample @c ada
+pragma Assert (Temperature <= 999.0);
+@end smallexample
+
+@noindent
+In both cases, if assertions are active and the temperature is excessive,
+the exception @code{Assert_Failure} will be raised, with the given string in
+the first case or a string indicating the location of the pragma in the second
+case used as the exception message.
+
+You can turn assertions on and off by using the @code{Assertion_Policy}
+pragma.
+@cindex pragma @code{Assertion_Policy}
+This is an Ada 2005 pragma which is implemented in all modes by
+GNAT, but only in the latest versions of GNAT which include Ada 2005
+capability. Alternatively, you can use the @option{-gnata} switch
+@cindex @option{-gnata} switch
+to enable assertions from the command line (this is recognized by all versions
+of GNAT).
+
+For the example above with the @code{Put_Line}, the GNAT-specific pragma
+@code{Debug} can be used:
+@cindex pragma @code{Debug}
+
+@smallexample @c ada
+pragma Debug (Put_Line ("got to the first stage!"));
+@end smallexample
+
+@noindent
+If debug pragmas are enabled, the argument, which must be of the form of
+a procedure call, is executed (in this case, @code{Put_Line} will be called).
+Only one call can be present, but of course a special debugging procedure
+containing any code you like can be included in the program and then
+called in a pragma @code{Debug} argument as needed.
+
+One advantage of pragma @code{Debug} over the @code{if Debugging then}
+construct is that pragma @code{Debug} can appear in declarative contexts,
+such as at the very beginning of a procedure, before local declarations have
+been elaborated.
+
+Debug pragmas are enabled using either the @option{-gnata} switch that also
+controls assertions, or with a separate Debug_Policy pragma.
+@cindex pragma @code{Debug_Policy}
+The latter pragma is new in the Ada 2005 versions of GNAT (but it can be used
+in Ada 95 and Ada 83 programs as well), and is analogous to
+pragma @code{Assertion_Policy} to control assertions.
+
+@code{Assertion_Policy} and @code{Debug_Policy} are configuration pragmas,
+and thus they can appear in @file{gnat.adc} if you are not using a
+project file, or in the file designated to contain configuration pragmas
+in a project file.
+They then apply to all subsequent compilations. In practice the use of
+the @option{-gnata} switch is often the most convenient method of controlling
+the status of these pragmas.
+
+Note that a pragma is not a statement, so in contexts where a statement
+sequence is required, you can't just write a pragma on its own. You have
+to add a @code{null} statement.
+
+@smallexample @c ada
+@group
+if @dots{} then
+   @dots{} -- some statements
+else
+   pragma Assert (Num_Cases < 10);
+   null;
+end if;
+@end group
+@end smallexample
+
+
+@node Conditionalizing Declarations
+@section Conditionalizing Declarations
+
+@noindent
+In some cases, it may be necessary to conditionalize declarations to meet
+different requirements. For example we might want a bit string whose length
+is set to meet some hardware message requirement.
+
+In some cases, it may be possible to do this using declare blocks controlled
+by conditional constants:
+
+@smallexample @c ada
+@group
+if Small_Machine then
+   declare
+      X : Bit_String (1 .. 10);
+   begin
+      @dots{}
+   end;
+else
+   declare
+      X : Large_Bit_String (1 .. 1000);
+   begin
+      @dots{}
+   end;
+end if;
+@end group
+@end smallexample
+
+@noindent
+Note that in this approach, both declarations are analyzed by the
+compiler so this can only be used where both declarations are legal,
+even though one of them will not be used.
+
+Another approach is to define integer constants, e.g.@: @code{Bits_Per_Word}, or
+Boolean constants, e.g.@: @code{Little_Endian}, and then write declarations
+that are parameterized by these constants. For example
+
+@smallexample @c ada
+@group
+for Rec use
+  Field1 at 0 range Boolean'Pos (Little_Endian) * 10 .. Bits_Per_Word;
+end record;
+@end group
+@end smallexample
+
+@noindent
+If @code{Bits_Per_Word} is set to 32, this generates either
+
+@smallexample @c ada
+@group
+for Rec use
+  Field1 at 0 range 0 .. 32;
+end record;
+@end group
+@end smallexample
+
+@noindent
+for the big endian case, or
+
+@smallexample @c ada
+@group
+for Rec use record
+  Field1 at 0 range 10 .. 32;
+end record;
+@end group
+@end smallexample
+
+@noindent
+for the little endian case. Since a powerful subset of Ada expression
+notation is usable for creating static constants, clever use of this
+feature can often solve quite difficult problems in conditionalizing
+compilation (note incidentally that in Ada 95, the little endian
+constant was introduced as @code{System.Default_Bit_Order}, so you do not
+need to define this one yourself).
+
+
+@node Use of Alternative Implementations
+@section Use of Alternative Implementations
+
+@noindent
+In some cases, none of the approaches described above are adequate. This
+can occur for example if the set of declarations required is radically
+different for two different configurations.
+
+In this situation, the official Ada way of dealing with conditionalizing
+such code is to write separate units for the different cases. As long as
+this does not result in excessive duplication of code, this can be done
+without creating maintenance problems. The approach is to share common
+code as far as possible, and then isolate the code and declarations
+that are different. Subunits are often a convenient method for breaking
+out a piece of a unit that is to be conditionalized, with separate files
+for different versions of the subunit for different targets, where the
+build script selects the right one to give to the compiler.
+@cindex Subunits (and conditional compilation)
+
+As an example, consider a situation where a new feature in Ada 2005
+allows something to be done in a really nice way. But your code must be able
+to compile with an Ada 95 compiler. Conceptually you want to say:
+
+@smallexample @c ada
+@group
+if Ada_2005 then
+   @dots{} neat Ada 2005 code
+else
+   @dots{} not quite as neat Ada 95 code
+end if;
+@end group
+@end smallexample
+
+@noindent
+where @code{Ada_2005} is a Boolean constant.
+
+But this won't work when @code{Ada_2005} is set to @code{False},
+since the @code{then} clause will be illegal for an Ada 95 compiler.
+(Recall that although such unreachable code would eventually be deleted
+by the compiler, it still needs to be legal.  If it uses features
+introduced in Ada 2005, it will be illegal in Ada 95.)
+
+So instead we write
+
+@smallexample @c ada
+procedure Insert is separate;
+@end smallexample
+
+@noindent
+Then we have two files for the subunit @code{Insert}, with the two sets of
+code.
+If the package containing this is called @code{File_Queries}, then we might
+have two files
+
+@itemize @bullet
+@item    @file{file_queries-insert-2005.adb}
+@item    @file{file_queries-insert-95.adb}
+@end itemize
+
+@noindent
+and the build script renames the appropriate file to
+
+@smallexample
+file_queries-insert.adb
+@end smallexample
+
+@noindent
+and then carries out the compilation.
+
+This can also be done with project files' naming schemes. For example:
+
+@smallexample @c project
+For Body ("File_Queries.Insert") use "file_queries-insert-2005.ada";
+@end smallexample
+
+@noindent
+Note also that with project files it is desirable to use a different extension
+than @file{ads} / @file{adb} for alternative versions. Otherwise a naming
+conflict may arise through another commonly used feature: to declare as part
+of the project a set of directories containing all the sources obeying the
+default naming scheme.
+
+The use of alternative units is certainly feasible in all situations,
+and for example the Ada part of the GNAT run-time is conditionalized
+based on the target architecture using this approach. As a specific example,
+consider the implementation of the AST feature in VMS. There is one
+spec:
+
+@smallexample
+s-asthan.ads
+@end smallexample
+
+@noindent
+which is the same for all architectures, and three bodies:
+
+@table @file
+@item    s-asthan.adb
+used for all non-VMS operating systems
+@item    s-asthan-vms-alpha.adb
+used for VMS on the Alpha
+@item    s-asthan-vms-ia64.adb
+used for VMS on the ia64
+@end table
+
+@noindent
+The dummy version @file{s-asthan.adb} simply raises exceptions noting that
+this operating system feature is not available, and the two remaining
+versions interface with the corresponding versions of VMS to provide
+VMS-compatible AST handling. The GNAT build script knows the architecture
+and operating system, and automatically selects the right version,
+renaming it if necessary to @file{s-asthan.adb} before the run-time build.
+
+Another style for arranging alternative implementations is through Ada's
+access-to-subprogram facility.
+In case some functionality is to be conditionally included,
+you can declare an access-to-procedure variable @code{Ref} that is initialized
+to designate a ``do nothing'' procedure, and then invoke @code{Ref.all}
+when appropriate.
+In some library package, set @code{Ref} to @code{Proc'Access} for some
+procedure @code{Proc} that performs the relevant processing.
+The initialization only occurs if the library package is included in the
+program.
+The same idea can also be implemented using tagged types and dispatching
+calls.
+
+
+@node Preprocessing
+@section Preprocessing
+@cindex Preprocessing
+
+@noindent
+Although it is quite possible to conditionalize code without the use of
+C-style preprocessing, as described earlier in this section, it is
+nevertheless convenient in some cases to use the C approach. Moreover,
+older Ada compilers have often provided some preprocessing capability,
+so legacy code may depend on this approach, even though it is not
+standard.
+
+To accommodate such use, GNAT provides a preprocessor (modeled to a large
+extent on the various preprocessors that have been used
+with legacy code on other compilers, to enable easier transition).
+
+The preprocessor may be used in two separate modes. It can be used quite
+separately from the compiler, to generate a separate output source file
+that is then fed to the compiler as a separate step. This is the
+@code{gnatprep} utility, whose use is fully described in
+@ref{Preprocessing Using gnatprep}.
+@cindex @code{gnatprep}
+
+The preprocessing language allows such constructs as
+
+@smallexample
+@group
+#if DEBUG or PRIORITY > 4 then
+   bunch of declarations
+#else
+   completely different bunch of declarations
+#end if;
+@end group
+@end smallexample
+
+@noindent
+The values of the symbols @code{DEBUG} and @code{PRIORITY} can be
+defined either on the command line or in a separate file.
+
+The other way of running the preprocessor is even closer to the C style and
+often more convenient. In this approach the preprocessing is integrated into
+the compilation process. The compiler is fed the preprocessor input which
+includes @code{#if} lines etc, and then the compiler carries out the
+preprocessing internally and processes the resulting output.
+For more details on this approach, see @ref{Integrated Preprocessing}.
+
+
+@c *******************************
 @node Inline Assembler
 @appendix Inline Assembler
+@c *******************************
 
 @noindent
 If you need to write low-level software that interacts directly
 with the hardware, Ada provides two ways to incorporate assembly
 language code into your program.  First, you can import and invoke
 external routines written in assembly language, an Ada feature fully
-supported by GNAT.  However, for small sections of code it may be simpler
+supported by GNAT@.  However, for small sections of code it may be simpler
 or more efficient to include assembly language statements directly
 in your Ada source program, using the facilities of the implementation-defined
 package @code{System.Machine_Code}, which incorporates the gcc
@@ -25742,7 +29407,8 @@ from which it generates a sequence of assembly language instructions.
 
 The examples in this chapter will illustrate several of the forms
 for invoking @code{Asm}; a complete specification of the syntax
-is found in the @cite{GNAT Reference Manual}.
+is found in @ref{Machine Code Insertions,,, gnat_rm, GNAT Reference
+Manual}.
 
 Under the standard GNAT conventions, the @code{Nothing} procedure
 should be in a file named @file{nothing.adb}.
@@ -25940,7 +29606,7 @@ most useful (for the Intel x86 processor) are the following:
 @item =
 output constraint
 @item g
-global (i.e. can be stored anywhere)
+global (i.e.@: can be stored anywhere)
 @item m
 in memory
 @item I
@@ -26189,7 +29855,7 @@ end Increment_2;
 @end smallexample
 
 Compile the program with both optimization (@option{-O2}) and inlining
-enabled (@option{-gnatpn} instead of @option{-gnatp}).
+(@option{-gnatn}) enabled.
 
 The @code{Incr} function is still compiled as usual, but at the
 point in @code{Increment} where our function used to be called:
@@ -26330,14 +29996,15 @@ problems.
 
 @noindent
 This chapter describes the compatibility issues that may arise between
-GNAT and other Ada 83 and Ada 95 compilation systems, and shows how GNAT
-can expedite porting
+GNAT and other Ada compilation systems (including those for Ada 83),
+and shows how GNAT can expedite porting
 applications developed in other Ada environments.
 
 @menu
 * Compatibility with Ada 83::
+* Compatibility between Ada 95 and Ada 2005::
 * Implementation-dependent characteristics::
-* Compatibility with Other Ada 95 Systems::
+* Compatibility with Other Ada Systems::
 * Representation Clauses::
 @ifclear vms
 @c Brief section is only in non-VMS version
@@ -26351,12 +30018,12 @@ applications developed in other Ada environments.
 
 @node Compatibility with Ada 83
 @section Compatibility with Ada 83
-@cindex Compatibility (between Ada 83 and Ada 95)
+@cindex Compatibility (between Ada 83 and Ada 95 / Ada 2005)
 
 @noindent
-Ada 95 is designed to be highly upwards compatible with Ada 83.  In
-particular, the design intention is that the difficulties associated
-with moving from Ada 83 to Ada 95 should be no greater than those
+Ada 95 and Ada 2005 are highly upwards compatible with Ada 83.  In
+particular, the design intention was that the difficulties associated
+with moving from Ada 83 to Ada 95 or Ada 2005 should be no greater than those
 that occur when moving from one Ada 83 system to another.
 
 However, there are a number of points at which there are minor
@@ -26376,21 +30043,25 @@ following subsections treat the most likely issues to be encountered.
 @node Legal Ada 83 programs that are illegal in Ada 95
 @subsection Legal Ada 83 programs that are illegal in Ada 95
 
-@table @asis
+Some legal Ada 83 programs are illegal (i.e., they will fail to compile) in
+Ada 95 and thus also in Ada 2005:
+
+@table @emph
 @item Character literals
 Some uses of character literals are ambiguous.  Since Ada 95 has introduced
 @code{Wide_Character} as a new predefined character type, some uses of
 character literals that were legal in Ada 83 are illegal in Ada 95.
 For example:
 @smallexample @c ada
-   for Char in 'A' .. 'Z' loop ... end loop;
+   for Char in 'A' .. 'Z' loop @dots{} end loop;
 @end smallexample
+
 @noindent
 The problem is that @code{'A'} and @code{'Z'} could be from either
 @code{Character} or @code{Wide_Character}.  The simplest correction
 is to make the type explicit; e.g.:
 @smallexample @c ada
-   for Char in Character range 'A' .. 'Z' loop ... end loop;
+   for Char in Character range 'A' .. 'Z' loop @dots{} end loop;
 @end smallexample
 
 @item New reserved words
@@ -26460,7 +30131,7 @@ the fix is usually simply to add the @code{(<>)} to the generic declaration.
 @node More deterministic semantics
 @subsection More deterministic semantics
 
-@table @asis
+@table @emph
 @item Conversions
 Conversions from real types to integer types round away from 0.  In Ada 83
 the conversion Integer(2.5) could deliver either 2 or 3 as its value.  This
@@ -26487,8 +30158,8 @@ possible in Ada 83.  Fortunately this is extremely rare, but the one
 situation that you should be alert to is the change in the predefined type
 @code{Character} from 7-bit ASCII to 8-bit Latin-1.
 
-@table @asis
-@item range of @code{Character}
+@table @emph
+@item Range of type @code{Character}
 The range of @code{Standard.Character} is now the full 256 characters
 of Latin-1, whereas in most Ada 83 implementations it was restricted
 to 128 characters. Although some of the effects of
@@ -26512,27 +30183,85 @@ covers only the restricted range.
 
 @node Other language compatibility issues
 @subsection Other language compatibility issues
-@table @asis
-@item @option{-gnat83 switch}
+
+@table @emph
+@item @option{-gnat83} switch
 All implementations of GNAT provide a switch that causes GNAT to operate
 in Ada 83 mode.  In this mode, some but not all compatibility problems
 of the type described above are handled automatically.  For example, the
-new Ada 95 reserved words are treated simply as identifiers as in Ada 83.
+new reserved words introduced in Ada 95 and Ada 2005 are treated simply
+as identifiers as in Ada 83.
 However,
 in practice, it is usually advisable to make the necessary modifications
 to the program to remove the need for using this switch.
 See @ref{Compiling Different Versions of Ada}.
 
 @item Support for removed Ada 83 pragmas and attributes
-A number of pragmas and attributes from Ada 83 have been removed from Ada 95,
-generally because they have been replaced by other mechanisms.  Ada 95
+A number of pragmas and attributes from Ada 83 were removed from Ada 95,
+generally because they were replaced by other mechanisms.  Ada 95 and Ada 2005
 compilers are allowed, but not required, to implement these missing
-elements.  In contrast with some other Ada 95 compilers, GNAT implements all
+elements.  In contrast with some other compilers, GNAT implements all
 such pragmas and attributes, eliminating this compatibility concern.  These
 include @code{pragma Interface} and the floating point type attributes
 (@code{Emax}, @code{Mantissa}, etc.), among other items.
 @end table
 
+
+@node Compatibility between Ada 95 and Ada 2005
+@section Compatibility between Ada 95 and Ada 2005
+@cindex Compatibility between Ada 95 and Ada 2005
+
+@noindent
+Although Ada 2005 was designed to be upwards compatible with Ada 95, there are
+a number of incompatibilities. Several are enumerated below;
+for a complete description please see the
+Annotated Ada 2005 Reference Manual, or section 9.1.1 in
+@cite{Rationale for Ada 2005}.
+
+@table @emph
+@item New reserved words.
+The words @code{interface}, @code{overriding} and @code{synchronized} are
+reserved in Ada 2005.
+A pre-Ada 2005 program that uses any of these as an identifier will be
+illegal.
+
+@item New declarations in predefined packages.
+A number of packages in the predefined environment contain new declarations:
+@code{Ada.Exceptions}, @code{Ada.Real_Time}, @code{Ada.Strings},
+@code{Ada.Strings.Fixed}, @code{Ada.Strings.Bounded},
+@code{Ada.Strings.Unbounded}, @code{Ada.Strings.Wide_Fixed},
+@code{Ada.Strings.Wide_Bounded}, @code{Ada.Strings.Wide_Unbounded},
+@code{Ada.Tags}, @code{Ada.Text_IO}, and @code{Interfaces.C}.
+If an Ada 95 program does a @code{with} and @code{use} of any of these
+packages, the new declarations may cause name clashes.
+
+@item Access parameters.
+A nondispatching subprogram with an access parameter cannot be renamed
+as a dispatching operation.  This was permitted in Ada 95.
+
+@item Access types, discriminants, and constraints.
+Rule changes in this area have led to some incompatibilities; for example,
+constrained subtypes of some access types are not permitted in Ada 2005.
+
+@item Aggregates for limited types.
+The allowance of aggregates for limited types in Ada 2005 raises the
+possibility of ambiguities in legal Ada 95 programs, since additional types
+now need to be considered in expression resolution.
+
+@item Fixed-point multiplication and division.
+Certain expressions involving ``*'' or ``/'' for a fixed-point type, which
+were legal in Ada 95 and invoked the predefined versions of these operations,
+are now ambiguous.
+The ambiguity may be resolved either by applying a type conversion to the
+expression, or by explicitly invoking the operation from package
+@code{Standard}.
+
+@item Return-by-reference types.
+The Ada 95 return-by-reference mechanism has been removed.  Instead, the user
+can declare a function returning a value from an anonymous access type.
+@end table
+
+
 @node Implementation-dependent characteristics
 @section Implementation-dependent characteristics
 @noindent
@@ -26559,11 +30288,11 @@ transition from certain Ada 83 compilers.
 @noindent
 Ada compilers are allowed to supplement the language-defined pragmas, and
 these are a potential source of non-portability.  All GNAT-defined pragmas
-are described in the GNAT Reference Manual, and these include several that
-are specifically intended to correspond to other vendors' Ada 83 pragmas.
+are described in @ref{Implementation Defined Pragmas,,, gnat_rm, GNAT
+Reference Manual}, and these include several that are specifically
+intended to correspond to other vendors' Ada 83 pragmas.
 For migrating from VADS, the pragma @code{Use_VADS_Size} may be useful.
-For
-compatibility with HP Ada 83, GNAT supplies the pragmas
+For compatibility with HP Ada 83, GNAT supplies the pragmas
 @code{Extend_System}, @code{Ident}, @code{Inline_Generic},
 @code{Interface_Name}, @code{Passive}, @code{Suppress_All},
 and @code{Volatile}.
@@ -26578,9 +30307,9 @@ relevant in a GNAT context and hence are not otherwise implemented.
 @subsection Implementation-defined attributes
 
 Analogous to pragmas, the set of attributes may be extended by an
-implementation.  All GNAT-defined attributes are described in the
-@cite{GNAT Reference Manual}, and these include several that are specifically
-intended
+implementation.  All GNAT-defined attributes are described in
+@ref{Implementation Defined Attributes,,, gnat_rm, GNAT Reference
+Manual}, and these include several that are specifically intended
 to correspond to other vendors' Ada 83 attributes.  For migrating from VADS,
 the attribute @code{VADS_Size} may be useful.  For compatibility with HP
 Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and
@@ -26591,17 +30320,17 @@ Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and
 @noindent
 Vendors may supply libraries to supplement the standard Ada API.  If Ada 83
 code uses vendor-specific libraries then there are several ways to manage
-this in Ada 95:
+this in Ada 95 or Ada 2005:
 @enumerate
 @item
-If the source code for the libraries (specifications and bodies) are
+If the source code for the libraries (specs and bodies) are
 available, then the libraries can be migrated in the same way as the
 application.
 @item
-If the source code for the specifications but not the bodies are
+If the source code for the specs but not the bodies are
 available, then you can reimplement the bodies.
 @item
-Some new Ada 95 features obviate the need for library support.  For
+Some features introduced by Ada 95 obviate the need for library support.  For
 example most Ada 83 vendors supplied a package for unsigned integers.  The
 Ada 95 modular type feature is the preferred way to handle this need, so
 instead of migrating or reimplementing the unsigned integer package it may
@@ -26627,7 +30356,7 @@ ways to deal with this situation:
 
 @itemize @bullet
 @item
-Modify the program to eliminate the circularities, e.g. by moving
+Modify the program to eliminate the circularities, e.g.@: by moving
 elaboration-time code into explicitly-invoked procedures
 @item
 Constrain the elaboration order by including explicit @code{Elaborate_Body} or
@@ -26646,23 +30375,27 @@ representations, interfacing with assembler code, and similar issues.  If
 such an Ada 83 application is being ported to different target hardware (for
 example where the byte endianness has changed) then you will need to
 carefully examine the program logic; the porting effort will heavily depend
-on the robustness of the original design.  Moreover, Ada 95 is sometimes
+on the robustness of the original design.  Moreover, Ada 95 (and thus
+Ada 2005) are sometimes
 incompatible with typical Ada 83 compiler practices regarding implicit
 packing, the meaning of the Size attribute, and the size of access values.
 GNAT's approach to these issues is described in @ref{Representation Clauses}.
 
-@node Compatibility with Other Ada 95 Systems
-@section Compatibility with Other Ada 95 Systems
+@node Compatibility with Other Ada Systems
+@section Compatibility with Other Ada Systems
 
 @noindent
-Providing that programs avoid the use of implementation dependent and
-implementation defined features of Ada 95, as documented in the Ada 95
-reference manual, there should be a high degree of portability between
-GNAT and other Ada 95 systems.  The following are specific items which
-have proved troublesome in moving GNAT programs to other Ada 95
+If programs avoid the use of implementation dependent and
+implementation defined features, as documented in the @cite{Ada
+Reference Manual}, there should be a high degree of portability between
+GNAT and other Ada systems.  The following are specific items which
+have proved troublesome in moving Ada 95 programs from GNAT to other Ada 95
 compilers, but do not affect porting code to GNAT@.
+(As of @value{NOW}, GNAT is the only compiler available for Ada 2005;
+the following issues may or may not arise for Ada 2005 programs
+when other compilers appear.)
 
-@table @asis
+@table @emph
 @item Ada 83 Pragmas and Attributes
 Ada 95 compilers are allowed, but not required, to implement the missing
 Ada 83 pragmas and attributes that are no longer defined in Ada 95.
@@ -26670,7 +30403,7 @@ GNAT implements all such pragmas and attributes, eliminating this as
 a compatibility concern, but some other Ada 95 compilers reject these
 pragmas and attributes.
 
-@item Special-needs Annexes
+@item Specialized Needs Annexes
 GNAT implements the full set of special needs annexes.  At the
 current time, it is the only Ada 95 compiler to do so.  This means that
 programs making use of these features may not be portable to other Ada
@@ -26688,21 +30421,21 @@ far beyond this minimal set, as described in the next section.
 @noindent
 The Ada 83 reference manual was quite vague in describing both the minimal
 required implementation of representation clauses, and also their precise
-effects.  The Ada 95 reference manual is much more explicit, but the minimal
-set of capabilities required in Ada 95 is quite limited.
+effects.  Ada 95 (and thus also Ada 2005) are much more explicit, but the
+minimal set of capabilities required is still quite limited.
 
-GNAT implements the full required set of capabilities described in the
-Ada 95 reference manual, but also goes much beyond this, and in particular
+GNAT implements the full required set of capabilities in
+Ada 95 and Ada 2005, but also goes much further, and in particular
 an effort has been made to be compatible with existing Ada 83 usage to the
 greatest extent possible.
 
 A few cases exist in which Ada 83 compiler behavior is incompatible with
-requirements in the Ada 95 reference manual.  These are instances of
+the requirements in Ada 95 (and thus also Ada 2005).  These are instances of
 intentional or accidental dependence on specific implementation dependent
 characteristics of these Ada 83 compilers.  The following is a list of
-the cases most likely to arise in existing legacy Ada 83 code.
+the cases most likely to arise in existing Ada 83 code.
 
-@table @asis
+@table @emph
 @item Implicit Packing
 Some Ada 83 compilers allowed a Size specification to cause implicit
 packing of an array or record.  This could cause expensive implicit
@@ -26710,17 +30443,17 @@ conversions for change of representation in the presence of derived
 types, and the Ada design intends to avoid this possibility.
 Subsequent AI's were issued to make it clear that such implicit
 change of representation in response to a Size clause is inadvisable,
-and this recommendation is represented explicitly in the Ada 95 RM
-as implementation advice that is followed by GNAT@.
+and this recommendation is represented explicitly in the Ada 95 (and Ada 2005)
+Reference Manuals as implementation advice that is followed by GNAT@.
 The problem will show up as an error
 message rejecting the size clause.  The fix is simply to provide
 the explicit pragma @code{Pack}, or for more fine tuned control, provide
 a Component_Size clause.
 
 @item Meaning of Size Attribute
-The Size attribute in Ada 95 for discrete types is defined as being the
-minimal number of bits required to hold values of the type.  For example,
-on a 32-bit machine, the size of Natural will typically be 31 and not
+The Size attribute in Ada 95 (and Ada 2005) for discrete types is defined as
+the minimal number of bits required to hold values of the type.  For example,
+on a 32-bit machine, the size of @code{Natural} will typically be 31 and not
 32 (since no sign bit is required).  Some Ada 83 compilers gave 31, and
 some 32 in this situation.  This problem will usually show up as a compile
 time error, but not always.  It is a good idea to check all uses of the
@@ -26778,7 +30511,7 @@ existing HP Ada 83 code to GNAT in VMS systems should be easier than
 most other porting efforts.  The following are some of the most
 significant differences between GNAT and HP Ada 83.
 
-@table @asis
+@table @emph
 @item Default floating-point representation
 In GNAT, the default floating-point format is IEEE, whereas in HP Ada 83,
 it is VMS format.  GNAT does implement the necessary pragmas
@@ -26800,11 +30533,11 @@ HP Ada provides the following declarations:
 @smallexample @c ada
 TO_ADDRESS (INTEGER)
 TO_ADDRESS (UNSIGNED_LONGWORD)
-TO_ADDRESS (universal_integer)
+TO_ADDRESS (@i{universal_integer})
 @end smallexample
 
 @noindent
-The version of TO_ADDRESS taking a universal integer argument is in fact
+The version of TO_ADDRESS taking a @i{universal integer} argument is in fact
 an extension to Ada 83 not strictly compatible with the reference manual.
 In GNAT, we are constrained to be exactly compatible with the standard,
 and this means we cannot provide this capability.  In HP Ada 83, the
@@ -26818,10 +30551,10 @@ TO_ADDRESS (16#12777#);
 Normally, according to the Ada 83 standard, one would expect this to be
 ambiguous, since it matches both the INTEGER and UNSIGNED_LONGWORD forms
 of TO_ADDRESS@.  However, in HP Ada 83, there is no ambiguity, since the
-definition using universal_integer takes precedence.
+definition using @i{universal_integer} takes precedence.
 
-In GNAT, since the version with universal_integer cannot be supplied, it is
-not possible to be 100% compatible.  Since there are many programs using
+In GNAT, since the version with @i{universal_integer} cannot be supplied, it
+is not possible to be 100% compatible.  Since there are many programs using
 numeric constants for the argument to TO_ADDRESS, the decision in GNAT was
 to change the name of the function in the UNSIGNED_LONGWORD case, so the
 declarations provided in the GNAT version of AUX_Dec are:
@@ -26845,14 +30578,15 @@ does not provide a specified value for the Task_Id of the environment task,
 which in GNAT is treated like any other declared task.
 @end table
 
+@noindent
 For full details on these and other less significant compatibility issues,
 see appendix E of the HP publication entitled @cite{HP Ada, Technical
 Overview and Comparison on HP Platforms}.
 
 For GNAT running on other than VMS systems, all the HP Ada 83 pragmas and
 attributes are recognized, although only a subset of them can sensibly
-be implemented.  The description of pragmas in the
-@cite{GNAT Reference Manual}
+be implemented.  The description of pragmas in @ref{Implementation
+Defined Pragmas,,, gnat_rm, GNAT Reference Manual}
 indicates whether or not they are applicable to non-VMS systems.
 @end ifclear
 
@@ -26882,7 +30616,7 @@ three main goals:
 
 @enumerate
 @item
-Providing a full conforming implementation of the Ada 95 language
+Providing a full conforming implementation of Ada 95 and Ada 2005
 
 @item
 Allowing maximum backward compatibility, thus easing migration of existing
@@ -27229,7 +30963,7 @@ Using general access types ensures maximum compatibility with both
 All code that comes as part of GNAT is 64-bit clean, but the
 restrictions given in @ref{Restrictions on use of 64 bit objects},
 still apply. Look at the package
-specifications to see in which contexts objects allocated
+specs to see in which contexts objects allocated
 in 64-bit address space are acceptable.
 
 @node Technical details
@@ -27248,8 +30982,8 @@ visible (i.e., non-private) integer type.
 Standard operations on the type, such as the binary operators ``+'', ``-'',
 etc., that take @code{Address} operands and return an @code{Address} result,
 have been hidden by declaring these
-@code{abstract}, an Ada 95 feature that helps avoid the potential ambiguities
-that would otherwise result from overloading.
+@code{abstract}, a feature introduced in Ada 95 that helps avoid the potential
+ambiguities that would otherwise result from overloading.
 (Note that, although @code{Address} is a visible integer type,
 good programming practice dictates against exploiting the type's
 integer properties such as literals, since this will compromise
@@ -27368,7 +31102,7 @@ uninstall or integrate different GNAT products.
 
 @noindent
 Make sure the system on which GNAT is installed is accessible from the
-current machine, i.e. the install location is shared over the network.
+current machine, i.e., the install location is shared over the network.
 Shared resources are accessed on Windows by means of UNC paths, which
 have the format @code{\\server\sharename\path}
 
@@ -27408,14 +31142,14 @@ $ gnatmake winprog -largs -mwindows
 
 @noindent
 It is possible to control where temporary files gets created by setting
-the TMP environment variable. The file will be created:
+the @env{TMP} environment variable. The file will be created:
 
 @itemize
-@item Under the directory pointed to by the TMP environment variable if
+@item Under the directory pointed to by the @env{TMP} environment variable if
 this directory exists.
 
-@item Under c:\temp, if the TMP environment variable is not set (or not
-pointing to a directory) and if this directory exists.
+@item Under @file{c:\temp}, if the @env{TMP} environment variable is not
+set (or not pointing to a directory) and if this directory exists.
 
 @item Under the current working directory otherwise.
 @end itemize
@@ -27439,7 +31173,7 @@ 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
+Microsoft tools (e.g.@: Microsoft Visual C/C++), you should be aware of
 the following limitations:
 
 @itemize @bullet
@@ -27464,7 +31198,7 @@ of the above limitations, you have two choices:
 
 @enumerate
 @item
-Encapsulate your non Ada code in a DLL to be linked with your Ada
+Encapsulate your non-Ada code in a DLL to be linked with your Ada
 application. In this case, use the Microsoft or whatever environment to
 build the DLL and use GNAT to build your executable
 (@pxref{Using DLLs with GNAT}).
@@ -27567,12 +31301,12 @@ on the stack by the caller from right to left. The callee (and not the
 caller) is in charge of cleaning the stack on routine exit. In addition,
 the name of a routine with @code{Stdcall} calling convention is mangled by
 adding a leading underscore (as for the @code{C} calling convention) and a
-trailing @code{@@}@code{@i{nn}}, where @i{nn} is the overall size (in
+trailing @code{@@}@code{@var{nn}}, where @var{nn} is the overall size (in
 bytes) of the parameters passed to the routine.
 
 The name to use on the Ada side when importing a C routine with a
 @code{Stdcall} calling convention is the name of the C routine. The leading
-underscore and trailing @code{@@}@code{@i{nn}} are added automatically by
+underscore and trailing @code{@@}@code{@var{nn}} are added automatically by
 the compiler. For instance the Win32 function:
 
 @smallexample
@@ -27615,16 +31349,14 @@ pragma Import (Stdcall, Get_Val, Link_Name => "retrieve_val");
 @end smallexample
 
 @noindent
-then the imported routine is @code{retrieve_val@@4}, that is, there is no
-trailing underscore but the appropriate @code{@@}@code{@i{nn}} is always
-added at the end of the @code{Link_Name} by the compiler.
+then the imported routine is @code{retrieve_val}, that is, there is no
+decoration at all. No leading underscore and no Stdcall suffix
+@code{@@}@code{@var{nn}}.
 
 @noindent
-Note, that in some special cases a DLL's entry point name lacks a trailing
-@code{@@}@code{@i{nn}} while the exported name generated for a call has it.
-The @code{gnatdll} tool, which creates the import library for the DLL, is able
-to handle those cases (@pxref{Using gnatdll} for the description of
-the switches).
+This is especially important as in some special cases a DLL's entry
+point name lacks a trailing @code{@@}@code{@var{nn}} while the exported
+name generated for a call has it.
 
 @noindent
 It is also possible to import variables defined in a DLL by using an
@@ -27647,7 +31379,7 @@ pragma Import (Stdcall, My_Var);
 
 @noindent
 Note that to ease building cross-platform bindings this convention
-will be handled as a @code{C} calling convention on non Windows platforms.
+will be handled as a @code{C} calling convention on non-Windows platforms.
 
 @node Win32 Calling Convention
 @subsection @code{Win32} Calling Convention
@@ -27683,8 +31415,8 @@ provided by @file{API.dll} you must statically link against the DLL or
 an import library which contains a jump table with an entry for each
 routine and variable exported by the DLL. In the Microsoft world this
 import library is called @file{API.lib}. When using GNAT this import
-library is called either @file{libAPI.a} or @file{libapi.a} (names are
-case insensitive).
+library is called either @file{libAPI.dll.a}, @file{libapi.dll.a},
+@file{libAPI.a} or @file{libapi.a} (names are case insensitive).
 
 After you have linked your application with the DLL or the import library
 and you run your application, here is what happens:
@@ -27714,7 +31446,7 @@ routines and routines in the application using the DLL.
 @end itemize
 
 @item
-The entries in the jump table (from the import library @file{libAPI.a}
+The entries in the jump table (from the import library @file{libAPI.dll.a}
 or @file{API.lib} or automatically created when linking against a DLL)
 which is part of your application are initialized with the addresses
 of the routines and variables in @file{API.dll}.
@@ -27764,7 +31496,7 @@ The Ada spec for the routines and/or variables you want to access in
 header files provided with the DLL.
 
 @item
-The import library (@file{libAPI.a} or @file{API.lib}). As previously
+The import library (@file{libAPI.dll.a} or @file{API.lib}). As previously
 mentioned an import library is a statically linked library containing the
 import table which will be filled at load time to point to the actual
 @file{API.dll} routines. Sometimes you don't have an import library for the
@@ -27787,7 +31519,8 @@ $ 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 library named @file{libAPI.a}
+(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
 
@@ -27863,10 +31596,11 @@ can have @code{C} or @code{Stdcall} convention.
 
 @noindent
 If a Microsoft-style import library @file{API.lib} or a GNAT-style
-import library @file{libAPI.a} is available with @file{API.dll} you
-can skip this section. You can also skip this section if
-@file{API.dll} is built with GNU tools as in this case it is possible
-to link directly against the DLL. Otherwise read on.
+import library @file{libAPI.dll.a} or @file{libAPI.a} is available
+with @file{API.dll} you can skip this section. You can also skip this
+section if @file{API.dll} or @file{libAPI.dll} is built with GNU tools
+as in this case it is possible to link directly against the
+DLL. Otherwise read on.
 
 @node The Definition File
 @subsubsection The Definition File
@@ -27883,21 +31617,21 @@ suffix) has the following structure:
 @smallexample
 @group
 @cartouche
-[LIBRARY @i{name}]
-[DESCRIPTION @i{string}]
+@r{[}LIBRARY @var{name}@r{]}
+@r{[}DESCRIPTION @var{string}@r{]}
 EXPORTS
-   @i{symbol1}
-   @i{symbol2}
-   ...
+   @var{symbol1}
+   @var{symbol2}
+   @dots{}
 @end cartouche
 @end group
 @end smallexample
 
 @table @code
-@item LIBRARY @i{name}
+@item LIBRARY @var{name}
 This section, which is optional, gives the name of the DLL.
 
-@item DESCRIPTION @i{string}
+@item DESCRIPTION @var{string}
 This section, which is optional, gives a description string that will be
 embedded in the import library.
 
@@ -27918,7 +31652,7 @@ EXPORTS
 @end table
 
 @noindent
-Note that you must specify the correct suffix (@code{@@}@code{@i{nn}})
+Note that you must specify the correct suffix (@code{@@}@code{@var{nn}})
 (@pxref{Windows Calling Conventions}) for a Stdcall
 calling convention function in the exported symbols list.
 
@@ -27946,12 +31680,12 @@ $ dll2def API.dll > API.def
 @code{dll2def} is a very simple tool: it takes as input a DLL and prints
 to standard output the list of entry points in the DLL. Note that if
 some routines in the DLL have the @code{Stdcall} convention
-(@pxref{Windows Calling Conventions}) with stripped @code{@@}@i{nn}
+(@pxref{Windows Calling Conventions}) with stripped @code{@@}@var{nn}
 suffix then you'll have to edit @file{api.def} to add it, and specify
-@code{-k} to @code{gnatdll} when creating the import library.
+@option{-k} to @command{gnatdll} when creating the import library.
 
 @noindent
-Here are some hints to find the right @code{@@}@i{nn} suffix.
+Here are some hints to find the right @code{@@}@var{nn} suffix.
 
 @enumerate
 @item
@@ -27970,7 +31704,7 @@ definition file and add the right suffix.
 @end enumerate
 
 @item
-Build the import library @code{libAPI.a}, using @code{gnatdll}
+Build the import library @code{libAPI.dll.a}, using @code{gnatdll}
 (@pxref{Using gnatdll}) as follows:
 
 @smallexample
@@ -27982,8 +31716,8 @@ $ gnatdll -e API.def -d API.dll
 name of the DLL containing the services listed in the definition file
 @file{API.dll}. The name of the static import library generated is
 computed from the name of the definition file as follows: if the
-definition file name is @i{xyz}@code{.def}, the import library name will
-be @code{lib}@i{xyz}@code{.a}. Note that in the previous example option
+definition file name is @var{xyz}@code{.def}, the import library name will
+be @code{lib}@var{xyz}@code{.a}. Note that in the previous example option
 @option{-e} could have been removed because the name of the definition
 file (before the ``@code{.def}'' suffix) is the same as the name of the
 DLL (@pxref{Using gnatdll} for more information about @code{gnatdll}).
@@ -28045,11 +31779,11 @@ into the DLL. This is done by using the standard @command{gnatmake} tool.
 
 @item building the DLL
 
-To build the DLL you must use @command{gcc}'s @code{-shared}
+To build the DLL you must use @command{gcc}'s @option{-shared}
 option. It is quite simple to use this method:
 
 @smallexample
-$ gcc -shared -o api.dll obj1.o obj2.o ...
+$ gcc -shared -o api.dll obj1.o obj2.o @dots{}
 @end smallexample
 
 It is important to note that in this case all symbols found in the
@@ -28058,7 +31792,7 @@ the set of symbols to export by passing to @command{gcc} a definition
 file, @pxref{The Definition File}. For example:
 
 @smallexample
-$ gcc -shared -o api.dll api.def obj1.o obj2.o ...
+$ gcc -shared -o api.dll api.def obj1.o obj2.o @dots{}
 @end smallexample
 
 If you use a definition file you must export the elaboration procedures
@@ -28082,7 +31816,7 @@ $ attrib +R apilib\*.ali
 
 At this point it is possible to use the DLL by directly linking
 against it. Note that you must use the GNAT shared runtime when using
-GNAT shared libraries. This is achieved by using @code{-shared} binder's
+GNAT shared libraries. This is achieved by using @option{-shared} binder's
 option.
 
 @smallexample
@@ -28094,7 +31828,13 @@ $ gnatmake main -Iapilib -bargs -shared -largs -Lapilib -lAPI
 @cindex DLLs, building
 
 @noindent
-There is nothing specific to Windows in this area. @pxref{Library Projects}.
+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
@@ -28177,7 +31917,7 @@ one in the main program.
 
 It is therefore not possible to exchange GNAT run-time objects between the
 Ada DLL and the main Ada program. Example of GNAT run-time objects are file
-handles (e.g. @code{Text_IO.File_Type}), tasks types, protected objects
+handles (e.g.@: @code{Text_IO.File_Type}), tasks types, protected objects
 types, etc.
 
 It is completely safe to exchange plain elementary, array or record types,
@@ -28283,7 +32023,7 @@ package body API is
       return Fact;
    end Factorial;
 
-   ...
+   @dots{}
    --  The remainder of this package body is unchanged.
 end API;
 @end cartouche
@@ -28346,7 +32086,7 @@ during the DLL build process by the @code{gnatdll} tool
 
 @noindent
 To use the services exported by the Ada DLL from another programming
-language (e.g. C), you have to translate the specs of the exported Ada
+language (e.g.@: C), you have to translate the specs of the exported Ada
 entities in that language. For instance in the case of @code{API.dll},
 the corresponding C header file could look like:
 
@@ -28374,7 +32114,7 @@ example consider a DLL comprising the following package @code{API}:
 @cartouche
 package API is
    Count : Integer := 0;
-   ...
+   @dots{}
    --  Remainder of the package omitted.
 end API;
 @end cartouche
@@ -28454,23 +32194,23 @@ static import library for the DLL and the actual DLL. The form of the
 
 @smallexample
 @cartouche
-$ gnatdll [@var{switches}] @var{list-of-files} [-largs @var{opts}]
+$ gnatdll @ovar{switches} @var{list-of-files} @r{[}-largs @var{opts}@r{]}
 @end cartouche
 @end smallexample
 
 @noindent
-where @i{list-of-files} is a list of ALI and object files. The object
+where @var{list-of-files} is a list of ALI and object files. The object
 file list must be the exact list of objects corresponding to the non-Ada
 sources whose services are to be included in the DLL. The ALI file list
 must be the exact list of ALI files for the corresponding Ada sources
-whose services are to be included in the DLL. If @i{list-of-files} is
+whose services are to be included in the DLL. If @var{list-of-files} is
 missing, only the static import library is generated.
 
 @noindent
 You may specify any of the following switches to @code{gnatdll}:
 
 @table @code
-@item -a[@var{address}]
+@item -a@ovar{address}
 @cindex @option{-a} (@code{gnatdll})
 Build a non-relocatable DLL at @var{address}. If @var{address} is not
 specified the default address @var{0x11000000} will be used. By default,
@@ -28480,7 +32220,7 @@ advise the reader to build relocatable DLL.
 @item -b @var{address}
 @cindex @option{-b} (@code{gnatdll})
 Set the relocatable DLL base address. By default the address is
-@var{0x11000000}.
+@code{0x11000000}.
 
 @item -bargs @var{opts}
 @cindex @option{-bargs} (@code{gnatdll})
@@ -28492,7 +32232,7 @@ Binder options. Pass @var{opts} to the binder.
 @code{gnatdll} to do anything. The name of the generated import library is
 obtained algorithmically from @var{dllfile} as shown in the following
 example: if @var{dllfile} is @code{xyz.dll}, the import library name is
-@code{libxyz.a}. The name of the definition file to use (if not specified
+@code{libxyz.dll.a}. The name of the definition file to use (if not specified
 by option @option{-e}) is obtained algorithmically from @var{dllfile}
 as shown in the following example:
 if @var{dllfile} is @code{xyz.dll}, the definition
@@ -28522,10 +32262,10 @@ object files needed to build the DLL.
 
 @item -k
 @cindex @option{-k} (@code{gnatdll})
-Removes the @code{@@}@i{nn} suffix from the import library's exported
+Removes the @code{@@}@var{nn} suffix from the import library's exported
 names, but keeps them for the link names. You must specify this
 option if you want to use a @code{Stdcall} function in a DLL for which
-the @code{@@}@i{nn} suffix has been removed. This is the case for most
+the @code{@@}@var{nn} suffix has been removed. This is the case for most
 of the Windows NT DLL for example. This option has no effect when
 @option{-n} option is specified.
 
@@ -28564,7 +32304,7 @@ $ gnatdll -d api.dll api.ali
 @end smallexample
 
 @noindent
-The above command creates two files: @file{libapi.a} (the import
+The above command creates two files: @file{libapi.dll.a} (the import
 library) and @file{api.dll} (the actual DLL). If you want to create
 only the DLL, just type:
 
@@ -28642,7 +32382,7 @@ $ gnatlink api -o api.jnk api.exp -mdll
 
 @item
 @code{gnatdll} builds the new export table using the new base file and
-generates the DLL import library @file{libAPI.a}.
+generates the DLL import library @file{libAPI.dll.a}.
 
 @smallexample
 @group
@@ -28673,7 +32413,7 @@ common @code{dlltool} switches. The form of the @code{dlltool} command
 is
 
 @smallexample
-$ dlltool [@var{switches}]
+$ dlltool @ovar{switches}
 @end smallexample
 
 @noindent
@@ -28697,7 +32437,7 @@ DLL in the static import library generated by @code{dlltool} with switch
 
 @item -k
 @cindex @option{-k} (@command{dlltool})
-Kill @code{@@}@i{nn} from exported names
+Kill @code{@@}@var{nn} from exported names
 (@pxref{Windows Calling Conventions}
 for a discussion about @code{Stdcall}-style symbols.
 
@@ -28710,7 +32450,7 @@ Prints the @code{dlltool} switches with a concise description.
 Generate an export file @var{exportfile}. The export file contains the
 export table (list of symbols in the DLL) and is used to create the DLL.
 
-@item --output-lib @i{libfile}
+@item --output-lib @var{libfile}
 @cindex @option{--output-lib} (@command{dlltool})
 Generate a static import library @var{libfile}.
 
@@ -28718,9 +32458,9 @@ Generate a static import library @var{libfile}.
 @cindex @option{-v} (@command{dlltool})
 Verbose mode.
 
-@item --as @i{assembler-name}
+@item --as @var{assembler-name}
 @cindex @option{--as} (@command{dlltool})
-Use @i{assembler-name} as the assembler. The default is @code{as}.
+Use @var{assembler-name} as the assembler. The default is @code{as}.
 @end table
 
 @node GNAT and Windows Resources
@@ -29114,12 +32854,12 @@ approach to debug a program as described in
 It is possible to specify the program stack size at link time. On modern
 versions of Windows, starting with XP, this is mostly useful to set the size of
 the main stack (environment task). The other task stacks are set with pragma
-Storage_Size or with gnatbind -d.
+Storage_Size or with the @command{gnatbind -d} command.
 
-Older versions of Windows (2000, NT4, etc.) do
-not provide any means of setting the reserve size of individual tasks, thus the
-link-time stack size applies to all tasks and pragma Storage_Size has no effect.
-It means, in particular, that Stack Overflow checks are made against this
+Since older versions of Windows (2000, NT4, etc.) do not allow setting the
+reserve size of individual tasks, the link-time stack size applies to all
+tasks, and pragma Storage_Size has no effect.
+In particular, Stack Overflow checks are made against this
 link-time specified size.
 
 This setting can be done with