avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline...


From: David Brown
Subject: Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline...
Date: Wed, 25 Jul 2012 01:40:39 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Lightning/1.0b3pre Thunderbird/3.1.16

On 24/07/12 21:22, Joerg Wunsch wrote:
As Georg-Johann Lay wrote:

C89 is a subset thereof, and the problem is also present with
-std=c90.

ANSI C89 and ISO C90 are synonyms.

However, GCC itself does not have a feature to compile to MISRA
(AFAIK) so it makes it difficult to fully comply.

(Though I've wanted to add that feature to GCC for years.)

That's basically blocked because MISRA is not open.

Well, I think MISRA could be added just as warning levels (like
-Wmisra or such, perhaps even two levels of them, as some rules are
mandatory, while other are recommended only), without affecting the
actual compilation result.


There would have to be a range of warning options (perhaps as sub-options to -Wmisra), since you don't always want to follow all MISRA rules. In fact, I strongly doubt you could make a flashing LED while still following /all/ the MISRA rules (try making an interrupt function without using your compiler's extensions, for example).

I suspect that implementing the actual warning messages would be relatively easy, at least for those that are practical for a compiler. But there would need to be a whole lot of tedious details for different options, matching up the MISRA rule numbers, etc. It's the kind of job you do for money, not for the fun of it.

How could a GCC
developer review code, fix bugs or confirm bugs if he does not know
what the compiler is supposed to do?

Except he buys an expensive document.

The MISRA C document, when bought as PDF on the web, is just GPB 10 +
VAT, I wouldn't really call that "expensive".  The C standard is much
more expensive, yet GCC tries to comply to it. ;-)  (It's CHF 238,
where you probably have to add VAT as well.)

Cost is probably not be an issue (if it is, I will happily sponsor the £10 for whoever wants to implement these warnings!). However, there may be copyright issues - you can't freely copy the rule numbers and information from the MISRA documents into gcc. You probably can't even use the name "MISRA". Someone would have to get permission from MISRA to be able to make these warnings, and I have no idea how strict MISRA are on these issues.


While the C standard drafts have always been publically available, the
standard itself used to be sold only either.  It's only been later on
that the standard committee decided to publish some drafts that were
effectively the actual C99 standard plus technical corrigenda, but for
C11, you're in the payware boat again.  Most standards are not "open"
in a sense that you'd be allowed to give the actual standard document
away to someone else.  Standardization bodies refinance themselves by
selling their standards.

I don't think MISRA disallows distributing opensource software that
attempts to comply with it (but I'd have to review their conditions
again if someone is really interested).

No, I'm not a big fan of MISRA, by no means.  I'd just wanted to clean
up a bit with the perception that MISRA were something expensive while
you'd get something like the C standard for free ...

The way I see it, MISRA rules can be divided into three groups. Half of them are so obvious that no serious programmer would need to be told them. Half of them are good ideas. And half of them are directly bad, as they lead to messy and hard-to-read code.

But it /is/ a standard that people follow, at least in part - often just because it is a single, fairly static standards document. I don't know of any comparable alternative.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]