Migration from MISRA C++:2008 or AUTOSAR to MISRA C++:2023

Since their initial release in 2008, the MISRA C++ coding guidelines are the de-facto standard for developing reliable or safety-critical software in C++.

The AUTOSAR coding guidelines have extended upon the 2008 release of MISRA C++, keeping some of MISRA's rules and adding new ones to update the coding guidelines to new language features and aspects of modern C++.

With the most recent MISRA C++:2023, the story continues with a new ruleset based upon the learnings of MISRA and AUTOSAR, again taking into account recent developments in C++ and improving the applicability and understandability of rules.

With each new release, developers following the MISRA guidelines face the question of how to migrate between the different versions of the MISRA ruleset.

In particular when a static code analyzer is used to verify compliance, migration involves changes to the overall configuration, reported messages and possibly high-level information such as trend charts.

For the Axivion Suite, migrating between standards takes all these aspects into account and automates them as far as possible:

The Axivion Suite keeps a history of messages to support extensive reporting, to be able to set a baseline of messages for legacy code and to provide information about trends in the overall code quality. When migrating from MISRA C++:2008 or AUTOSAR to MISRA C++:2023, this history of messages should be continued appropriately and as continuously as possible.

Essentially, this means the Axivion Suite has to detect cases in which messages should be connected rather than reporting the removal of the old and the addition of a new message. This holds in particular, as the removal could be misunderstood as improved code quality when missing the addition.

At the same time, additional messages caused by the migration represent quality issues but not a decline in quality - after all, the code has not changed during the migration.

For a proper migration strategy, the following cases have to be taken into account:

  •  For rules which are identical between the old and new versions of a ruleset, messages should definitely be connected.
  • Certain rules are stricter in the new MISRA C++:2023. In this case old messages can be connected whereas new messages can be reported as new.
  • In the opposite direction, rules could have been relaxed. In this case certain old messages can be interconnected, while others are reported as removed.

However, when it comes to MISRA C++:2023 and its predecessors, there is not always a one-to-one correspondence between old and new rules. In consequence, developers need to be aware about the migration strategy and the change of the rule sets in order to handle added or removed messages appropriately.

In all cases, isolating the effects of a migration between coding standards is reasonable to simplify understanding the effects of the migration. This can be achieved by performing an analysis immediately before and after migrating, avoiding intermediate code changes and tool upgrades. If tool upgrades are involved as well, multiple analyses can be used to isolate their effects as well.

Join Our Webinar and Learn More

Join our webinar on "MISRA C++:2023 - Applying the new standard in C++ projects"  and learn more about Axivion's MISRA checker.

 

Webinar_Axivion_MISRACpp_2023

Join the Webinar

 

For more information about Axivion Static Code Analysis and Axivion Architecture Verification, please see Axivion.

To schedule an appointment for a free demo, please contact us.

Comments