I am happy to share with the community that we’ve implemented the autocheck tool and it is available for free at [0]!
autocheck is a source code analyses tool implemented by using clang API. Its purpose is to check the code against Autosar Automotive Standard. Autosar contains a set of guidelines for the use of the C++ language in critical and safety-related systems and its goal is to improve security, safety and quality of software.
We have presented the overall idea on the 2020 LLVM Developers’ Meeting [1].
We have currently covered most of the rules that apply to the current Autosar Standard, but not all, and our plan is to continue adding more rules. Furthermore, a new standard has recently been published, so we will focus on covering it in the future as well.
The tool is very easy to use and has a bunch of very useful user/command line options [2].
How do you intend to handle the license restrictions? Unlike Autosar, MISRA requires one to purchase a license to view the guidelines. One may not reproduce the guidelines text in a static analysis tool without permission/additional fees to MISRA. That’s the main reason clang-tidy does not have such a module
Our focus is on source code analysis and Autosar rules. We need to double check if we would break something, so we are postponing making the project public. Will update you soon.
I think it’s private now due to licensing concerns highlighted above.
Given that license issues are going to be resolved, I think this work should go into either clang-tidy or clang static analyzer.
CC @AaronBallman@PiotrZSL@LegalizeAdulthood
In what way? The LLVM Foundation Board did not approve of Autosar checks making it into the project (see above). But maybe the discussion is reopened?
It’s a lot harder to do this for MISRA though, also due to way-of-working issues. Both code owner and code reviewer must purchase a copy of the MISRA guidelines to be able to put a patch. So the development process is not as open-source as we’d like it to be. But maybe a solution can be found?
To be clear: I can’t express enough how much I’d love to have Autosar and MISRA checks in clang-tidy
Now that I read both threads you linked above, I’m afraid that the only thing to reopen here is negotiations with MISRA to allow us to cite their documents.
I’m afraid this is an unacceptable requirement for anything under LLVM project. The closest precedent I can think of is Windows support in Clang. It’s certainly different in nature, but maybe some inspiration can be drawn from it.
Yep, very unfortunate. Even if we get past that, we cannot reproduce or paraphrase the rule text in the docs nor in the actual warning. We could only emit a diagnostic like “MISRA rule 1.2.3 violated”, and the user of clang-tidy would need to buy the MISRA document and search the mentioned rule to be able to understand the problem.
There’s this other tool called “cppcheck” that allows users to pass in a text file with the text of the rules. This way they don’t violate the restrictions.
But yes, sadly this is very different from the philosophy of the LLVM project.
Yep, the official docs suggest to select and copy-paste an Annex at the end of the Misra document that summarizes the rules, into a text file. It’s probably doable to write a quick Python tool to do that automatically.
Hi, we are preparing a new way of implementation, that should be OK for sharing very soon. The main challenge is to avoid potential problems with licencing, and we are addressing that.
Thanks for the feedback! You’re absolutely right about the challenges around open-sourcing this tool. We haven’t received the necessary approvals and there are specific restrictions related to using the standards. Honestly, our main goal was to create a useful, free tool for the community, but for now, open-sourcing it isn’t feasible. It’s unfortunate, but we’re keeping it on the back burner for the moment.
If the company you are working for has experience with these copyrights issues and you would like to help to make this happen (i.e. to open source it), contact us: djordje.todorovic@htecgroup.com