All of lore.kernel.org
 help / color / mirror / Atom feed
* -Werror and --disable-werror
@ 2009-09-16 19:42 Robert Millan
  2009-09-16 19:48 ` Robert Millan
  2009-09-19 14:12 ` Vladimir 'phcoder' Serbinenko
  0 siblings, 2 replies; 6+ messages in thread
From: Robert Millan @ 2009-09-16 19:42 UTC (permalink / raw)
  To: grub-devel


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).

Since -Werror may be a problem in some situations, I've added a
--disable-werror switch, which does the obvious thing.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: -Werror and --disable-werror
  2009-09-16 19:42 -Werror and --disable-werror Robert Millan
@ 2009-09-16 19:48 ` Robert Millan
  2009-09-19 14:12 ` Vladimir 'phcoder' Serbinenko
  1 sibling, 0 replies; 6+ messages in thread
From: Robert Millan @ 2009-09-16 19:48 UTC (permalink / raw)
  To: grub-devel

On Wed, Sep 16, 2009 at 09:42:14PM +0200, Robert Millan wrote:
> 
> Hi,
> 
> -Werror is not in effect.

Erm.  s/not/now/g.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: -Werror and --disable-werror
  2009-09-16 19:42 -Werror and --disable-werror Robert Millan
  2009-09-16 19:48 ` Robert Millan
@ 2009-09-19 14:12 ` Vladimir 'phcoder' Serbinenko
  2009-09-19 20:38   ` Robert Millan
  2009-09-20  6:46   ` richardvoigt
  1 sibling, 2 replies; 6+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-09-19 14:12 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: rmh

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)
        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
> Since -Werror may be a problem in some situations, I've added a
> --disable-werror switch, which does the obvious thing.
>
>   




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: -Werror and --disable-werror
  2009-09-19 14:12 ` Vladimir 'phcoder' Serbinenko
@ 2009-09-19 20:38   ` Robert Millan
  2009-09-20  6:46   ` richardvoigt
  1 sibling, 0 replies; 6+ messages in thread
From: Robert Millan @ 2009-09-19 20:38 UTC (permalink / raw)
  To: Vladimir 'phcoder' Serbinenko; +Cc: The development of GRUB 2

On Sat, Sep 19, 2009 at 04:12:59PM +0200, Vladimir 'phcoder' Serbinenko 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)
>         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

Oh, I see.  Well, since in this case there's no bug, as long as the warning
is gone it should be ok.  Any other idea on how to archieve that?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: -Werror and --disable-werror
  2009-09-19 14:12 ` Vladimir 'phcoder' Serbinenko
  2009-09-19 20:38   ` Robert Millan
@ 2009-09-20  6:46   ` richardvoigt
  2009-09-20  8:28     ` Vladimir 'phcoder' Serbinenko
  1 sibling, 1 reply; 6+ messages in thread
From: richardvoigt @ 2009-09-20  6:46 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: rmh

On Sat, Sep 19, 2009 at 9:12 AM, Vladimir 'phcoder' Serbinenko
<phcoder@gmail.com> 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
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: -Werror and --disable-werror
  2009-09-20  6:46   ` richardvoigt
@ 2009-09-20  8:28     ` Vladimir 'phcoder' Serbinenko
  0 siblings, 0 replies; 6+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-09-20  8:28 UTC (permalink / raw)
  To: The development of GRUB 2

richardvoigt@gmail.com wrote:
> On Sat, Sep 19, 2009 at 9:12 AM, Vladimir 'phcoder' Serbinenko
> <phcoder@gmail.com> 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.
>
>   
Read the code. There is a comment
>>        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.
>
>   
We optimise for size, not for speed.
>>> 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
>> Grub-devel@gnu.org
>> http://lists.gnu.org/mailman/listinfo/grub-devel
>>
>>     
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>   




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-09-20  8:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-16 19:42 -Werror and --disable-werror Robert Millan
2009-09-16 19:48 ` Robert Millan
2009-09-19 14:12 ` Vladimir 'phcoder' Serbinenko
2009-09-19 20:38   ` Robert Millan
2009-09-20  6:46   ` richardvoigt
2009-09-20  8:28     ` Vladimir 'phcoder' Serbinenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.