HomeFreeBSD

ctld: Disable -Wshadow for GCC

Description

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

Details

Provenance
jhbAuthored on Fri, Apr 11, 1:34 PM
Parents
rG65eaf726201c: netlink: Move static arrays of parsers into tests that use them
Branches
Unknown
Tags
Unknown