Simplify Implementation of Instantiation Messages in Ada
The Ada compiler's message generation for template instantiations has been refactored for clarity and reduced code duplication.
The Ada compiler’s error reporting for template instantiations has been refactored. This change removes duplicated code and simplifies the control flow within the Error_Msg_N function in errout.adb, improving maintainability and readability of the codebase.
In Details
This commit cleans up errout.adb, specifically the Error_Msg_N function responsible for generating messages during Ada template instantiation. The refactor aims to reduce redundancy and improve code clarity within this function. It touches core error-handling logic within the Ada front end.
For Context
The Ada front end in GCC handles features like templates (generics), which allow code to be written once and then instantiated with different types. During instantiation, the compiler may need to generate error messages to guide the user. This commit simplifies the internal code responsible for generating these error messages, making the compiler's code easier to understand and maintain. Improved maintainability can lead to fewer bugs and better error messages in the future.