[clang] [Clang] Fix false-positive fallthrough warning (PR #234848)
Adinesh Reddy via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 5 23:27:58 PST 2026
================
@@ -253,6 +253,82 @@ int fallthrough_covered_enums(Enum e) {
return n;
}
+// Attributes on consecutive switch labels should not introduce false fallthrough.
+int fallthrough_attributed_labels(int n) {
+ switch (n) {
+ [[unlikely]] case 0:
+ [[unlikely]] case 1:
+ [[likely]] case 2:
+ case 3:
+ [[unlikely]] case 4:
+ [[unlikely]] default:
+ return -1;
+ }
+ switch (n) {
----------------
Adinesh-Reddy wrote:
Done
https://github.com/llvm/llvm-project/pull/234848
More information about the cfe-commits
mailing list