bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: address coreutils' gcc9 build failures


From: Jim Meyering
Subject: FYI: address coreutils' gcc9 build failures
Date: Sun, 24 Jun 2018 16:10:13 -0700

I tried to build coreutils using recent gcc, built from git, so it
calls itself "gcc version 9.0.0 20180616 (experimental) (GCC)".
There were three gnulib-related build failures.  These were errors
solely because I also configured with --enable-gcc-warnings.

With these three changes to gnulib files, the build succeeded:

>From 593c1703712ec68b1e59bd7f1764d990e030ec69 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 24 Jun 2018 11:31:50 -0700
Subject: [PATCH 1/3] manywarnings: accommodate GCC 9.0-pre: remove -Wchkp and
 -Wabi

* build-aux/gcc-warning.spec: Add them here, each with an explanation.
* m4/manywarnings.m4: Remove them.
Otherwise, building coreutils, I would see this:
cc1: error: deprecated command line option '-Wchkp' [-Werror]
cc1: error: -Wabi won't warn about anything [-Werror=abi]
cc1: note: -Wabi warns about differences from the most up-to-date ABI,\
  which is also used by default
cc1: note: use e.g. -Wabi=11 to warn about changes from GCC 7
---
 ChangeLog                  | 12 ++++++++++++
 build-aux/gcc-warning.spec |  2 ++
 m4/manywarnings.m4         |  2 --
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 110487657..546da3218 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2018-06-24  Jim Meyering  <address@hidden>
+
+       manywarnings: accommodate GCC 9.0-pre: remove -Wchkp and -Wabi
+       * build-aux/gcc-warning.spec: Add them here, each with an explanation.
+       * m4/manywarnings.m4: Remove them.
+       Otherwise, building coreutils, I would see this:
+       cc1: error: deprecated command line option '-Wchkp' [-Werror]
+       cc1: error: -Wabi won't warn about anything [-Werror=abi]
+       cc1: note: -Wabi warns about differences from the most up-to-date ABI,\
+         which is also used by default
+       cc1: note: use e.g. -Wabi=11 to warn about changes from GCC 7
+
 2018-06-03  Paul Eggert  <address@hidden>

        Port crypto/af_alg to GCC 4.8.4
diff --git a/build-aux/gcc-warning.spec b/build-aux/gcc-warning.spec
index 2ffdb2ba4..e2625ea9d 100644
--- a/build-aux/gcc-warning.spec
+++ b/build-aux/gcc-warning.spec
@@ -3,6 +3,7 @@
 --extra-warnings                       alias for -Wextra
 -Wabi-tag                              c++
 -Wabi=                                 c++
+-Wabi                                  this is now a no-op
 -Waggregate-return                     obsolescent
 -Waliasing                             fortran
 -Walign-commons                                fortran
@@ -30,6 +31,7 @@
 -Wcatch-value                          c++
 -Wcatch-value=<0,3>                    c++
 -Wcharacter-truncation                 fortran
+-Wchkp                                 deprecated
 -Wclass-memaccess                      c++
 -Wcompare-reals                                fortran
 -Wconditionally-supported              c++ and objc++
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index 60c0e4051..350c1355d 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -113,7 +113,6 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
   gl_manywarn_set=
   for gl_manywarn_item in -fno-common \
     -W \
-    -Wabi \
     -Waddress \
     -Waggressive-loop-optimizations \
     -Wall \
@@ -128,7 +127,6 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
     -Wcast-align=strict \
     -Wcast-function-type \
     -Wchar-subscripts \
-    -Wchkp \
     -Wclobbered \
     -Wcomment \
     -Wcomments \
--
2.18.0.rc2


>From 03fc6e299b3bdb255ee5f70fbec31feaf69717e8 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 24 Jun 2018 11:51:48 -0700
Subject: [PATCH 2/3] canon-host.c: avoid spurious GCC 9 warning

* lib/canon-host.c: Suppress GCC9's -Wsuggest-attribute=malloc.
---
 ChangeLog        | 3 +++
 lib/canon-host.c | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 546da3218..d325d42ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-06-24  Jim Meyering  <address@hidden>

+       canon-host.c: avoid spurious GCC 9 warning
+       * lib/canon-host.c: Suppress GCC9's -Wsuggest-attribute=malloc.
+
        manywarnings: accommodate GCC 9.0-pre: remove -Wchkp and -Wabi
        * build-aux/gcc-warning.spec: Add them here, each with an explanation.
        * m4/manywarnings.m4: Remove them.
diff --git a/lib/canon-host.c b/lib/canon-host.c
index f2a16a758..64afe1a0a 100644
--- a/lib/canon-host.c
+++ b/lib/canon-host.c
@@ -17,6 +17,12 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */

+/* Without this pragma, gcc version 9.0.0 20180616 suggests that
+   the canon_* functions might be candidateifor attribute 'malloc'  */
+#if 9 <= __GNUC__
+# pragma GCC diagnostic ignored "-Wsuggest-attribute=malloc"
+#endif
+
 #include <config.h>

 #include "canon-host.h"
--
2.18.0.rc2


>From 131b984c708d174366d5e6d224c5164a7225ee7c Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 24 Jun 2018 15:58:09 -0700
Subject: [PATCH 3/3] parse-datetime.y: avoid spurious GCC 9 warning

* lib/parse-datetime.y (parse_datetime2): Save RELATIVE_TIME_0 into
a function local prior to the first "goto fail".  The prior use would
evoke this:
parse-datetime.y: In function 'parse_datetime2':
parse-datetime.y:1791:19: error: jump skips variable initialization \
  [-Werror=jump-misses-init]
parse-datetime.y:2385:2: note: label 'fail' defined here
parse-datetime.y:188:43: note: '({anonymous})' declared here
parse-datetime.y:1841:12: note: in expansion of macro 'RELATIVE_TIME_0'
---
 ChangeLog            | 11 +++++++++++
 lib/parse-datetime.y |  7 ++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index d325d42ed..9d1a3e337 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2018-06-24  Jim Meyering  <address@hidden>

+       parse-datetime.y: avoid spurious GCC 9 warning
+       * lib/parse-datetime.y (parse_datetime2): Save RELATIVE_TIME_0 into
+       a function local prior to the first "goto fail".  The prior use would
+       evoke this:
+       parse-datetime.y: In function 'parse_datetime2':
+       parse-datetime.y:1791:19: error: jump skips variable initialization \
+         [-Werror=jump-misses-init]
+       parse-datetime.y:2385:2: note: label 'fail' defined here
+       parse-datetime.y:188:43: note: '({anonymous})' declared here
+       parse-datetime.y:1841:12: note: in expansion of macro 'RELATIVE_TIME_0'
+
        canon-host.c: avoid spurious GCC 9 warning
        * lib/canon-host.c: Suppress GCC9's -Wsuggest-attribute=malloc.

diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index f14bb31dc..3d8666a4d 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -1766,6 +1766,11 @@ parse_datetime2 (struct timespec *result, char const *p,

   timezone_t tz = tzdefault;

+  /* Store a local copy prior to first "goto".  Without this, a prior use
+     below of RELATIVE_TIME_0 on the RHS might translate to an assignment-
+     to-temporary, which would trigger a -Wjump-misses-init warning.  */
+  static const relative_time rel_time_0 = RELATIVE_TIME_0;
+
   if (strncmp (p, "TZ=\"", 4) == 0)
     {
       char const *tzbase = p + 4;
@@ -1838,7 +1843,7 @@ parse_datetime2 (struct timespec *result, char const *p,
   tm.tm_isdst = tmp.tm_isdst;

   pc.meridian = MER24;
-  pc.rel = RELATIVE_TIME_0;
+  pc.rel = rel_time_0;
   pc.timespec_seen = false;
   pc.rels_seen = false;
   pc.dates_seen = 0;
--
2.18.0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]