Menu

#293 cscope cannot find function which is parse as function pointer

None
closed-invalid
nobody
None
5
2020-09-06
2018-01-31
quan
No

Hi Team,

I use cscope usually and I found that in "Find functions calling this function: " cannot find the function is called by pass it as function pointer.

for example :
void functionpointer()
{
}
int example1()
{
findmain(functionpointer);
}
int example2()
{
functionpointer();
}
int main()
{
example();
}

when i use cscope to find

Functions calling this function: functionpointer
File Function Line
0 tmp.c example2 13 functionpointer();

Find this C symbol:
Find this global definition:
Find functions called by this function:
Find functions calling this function: functionpointer
Find this text string:
Change this text string:
Find this egrep pattern:
Find this file:
Find files #including this file:
Find assignments to this symbol:

as you see, it is only find on example2, it is called by example1 also ?

can you please give me that is it correct or not?

Discussion

  • Hans-Bernhard Broeker

    Well, that's because that is not a call to functionpointer(). That's just passing a function by pointer.

    Calling it would happen somewhere inside findmain(). But that would not be calling functionpointer() either: it would be calling its function-pointer typed argument. And because of the well-known limitation of parsing functions with function-pointer arguments, odds are cscope would be unable to locate that call.

    You're really expecting rather too much from a source code navigation tool here.

     
  • Hans-Bernhard Broeker

    • status: open --> pending-invalid
    • Group: -->
     
  • Hans-Bernhard Broeker

    • status: pending-invalid --> closed-invalid
     

Log in to post a comment.