- 
                Notifications
    You must be signed in to change notification settings 
- Fork 25
Closed
Description
The goal of this issue is to add new options that let the client choose the severity level for some of the checks performed by the CFG builder. 3 checks are concerned:
- BasicBlockGroupGoesBeyondTheLimitwhen the target of a PERFORM may not return because of a premature exit
- BadPerformProcedureThruwhen start and end of a PERFORM THRU are not in correct order
- RecursiveBlockOnPerformProcedurewhen a PERFORM is recursive on at least one of its paths
BadAlterIntrWithNoSiblingGotoInstr is not concerned as unresolved altered GO TOs are considered as an error no matter what.
Technical
Instead of directly creating those diagnostic when detected, the CFG builder will store information in current graph for later use. At the end of the building, the diagnostics will be created depending on the severity level chosen by the user (see ITypeCobolCheckOptions and existing optional diagnostics CheckendAlignment or CheckEndProgram).
- for BasicBlockGroupGoesBeyondTheLimit- add a new property Dictionary<PerformProcedure, List<Node>> PrematurePerformExits, key is the PERFORM statement which is prematurely ended, the corresponding list of nodes is all the instructions that break the flow of the PERFORM
 
- add a new property 
- for BadPerformProcedureThru- add a new property Dictionary<PerformProcedure, Tuple<Node, Node>> WrongOrderPerformThrus, key is the PERFORM THRU statement which has wrong procedure order, the tuple contains the resolved paragraph or sections. First item is the start of range (before THRU), second item is the end of range (after THRU). SoItem1is declared afterItem2in program.
 
- add a new property 
- for RecursiveBlockOnPerformProcedure- add a new property Dictionary<PerformProcedure, Node> RecursivePerforms, key is the recursive PERFORM statement, value is the first detected instruction that leads to recursivity.
 
- add a new property 
New options are:
- diag.cppe|diagnostic.checkPerformPrematureExits
- diag.cpto|diagnostic.checkPerformThruOrder
- diag.crp|diagnostic.checkRecursivePerforms
Those 3 options would be set to Warning by default, to match the IBM-compiler behavior.