Skip to content

Commit f5ce41c

Browse files
committed
Clarify compiler versions for __fallthrough__ attribute and feature testing via __has_attribute
Signed-off-by: Thomas Nyman <[email protected]>
1 parent 4b9c0c3 commit f5ce41c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ The C17 standard[^C2017] does not provide a mechanism to mark intentional fallth
352352
#endif
353353
~~~
354354

355+
The `__fallthrough__` attribute is supported since GCC 7.0.0[^gcc-release-notes-7] and Clang 4.0.0[^clang-fallthrough]. Feature testing via `__has_attribute` is supported since GCC 5.0.0[^gcc-release-notes-5] and Clang 2.9.
356+
355357
[^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
356358

357359
[^Corbet19]: Corbet, Jonathan. ["An end to implicit fall-throughs in the kernel"](https://lwn.net/Articles/794944/), LWN, 2019-08-01.
@@ -362,6 +364,12 @@ The C17 standard[^C2017] does not provide a mechanism to mark intentional fallth
362364

363365
[^Howlett23]: Howlett, Liam,[tools: Rename __fallthrough to fallthrough](https://github.com/torvalds/linux/commit/f7a858bffcddaaf70c71b6b656e7cc21b6107cec), Linux Kernel Source, 2023-04-07.
364366

367+
[^gcc-release-notes-5]: GCC team, [GCC 5 Release Series Changes, New Features, and Fixes](https://gcc.gnu.org/gcc-5/changes.html), 2017-10-10.
368+
369+
[^gcc-release-notes-7]: GCC team, [GCC 7 Release Series Changes, New Features, and Fixes](https://gcc.gnu.org/gcc-7/changes.html), 2019-11-14.
370+
371+
[^clang-fallthrough]: LLVM team, [Attributes in Clang: fallthrough, clang::fallthrough](https://releases.llvm.org/4.0.0/tools/clang/docs/AttributeReference.html#fallthrough-clang-fallthrough), Clang Documentation, 2017-03-13.
372+
365373
---
366374

367375
### Enable warnings for possibly misleading Unicode bidirectional control characters

0 commit comments

Comments
 (0)