pylangc Code
Simple Python-based Static Code Analyzer for C programs based on GLib
Brought to you by:
ogytonchev
| File | Date | Author | Commit |
|---|---|---|---|
| README | 2015-07-15 |
|
[5899aa] README: extend info with an example |
| c_code_analyzer.py | 2015-07-15 |
|
[2c1dd2] c_code_analyzer: remove unnecessary code |
| c_grammar.py | 2015-07-14 |
|
[cff353] c_grammar: update C grammar |
| gtk_doc_grammar.py | 2015-07-13 |
|
[4c1340] gtk_doc_grammar: first version |
Simple Python-based Static Code Analyzer for C programs based on GLib/GStreamer.
The tool takes advantage of the GObject-Introspection annotations built on top
of GTK-Doc comment blocks. Note that this tool is proof-of-concept only.
To be able to run it, you should install pylangparser first:
https://github.com/otonchev/pylangparser/wiki
To run it, just type:
python c_code_analyzer.py
Example:
If run for the following C program:
void b()
{
GstElement *parent;
parent = gst_element_get_parent (el);
do_something_with_pad (pad);
if (FALSE)
gst_object_unref (parent);
}
the script will output:
INFO: found function definition:
[['void'],
[['b']],
[[['GstElement'], [[['*'], ['parent']]]]],
[[[['parent'], ['='], [['gst_element_get_parent'], [['el']]]]],
[[['do_something_with_pad'], [['pad']]]],
[['if'], [['FALSE']], [[['gst_object_unref'], [['parent']]]]]]]
calling function gst_element_get_parent
allocating variable: parent
calling function do_something_with_pad
calling function gst_object_unref
freeing variable: parent
WARNING: function returned, non freed allocations: ['parent']