multilang-depends / depends

Depends is a fast, comprehensive code dependency analysis tool
MIT License
195 stars 54 forks source link

Incomplete depends analysis in function level #14

Closed yixin-09 closed 5 years ago

yixin-09 commented 5 years ago

I use the following cmd to analysis "specfunc" in gsl-2.6 (ftp://ftp.gnu.org/gnu/gsl/).

./depends.sh -s --granularity=method --format="json" cpp ../benchmark/gsl-2.6/specfunc gsl26

However, I found depends analysis for many functions is incomplete. For example, the function "gsl_sf_bessel_Y0_e" (in bessel_Y0.c) depens on "gsl_sf_bessel_J0_e" as shown in code below, the relation was not reported by depends.

int gsl_sf_bessel_Y0_e(const double x, gsl_sf_result * result)
{
  ...
    int stat_J0 = gsl_sf_bessel_J0_e(x, &J0);
...
gangz commented 5 years ago

It is not an issue. Depends deduce the call relations from include paths. in the original file, the line 26 of bessel_Y0.c is written as #include <gsl/gsl_sf_bessel.h>, but the gsl directory do not contains gsl_sf_bessel.h file.

if we modify the line to #include "gsl_sf_bessel.h" and using the following command:

./depends.sh -s --granularity=method --format=json,detail --detail cpp /home/gangz/work/depends/data/gsl-2.6/specfunc gsl26 --auto-include

(note that I add --auto-inlcude to guarantee all the files under the include path, we will get the following result:

=======/bessel_Y0.c(gsl_sf_bessel_Y0_e) -> /gsl_sf_bessel.h(gsl_sf_bessel_J0_e)=========
[Call]gsl_sf_bessel_Y0_e->gsl_sf_bessel_J0_e
[Use]gsl_sf_bessel_Y0_e->gsl_sf_bessel_J0_e