#endif
#ifndef NO_CLOCK
- STATIC CLOCK_TYPE GC_start_time = 0;
+ STATIC CLOCK_TYPE GC_start_time = CLOCK_TYPE_INITIALIZER;
/* Time at which we stopped world. */
/* used only in GC_timeout_stop_func. */
#endif
GC_INNER GC_bool GC_try_to_collect_inner(GC_stop_func stop_func)
{
# ifndef NO_CLOCK
- CLOCK_TYPE start_time = 0; /* initialized to prevent warning. */
+ CLOCK_TYPE start_time = CLOCK_TYPE_INITIALIZER;
GC_bool start_time_valid;
# endif
{
unsigned i;
# ifndef NO_CLOCK
- CLOCK_TYPE start_time = 0; /* initialized to prevent warning. */
+ CLOCK_TYPE start_time = CLOCK_TYPE_INITIALIZER;
# endif
GC_ASSERT(I_HOLD_LOCK());
STATIC void GC_finish_collection(void)
{
# ifndef NO_CLOCK
- CLOCK_TYPE start_time = 0; /* initialized to prevent warning. */
- CLOCK_TYPE finalize_time = 0;
+ CLOCK_TYPE start_time = CLOCK_TYPE_INITIALIZER;
+ CLOCK_TYPE finalize_time = CLOCK_TYPE_INITIALIZER;
# endif
GC_ASSERT(I_HOLD_LOCK());
# undef GET_TIME
# undef MS_TIME_DIFF
# define CLOCK_TYPE struct timeval
+# define CLOCK_TYPE_INITIALIZER { 0, 0 }
# define GET_TIME(x) \
do { \
struct rusage rusage; \
/* Avoid using double type since some targets (like ARM) might */
/* require -lm option for double-to-long conversion. */
#endif /* !BSD_TIME && !MSWIN32 */
+# ifndef CLOCK_TYPE_INITIALIZER
+ /* This is used to initialize CLOCK_TYPE variables (to some value) */
+ /* to avoid "variable might be uninitialized" compiler warnings. */
+# define CLOCK_TYPE_INITIALIZER 0
+# endif
#endif /* !NO_CLOCK */
/* We use bzero and bcopy internally. They may not be available. */
struct hblk ** rlp;
struct hblk ** rlh;
# ifndef NO_CLOCK
- CLOCK_TYPE start_time = 0; /* initialized to prevent warning. */
+ CLOCK_TYPE start_time = CLOCK_TYPE_INITIALIZER;
if (GC_print_stats == VERBOSE)
GET_TIME(start_time);