19-09-2016, 10:19 AM
MISRA C++:2008 system-wide analysis should be used to check all the code within the project when the library is supplied and used in source code form, as all of the code will be compiled using a C++ compiler. Note that any C code wrapped in “extern C†will always be compiled by the C++ compiler.
Things are more complicated when the library is to be used in binary form. In that case, the library code should be checked in isolation (by the third party) against MISRA C:2004 with the project code being checked against MISRA C++:2008. The library API headers will be included in C and C++ code and will therefore be checked against MISRA C and C++. It is possible that use of API headers within C++ code will result in MISRA C++ violations that need to be managed through the deviation process.
Note that a MISRA checker will not be able to detect system-wide violations existing due to conflicts between C and C++ code when the library is supplied in binary form – this issue exists for any project using library code in binary form, as discussed in section 6.3 of MISRA Compliance:2016.
Things are more complicated when the library is to be used in binary form. In that case, the library code should be checked in isolation (by the third party) against MISRA C:2004 with the project code being checked against MISRA C++:2008. The library API headers will be included in C and C++ code and will therefore be checked against MISRA C and C++. It is possible that use of API headers within C++ code will result in MISRA C++ violations that need to be managed through the deviation process.
Note that a MISRA checker will not be able to detect system-wide violations existing due to conflicts between C and C++ code when the library is supplied in binary form – this issue exists for any project using library code in binary form, as discussed in section 6.3 of MISRA Compliance:2016.
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group