From 6be857f9b9070a697529da3aad2d099dd0fac597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Thu, 9 Nov 2017 12:37:06 +0100 Subject: [PATCH] Silence compiler warnings --- ....8-time-use-noreturn-to-pacify-gcc-7.patch | 56 +++++++++++++++++++ time.spec | 10 +++- 2 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 time-1.8-time-use-noreturn-to-pacify-gcc-7.patch diff --git a/time-1.8-time-use-noreturn-to-pacify-gcc-7.patch b/time-1.8-time-use-noreturn-to-pacify-gcc-7.patch new file mode 100644 index 0000000..3fbe568 --- /dev/null +++ b/time-1.8-time-use-noreturn-to-pacify-gcc-7.patch @@ -0,0 +1,56 @@ +From 5d15357e0858bd4dcf2788420ea544459d9e9b24 Mon Sep 17 00:00:00 2001 +From: Assaf Gordon +Date: Wed, 8 Nov 2017 14:49:51 -0700 +Subject: [PATCH] time: use noreturn to pacify gcc-7 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reported by Jim Meyering in +https://lists.gnu.org/archive/html/bug-time/2017-11/msg00000.html . + +gcc-7 with --enable-gcc-warnings would warn about: + + src/time.c: In function 'getargs': + src/time.c:664:4: warning: this statement may fall through + [-Wimplicit-fallthrough=] + usage (EXIT_SUCCESS); + ^~~~~~~~~~~~~~~~~~~~ + src/time.c:665:2: note: here + case 'o': + ^~~~ + +This is a false-positive as usage() calls exit(3) and never returns +(but gcc seems unable to deduce that). + +Use noreturn to suppress the warning. + +* bootstrap.conf: Add gnulib's stdnoreturn module. +* src/time.c (usage): Mark as 'noreturn'. + +Petr Písař: Ported to 1.8. + +diff --git a/src/time.c b/src/time.c +index 6fa6c87..9047374 100644 +--- a/src/time.c ++++ b/src/time.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -214,7 +215,7 @@ static struct option longopts[] = + # define PROGRAM_NAME "time" + + +-static void ++noreturn static void + usage (int status) + { + if (status != EXIT_SUCCESS) +-- +2.13.6 + diff --git a/time.spec b/time.spec index 524b5a9..d6bc598 100644 --- a/time.spec +++ b/time.spec @@ -33,14 +33,16 @@ Source: ftp://prep.ai.mit.edu/pub/gnu/%{name}/%{name}-%{version}.tar.gz # Do not print command failure in POSIX mode, in upstream after 1.8 # Patch0: time-1.8-time-remove-Command-exited-with-non-zero-status-in-P.patch +# Silent compiler warnings, in upstream after 1.8 +Patch1: time-1.8-time-use-noreturn-to-pacify-gcc-7.patch # Correct test added in # time-remove-Command-exited-with-non-zero-status-in-P.patch -Patch1: time-1.8-Accept-numeric-values-in-tests-time-posix-quiet.sh.patch +Patch2: time-1.8-Accept-numeric-values-in-tests-time-posix-quiet.sh.patch # Bug #527276 -Patch2: time-1.8-Recompute-CPU-usage-at-microsecond-level.patch +Patch3: time-1.8-Recompute-CPU-usage-at-microsecond-level.patch # Fix measuring time when a clock experiences a jump, bug #1004416, # -Patch3: time-1.8-Prefer-clock_gettime-CLOCK_MONOTONIC.patch +Patch4: time-1.8-Prefer-clock_gettime-CLOCK_MONOTONIC.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: bash @@ -65,6 +67,7 @@ chmod +x tests/time-posix-quiet.sh %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 autoreconf -fi %build @@ -98,6 +101,7 @@ fi %changelog * Thu Nov 09 2017 Petr Pisar - 1.8-2 - Use upstream patch for POSIX mode +- Silence compiler warnings * Wed Nov 08 2017 Petr Pisar - 1.8-1 - 1.8 bump