MISRA Coding Standards

Originally intended to provide guidance to facilitate safe and reliable coding practices for the automotive industry, the Motor Industry Software Reliability Association (MISRA) coding standards have been adopted by many other industries developing safety-critical embedded software including telecom, aerospace, defense, and medical. Klocwork provides built-in, automated detection and reporting for MISRA-C:2004 and MISRA-C++:2008.

Using Klocwork, MISRA coding standard violations can be reported automatically at the developer desktop, integration build, and through the Klocwork peer code review solution. Combined with Klocwork's leading defect detection capabilities, customers now have one tool that can be used to implement defect detection and coding standard enforcement.

Enabling MISRA for a project
Sample of MISRA Checkers
Build your own coding standards

Support for other coding standards

In addition to support for formal, published standards such as MISRA, Klocwork's analysis provides out-of-the-box support for general coding practices recommended by regulatory bodies, industry consortiums, and individual companies that are serious about software quality discipline. These various standards differ in some of their specifics but most recommend the following general guidelines, all of which are supported by Klocwork.

  • Ban explicit language features that can hide coding errors
  • Eliminate multiple declarations in functions, classes, data types, macros, variables, etc
  • Only use pointer expressions after initialized
  • Only include header files once
  • Eliminate unused or unreachable code
  • Place limits on the complexity of the software functions

Create your own coding standards

Customers can also leverage Klocwork's product extensibility for C, C++ and Java. This capability allows developers to easily extend Klocwork's extensive built-in library by adding their own checkers to meet their unique requirements.

The foundation for this capability is a high-level declarative language that allows developers to add their own checkers using one of two types of language frameworks:

  • Abstract Syntax Tree (AST) checkers are used when the checker doesn't require runtime state to evaluate an error condition and can be found entirely within the source tree
  • Data flow checkers require knowledge of the code's runtime state and complex data flow across function call boundaries in order to create effective analysis

Checker development for most custom checkers can be done right within the Klocwork Checker Studio, a graphical environment that allows developers to easily write new checkers that query their code's AST

MISRA and MISRA C are registered trademarks of MIRA Limited, held on behalf of the MISRA Consortium. No endorsement of any product by MISRA is implied
Free Trial

In this section

Relevant Reads

WHITEPAPER: Source Code Analysis in an Agile World

To keep pace with ever-increasing customer demands on software functionality and time-to-market expectations, software developers have had to evolve the way they develop code to be both faster and higher quality. [...]

WHITEPAPER: The Next Generation Source Code Analysis

Automated source code analysis (SCA) technology locates and describes critical bugs and security vulnerabilities in software source code. [...]