Ada: Make error messages for static accessibility checks more consistent
Standardizes Ada error messages for static accessibility checks and adds rule references.
This commit aims to unify the error messages generated for failed static accessibility checks in Ada. The messages now consistently use phrases like “accessibility level of X is too deep” or “X has deeper accessibility level than”. Additionally, these messages are augmented with references to the relevant rules in the Ada Reference Manual, prioritizing the latest version (Ada 2022 with Amendment 1). The exception is for illegal ‘Access attribute references, which retain their original ‘nonlocal access vs local object’ viewpoint.
In Details
This change refactors the error reporting for static accessibility checks in the Ada front-end (gcc/ada/accessibility.adb, sem_attr.adb, sem_ch3.adb, sem_ch6.adb, sem_ch9.adb, sem_ch13.adb, sem_res.adb). It consolidates wording to provide a more consistent user experience, referencing specific Ada Language Reference Manual (ARM) rules for each failure. The goal is to improve clarity for developers debugging complex type and scope issues, by providing precise rule numbers along with descriptive error messages. Specific error paths, like those for attribute access on subprograms o…
- static accessibility
- A compile-time check in Ada that ensures a program can legally access a given type, variable, or subprogram based on its scope and visibility rules.
- Ada Reference Manual (ARM)
- The official documentation that specifies the Ada programming language. It contains the rules and syntax for the language.
- Ada 2022
- The latest major revision of the Ada programming language standard, incorporating new features and refinements.
- 'Access attribute
- In Ada, an attribute that provides access to the subprogram code of a callable entity, or to the object designated by an access type.
- scope
- The region of a program where a declared identifier is valid and can be used.