MISRA C++2023, Build-Wrapper for macOS and Valgrind issues import

Hello dear C and C++ users

We are super happy to come to you with great news.

You can now use the Build-Wrapper with ARM macs and with macOS 13 (Ventura).
You can now import Valgrind issues. It works for both Memcheck and Hellgrind issues.

Last but not least, we are bringing MISRA C++ 2023 support with an initial batch of 43 rules!:

  • Rule M23_003: Variables with limited visibility should be used at least once
  • Rule M23_036: Unsigned integer literals shall be appropriately suffixed
  • Rule M23_039: ‘#include’ directives should only be preceded by preprocessor directives or comments
  • Rule M23_042: Function-like macros shall not be defined
  • Rule M23_045: All identifiers used in the controlling expression of “#if” or “#elif” preprocessing directives shall be “#define”'d at the point of evaluation
  • Rule M23_046: A line whose first token is ‘#’ shall be a valid preprocessing directive
  • Rule M23_064: ‘nullptr’ shall be the only form of the ‘null-pointer-constant’
  • Rule M23_083: The declaration of an object should contain no more than two levels of pointer indirection
  • Rule M23_087: A virtual base class shall only be cast to a derived class by means of “dynamic_cast”
  • Rule M23_089: C-style casts and functional notation casts shall not be used
  • Rule M23_090: A cast shall not remove any “const” or “volatile” qualification from the type accessed via a pointer or by reference
  • Rule M23_094: A cast should not convert a pointer type to an integral type
  • Rule M23_100: The “address-of” operator shall not be overloaded
  • Rule M23_112: All “if … else if” constructs shall be terminated with an “else” statement
  • Rule M23_126: The ‘goto’ statement shall jump to a label declared later in the function body
  • Rule M23_134: The identifier ‘main’ shall not be used for a function other than the global function ‘main’
  • Rule M23_135: There shall be no unnamed namespaces in ‘header files’
  • Rule M23_146: A declaration should not declare more than one variable or member variable
  • Rule M23_152: The value of an object shall not be read before it has been set
  • Rule M23_158: The union keyword shall not be used
  • Rule M23_162: Named bit-fields with signed integer type shall not have a length of one bit
  • Rule M23_163: Classes shall not be derived from virtual bases
  • Rule M23_187: An exception object shall not have pointer type
  • Rule M23_191: An ‘empty throw’ shall only occur within the ‘compound-statement’ of a ‘catch handler’
  • Rule M23_194: Handlers for a ‘function-try-block’ of a constructor or destructor shall not use non-static members from their class or its bases
  • Rule M23_196: An exception of class type shall be caught by const reference or reference
  • Rule M23_201: A ‘noexcept’ ‘function’ should not attempt to propagate an exception to the calling function
  • Rule M23_210: The ‘#include’ directive shall be followed by either a ‘’ or ‘“filename”’ sequence
  • Rule M23_212: The “#” and “##” preprocessor operators should not be used
  • Rule M23_218: The standard header file “” shall not be used
  • Rule M23_224: The macro “offsetof” shall not be used
  • Rule M23_280: An object shall not be used while in a ‘potentially moved-from state’
  • Rule M23_287: The result of “std::remove”, “std::remove_if”, “std::unique” and “empty” shall be used
  • Rule M23_324: A pointer to an incomplete class type shall not be deleted
  • Rule M23_325: Line-splicing shall not be used in ‘’//‘’ comments
  • Rule M23_329: Advanced memory management shall not be used
  • Rule M23_330: An Explicit type conversion shall not be an expression statement
  • Rule M23_331: Any function with limited visibility should be used at least once
  • Rule M23_338: Unscoped enumerations should not be declared
  • Rule M23_356: Variables of array type should not be declared
  • Rule M23_359: A function declared with the ‘’[[noreturn]]‘’ attribute shall not return
  • Rule M23_360: An object shall not be accessed outside of its lifetime
  • Rule M23_388: Global variables shall not be used
  • Rule M23_403: The ‘goto’ statement should not be used

All available MISRA C++ 2023 rules can be found here.

And because we think that MISRA C++ 2023 has value for a wider audience than the automotive industry, we added a new C++ quality profile called Mission-critical. It is actually wider than MISRA C++ 2023 and it is our recommendation for developing mission-critical software with modern C++. It will be updated with new MISRA C++ 2023 rules in the future.

These new features will be available with SonarQube 10.2 starting from Developer Edition. They will be available shortly on SonarCloud .
MISRA is already available on SonarLint.

As always, you can see what’s coming next and vote for C and C++ features you would like to see in SonarQube , SonarCloud , and SonarLint .

Cheers

2 Likes

Dear Geoffray,

In our company we are interested in those MISRA C++ 2023 rules.
What is the upcoming roadmap on that?
Can you estimate how much of the MISRA rules you will add to future versions?
E.g.
10.5 - 40%
10.6 - 50%

Cheers
Manuel

Hi @mb-bmw

Thanks for reaching out, and welcome to our community.

We are currently committing to integrating the best possible MISRA C++2023 coverage within the Sonar solutions.
Because of other significant developments around Clean Code, I cannot give you the specific numbers you need at the moment.
I am sorry for that. Stay assured that MISRA remains a critical topic for us.
I will post some updates when we have more visibility.

1 Like