Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDBF-348: Correct AIX cast warning (my_time.h) #2079

Closed
wants to merge 1 commit into from

Conversation

grooverdan
Copy link
Member

tv_usec is a (suseconds_t) so we cast to it. Prevents the warning that occurs quite significantly on AIX:

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);
|

(gcc-10)

On Windows suseconds_t isn't defined so we use the existing
long return type of my_time_fraction_remainder.

tv_usec is a (suseconds_t) so we cast to it. Prevents the 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);
      |

(gcc-10)

On Windows suseconds_t isn't defined so we use the existing
long return type of my_time_fraction_remainder.
@dr-m
Copy link
Contributor

dr-m commented Apr 1, 2022

Would this fix MDEV-26136, which was originally reported for macOS?

@@ -244,9 +244,12 @@ static inline void my_time_trunc(MYSQL_TIME *ltime, uint decimals)
!ltime->hour && !ltime->minute && !ltime->second)
ltime->neg= FALSE;
}
#ifdef __WIN__
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_WIN32 wins the popularity contest in 10.5 over __WIN__, so perhaps we would want to use that.

@grooverdan
Copy link
Member Author

grooverdan commented Apr 1, 2022

highly probable given the timeval structure in https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/gettimeofday.2.html

Given MDEV-26136, this could go back to 10.2 as well.

grooverdan added a commit that referenced this pull request Apr 3, 2022
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
@grooverdan
Copy link
Member Author

closed in #75b9014 (10.2) with Marko's change and BB passing.

@grooverdan grooverdan closed this Apr 4, 2022
@grooverdan grooverdan deleted the bb-10.5-danielblack-MDBF-348-aix-warnings branch April 4, 2022 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants