Cobol: Improve CALL statement handling with -fno-static-call
GCC's Cobol compiler now correctly handles CALL statements, especially when they are the last statement or involve exception handling.
This commit enhances the processing of CALL statements in GCC’s Cobol compiler, particularly when the -fno-static-call option is active. It ensures correct behavior for calls that are the final statement in a source module and properly manages the ON EXCEPTION clause, regardless of whether exception processing is enabled.
In Details
The genapi.cc (parser_call) and parse.y components are updated to refine CALL statement parsing. The changes address two main areas: handling a CALL as the last statement in a source module and correctly processing the ON EXCEPTION clause. This ensures robust behavior when -fno-static-call is used, which affects how external procedure calls are resolved and linked.
- CALL statement
- A COBOL statement used to invoke an external program or procedure. It specifies the name of the program to be called and can include parameters and exception handling clauses.
- -fno-static-call
- A GCC compiler flag for COBOL that influences how external procedure calls are handled. It may affect dynamic linking or invocation mechanisms compared to static calls.
- ON EXCEPTION
- A COBOL clause that specifies a procedure to be executed if an error or exception occurs during the execution of a
CALLstatement.