[llvm] Add back fallthrough annotations removed by 7f3afab (PR #148032)

Jorge Gorbe Moya via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 10 11:56:33 PDT 2025


https://github.com/slackito created https://github.com/llvm/llvm-project/pull/148032

The original commit removed them to avoid the dependency on llvm Support because of LLVM_FALLTHROUGH, but this triggers `-Wimplicit-fallthrough` warnings.

LLVM requires a C++17 compiler now, so we should be able to use the standard [[fallthrough]] attribute.

>From 31c3507d3cbd7181c29300e7daa7799020f5459d Mon Sep 17 00:00:00 2001
From: Jorge Gorbe Moya <jgorbe at google.com>
Date: Thu, 10 Jul 2025 11:45:36 -0700
Subject: [PATCH] Add back fallthrough annotations removed by 7f3afab

The original commit removed them to avoid the dependency on llvm Support
because of LLVM_FALLTHROUGH, but this triggers `-Wimplicit-fallthrough`
warnings.

LLVM requires a C++17 compiler now, so we should be able to use the
standard [[fallthrough]] attribute.
---
 third-party/siphash/include/siphash/SipHash.h | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/third-party/siphash/include/siphash/SipHash.h b/third-party/siphash/include/siphash/SipHash.h
index 9653e9428b123..ca4fe45e4fddf 100644
--- a/third-party/siphash/include/siphash/SipHash.h
+++ b/third-party/siphash/include/siphash/SipHash.h
@@ -104,25 +104,24 @@ void siphash(const unsigned char *in, uint64_t inlen,
   switch (left) {
   case 7:
     b |= ((uint64_t)ni[6]) << 48;
-    /* FALLTHRU */
+    [[fallthrough]];
   case 6:
     b |= ((uint64_t)ni[5]) << 40;
-    /* FALLTHRU */
+    [[fallthrough]];
   case 5:
     b |= ((uint64_t)ni[4]) << 32;
-    /* FALLTHRU */
+    [[fallthrough]];
   case 4:
     b |= ((uint64_t)ni[3]) << 24;
-    /* FALLTHRU */
+    [[fallthrough]];
   case 3:
     b |= ((uint64_t)ni[2]) << 16;
-    /* FALLTHRU */
+    [[fallthrough]];
   case 2:
     b |= ((uint64_t)ni[1]) << 8;
-    /* FALLTHRU */
+    [[fallthrough]];
   case 1:
     b |= ((uint64_t)ni[0]);
-    /* FALLTHRU */
     break;
   case 0:
     break;



More information about the llvm-commits mailing list