aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/doc
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2021-10-08 17:57:37 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-10-20 10:17:04 +0000
commit749e01a5f310f2c4327f030d425aa6e23afbbbd5 (patch)
treec94bcefc1cabb116c33ba92a7fe4aed9bd974c2f /gcc/ada/doc
parentff2746728050429684bf62729df798189cc1d396 (diff)
downloadgcc-749e01a5f310f2c4327f030d425aa6e23afbbbd5.zip
gcc-749e01a5f310f2c4327f030d425aa6e23afbbbd5.tar.gz
gcc-749e01a5f310f2c4327f030d425aa6e23afbbbd5.tar.bz2
[Ada] Warning on nonmatching subtypes in fully conforming subprogram specs and bodies
gcc/ada/ * sem_ch6.adb: Add with and use of Warnsw. (Check_Conformance): Report a warning when subtypes or designated subtypes of formal parameters or result subtypes denote different declarations between the spec and body of the (Subprogram_Subtypes_Have_Same_Declaration): New function nested within Check_Conformance that determines whether two subtype entities referenced in a subprogram come from the same declaration. Returns True immediately if the subprogram is in a generic instantiation, or the subprogram is marked Is_Internal or is declared in an internal (GNAT library) unit, or GNAT_Mode is enabled, otherwise compares the nonlimited views of the entities (or their designated subtypes' nonlimited views in the anonymous access cases). (Nonlimited_View_Of_Subtype): New function nested within function Subprogram_Subtypes_Have_Same_Declaration that returns Non_Limited_View of a type or subtype that is an incomplete or class-wide type that comes from a limited of a package (From_Limited_With is True for the entity), or returns Full_View when the nonlimited view is an incomplete type. Otherwise returns the entity passed in. * warnsw.ads (Warn_On_Pedantic_Checks): New warning flag. (type Warning_Record): New component Warn_On_Pedantic_Checks. * warnsw.adb (All_Warnings): Set Warn_On_Pedantic_Checks from parameter Setting. (Restore_Warnings): Restore the value of the Warn_On_Pedantic_Checks flag. (Save_Warnings): Save the value of the Warn_On_Pedantic_Checks flag. (Set_Underscore_Warning_Switch): Add settings of the Warn_On_Pedantic flag according to the switch ("-gnatw_p" vs. "-gnatw_P"). * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Add documentation of new switches -gnatw_p and -gnatw_P (warnings for pedantic checks). * gnat_ugn.texi: Regenerate. * usage.adb: Add Warn_On_Pedantic_Checks.
Diffstat (limited to 'gcc/ada/doc')
-rw-r--r--gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
index 67fd130..48b7623 100644
--- a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
+++ b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
@@ -3582,6 +3582,25 @@ of the pragma in the :title:`GNAT_Reference_manual`).
ordering.
+.. index:: -gnatw_p (gcc)
+
+:switch:`-gnatw_p`
+ *Activate warnings for pedantic checks.*
+
+ This switch activates warnings for the failure of certain pedantic checks.
+ The only case currently supported is a check that the subtype_marks given
+ for corresponding formal parameter and function results in a subprogram
+ declaration and its body denote the same subtype declaration. The default
+ is that such warnings are not given.
+
+.. index:: -gnatw_P (gcc)
+
+:switch:`-gnatw_P`
+ *Suppress warnings for pedantic checks.*
+
+ This switch suppresses warnings on violations of pedantic checks.
+
+
.. index:: -gnatwq (gcc)
.. index:: Parentheses, warnings