On Tue, Dec 10, 2013 at 12:13:09AM +0100, Lukas Tribus wrote: > Hi Igor, > > > > include/common/time.h:111:29: warning: implicit conversion from > > 'unsigned long' to '__darwin_suseconds_t' (aka 'int') changes value > > from > > 18446744073709551615 to -1 [-Wconstant-conversion] > > tv->tv_sec = tv->tv_usec = TV_ETERNITY; > > ~ ^~~~~~~~~~~ > > include/common/time.h:32:26: note: expanded from macro 'TV_ETERNITY' > > > > Can I ignore this warning even the compile succeed? Thanks for any > > suggestion. > > > Not sure, could you git bisect this?
Last change here dates from 2007. Compilers tend to report more and more warnings in recent versions, and systems use a wide variety of types for time. Igor, could you please confirm that the attached patch fixes the issue ? If so, I'll merge it. Thanks, Willy
>From 5f3f15f6186d27343b9d346714ea2ad1aa9a8e46 Mon Sep 17 00:00:00 2001 From: Willy Tarreau <[email protected]> Date: Fri, 13 Dec 2013 09:22:23 +0100 Subject: BUILD: time: adapt the type of TV_ETERNITY to the local system Some systems use different types for tv_sec/tv_usec, some are signed others not. From time to time new warnings are reported about implicit casts being done. This patch ensures that TV_ETERNITY is cast to the appropriate type in assignments and conversions. --- include/common/time.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/common/time.h b/include/common/time.h index 5d86ad5..8be4718 100644 --- a/include/common/time.h +++ b/include/common/time.h @@ -108,7 +108,8 @@ REGPRM2 void tv_update_date(int max_wait, int interrupted); */ REGPRM1 static inline struct timeval *tv_eternity(struct timeval *tv) { - tv->tv_sec = tv->tv_usec = TV_ETERNITY; + tv->tv_sec = (typeof(tv->tv_sec))TV_ETERNITY; + tv->tv_usec = (typeof(tv->tv_usec))TV_ETERNITY; return tv; } @@ -124,12 +125,12 @@ REGPRM1 static inline struct timeval *tv_zero(struct timeval *tv) { /* * returns non null if tv is [eternity], otherwise 0. */ -#define tv_iseternity(tv) ((tv)->tv_usec == TV_ETERNITY) +#define tv_iseternity(tv) ((tv)->tv_usec == (typeof((tv)->tv_usec))TV_ETERNITY) /* * returns 0 if tv is [eternity], otherwise non-zero. */ -#define tv_isset(tv) ((tv)->tv_usec != TV_ETERNITY) +#define tv_isset(tv) ((tv)->tv_usec != (typeof((tv)->tv_usec))TV_ETERNITY) /* * returns non null if tv is [0], otherwise 0. -- 1.7.12.2.21.g234cd45.dirty

