git: 2e08e4b75ea1 - main - zfs: Fix build with GCC 12.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 21 Dec 2022 18:49:45 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=2e08e4b75ea1080c224a33baf62199d893dc322d

commit 2e08e4b75ea1080c224a33baf62199d893dc322d
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-12-21 18:49:23 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-12-21 18:49:23 +0000

    zfs: Fix build with GCC 12.
    
    Silence -Winfinite-recursion for ldo.c in lua and -Wstringop-overread
    for nvpair.c.
    
    Reviewed by:    mm
    Differential Revision:  https://reviews.freebsd.org/D37631
---
 sys/conf/files           | 4 ++--
 sys/conf/kern.mk         | 2 ++
 sys/modules/zfs/Makefile | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/sys/conf/files b/sys/conf/files
index 75644d689ff9..9e6456519259 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -172,7 +172,7 @@ contrib/openzfs/module/lua/lcompat.c		optional zfs compile-with "${ZFS_C}"
 contrib/openzfs/module/lua/lcorolib.c		optional zfs compile-with "${ZFS_C}"
 contrib/openzfs/module/lua/lctype.c			optional zfs compile-with "${ZFS_C}"
 contrib/openzfs/module/lua/ldebug.c			optional zfs compile-with "${ZFS_C}"
-contrib/openzfs/module/lua/ldo.c			optional zfs compile-with "${ZFS_C}"
+contrib/openzfs/module/lua/ldo.c			optional zfs compile-with "${ZFS_C} ${NO_WINFINTE_RECURSION}"
 contrib/openzfs/module/lua/lfunc.c			optional zfs compile-with "${ZFS_C}"
 contrib/openzfs/module/lua/lgc.c			optional zfs compile-with "${ZFS_C}"
 contrib/openzfs/module/lua/llex.c			optional zfs compile-with "${ZFS_C}"
@@ -191,7 +191,7 @@ contrib/openzfs/module/lua/lzio.c			optional zfs compile-with "${ZFS_C}"
 
 # zfs nvpair support
 contrib/openzfs/module/nvpair/fnvpair.c		optional zfs compile-with "${ZFS_C}"
-contrib/openzfs/module/nvpair/nvpair.c		optional zfs compile-with "${ZFS_RPC_C}"
+contrib/openzfs/module/nvpair/nvpair.c		optional zfs compile-with "${ZFS_RPC_C} ${NO_WSTRINGOP_OVERREAD}"
 contrib/openzfs/module/nvpair/nvpair_alloc_fixed.c	optional zfs compile-with "${ZFS_C}"
 contrib/openzfs/module/nvpair/nvpair_alloc_spl.c	optional zfs compile-with "${ZFS_C}"
 
diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
index 65cf86375cce..682463e8e0d5 100644
--- a/sys/conf/kern.mk
+++ b/sys/conf/kern.mk
@@ -81,6 +81,8 @@ CWARNEXTRA+=	-Wno-address-of-packed-member			\
 CWARNEXTRA+=	-Wno-error=nonnull				\
 		-Wno-dangling-pointer				\
 		-Wno-zero-length-bounds
+NO_WINFINTE_RECURSION=	-Wno-infinite-recursion
+NO_WSTRINGOP_OVERREAD=	-Wno-stringop-overread
 .endif
 .endif
 
diff --git a/sys/modules/zfs/Makefile b/sys/modules/zfs/Makefile
index 71affa119f0b..510d3affb0d7 100644
--- a/sys/modules/zfs/Makefile
+++ b/sys/modules/zfs/Makefile
@@ -348,10 +348,11 @@ CFLAGS.gcc+= -Wno-pointer-to-int-cast
 
 CFLAGS.lapi.c= -Wno-cast-qual
 CFLAGS.lcompat.c= -Wno-cast-qual
+CFLAGS.ldo.c= ${NO_WINFINTE_RECURSION}
 CFLAGS.lobject.c= -Wno-cast-qual
 CFLAGS.ltable.c= -Wno-cast-qual
 CFLAGS.lvm.c= -Wno-cast-qual
-CFLAGS.nvpair.c= -Wno-cast-qual -DHAVE_RPC_TYPES
+CFLAGS.nvpair.c= -Wno-cast-qual -DHAVE_RPC_TYPES ${NO_WSTRINGOP_OVERREAD}
 CFLAGS.spl_string.c= -Wno-cast-qual
 CFLAGS.spl_vm.c= -Wno-cast-qual
 CFLAGS.spl_zlib.c= -Wno-cast-qual