Skip to content

Commit 0ddf911

Browse files
committed
Fix inconsistent reference to kernel version were fallthrough originates
Signed-off-by: Thomas Nyman <[email protected]>
1 parent 930fda8 commit 0ddf911

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ This warning flag warns when a fallthrough occurs unless it is specially marked
320320

321321
This warning flag does not have a performance impact. However, sometimes a fallthrough *is* intentional. This flag requires developers annotate those (rare) cases in the source code where a fallthrough *is* intentional, to suppress the warning. Obviously, this annotation should *only* be used when it is intentional. C++17 (or later) code should simply use the attribute `[[fallthrough]]` as it is standard (remember to add `;` after it).
322322

323-
The C17 standard[^C2017] does not provide a mechanism to mark intentional fallthroughs. Different tools support different mechanisms for marking one, including attributes and comments in various forms[^Shafik15]. A portable way to mark one is to define a function-like macro named `fallthrough()` to mark an intentional fallthrough that adjusts to the relevant tool (e.g., compiler) mechanism. We suggest using this construct below, inspired by the keyword-like construct used by the Linux kernel version 5.10 and later. We suggest using a function call syntax instead so more editors and other tools will deal with it correctly:
323+
The C17 standard[^C2017] does not provide a mechanism to mark intentional fallthroughs. Different tools support different mechanisms for marking one, including attributes and comments in various forms[^Shafik15]. A portable way to mark one is to define a function-like macro named `fallthrough()` to mark an intentional fallthrough that adjusts to the relevant tool (e.g., compiler) mechanism. We suggest using this construct below, inspired by the keyword-like construct used by the Linux kernel version 6.4 and later[^Howlett23]. We suggest using a function call syntax instead so more editors and other tools will deal with it correctly:
324324

325325
~~~c
326326
#if __has_attribute(__fallthrough__)
@@ -330,8 +330,6 @@ The C17 standard[^C2017] does not provide a mechanism to mark intentional fallth
330330
#endif
331331
~~~
332332

333-
This is similar to the keyword-like macro used by the Linux kernel version 6.4 and later[^Howlett23].
334-
335333
[^Polacek17]: Polacek, Marek, ["-Wimplicit-fallthrough in GCC 7"](https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7), Red Hat Developer, 2017-03-10
336334

337335
[^Corbet19]: Corbet, Jonathan. ["An end to implicit fall-throughs in the kernel"](https://lwn.net/Articles/794944/), LWN, 2019-08-01.

0 commit comments

Comments
 (0)