From: James Sedgwick Date: Fri, 12 May 2017 04:31:22 +0000 (-0700) Subject: add FOLLY_FALLTHROUGH throughout to satisfy internal linter X-Git-Tag: v2017.05.15.00~5 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ce7751a29638825aa17f70a6ab4e2b036941ad90;p=folly.git add FOLLY_FALLTHROUGH throughout to satisfy internal linter Summary: changes as suggested by FB-internal linter Reviewed By: yfeldblum Differential Revision: D4957742 fbshipit-source-id: c9d94c477d24f153cab0d25edccfd39ff31fdfdf --- diff --git a/folly/Format.cpp b/folly/Format.cpp index db95ea24..25ddf631 100644 --- a/folly/Format.cpp +++ b/folly/Format.cpp @@ -16,6 +16,7 @@ #include +#include #include #include @@ -81,6 +82,7 @@ void FormatValue::formatHelper( switch (arg.presentation) { case '%': val *= 100; + FOLLY_FALLTHROUGH; case 'f': case 'F': { diff --git a/folly/SocketAddress.cpp b/folly/SocketAddress.cpp index ec30b5de..2d12d787 100644 --- a/folly/SocketAddress.cpp +++ b/folly/SocketAddress.cpp @@ -20,6 +20,7 @@ #include +#include #include #include @@ -554,7 +555,7 @@ bool SocketAddress::prefixMatch(const SocketAddress& other, switch (getFamily()) { case AF_INET: mask_length = 32; - // fallthrough + FOLLY_FALLTHROUGH; case AF_INET6: { auto prefix = folly::IPAddress::longestCommonPrefix( diff --git a/folly/SpookyHashV1.cpp b/folly/SpookyHashV1.cpp index cdd09193..401da9f8 100644 --- a/folly/SpookyHashV1.cpp +++ b/folly/SpookyHashV1.cpp @@ -26,6 +26,8 @@ #include +#include + #include #define ALLOW_UNALIGNED_READS 1 @@ -96,37 +98,48 @@ void SpookyHashV1::Short( switch (remainder) { case 15: - d += ((uint64_t)u.p8[14]) << 48; + d += ((uint64_t)u.p8[14]) << 48; + FOLLY_FALLTHROUGH; case 14: d += ((uint64_t)u.p8[13]) << 40; + FOLLY_FALLTHROUGH; case 13: d += ((uint64_t)u.p8[12]) << 32; + FOLLY_FALLTHROUGH; case 12: d += u.p32[2]; c += u.p64[0]; break; case 11: d += ((uint64_t)u.p8[10]) << 16; + FOLLY_FALLTHROUGH; case 10: d += ((uint64_t)u.p8[9]) << 8; + FOLLY_FALLTHROUGH; case 9: d += (uint64_t)u.p8[8]; + FOLLY_FALLTHROUGH; case 8: c += u.p64[0]; break; case 7: c += ((uint64_t)u.p8[6]) << 48; + FOLLY_FALLTHROUGH; case 6: c += ((uint64_t)u.p8[5]) << 40; + FOLLY_FALLTHROUGH; case 5: c += ((uint64_t)u.p8[4]) << 32; + FOLLY_FALLTHROUGH; case 4: c += u.p32[0]; break; case 3: c += ((uint64_t)u.p8[2]) << 16; + FOLLY_FALLTHROUGH; case 2: c += ((uint64_t)u.p8[1]) << 8; + FOLLY_FALLTHROUGH; case 1: c += (uint64_t)u.p8[0]; break; diff --git a/folly/SpookyHashV2.cpp b/folly/SpookyHashV2.cpp index a01271da..0f623625 100644 --- a/folly/SpookyHashV2.cpp +++ b/folly/SpookyHashV2.cpp @@ -28,6 +28,7 @@ #include +#include #include #include @@ -98,37 +99,48 @@ void SpookyHashV2::Short( switch (remainder) { case 15: - d += ((uint64_t)u.p8[14]) << 48; + d += ((uint64_t)u.p8[14]) << 48; + FOLLY_FALLTHROUGH; case 14: d += ((uint64_t)u.p8[13]) << 40; + FOLLY_FALLTHROUGH; case 13: d += ((uint64_t)u.p8[12]) << 32; + FOLLY_FALLTHROUGH; case 12: d += u.p32[2]; c += u.p64[0]; break; case 11: d += ((uint64_t)u.p8[10]) << 16; + FOLLY_FALLTHROUGH; case 10: d += ((uint64_t)u.p8[9]) << 8; + FOLLY_FALLTHROUGH; case 9: d += (uint64_t)u.p8[8]; + FOLLY_FALLTHROUGH; case 8: c += u.p64[0]; break; case 7: c += ((uint64_t)u.p8[6]) << 48; + FOLLY_FALLTHROUGH; case 6: c += ((uint64_t)u.p8[5]) << 40; + FOLLY_FALLTHROUGH; case 5: c += ((uint64_t)u.p8[4]) << 32; + FOLLY_FALLTHROUGH; case 4: c += u.p32[0]; break; case 3: c += ((uint64_t)u.p8[2]) << 16; + FOLLY_FALLTHROUGH; case 2: c += ((uint64_t)u.p8[1]) << 8; + FOLLY_FALLTHROUGH; case 1: c += (uint64_t)u.p8[0]; break; diff --git a/folly/experimental/io/HugePages.cpp b/folly/experimental/io/HugePages.cpp index f94b818b..ad15d359 100644 --- a/folly/experimental/io/HugePages.cpp +++ b/folly/experimental/io/HugePages.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -99,9 +100,9 @@ size_t parsePageSizeValue(StringPiece value) { StringPiece numStr(value.data() + match.position(1), size_t(match.length(1))); size_t size = to(numStr); switch (c) { - case 't': size *= 1024; - case 'g': size *= 1024; - case 'm': size *= 1024; + case 't': size *= 1024; FOLLY_FALLTHROUGH; + case 'g': size *= 1024; FOLLY_FALLTHROUGH; + case 'm': size *= 1024; FOLLY_FALLTHROUGH; case 'k': size *= 1024; } return size;