[lib] Make lib compatible with -Wfall-through excepting legacy

Switch to a macro `ZSTD_FALLTHROUGH;` instead of a comment. On supported
compilers this uses an attribute, otherwise it becomes a comment.

This is necessary to be compatible with clang's `-Wfall-through`, and
gcc's `-Wfall-through=2` which don't support comments. Without this the
linux build emits a bunch of warnings.
This commit is contained in:
Nick Terrell
2021-09-23 11:54:14 -07:00
parent 1715601e55
commit 20821a46f4
10 changed files with 79 additions and 29 deletions
+1 -1
View File
@@ -486,7 +486,7 @@ MEM_STATIC int ZSTD_disableLiteralsCompression(const ZSTD_CCtx_params* cctxParam
return 1;
default:
assert(0 /* impossible: pre-validated */);
/* fall-through */
ZSTD_FALLTHROUGH;
case ZSTD_lcm_auto:
return (cctxParams->cParams.strategy == ZSTD_fast) && (cctxParams->cParams.targetLength > 0);
}