Date: Tue, 27 Jan 2026 18:44:24 +0000 From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: bce125030930 - stable/14 - ctld: Disable -Wshadow for GCC Message-ID: <69790788.f7e0.57df8263@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=bce1250309302f66165a536c2834c7fc515ebc74 commit bce1250309302f66165a536c2834c7fc515ebc74 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2025-04-11 13:34:36 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2026-01-27 18:15:57 +0000 ctld: Disable -Wshadow for GCC GCC raises shadow warnings in C++ when a global function shadows a structure type name (since it shadows the constructors for that type). System headers are full of such cases (and some such as struct sigaction vs sigaction() are mandated by POSIX), so just disable the warning. For example: In file included from usr.sbin/ctld/ctld.cc:33: sys/sys/event.h:366:20: error: 'int kqueue()' hides constructor for 'struct kqueue' [-Werror=shadow] 366 | int kqueue(void); | ^ sys/sys/event.h:371:43: error: 'int kevent(int, const kevent*, int, kevent*, int, const timespec*)' hides constructor for 'struct kevent' [-Werror=shadow] 371 | const struct timespec *timeout); | ^ In file included from usr.sbin/ctld/ctld.cc:37: sys/sys/stat.h:396:63: error: 'int stat(const char*, stat*)' hides constructor for 'struct stat' [-Werror=shadow] 396 | int stat(const char * __restrict, struct stat * __restrict); | ^ Reported by: bz (cherry picked from commit 75a24e7f9afb128138c3b3462b80731cab0f5bdd) --- usr.sbin/ctld/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/ctld/Makefile b/usr.sbin/ctld/Makefile index 737d09446db8..ed6d8d5f9b5d 100644 --- a/usr.sbin/ctld/Makefile +++ b/usr.sbin/ctld/Makefile @@ -15,6 +15,7 @@ CFLAGS+= -I${SRCTOP}/sys/dev/iscsi CFLAGS+= -I${SRCTOP}/lib/libiscsiutil #CFLAGS+= -DICL_KERNEL_PROXY NO_WCAST_ALIGN= +CXXWARNFLAGS.gcc= -Wno-shadow MAN= ctld.8 ctl.conf.5 LIBADD= bsdxml iscsiutil md sbuf util ucl m nvhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69790788.f7e0.57df8263>
