sugarcat
sugarcat

Reputation: 1

cflow can't recognize function call in loop

int main() {
    
    for (int i = 1; i < 10 ; i++) {
      test1();
    } 
    for (int i = 1; i < 10 ; i++)
      test2();

    return 0;
}

So for the code above, cflow can see test2() but not test1(). See output below:

$cflow tmp.c
main() <int main () at tmp.c:1>:
    test2()
$ cflow --version
cflow (GNU cflow) 1.7
Copyright (C) 2005-2021 Sergey Poznyakoff

Is this a bug or something very stupid I have done?

Thanks for you input!

Upvotes: 0

Views: 136

Answers (2)

AlvyneZ
AlvyneZ

Reputation: 1

Answering this a little bit late. I also ran into the same issue and got a work around. I have a huge code base and can't change all for loops to C89 standard, plus I have thirdparty code I don't want to edit.

So just call cflow with the define -D"for(x,...)=for(;;)".

Upvotes: 0

DEE_GEE
DEE_GEE

Reputation: 11

If you remove int i from the loops and define i = 0 outside the for loop, it shows both calls.

Upvotes: 0

Related Questions