[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/12] timevar: don't declare getrusage if we don't use it
From: |
Akim Demaille |
Subject: |
[PATCH 12/12] timevar: don't declare getrusage if we don't use it |
Date: |
Sat, 22 Sep 2018 13:49:48 +0200 |
This fails on MinGW.
Reported by Simon Sobisch.
http://lists.gnu.org/archive/html/bug-bison/2018-09/msg00058.html
* lib/timevar.c: Don't provide default prototypes for functions
we don't use.
---
lib/timevar.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/lib/timevar.c b/lib/timevar.c
index ded64901..cccc61f2 100644
--- a/lib/timevar.c
+++ b/lib/timevar.c
@@ -48,16 +48,6 @@ struct tms
};
#endif
-#if defined HAVE_DECL_GETRUSAGE && !HAVE_DECL_GETRUSAGE
-int getrusage (int, struct rusage *);
-#endif
-#if defined HAVE_DECL_TIMES && !HAVE_DECL_TIMES
-clock_t times (struct tms *);
-#endif
-#if defined HAVE_DECL_CLOCK && !HAVE_DECL_CLOCK
-clock_t clock (void);
-#endif
-
/* Calculation of scale factor to convert ticks to microseconds.
We mustn't use CLOCKS_PER_SEC except with clock(). */
#if HAVE_SYSCONF && defined _SC_CLK_TCK
@@ -86,6 +76,14 @@ clock_t clock (void);
# define HAVE_USER_TIME
#endif
+#if defined USE_TIMES && !defined HAVE_DECL_TIMES
+clock_t times (struct tms *);
+#elif defined USE_GETRUSAGE && !defined HAVE_DECL_GETRUSAGE
+int getrusage (int, struct rusage *);
+#elif defined USE_CLOCK && !defined HAVE_DECL_CLOCK
+clock_t clock (void);
+#endif
+
/* libc is very likely to have snuck a call to sysconf() into one of
the underlying constants, and that can be very slow, so we have to
precompute them. Whose wonderful idea was it to make all those
@@ -172,7 +170,7 @@ set_to_current_time (struct timevar_time_def *now)
{
#ifdef USE_TIMES
struct tms tms;
- now->wall = times (&tms) * ticks_to_msec;
+ now->wall = times (&tms) * ticks_to_msec;
now->user = (tms.tms_utime + tms.tms_cutime) * ticks_to_msec;
now->sys = (tms.tms_stime + tms.tms_cstime) * ticks_to_msec;
#elif defined USE_GETRUSAGE
--
2.19.0
- [PATCH 00/12] timevar: clean up, for a possible integration to gnulib, Akim Demaille, 2018/09/22
- [PATCH 01/12] timevar: remove remains of GCC, Akim Demaille, 2018/09/22
- [PATCH 03/12] timevar: prefer #elif, Akim Demaille, 2018/09/22
- [PATCH 02/12] timevar: assume ANSI C, Akim Demaille, 2018/09/22
- [PATCH 04/12] timevar: we don't care about backward compatibility, Akim Demaille, 2018/09/22
- [PATCH 05/12] timevar: rename init_timevar as timevar_init, Akim Demaille, 2018/09/22
- [PATCH 06/12] timevar: remove useless 'extern' for prototypes, Akim Demaille, 2018/09/22
- [PATCH 12/12] timevar: don't declare getrusage if we don't use it,
Akim Demaille <=
- [PATCH 08/12] timevar: reduce scopes, Akim Demaille, 2018/09/22
- [PATCH 07/12] timevar: document in the header, not in the implementation, Akim Demaille, 2018/09/22
- [PATCH 10/12] timevar: introduce and use get_current_time, Akim Demaille, 2018/09/22
- [PATCH 11/12] timevar: get rid of a useless macro, Akim Demaille, 2018/09/22
- [PATCH 09/12] timevar: rename get_time as set_to_current_time, Akim Demaille, 2018/09/22