On Friday, September 8, 2017 12:06:22 PM CEST Sergey Poznyakoff wrote: > Paul Eggert <egg...@cs.ucla.edu> ha escrit: > > > I suggest ignoring the warning globally by pragma (i.e., in > > configure.ac) since it's more trouble than it's worth for tar. > > Agreed.
Please have a look at the attached patch then. Pavel
>From 144ce3bc94bc38e9170bce7eb9cc870ed0638ac6 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup <prais...@redhat.com> Date: Fri, 8 Sep 2017 08:26:01 +0200 Subject: [PATCH] Fix/silence GCC 7 warnings Per https://www.mail-archive.com/bug-tar@gnu.org/msg05347.html * configure.ac: Lower GCC's -Wimplicit-fallthrough from 5 to 1 and avoid using -Wformat-overflow. * lib/wordsplit.c (wordsplit_perror): Add missing break. * src/sparse.c (sparse_scan_file): Explicitly mention fallback. * src/tar.c (parse_opt): Use abort to assure compiler that argp_error doesn't return in this case. * gnulib: Move to the latest version. --- configure.ac | 2 ++ gnulib | 2 +- lib/wordsplit.c | 1 + src/sparse.c | 1 + src/tar.c | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e89ed1d..be3809d 100644 --- a/configure.ac +++ b/configure.ac @@ -151,6 +151,7 @@ if test "$gl_gcc_warnings" = yes; then nw="$nw -Wstrict-overflow" # It's OK to optimize strictly. nw="$nw -Wsuggest-attribute=pure" # Too many warnings for now. nw="$nw -Wstack-protector" + nw="$nw -Wformat-overflow=2" gl_MANYWARN_ALL_GCC([ws]) gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw]) @@ -164,6 +165,7 @@ if test "$gl_gcc_warnings" = yes; then gl_WARN_ADD([-fdiagnostics-show-option]) gl_WARN_ADD([-funit-at-a-time]) + gl_WARN_ADD([-Wimplicit-fallthrough=1]) # Be more tolerant to fall-through comments AC_SUBST([WARN_CFLAGS]) diff --git a/gnulib b/gnulib index e210a3c..3ba4dba 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit e210a3cbaec0ee82a67ff8fc427e21bdd64dba1b +Subproject commit 3ba4dbaefe671991083ff46a2714ff256adf75a1 diff --git a/lib/wordsplit.c b/lib/wordsplit.c index 07d0f8a..f2ecada 100644 --- a/lib/wordsplit.c +++ b/lib/wordsplit.c @@ -1584,6 +1584,7 @@ wordsplit_perror (struct wordsplit *wsp) case WRDSE_NOSUPP: wsp->ws_error (_("command substitution is not yet supported")); + break; case WRDSE_USAGE: wsp->ws_error (_("invalid wordsplit usage")); diff --git a/src/sparse.c b/src/sparse.c index b3a3fd3..5bd2b01 100644 --- a/src/sparse.c +++ b/src/sparse.c @@ -361,6 +361,7 @@ sparse_scan_file (struct tar_sparse_file *file) /* fall back to "raw" for this and all other files */ hole_detection = HOLE_DETECTION_RAW; #endif + /* fallthrough */ case HOLE_DETECTION_RAW: if (sparse_scan_file_raw (file)) return true; diff --git a/src/tar.c b/src/tar.c index 07a6995..4006060 100644 --- a/src/tar.c +++ b/src/tar.c @@ -2068,6 +2068,7 @@ parse_opt (int key, char *arg, struct argp_state *state) _("Options '-[0-7][lmh]' not supported by *this* tar")); #endif /* not DEVICE_PREFIX */ + abort (); case ARGP_KEY_ERROR: if (args->loc->source == OPTS_FILE) -- 2.13.5