mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +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
@@ -1007,8 +1007,23 @@ send_print_verbose(FILE *fout, const char *tosnap, const char *fromsnap,
|
||||
(void) fprintf(fout, dgettext(TEXT_DOMAIN,
|
||||
"incremental\t%s\t%s"), fromsnap, tosnap);
|
||||
} else {
|
||||
/*
|
||||
* 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
|
||||
(void) fprintf(fout, dgettext(TEXT_DOMAIN,
|
||||
"full\t%s"), tosnap);
|
||||
#if defined(__GNUC__) && !defined(__clang__) && \
|
||||
defined(ZFS_UBSAN_ENABLED) && defined(HAVE_FORMAT_OVERFLOW)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
}
|
||||
(void) fprintf(fout, "\t%llu", (longlong_t)size);
|
||||
} else {
|
||||
@@ -1028,8 +1043,23 @@ send_print_verbose(FILE *fout, const char *tosnap, const char *fromsnap,
|
||||
if (size != 0) {
|
||||
char buf[16];
|
||||
zfs_nicebytes(size, buf, sizeof (buf));
|
||||
/*
|
||||
* 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
|
||||
(void) fprintf(fout, dgettext(TEXT_DOMAIN,
|
||||
" estimated size is %s"), buf);
|
||||
#if defined(__GNUC__) && !defined(__clang__) && \
|
||||
defined(ZFS_UBSAN_ENABLED) && defined(HAVE_FORMAT_OVERFLOW)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
}
|
||||
}
|
||||
(void) fprintf(fout, "\n");
|
||||
|
||||
Reference in New Issue
Block a user