Messages in this thread |  | | Date | Sun, 27 Feb 2022 17:57:52 -0600 | Subject | Re: [greybus-dev] [PATCH] Kbuild: remove -std=gnu89 from compiler arguments | From | Alex Elder <> |
| |
On 2/27/22 5:11 PM, Linus Torvalds wrote: > 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.
Understood. What I meant is that the shifts were producing single-bit masks from plain int values that range from 0 to 10 or something (in a for loop). Looking again though, that it's not so simple. Regardless, your point about the warning is good and I won't plan to "fix" this.
Thanks.
-Alex > > 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
|  |