diff options
author | Hristian Kirtchev <kirtchev@adacore.com> | 2017-11-16 13:17:19 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2017-11-16 13:17:19 +0000 |
commit | 7fb62ca1b7a7db0177e956b2d9f35d46789cfe70 (patch) | |
tree | 96292be8e6c39e5951bbadc87986bde4d634a44e /gcc/ada/gnat_ugn.texi | |
parent | 403bc026aca65b22159955dd4df81eb9b2b407f4 (diff) | |
download | gcc-7fb62ca1b7a7db0177e956b2d9f35d46789cfe70.zip gcc-7fb62ca1b7a7db0177e956b2d9f35d46789cfe70.tar.gz gcc-7fb62ca1b7a7db0177e956b2d9f35d46789cfe70.tar.bz2 |
opt.ads: Elaboration warnings are now on by default.
2017-11-16 Hristian Kirtchev <kirtchev@adacore.com>
* opt.ads: Elaboration warnings are now on by default. Add a comment
explaining why this is needed.
* sem_ch9.adb (Analyze_Requeue): Preserve the status of elaboration
warnings.
* sem_ch12.adb (Analyze_Package_Instantiation): Preserve the status of
elaboration warnings.
(Analyze_Subprogram_Instantiation): Preserve the status of elaboration
warnings.
* sem_elab.adb: Update the structure of Call_Attributes and
Instantiation_Attributes.
(Build_Call_Marker): Propagate the status of elaboration warnings from
the call to the marker.
(Extract_Call_Attributes): Extract the status of elaboration warnings.
(Extract_Instantiation_Attributes): Extract the status of elaboration
warnings.
(Process_Conditional_ABE_Activation_Impl): Elaboration diagnostics are
now dependent on the status of elaboration warnings.
(Process_Conditional_ABE_Call_Ada): Elaboration diagnostics are now
dependent on the status of elaboration warnings.
(Process_Conditional_ABE_Instantiation_Ada): Elaboration diagnostics
are now dependent on the status of elaboration warnings.
(Process_Guaranteed_ABE_Activation_Impl): Remove pragma Unreferenced
for formal Call_Attrs. Elaboration diagnostics are now dependent on the
status of elaboration warnings.
(Process_Guaranteed_ABE_Call): Elaboration diagnostics are now
dependent on the status of elaboration warnings.
(Process_Guaranteed_ABE_Instantiation): Elaboration diagnostics are now
dependent on the status of elaboration warnings.
* sem_prag.adb (Analyze_Pragma): Remove the unjustified warning
concerning pragma Elaborate.
* sem_res.adb (Resolve_Call): Preserve the status of elaboration
warnings.
(Resolve_Entry_Call): Propagate flag Is_Elaboration_Warnings_OK_Node
from the procedure call to the entry call.
* sem_util.adb (Mark_Elaboration_Attributes): Add formal parameter
Warnings.
(Mark_Elaboration_Attributes_Node): Preserve the status of elaboration
warnings
* sem_util.ads (Mark_Elaboration_Attributes): Add formal parameter
Warnings. Update the comment on usage.
* sinfo.adb (Is_Dispatching_Call): Update to use Flag6.
(Is_Elaboration_Warnings_OK_Node): New routine.
(Set_Is_Dispatching_Call): Update to use Flag6.
(Set_Is_Elaboration_Warnings_OK_Node): New routine.
* sinfo.ads: Attribute Is_Dispatching_Call now uses Flag6. Add new
attribute Is_Elaboration_Warnings_OK_Node along with occurrences
in nodes.
(Is_Elaboration_Warnings_OK_Node): New routine along with pragma
Inline.
(Set_Is_Elaboration_Warnings_OK_Node): New routine along with pragma
Inline.
* doc/gnat_ugn/elaboration_order_handling_in_gnat.rst: Update various
sections to indicate how to suppress elaboration warnings. Document
switches -gnatwl and -gnatwL.
* gnat_ugn.texi: Regenerate.
From-SVN: r254819
Diffstat (limited to 'gcc/ada/gnat_ugn.texi')
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 57 |
1 files changed, 52 insertions, 5 deletions
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 05fdf4c..43ef2459 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -21,7 +21,7 @@ @copying @quotation -GNAT User's Guide for Native Platforms , Nov 09, 2017 +GNAT User's Guide for Native Platforms , Nov 16, 2017 AdaCore @@ -27897,8 +27897,8 @@ three models: Note that GNAT emits warnings rather than hard errors whenever it encounters an elaboration problem. This is because the elaboration model in effect may be too conservative, or a particular scenario may not be elaborated or executed due to -data and control flow. The warnings can be suppressed with compiler switch -@code{-gnatws}. +data and control flow. The warnings can be suppressed selectively with @code{pragma +Warnigns (Off)} or globally with compiler switch @code{-gnatwL}. @node Dynamic Elaboration Model in GNAT,Static Elaboration Model in GNAT,Common Elaboration-model Traits,Elaboration Order Handling in GNAT @anchor{gnat_ugn/elaboration_order_handling_in_gnat dynamic-elaboration-model-in-gnat}@anchor{23e}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id8}@anchor{23f} @@ -27975,8 +27975,8 @@ run-time checks based on the nature of the target. The static model performs extensive diagnostics on scenarios which elaborate or execute internal targets. The warnings resulting from these diagnostics -are enabled by default, but can be suppressed using compiler switch -@code{-gnatws}. +are enabled by default, but can be suppressed selectively with @code{pragma +Warnings (Off)} or globally with compiler switch @code{-gnatwL}. @example 1. package body Static_Model is @@ -28959,6 +28959,53 @@ In the example above, the elaboration of declaration @code{Ptr} is assigned @code{Func'Access} before the body of @code{Func} has been elaborated. @end table +@geindex -gnatwl (gnat) + + +@table @asis + +@item @code{-gnatwl} + +Turn on warnings for elaboration problems + +When this switch is in effect, GNAT emits diagnostics in the form of warnings +concerning various elaboration problems. The warnings are enabled by default. +The switch is provided in case all warnings are suppressed, but elaboration +warnings are still desired. + +@item @code{-gnatwL} + +Turn off warnings for elaboration problems + +When this switch is in effect, GNAT no longer emits any diagnostics in the +form of warnings. Selective suppression of elaboration problems is possible +using @code{pragma Warnings (Off)}. + +@example + 1. package body Selective_Suppression is + 2. function ABE return Integer; + 3. + 4. Val_1 : constant Integer := ABE; + | + >>> warning: cannot call "ABE" before body seen + >>> warning: Program_Error will be raised at run time + + 5. + 6. pragma Warnings (Off); + 7. Val_2 : constant Integer := ABE; + 8. pragma Warnings (On); + 9. +10. function ABE return Integer is +11. begin +12. ... +13. end ABE; +14. end Selective_Suppression; +@end example + +Note that suppressing elaboration warnings does not eliminate run-time +checks. The example above will still fail at runtime with an ABE. +@end table + @node Summary of Procedures for Elaboration Control,Inspecting the Chosen Elaboration Order,Elaboration-related Compiler Switches,Elaboration Order Handling in GNAT @anchor{gnat_ugn/elaboration_order_handling_in_gnat summary-of-procedures-for-elaboration-control}@anchor{24e}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id16}@anchor{24f} @section Summary of Procedures for Elaboration Control |