From d104ccf947c66035850048e044e76a4dfb4dec7f Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 6 Apr 2020 06:49:45 -0700 Subject: warning cleanup: GNU C++ initializer warnings. This is the eight and final round of an effort to enable GCC's -Wextra option. The C++ compiler, with -Wextra, doesn't like C's universal struct initializer { 0 }, individually complaining about all the remaining members not being initialized. What works in C++ is the { } initializer. Conditional definition to the rescue. * lib.h (all_zero_init): New macro which expands to { } under C++, and { 0 } under C. * lib.c (make_time_impl, epoch_tm, time_string_meth, time_parse_meth): Use all_zero_init. * parser.c (prime_parser): Likewise. * socket.c (sock_mark_connected): Likewise. * sysif.c (fcntl_wrap): Likewise. * termios.c (encode_speeds, decode_speeds): Likewise. * configure (diag_flags): Add -Wextra. --- sysif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysif.c') diff --git a/sysif.c b/sysif.c index a3b3ff91..6b646d9c 100644 --- a/sysif.c +++ b/sysif.c @@ -889,7 +889,7 @@ static val fcntl_wrap(val fd_in, val cmd_in, val arg_in) if (missingp(arg_in)) { errno = EINVAL; } else { - struct flock fl = { 0 }; + struct flock fl = all_zero_init; flock_pack(self, arg_in, &fl); res = fcntl(fd, cmd, &fl); if (cmd == F_GETLK) -- cgit v1.2.3