Disable clang 14 warning about bitwise operators in zstd

Parts of zstd, used in openzfs and other places, trigger a new clang 14
-Werror warning:

```
sys/contrib/zstd/lib/decompress/huf_decompress.c:889:25: error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
                        (BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

While the warning is benign, it should ideally be fixed upstream and
then vendor-imported, but for now silence it selectively.

MFC after:	3 days
This commit is contained in:
Dimitry Andric 2022-02-08 21:46:03 +01:00
parent 7d8a4eb943
commit 5f2aca8394
6 changed files with 11 additions and 1 deletions

View File

@ -264,5 +264,6 @@ CFLAGS+= -g -DDEBUG=1
CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith
CFLAGS.zstd.c+= -fno-tree-vectorize
CFLAGS.zstd.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL}
.include <bsd.lib.mk>

View File

@ -49,6 +49,8 @@ ZSTDDIR= ${SRCTOP}/sys/contrib/zstd
.include <bsd.compiler.mk>
CFLAGS.huf_decompress.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL}
# https://github.com/facebook/zstd/commit/812e8f2a [zstd 1.4.1]
# "Note that [GCC] autovectorization still does not do a good job on the
# optimized version, so it's turned off via attribute and flag. I found

View File

@ -111,6 +111,9 @@ CWARNFLAGS.clang+= -Wno-array-bounds
${COMPILER_TYPE} == "gcc")
CWARNFLAGS+= -Wno-misleading-indentation
.endif # NO_WMISLEADING_INDENTATION
.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 140000
NO_WBITWISE_INSTEAD_OF_LOGICAL= -Wno-bitwise-instead-of-logical
.endif
.endif # WARNS
.if defined(FORMAT_AUDIT)

View File

@ -702,7 +702,7 @@ contrib/zstd/lib/decompress/zstd_decompress.c optional zstdio compile-with ${ZST
# See comment in sys/conf/kern.pre.mk
contrib/zstd/lib/decompress/zstd_decompress_block.c optional zstdio \
compile-with "${ZSTD_C} ${ZSTD_DECOMPRESS_BLOCK_FLAGS}"
contrib/zstd/lib/decompress/huf_decompress.c optional zstdio compile-with ${ZSTD_C}
contrib/zstd/lib/decompress/huf_decompress.c optional zstdio compile-with "${ZSTD_C} ${NO_WBITWISE_INSTEAD_OF_LOGICAL}"
# Blake 2
contrib/libb2/blake2b-ref.c optional crypto | !random_loadable random_fenestrasx \
compile-with "${NORMAL_C} -I$S/crypto/blake2 -Wno-cast-qual -DSUFFIX=_ref -Wno-unused-function"

View File

@ -28,6 +28,9 @@ NO_WTAUTOLOGICAL_POINTER_COMPARE= -Wno-tautological-pointer-compare
.if ${COMPILER_VERSION} >= 100000
NO_WMISLEADING_INDENTATION= -Wno-misleading-indentation
.endif
.if ${COMPILER_VERSION} >= 140000
NO_WBITWISE_INSTEAD_OF_LOGICAL= -Wno-bitwise-instead-of-logical
.endif
# Several other warnings which might be useful in some cases, but not severe
# enough to error out the whole kernel build. Display them anyway, so there is
# some incentive to fix them eventually.

View File

@ -346,3 +346,4 @@ CFLAGS.zstd.c= -U__BMI__ -fno-tree-vectorize
.if ${MACHINE_CPUARCH} == "aarch64"
CFLAGS.zstd.c+= -include ${SRCDIR}/zstd/include/aarch64_compat.h
.endif
CFLAGS.zstd.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL}