I need to detect direct and indirect recursion in a rather large (5-15,000) set of C files (not C ++).
Files are already pre-processed.
The code is pretty "old school" for security reasons, so there are no fancy things like function pointers, only functions that pass variables, and some function macros that do the same.
The most natural way to detect recursion is to create a directed call graph by looking at each a node function when the edge goes over to all the other functions that it calls. If the graph has any cycles, then we have recursion.
The regular expression for calling function calls is trivial, but I also need to know which function called the call.
PyCParser was nice, but it complains about a lot of things, such as variables that are not defined or typedefs, where the source type is not defined or not defined in another file that is completely irrelevant to my use case. The project uses a custom control system dependencies, so some of them are included and are automatically added, so I need to PyCParser did not care about anything other than the nodes FuncCalland FuncDefand I do not think there is a way to limit myself parsing process.
I would prefer not to use the parser, since I definitely do not have time to learn how to do this in python, and then implement the solution.
, C? , (, ) ? .
python .