-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
We should investigate compiler-based tools to perform the code analysis we currently do with shell scripts in dist/. If we had more flexible tools that actually understand C, it would be easier to introduce new checks as we discover issues we want to avoid in our code.
Our current scripts are based on clever use of grep and sed. Some of them are made possible by the style and formatting that clang-format enforces. There are limitations to what can be detected in this way. libclang lets you build custom code analysis tools using the AST generated by the clang parser. It has Python bindings and there is an existing ecosystem of tools built using it. coala.io, for example, lets you define rules and standards to be followed in your code (hat tip: michael.cahill). There are probably other options out there—both things built on clang and other non-clang tools.