On Sun, Feb 27, 2022 at 3:04 PM Alex Elder elder@linaro.org wrote:
Glancing at the Greybus code, I don't believe there's any reason it needs to shift a negative value. Such warnings could be fixed by making certain variables unsigned, for example.
As mentioned in the original thread, making things unsigned actually is likely to introduce bugs and make things worse.
The warning is simply bogus, and the fact that it was enabled by -Wextra in gcc for std=gnu99 and up was a mistake that looks likely to be fixed in gcc.
So don't try to "fix" the code to make any possible warnings go away. You may just make things worse.
(That is often true in general for the more esoteric warnings, but in this case it's just painfully more obvious).
Linus