MISRA Discussion Forums
C++17 [[fallthrough]]; attribute and (Rule 6-4-3 and Rule 6-4-5) - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19)
+---- Forum: 6.6 Statements (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=135)
+---- Thread: C++17 [[fallthrough]]; attribute and (Rule 6-4-3 and Rule 6-4-5) (/showthread.php?tid=1682)



C++17 [[fallthrough]]; attribute and (Rule 6-4-3 and Rule 6-4-5) - mshawa - 22-04-2024

Given the response from:  Rule 6-2-3 and C++17 [[fallthrough]]; attribute (misra.org.uk)
Should Rule 6-4-3(A switch statement shall be a well-formed switch statement) and Rule 6-4-5(An unconditional throw or break statement shall terminate every non-empty switch-clause) also have an exception for the [[fallthrough]]; attribute when used in an empty switch case?


RE: C++17 [[fallthrough]]; attribute and (Rule 6-4-3 and Rule 6-4-5) - misra cpp - 07-06-2024

As with your previous question, MISRA C++ 2008 only applies to C++::2003 - [[fallthrough]] is a later feature, so MISRA C++ 2008 is not going to say anything about it. To use MISRA C++ 2008 on C++::2017 code, you are going to need a deviation.

You may want to look at 'MISRA Compliance':
https://www.misra.org.uk/app/uploads/2021/06/MISRA-Compliance-2020.pdf