-
Notifications
You must be signed in to change notification settings - Fork 8.2k
drivers: sensor: lsm6dl fixing -Wdouble-promotion warning #68285
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
Conversation
Fixing this "revealed" bug which got introduced when a PR added the -Wdouble-promotion flag to GCC builds Signed-off-by: Francois Ramu <francois.ramu@st.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really what we want? Shouldn't the fix be to change SENSI_GRAIN_XL to a float instead of a double by adding f to the constant:
#define SENSI_GRAIN_XL (61 / 1000.0f)I think it's better than to force using doubles here.
I tend to agree. |
Sure but I do not see this is enough. Warning messages remain |
|
I approved here, as it is the simplest solution. Nevertheless I guess that all that sensitivity values there could be expressed as ug/LSB using just a uint32_t. Obviously all the "GRAINS" definition should be expressed in ug/LSB as well (e.g. |
|
@yperess The problem is that this warning shows up un CI in other PRs and hence is blocking them. I suggest approving this one and raising an issue for improvement (or a bug as you wish). I know that this is exactly why warning are there, but point is now detected. It doesn't have to be blocking. |
I'm sorry, I need a little more detail, out_ev is defined: static inline float out_ev(struct sensor_value *val)
{
return (val->val1 + (float)val->val2 / 1000000);
}In this case In my experience when we cover up these warnings, nobody ever goes back and fixes them. I would really prefer to just see a proper solution instead of moving to doubles which are much more costly. |
|
Can this be closed now that #68549 was merged? |
I guess so. It seems to me that the blocked PR have eventually been merged |
|
Closing |
Fixing this "revealed" bug which got introduced when a PR added the -Wdouble-promotion flag to GCC builds
Based on the recent PR #68237
Fixes #68284