diff options
author | Daniel Black <daniel@mariadb.org> | 2022-04-01 16:07:12 +1100 |
---|---|---|
committer | Daniel Black <daniel@mariadb.org> | 2022-04-04 08:31:40 +1000 |
commit | 75b9014fedd8bb85d15501a2281fbade6b56fe78 (patch) | |
tree | 1567c7c70ea3eff3717563f3bedd0642a132885a | |
parent | c1ab0e6fc6b390965e03867bd010b58b1c5cf29e (diff) | |
download | mariadb-git-75b9014fedd8bb85d15501a2281fbade6b56fe78.tar.gz |
MDEV-26136: Correct AIX/macOS cast warning (my_time.h)
tv_usec is a (suseconds_t) so we cast to it. Prevents the AIX(gcc-10) warning:
include/my_time.h: In function 'void my_timeval_trunc(timeval*, uint)':
include/my_time.h:249:65: warning: conversion from 'long int' to 'suseconds_t' {aka 'int'} may change value [-Wconversion]
249 | tv->tv_usec-= my_time_fraction_remainder(tv->tv_usec, decimals);
|
macOS is: conversion from 'long int' to '__darwin_suseconds_t' {aka 'int'} may change value
On Windows suseconds_t isn't defined so we use the existing
long return type of my_time_fraction_remainder.
Reviewed by Marko Mäkelä
Closes: #2079
-rw-r--r-- | include/my_time.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/my_time.h b/include/my_time.h index eeb790cdb54..9fb3bf199bf 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -220,9 +220,12 @@ static inline void my_time_trunc(MYSQL_TIME *ltime, uint decimals) { ltime->second_part-= my_time_fraction_remainder(ltime->second_part, decimals); } +#ifdef _WIN32 +#define suseconds_t long +#endif static inline void my_timeval_trunc(struct timeval *tv, uint decimals) { - tv->tv_usec-= my_time_fraction_remainder(tv->tv_usec, decimals); + tv->tv_usec-= (suseconds_t) my_time_fraction_remainder(tv->tv_usec, decimals); } |