Main Content

Recursive Functions

Create table of recursive functions

Description

This component creates a table containing the recursive functions in your source code (along with the files containing the functions).

  • For each direct recursion (function calling itself directly), the table lists the recursive function.

  • For each indirect recursion cycle (function calling itself through other functions), the table lists one function in the cycle.

For instance, the following code contains two indirect recursion cycles.

volatile int signal;

void operation1() {
    int stop = signal%2;
    if(!stop)
        operation1_1();
}


void operation1_1() {
    operation1();
}

void operation2() {
    int stop = signal%2;
    if(!stop)
        operation2_1();
}

void operation2_1() {
    operation2();
}

void main(){
    operation1();
    operation2();
}

The two call graph cycles are:

  • operation1operation1_1operation1

  • operation2operation2_1operation2

Pictorial representation of indirect recursion

This report component shows one function from each of the two cycles: operation1 and operation2. To see the full cycle, open the results in the Polyspace® user interface.