6. Adding the Results of Compiler Checks to gnatcheck OutputΒΆ
The gnatcheck tool can include in the generated diagnostic messages
and in
the report file the results of the checks performed by the compiler. Though
disabled by default, this effect may be obtained by using +R with
the following rule identifiers and parameters:
- Restrictions
To record restrictions violations (which are performed by the compiler if the pragma
RestrictionsorRestriction_Warningsare given), use theRestrictionsrule with the same parameters as pragmaRestrictionsorRestriction_Warnings.This rule allows parametric rule exemptions, the parameters that are allowed in the definition of exemption sections are the names of the restrictions except for the case when a restriction requires a non-numeric parameter, in this case the parameter should be the name of the restriction with the parameter, as it is given for the rule.
- Style_Checks
To record compiler style checks (see Style Checking section in GNAT User’s Guide), use the
Style_Checksrule.This rule takes a parameter in one of the following forms:
- All_Checks,
which enables the standard style checks corresponding to the
-gnatyyGNAT style check option, or
a string with the same structure and semantics as the
string_LITERALparameter of the GNAT pragmaStyle_Checks(see “Pragma Style_Checks” in the GNAT Reference Manual).
For example, the
+RStyle_Checks:Orule option activates the compiler style check that corresponds to-gnatyOstyle check option.- Warnings
To record compiler warnings (see Warning Message Control section in GNAT User’s Guide), use the
Warningsrule with a parameter that is a valid static_string_expression argument of the GNAT pragmaWarnings(see “Pragma Warnings” in the GNAT Reference Manual). Note that in case of gnatcheck ‘s’ parameter, that corresponds to the GNAT-gnatwsoption, disables all the specific warnings, but not suppresses the warning mode, and ‘e’ parameter, corresponding to-gnatwethat means “treat warnings as errors”, does not have any effect.This rule allows parametric rule exemptions, the parameters that are allowed in the definition of exemption sections are the same as the parameters of the rule itself. Note that parametric exemption sections have their effect only if either
.dparameter is specified for theWarningsrule or if the--show-rulesoption is set.
To disable a specific restriction check, use -RRestrictions gnatcheck
option with the corresponding restriction name as a parameter. -R is
not available for Style_Checks and Warnings options, to disable
warnings and style checks, use the corresponding warning and style options.