timevar: don't declare getrusage if we don't use it

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.
This commit is contained in:
Akim Demaille
2018-09-22 11:12:54 +02:00
parent 9dfd46a5d5
commit a990213582
2 changed files with 10 additions and 11 deletions

1
THANKS
View File

@@ -146,6 +146,7 @@ Sebastian Setzer sebastian.setzer.ext@siemens.com
Sebastien Fricker sebastien.fricker@gmail.com Sebastien Fricker sebastien.fricker@gmail.com
Sergei Steshenko sergstesh@yahoo.com Sergei Steshenko sergstesh@yahoo.com
Shura debil_urod@ngs.ru Shura debil_urod@ngs.ru
Simon Sobisch simonsobisch@web.de
Stefano Lattarini stefano.lattarini@gmail.com Stefano Lattarini stefano.lattarini@gmail.com
Stephen Cameron stephenmcameron@gmail.com Stephen Cameron stephenmcameron@gmail.com
Steve Murphy murf@parsetree.com Steve Murphy murf@parsetree.com

View File

@@ -48,16 +48,6 @@ struct tms
}; };
#endif #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. /* Calculation of scale factor to convert ticks to microseconds.
We mustn't use CLOCKS_PER_SEC except with clock(). */ We mustn't use CLOCKS_PER_SEC except with clock(). */
#if HAVE_SYSCONF && defined _SC_CLK_TCK #if HAVE_SYSCONF && defined _SC_CLK_TCK
@@ -86,6 +76,14 @@ clock_t clock (void);
# define HAVE_USER_TIME # define HAVE_USER_TIME
#endif #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 /* 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 the underlying constants, and that can be very slow, so we have to
precompute them. Whose wonderful idea was it to make all those 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 #ifdef USE_TIMES
struct tms tms; 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->user = (tms.tms_utime + tms.tms_cutime) * ticks_to_msec;
now->sys = (tms.tms_stime + tms.tms_cstime) * ticks_to_msec; now->sys = (tms.tms_stime + tms.tms_cstime) * ticks_to_msec;
#elif defined USE_GETRUSAGE #elif defined USE_GETRUSAGE