grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -Werror and --disable-werror


From: address@hidden
Subject: Re: -Werror and --disable-werror
Date: Sun, 20 Sep 2009 01:46:25 -0500

On Sat, Sep 19, 2009 at 9:12 AM, Vladimir 'phcoder' Serbinenko
<address@hidden> wrote:
> Robert Millan wrote:
>> Hi,
>>
>> -Werror is not in effect.  This will help ensuring that all new code is
>> checked to be warning-free before commit (incidentally, I found a newly
>> introduced bug thanks to this just minutes before enabling it).
>>
>>
> If you mean this change:
>
> +  /* Any value different than `p.offset' will satisfy the check during
> +     first loop.  */
> +  lastaddr = !p.offset;
> +
>
> Then there was no bug here.
>      if (labeln && lastaddr == p.offset)
>        return grub_error (GRUB_ERR_BAD_PART_TABLE, "loop detected");
>
>      labeln++;
>      if ((labeln & (labeln - 1)) == 0)

This is a check for being an integral power of 2 (or 0), i.e. having a
single bit set.  Was that the intent?  It's probably worth an
explanatory comment for the sake of those who aren't familiar with the
test.

>        lastaddr = p.offset;
>
> labeln is 0 during first loop run and then lastaddr is set. I explicitly
> omitted initing variables to have smaller loop detector

I suspect initializing lastaddr, which takes place outside the loop,
is less expensive than testing labeln on every iteration.

>> Since -Werror may be a problem in some situations, I've added a
>> --disable-werror switch, which does the obvious thing.
>>
>>
>
>
>
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/grub-devel
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]