[QUALITY] The MISRA topic

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
User avatar
russian
Posts: 364
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 16 times
Been thanked: 14 times

Re: coverity static checker

Postby russian » Tue Jul 29, 2014 7:14 pm

Giovanni wrote:could you run the tool on 3.0 and send me the report?


First of all I had to fix the testhal\STM32\STM32F4xx\IRQ_STORM iar project, can you please commit it into the repository? The patch and the full file are located at https://svn.code.sf.net/p/rusefi/code/trunk/misc/chibi_contr/ (tell me if you need this as a github pull request)

Here is the successful build before MISRA: Image

Here are the reports:
https://svn.code.sf.net/p/rusefi/code/trunk/misc/chibi_contr/misra_1998_report.txt
https://svn.code.sf.net/p/rusefi/code/trunk/misc/chibi_contr/misra_2004_report.txt

tecnologic
Posts: 124
Joined: Tue Jan 10, 2012 8:42 am
Has thanked: 21 times
Been thanked: 5 times

Re: coverity static checker

Postby tecnologic » Wed Jul 30, 2014 8:58 am

HI Together,

@Giovanni: do not buy PCLint, its not worth the money. I have to "use" it at work. Even if u have a good configuration (a lot of work and testing) it produces a Lot of false positives. With cryptic
error messages. And for MISRA checking u need to know. Misra Errors have all the same error ID, when u check this with lint. I suppose that u get the same "functionality" with an other tool.

I would try out Clang code checking. I compiled Chibios V3.0 recently with clang and had no warnings on Chibios, but some really good warnings in my Code, which Lint has not complained about. (Yes it was an Dev Project so Lint had many exceptions)

Rowley Crossworks integrates Clang realy well. But i suppose with a Make file u will get the same results.

regards

Tec

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: coverity static checker

Postby Giovanni » Wed Jul 30, 2014 10:47 am

Is there a clang based toolchain that I can download somewhere?

I would like to support it officially.

Giovanni

tecnologic
Posts: 124
Joined: Tue Jan 10, 2012 8:42 am
Has thanked: 21 times
Been thanked: 5 times

Re: coverity static checker

Postby tecnologic » Fri Aug 01, 2014 7:30 am

Hi Giovanni.

i use Rowley Crossworks V3.2. U can download a 30 Days Trial. There u can seamless switch between clang and gcc.

regards

Tec

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: coverity static checker

Postby Giovanni » Fri Aug 01, 2014 7:42 am

Is the compiler itself limited to 30 days? I don't care about the IDE and wish to avoid it entirely if possible.

Giovanni

skute
Posts: 64
Joined: Wed Aug 29, 2012 10:17 pm

Re: coverity static checker

Postby skute » Mon Aug 04, 2014 2:17 am

Instructions for downloading/building/running clang are here: http://clang.llvm.org/get_started.html

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: coverity static checker

Postby Giovanni » Tue Aug 05, 2014 9:04 pm

About the MISRA reports, lot of noise in there.

For example there is a rule about macros that have to be surrounded by (), lots of that kind and I cannot comply because macros are used for function-like macros or hooks not only expressions.

Another common complain is casting something that comes from a structure pointed by a pointer, exactly why?

Another kind is the presence of something non-preprocessor before and #include, the HAL architecture requires that when low level files are included.

There are very few really interesting notes, I will focus on those. Warnings about design choices will receive a documented waiver.

Giovanni

User avatar
russian
Posts: 364
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 16 times
Been thanked: 14 times

Re: coverity static checker

Postby russian » Tue Aug 05, 2014 11:17 pm

Giovanni wrote:About the MISRA reports, lot of noise in there.

Exactly, I was scratching my head about a number of these. But some of them are legit.

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: coverity static checker

Postby Giovanni » Wed Mar 04, 2015 7:28 pm

I am proceeding with MISRA for 3.0 now.

Some of those rules make the code look really dumb and putting lint exceptions in the code risk to make it less readable.

I am reaching a decision deadlock...

colin
Posts: 149
Joined: Thu Dec 22, 2011 7:44 pm

Re: [QUALITY] The MISRA topic

Postby colin » Wed Mar 04, 2015 11:17 pm

Personally I would prefer the code to be clean and readable to meeting some draconian rules like "macros must be surrounded by parentheses". It seems like many of the MISRA rules may be more of a burden and cost to readability than is worth the benefit of being "MISRA compliant" or getting some actual robustness. But, there may be some useful warnings to take to heart or techniques that are good ... maybe those are the exception however.


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 62 guests