This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
{Patch] Fix (fatal) warning in timevar.c
- From: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 30 Jan 2003 10:52:06 +1100 (EST)
- Subject: {Patch] Fix (fatal) warning in timevar.c
Patch fixes this (now fatal) warning:
../../gcc/gcc/timevar.c:51: warning: `struct rusage' declared inside parameter
list
../../gcc/gcc/timevar.c:51: warning: its scope is only this definition or
declaration, which is probably not what you want
make[2]: *** [timevar.o] Error 1
make[1]: *** [stage2_build] Error 2
make: *** [bootstrap] Error 2
Although times() and clock() do not have the same problem, I have
modified the guards for them as well for consistency.
Tested with i386-pc-mingw32 (trunk).
2003-01-29 Danny Smith <dannysmith@users.sourceforge.net>
* timevar.c (getrusage): Don't ever declare if not
HAVE_GETRUSAGE.
(times): Don't ever declare if not HAVE_TIMES.
(clock): Don't ever declare if not HAVE_CLOCK.
Index: timevar.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/timevar.c,v
retrieving revision 1.26
diff -c -3 -p -r1.26 timevar.c
*** timevar.c 15 Jan 2003 01:21:44 -0000 1.26
--- timevar.c 29 Jan 2003 23:31:24 -0000
*************** struct tms
*** 48,63 ****
};
#endif
- #if defined HAVE_DECL_GETRUSAGE && !HAVE_DECL_GETRUSAGE
- extern int getrusage PARAMS ((int, struct rusage *));
- #endif
- #if defined HAVE_DECL_TIMES && !HAVE_DECL_TIMES
- extern clock_t times PARAMS ((struct tms *));
- #endif
- #if defined HAVE_DECL_CLOCK && !HAVE_DECL_CLOCK
- extern clock_t clock PARAMS ((void));
- #endif
-
#ifndef RUSAGE_SELF
# define RUSAGE_SELF 0
#endif
--- 48,53 ----
*************** extern clock_t clock PARAMS ((void));
*** 81,97 ****
--- 71,96 ----
/* Prefer times to getrusage to clock (each gives successively less
information). */
#ifdef HAVE_TIMES
+ # if defined HAVE_DECL_TIMES && !HAVE_DECL_TIMES
+ extern clock_t times PARAMS ((struct tms *));
+ # endif
# define USE_TIMES
# define HAVE_USER_TIME
# define HAVE_SYS_TIME
# define HAVE_WALL_TIME
#else
#ifdef HAVE_GETRUSAGE
+ # if defined HAVE_DECL_GETRUSAGE && !HAVE_DECL_GETRUSAGE
+ extern int getrusage PARAMS ((int, struct rusage *));
+ # endif
# define USE_GETRUSAGE
# define HAVE_USER_TIME
# define HAVE_SYS_TIME
#else
#ifdef HAVE_CLOCK
+ # if defined HAVE_DECL_CLOCK && !HAVE_DECL_CLOCK
+ extern clock_t clock PARAMS ((void));
+ # endif
# define USE_CLOCK
# define HAVE_USER_TIME
#endif
http://movies.yahoo.com.au - Yahoo! Movies
- What's on at your local cinema?