Pádraig Brady wrote:
> The new coreutils CI I have in place is failing to build
> with gcc (Debian 10.2.1-6) 10.2.1 with gnulib latest (ebd843b3) as follows.

> lib/utimecmp.c: In function 'utimecmpat':
> lib/utimecmp.c:348:17: error: missing initializer for field 'tv_nsec' of 
> 'struct timespec' [-Werror=missing-field-initializers]
>    348 |                 [0].tv_nsec = dst_a_ns,
>        |                 ^

> I think this may be due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82283
> It's a pity that doesn't seem to have been backported to gcc 10 (2020).

Thanks for the heads-up and analysis.

> I was thinking I might need to ./configure --enable-gcc-warnings=no for CI
> at some stage

coreutils is probably not the only GNU package that will see this warning.
Therefore better silence it in gnulib rather than in coreutils.

This patch should do it.


2023-05-15  Bruno Haible  <br...@clisp.org>

        Work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82283 .
        Reported by Pádraig Brady <p...@draigbrady.com> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2023-05/msg00077.html>.
        * m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS): Add
        -Wno-missing-field-initializers for GCC < 11.

diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index edb8572da2..a2b53d33dc 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 86
+# gnulib-common.m4 serial 87
 dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -1053,6 +1053,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS]
     dnl -Wno-float-conversion                 >= 4.9          >= 3.9
     dnl -Wno-float-equal                      >= 3            >= 3.9
     dnl -Wimplicit-fallthrough                >= 7            >= 3.9
+    dnl -Wno-missing-field-initializers       >= 4.0, < 11
     dnl -Wno-pedantic                         >= 4.8          >= 3.9
     dnl -Wno-sign-compare                     >= 3            >= 3.9
     dnl -Wno-sign-conversion                  >= 4.3          >= 3.9
@@ -1078,6 +1079,9 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS]
       #if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
       -Wimplicit-fallthrough
       #endif
+      #if __GNUC__ >= 4 && __GNUC__ < 11 && !defined __clang__
+      -Wno-missing-field-initializers
+      #endif
       #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + 
(__clang_minor__ >= 9) > 3)
       -Wno-pedantic
       #endif




Reply via email to