Improve Ada error message insertion methods
This commit refactors Ada's error message insertion logic to improve code organization and remove redundancy.
This commit reorganizes the error message insertion logic within the Ada compiler, extracting it into dedicated subprograms for inserting new messages and determining the correct insertion point. This change simplifies the Error_Msg_Internal function, removes the need for a separate Set_Prev_Pointers pass, and improves the overall structure and maintainability of the error handling code.
In Details
The commit refactors error message handling in errout.adb and erroutc.ads. It introduces Insert_Error_Msg, Find_Msg_Insertion_Point, and Is_Before subprograms to encapsulate insertion logic. The deferred Set_Prev_Pointers pass in Finalize is removed, signifying a simplification of the error chain management. This primarily affects maintainability within the Ada front end.
For Context
This commit deals with how the Ada compiler handles and reports errors. Compilers often construct error messages in a chain-like structure to provide context and related information. This commit improves the process of inserting new error messages into this chain, making the code more organized and efficient. This kind of internal refactoring is important for making the compiler easier to maintain and improve over time.