https://gcc.gnu.org/g:108e346ced2a5589b90577f25c9559a61ae95eb9

commit r16-1321-g108e346ced2a5589b90577f25c9559a61ae95eb9
Author: Javier Miranda <mira...@adacore.com>
Date:   Mon Mar 3 11:34:35 2025 +0000

    ada: Pragma Ada_XX not propagated from library level spec to body
    
    Add documentation to pragmas Ada_83, Ada_95, Ada_05, Ada_12,
    and Ada_2022: when placed before a library level package
    specification they are not propagated to the corresponding
    package body; they must be added explicitly to the package
    body.
    
    gcc/ada/ChangeLog:
    
            * doc/gnat_rm/implementation_defined_pragmas.rst: Adding
            documentation.
            * doc/gnat_ugn/the_gnat_compilation_model.rst: ditto.
            * gnat_rm.texi: Regenerate.
            * gnat_ugn.texi: Regenerate.

Diff:
---
 .../doc/gnat_rm/implementation_defined_pragmas.rst | 25 ++++++++++++++++++++++
 .../doc/gnat_ugn/the_gnat_compilation_model.rst    |  4 ++++
 gcc/ada/gnat_rm.texi                               | 25 ++++++++++++++++++++++
 gcc/ada/gnat_ugn.texi                              |  6 +++++-
 4 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst 
b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst
index cae8c168562b..02013f1d9b12 100644
--- a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst
+++ b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst
@@ -123,6 +123,11 @@ and generics may name types with unknown discriminants 
without using
 the ``(<>)`` notation.  In addition, some but not all of the additional
 restrictions of Ada 83 are enforced.
 
+Like all configuration pragmas, if the pragma is placed before a library
+level package specification it is not propagated to the corresponding
+package body (see RM 10.1.5(8)); it must be added explicitly to the
+package body.
+
 Ada 83 mode is intended for two purposes.  Firstly, it allows existing
 Ada 83 code to be compiled and adapted to GNAT with less effort.
 Secondly, it aids in keeping code backwards compatible with Ada 83.
@@ -149,6 +154,11 @@ contexts.  This pragma is useful when writing a reusable 
component that
 itself uses Ada 95 features, but which is intended to be usable from
 either Ada 83 or Ada 95 programs.
 
+Like all configuration pragmas, if the pragma is placed before a library
+level package specification it is not propagated to the corresponding
+package body (see RM 10.1.5(8)); it must be added explicitly to the
+package body.
+
 Pragma Ada_05
 =============
 
@@ -166,6 +176,11 @@ This pragma is useful when writing a reusable component 
that
 itself uses Ada 2005 features, but which is intended to be usable from
 either Ada 83 or Ada 95 programs.
 
+Like all configuration pragmas, if the pragma is placed before a library
+level package specification it is not propagated to the corresponding
+package body (see RM 10.1.5(8)); it must be added explicitly to the
+package body.
+
 The one argument form (which is not a configuration pragma)
 is used for managing the transition from
 Ada 95 to Ada 2005 in the run-time library. If an entity is marked
@@ -209,6 +224,11 @@ contexts.  This pragma is useful when writing a reusable 
component that
 itself uses Ada 2012 features, but which is intended to be usable from
 Ada 83, Ada 95, or Ada 2005 programs.
 
+Like all configuration pragmas, if the pragma is placed before a library
+level package specification it is not propagated to the corresponding
+package body (see RM 10.1.5(8)); it must be added explicitly to the
+package body.
+
 The one argument form, which is not a configuration pragma,
 is used for managing the transition from Ada
 2005 to Ada 2012 in the run-time library. If an entity is marked
@@ -252,6 +272,11 @@ contexts.  This pragma is useful when writing a reusable 
component that
 itself uses Ada 2022 features, but which is intended to be usable from
 Ada 83, Ada 95, Ada 2005 or Ada 2012 programs.
 
+Like all configuration pragmas, if the pragma is placed before a library
+level package specification it is not propagated to the corresponding
+package body (see RM 10.1.5(8)); it must be added explicitly to the
+package body.
+
 The one argument form, which is not a configuration pragma,
 is used for managing the transition from Ada
 2012 to Ada 2022 in the run-time library. If an entity is marked
diff --git a/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst 
b/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst
index 64a363132c71..891886b53601 100644
--- a/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst
+++ b/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst
@@ -1477,6 +1477,10 @@ You can place configuration pragmas either appear at the 
start of a compilation
 unit or in a configuration pragma file that applies to
 all compilations performed in a given compilation environment.
 
+Configuration pragmas placed before a library level package specification
+are not propagated to the corresponding package body (see RM 10.1.5(8));
+they must be added explicitly to the package body.
+
 GNAT includes the ``gnatchop`` utility to provide an automatic
 way to handle configuration pragmas that follows the semantics for
 compilations (that is, files with multiple units) described in the RM.
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 4d984713e020..f44260b4a331 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -1581,6 +1581,11 @@ and generics may name types with unknown discriminants 
without using
 the @code{(<>)} notation.  In addition, some but not all of the additional
 restrictions of Ada 83 are enforced.
 
+Like all configuration pragmas, if the pragma is placed before a library
+level package specification it is not propagated to the corresponding
+package body (see RM 10.1.5(8)); it must be added explicitly to the
+package body.
+
 Ada 83 mode is intended for two purposes.  Firstly, it allows existing
 Ada 83 code to be compiled and adapted to GNAT with less effort.
 Secondly, it aids in keeping code backwards compatible with Ada 83.
@@ -1608,6 +1613,11 @@ contexts.  This pragma is useful when writing a reusable 
component that
 itself uses Ada 95 features, but which is intended to be usable from
 either Ada 83 or Ada 95 programs.
 
+Like all configuration pragmas, if the pragma is placed before a library
+level package specification it is not propagated to the corresponding
+package body (see RM 10.1.5(8)); it must be added explicitly to the
+package body.
+
 @node Pragma Ada_05,Pragma Ada_2005,Pragma Ada_95,Implementation Defined 
Pragmas
 @anchor{gnat_rm/implementation_defined_pragmas pragma-ada-05}@anchor{21}
 @section Pragma Ada_05
@@ -1626,6 +1636,11 @@ This pragma is useful when writing a reusable component 
that
 itself uses Ada 2005 features, but which is intended to be usable from
 either Ada 83 or Ada 95 programs.
 
+Like all configuration pragmas, if the pragma is placed before a library
+level package specification it is not propagated to the corresponding
+package body (see RM 10.1.5(8)); it must be added explicitly to the
+package body.
+
 The one argument form (which is not a configuration pragma)
 is used for managing the transition from
 Ada 95 to Ada 2005 in the run-time library. If an entity is marked
@@ -1671,6 +1686,11 @@ contexts.  This pragma is useful when writing a reusable 
component that
 itself uses Ada 2012 features, but which is intended to be usable from
 Ada 83, Ada 95, or Ada 2005 programs.
 
+Like all configuration pragmas, if the pragma is placed before a library
+level package specification it is not propagated to the corresponding
+package body (see RM 10.1.5(8)); it must be added explicitly to the
+package body.
+
 The one argument form, which is not a configuration pragma,
 is used for managing the transition from Ada
 2005 to Ada 2012 in the run-time library. If an entity is marked
@@ -1716,6 +1736,11 @@ contexts.  This pragma is useful when writing a reusable 
component that
 itself uses Ada 2022 features, but which is intended to be usable from
 Ada 83, Ada 95, Ada 2005 or Ada 2012 programs.
 
+Like all configuration pragmas, if the pragma is placed before a library
+level package specification it is not propagated to the corresponding
+package body (see RM 10.1.5(8)); it must be added explicitly to the
+package body.
+
 The one argument form, which is not a configuration pragma,
 is used for managing the transition from Ada
 2012 to Ada 2022 in the run-time library. If an entity is marked
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index ca1d7bcc1abf..0a3cdb502233 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -2911,6 +2911,10 @@ You can place configuration pragmas either appear at the 
start of a compilation
 unit or in a configuration pragma file that applies to
 all compilations performed in a given compilation environment.
 
+Configuration pragmas placed before a library level package specification
+are not propagated to the corresponding package body (see RM 10.1.5(8));
+they must be added explicitly to the package body.
+
 GNAT includes the @code{gnatchop} utility to provide an automatic
 way to handle configuration pragmas that follows the semantics for
 compilations (that is, files with multiple units) described in the RM.
@@ -29833,8 +29837,8 @@ to permit their use in free software.
 
 @printindex ge
 
-@anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{   
                           }
 @anchor{d2}@w{                              }
+@anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{   
                           }
 
 @c %**end of body
 @bye

Reply via email to