Introducing SFPV

Well, not too long ago I applied to Google summer of code. After getting a late start I quickly looked through the participating organizations and suggested projects mainly for projects that would teach me something on my mental todo list. I shot one project an email and got no response. While I waited for that response, I was reminded again and again llvm was on the list of participating organizations and I had been stalking the mailing list for interesting changes in clang.

I knew that most of the low hanging fruit for clang should have been taken care of, as there is a decent squadron of people working on clang, but I thought it would be an accomplishment to contribute to such a project. Then it hit me, there never seemed to be a good tool to assist in writing real-time code. Clang had static analysis tools and some rudimentary support for thread safety checks, so adding on real-time safety checks should not be impossible.

After discussing this in more detail in #lad and on the clang mailing list a proposal was sent in. Unfortunately this proposal was not accepted, though that has not stopped the project. Currently a standalone tool has been built using the API that clang provides to perform the analysis.

As the title hints, this is an analysis on function properties. With this tool inline annotations are utilized to mark if a function is safe or note. With this information and basic callgraph information common errors, such as calling printf in a real-time context can be deduced. More advanced bugs such as calling a function through a virtual member of a template class are not handled, so support is mostly C and not C++ at the moment.

While the current plans are less grand than the original proposal, I hope that this tool will be able to help out anyone writing real-time code in C/C++, as it gets more developed.

Source: "":