class warning_retraction_info

Describes the cases in which a warning instance should be retracted.

A number of warningclass report() and report_return_warning() methods take warning_retraction_info parameters.

The reported warning will be retracted during the drop phase if the specified conditions are met.

Note that a new warning instance in the same group may be issued in one of the later analysis phases (serial depth-first, parallel depth-first, or bottom-up) if the analysis determines that the problem still exists.

warning_retraction_info Details

class cs.warning_retraction_info

Describes the cases in which a warning instance should be retracted.

__init__(_bottom_up_procedures, _procedures, _compunits)

Constructor.

Parameters:
  • _bottom_up_procedures (iterable of procedure) –

    If any procedure in this list is visited in the bottom-up phase, retract the warning instance. Note that retraction always occurs in the drop phase: the bottom-up phase has not yet occurred at this point, but the set of procedures to be visited in the bottom-up phase is known.

  • _procedures (iterable of procedure) – If any procedure in this list is in a compilation unit ( compunit ) that is modified between incremental analyses, retract the warning instance.
  • _compunits (iterable of compunit) – If any compilation unit ( compunit ) in this list is modified between incremental analyses, retract the warning instance.
>>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp'))
>>> procs = project.current().procedures_vector()
>>> warning_retraction_info(procs[0:2], procs[2:4], [cu])
<cs.warning_retraction_info {<cs.procedure #File_Initialization>, <cs.procedure mymalloc>} {<cs.procedure bar>, <cs.procedure foo>} {<cs.compunit C:\alex\test\apitest.cpp>}>
__repr__()

Get a representation of a warning_retraction_info object that includes information useful for debugging.

Return type:str
Returns:The string representation.
>>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp'))
>>> procs = project.current().procedures_vector()
>>> wri = warning_retraction_info(procs[0:2], procs[2:4], [cu])
>>> repr(wri)
'<cs.warning_retraction_info {<cs.procedure #File_Initialization>, <cs.procedure mymalloc>} {<cs.procedure bar>, <cs.procedure foo>} {<cs.compunit C:\\alex\\test\\apitest.cpp>}>'
__str__()

Get a simple string representation of a warning_retraction_info object.

Return type:str
Returns:The string representation.
>>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp'))
>>> procs = project.current().procedures_vector()
>>> wri = warning_retraction_info(procs[0:2], procs[2:4], [cu])
>>> str(wri)
'<cs.warning_retraction_info {<cs.procedure #File_Initialization>, <cs.procedure mymalloc>} {<cs.procedure bar>, <cs.procedure foo>} {<cs.compunit C:\\alex\\test\\apitest.cpp>}>'