[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GRUB warning level increase
From: |
Grégoire Sutre |
Subject: |
Re: GRUB warning level increase |
Date: |
Sun, 12 Feb 2012 15:25:02 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111114 Iceowl/1.0b2 Icedove/3.1.16 |
On 02/10/2012 05:00 PM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
Hello, all. I have increased the warning level in GRUB. This is done for
quicker discovery and correction of the bugs which would be otherwise
hard to track. Mostly it enabled warnings regarding guidelines which are
already followed by GRUB.
On Debian GNU/Linux amd64 with GCC 4.6.2, I get a number of warnings
triggered by -Wunsafe-loop-optimizations. The first one is:
commands/lsacpi.c: In function 'grub_cmd_lsacpi':
commands/lsacpi.c:135:3: error: cannot optimize loop, the loop counter
may overflow [-Werror=unsafe-loop-optimizations]
commands/lsacpi.c:166:3: error: cannot optimize loop, the loop counter
may overflow [-Werror=unsafe-loop-optimizations]
cc1: all warnings being treated as errors
The attached patch fixes it. The remaining ones are, afaics, either
false positives or potential overflows in loops of the form:
for (i = 1; i <= foo; i++) { ... }
where i and foo have the same type (e.g., int). I'm not sure how to
properly fix those (declare i with a wider type? replace i by i+1 in
the whole loop to make the condition become i < foo?).
Grégoire
check-len.diff
Description: Text Data