23.6.27 Misnamed_Identifiers
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:
- type declarations
- constant declarations (but not number declarations)
- package renaming declarations (but not generic package renaming
declarations)
This rule may have parameters. When used without parameters, the rule enforces
the following checks:
- type-defining names end with
_T
, unless the type is an access type,
in which case the suffix must be _A
- constant names end with
_C
- names defining package renamings end with
_R
For a private or incomplete type declaration the following checks are
made for the defining name suffix:
- 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.
- 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.
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:
- For the +R option:
Default
- Sets the default listed above for all the names to be checked.
Type_Suffix=
string- Specifies the suffix for a type name.
Access_Suffix=
string- Specifies the suffix for an access type name. If
this parameter is set, it overrides for access
types the suffix set by the
Type_Suffix
parameter.
Constant_Suffix=
string- Specifies the suffix for a constant name.
Renaming_Suffix=
string- Specifies the suffix for a package renaming name.
- For the -R option:
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.
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
Access_Suffix
is
set).
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
Type_Suffix
is set, access type names are
checked as ordinary type names.
Constant_Suffix
- Removes the suffix specified for constants. This
disables checks for constant names but does not
disable any other checks for this rule.
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.
If more than one parameter is used, parameters must be separated by commas.
If more than one option is specified for the gnatcheck invocation,
a new option overrides the previous one(s).
The +RMisnamed_Identifiers option (with no parameter) enables
checks for all the
name suffixes specified by previous options used for this rule.
The -RMisnamed_Identifiers option (with no parameter) disables
all the checks but keeps
all the suffixes specified by previous options used for this rule.
The 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 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.