bug-cflow
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-cflow] cflow: static functions in inverted trees


From: Chris Smith
Subject: Re: [bug-cflow] cflow: static functions in inverted trees
Date: Sat, 12 Nov 2016 10:56:03 +0000

Hi Sergey,

Thanks for getting back to me. It's more likely I'm missing something. :-)

Yes, static functions are included in the lists of callers of each function. 
The issue is that the inverted graph iterates through all your functions and 
gives the callers for each, but that it doesn't include static functions as 
starting points for that process.

For example, using your test code, the function "counter" is a non-static 
function with both callers and callees, while errf - as you said - is a static 
function that also has both callers and callees. We get a callgraph starting 
from "counter", but we don't get one starting from "errf":

# cflow -r wc.c| grep ^counter
counter() <void counter (char *file) at wc.c:108>:
# cflow -r wc.c| grep ^errf
#

Is that intentional behaviour? If it's not, my patch adds static functions to 
the list of possible graph starting points. Have I missed something?

Thanks,
Chris

-----Original Message-----
From: Sergey Poznyakoff [mailto:address@hidden 
Sent: 12 November 2016 05:51
To: Chris Smith
Cc: address@hidden
Subject: Re: [bug-cflow] cflow: static functions in inverted trees

Hi Chris,

> I've been using cflow to analyse our source trees (great tool by the 
> way, thanks!), and spotted one detail that surprised me. We're most 
> interested in inverted trees, where each callee lists its callers. If 
> you do that, static functions aren't included in the original list of 
> callees so we don't get their details. Is there a reason for that?

I'm afraid I don't quite follow you.  Static functions are included by default, 
for both direct and inverted graphs.  A test run on the sample wc.c source 
shows: 

$ cflow -r cflow-1.5/doc/wc.c | head
COUNT():
    getword() <int getword (FILE *fp) at ../doc/wc.c:78>:
        counter() <void counter (char *file) at ../doc/wc.c:108>:
            main() <int main (int argc, char **argv) at ../doc/wc.c:127>
counter() <void counter (char *file) at ../doc/wc.c:108>:
    main() <int main (int argc, char **argv) at ../doc/wc.c:127>
exit():
    error_print() <void error_print (int perr, char *fmt, va_list ap) at 
../doc/wc.c:22>:
        errf() <void errf (char *fmt, ...) at ../doc/wc.c:34>:
            main() <int main (int argc, char **argv) at ../doc/wc.c:127>

Notice the errf function in the next to last line.  It is defined in wc.c as

static void
errf (char *fmt, ...)
{

Am I missing something?

Regards,
Sergey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]