Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add [[fallthrough]] attribute to case statements when appropriate. #1314

Open
wants to merge 1 commit into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ elseif(MSVC)
# warning C4548: expression before comma has no effect; expected expression with side-effect
/wd4548

# warning C5051: attribute 'fallthrough' requires at least '/std:c++17'
/wd5051

# Make sure WinDef.h does not define min and max macros which
# will conflict with std::min() and std::max().
/DNOMINMAX
Expand Down
22 changes: 11 additions & 11 deletions opensubdiv/bfr/hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,47 +388,47 @@ void SpookyHash::Short(
{
case 15:
d += ((uint64)u.p8[14]) << 48;
// FALLTHRU
[[fallthrough]];
case 14:
d += ((uint64)u.p8[13]) << 40;
// FALLTHRU
[[fallthrough]];
case 13:
d += ((uint64)u.p8[12]) << 32;
// FALLTHRU
[[fallthrough]];
case 12:
d += u.p32[2];
c += u.p64[0];
break;
case 11:
d += ((uint64)u.p8[10]) << 16;
// FALLTHRU
[[fallthrough]];
case 10:
d += ((uint64)u.p8[9]) << 8;
// FALLTHRU
[[fallthrough]];
case 9:
d += (uint64)u.p8[8];
// FALLTHRU
[[fallthrough]];
case 8:
c += u.p64[0];
break;
case 7:
c += ((uint64)u.p8[6]) << 48;
// FALLTHRU
[[fallthrough]];
case 6:
c += ((uint64)u.p8[5]) << 40;
// FALLTHRU
[[fallthrough]];
case 5:
c += ((uint64)u.p8[4]) << 32;
// FALLTHRU
[[fallthrough]];
case 4:
c += u.p32[0];
break;
case 3:
c += ((uint64)u.p8[2]) << 16;
// FALLTHRU
[[fallthrough]];
case 2:
c += ((uint64)u.p8[1]) << 8;
// FALLTHRU
[[fallthrough]];
case 1:
c += (uint64)u.p8[0];
break;
Expand Down