Silence compiler warnings
This commit is contained in:
parent
79e8678313
commit
6be857f9b9
56
time-1.8-time-use-noreturn-to-pacify-gcc-7.patch
Normal file
56
time-1.8-time-use-noreturn-to-pacify-gcc-7.patch
Normal file
@ -0,0 +1,56 @@
|
||||
From 5d15357e0858bd4dcf2788420ea544459d9e9b24 Mon Sep 17 00:00:00 2001
|
||||
From: Assaf Gordon <assafgordon@gmail.com>
|
||||
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 <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
+#include <stdnoreturn.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
@@ -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
|
||||
|
||||
10
time.spec
10
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
|
||||
# <https://lists.gnu.org/archive/html/bug-time/2017-11/msg00001.html>
|
||||
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,
|
||||
# <http://lists.gnu.org/archive/html/bug-gnu-utils/2013-09/msg00003.html>
|
||||
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 <ppisar@redhat.com> - 1.8-2
|
||||
- Use upstream patch for POSIX mode
|
||||
- Silence compiler warnings
|
||||
|
||||
* Wed Nov 08 2017 Petr Pisar <ppisar@redhat.com> - 1.8-1
|
||||
- 1.8 bump
|
||||
|
||||
Loading…
Reference in New Issue
Block a user