cobol: Show location for invalid arg in CALL
Cobol CALL argument errors now show the argument's location, not the procedure division's.
The Cobol compiler now correctly reports the source code location of an invalid argument within a CALL statement. Previously, errors related to incorrect arguments would report the location of the PROCEDURE DIVISION instead of the specific argument causing the issue. This change improves diagnostic accuracy by pinpointing the exact location of the problem.
In Details
When a Cobol CALL statement involves an argument that is invalid for the called procedure's parameter (e.g., type mismatch, incorrect usage), the GCC Cobol front-end needs to report the exact source location of that argument. This commit modifies the parser (parse.y) to ensure that the location data for invalid CALL arguments is correctly captured and displayed, rather than defaulting to the PROCEDURE DIVISION's location.
- CALL statement
- A Cobol statement used to invoke a subroutine or external program.
- PROCEDURE DIVISION
- The main section of a Cobol program that contains the executable statements.
- Diagnostic
- An error, warning, or informational message generated by the compiler to report issues or provide feedback to the programmer about the source code.