mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Fix GCC 12 compilation errors
Squelch false positives reported by GCC 12 with UBSan. Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Closes #14150
This commit is contained in:
committed by
Brian Behlendorf
parent
3a6d89ae52
commit
3c1e1933b6
@@ -199,6 +199,17 @@ nvprint_##type_and_variant(nvlist_prtctl_t pctl, void *private, \
|
||||
return (1); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Workaround for GCC 12+ with UBSan enabled deficencies.
|
||||
*
|
||||
* GCC 12+ invoked with -fsanitize=undefined incorrectly reports the code
|
||||
* below as violating -Wformat-overflow.
|
||||
*/
|
||||
#if defined(__GNUC__) && !defined(__clang__) && \
|
||||
defined(ZFS_UBSAN_ENABLED) && defined(HAVE_FORMAT_OVERFLOW)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-overflow"
|
||||
#endif
|
||||
NVLIST_PRTFUNC(boolean, int, int, "%d")
|
||||
NVLIST_PRTFUNC(boolean_value, boolean_t, int, "%d")
|
||||
NVLIST_PRTFUNC(byte, uchar_t, uchar_t, "0x%2.2x")
|
||||
@@ -213,6 +224,10 @@ NVLIST_PRTFUNC(uint64, uint64_t, u_longlong_t, "0x%llx")
|
||||
NVLIST_PRTFUNC(double, double, double, "0x%f")
|
||||
NVLIST_PRTFUNC(string, char *, char *, "%s")
|
||||
NVLIST_PRTFUNC(hrtime, hrtime_t, hrtime_t, "0x%llx")
|
||||
#if defined(__GNUC__) && !defined(__clang__) && \
|
||||
defined(ZFS_UBSAN_ENABLED) && defined(HAVE_FORMAT_OVERFLOW)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Generate functions to print array-valued nvlist members.
|
||||
|
||||
Reference in New Issue
Block a user