[petsc-dev] tool to find potential static functions

Karl Rupp rupp at mcs.anl.gov
Thu Mar 7 17:21:12 CST 2013


Hi again,

a first attempt (this time in Python...):
https://bitbucket.org/petsc/petsc-dev/commits/4fb9009dc5292af761f8c0215170e107cec4f1f0

$:PETSC_DIR> python bin/pythonscripts/PetscStaticFunctionCandidates.py

gives you a list of functions only used within a single file in src/ts/*
(making this a script parameter later...)

The parsing certainly needs improvement, but it gives a first idea. Most 
importantly, my interpretation of the problem description
  "find all functions which are only used in a single file"
ignored all the stuff in examples/*, and some of the obvious public 
functions thus get listed as well. I will also fix that, even though 
this drives up execution time for some folders considerably.

Still, the script is definitely better than nothing already at this 
early stage.

Best regards,
Karli




On 03/07/2013 01:33 AM, Barry Smith wrote:
>
>     It would be nice to have a tool that would go through all the source code and find all functions that are only used (and not mentioned in some public include file) in the file they are declared in. Thus giving us a handle on what functions can be declared static.
>
>     Barry
>




More information about the petsc-dev mailing list