MISRA Discussion Forums
Rule 6-2-3 and C++17 [[fallthrough]]; attribute - 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: Rule 6-2-3 and C++17 [[fallthrough]]; attribute (/showthread.php?tid=1679)



Rule 6-2-3 and C++17 [[fallthrough]]; attribute - kafka - 27-03-2024

Should the C++17 [[fallthrough]]; attribute be given an exception for MISRA C++ 2008 Rule 6-2-3 (a null statement shall appear on a line by itself)?


RE: Rule 6-2-3 and C++17 [[fallthrough]]; attribute - misra cpp - 19-04-2024

The short and unhelpful answer is that [[fallthrough]] was introduced to C++ after MISRA 2008 had been published, so is out of scope of any MISRA 2008 rule.

Having said that, looking at the rationale for 6-2-3, if this were still a requirement, then  "[[fallthrough]]; // comment"    should be acceptable as a null-statement on a single line