Skip to contentSkip to conversation

-Werror and --disable-werror

DISCUSSION Robert Millan 3 participants 6 messages Sep 16, 2009 – Sep 20, 2009

lore
Share & tools
lore
#0 lore raw

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.

Signature · 5 lines
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."
#1 lore raw
Quoted 4 lines · Robert Millan

Hi,

-Werror is not in effect.

Erm. s/not/now/g.

Signature · 5 lines
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."
#2 lore raw
In reply to Robert Millan
Quoted 7 lines · Robert Millan

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

Quoted 4 lines

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

#3 lore raw
Quoted 23 lines · Vladimir 'phcoder' Serbinenko
Quoted 7 lines · Robert Millan

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:

(quoted diff) +4 -0
+  /* 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;
Quoted 2 lines

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?

Signature · 5 lines
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."
#4 lore raw
In reply to Vladimir 'phcoder' Serbinenko
Quoted 15 lines · Vladimir 'phcoder' Serbinenko
Quoted 7 lines · Robert Millan

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;
+

Quoted 6 lines

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.

Quoted 4 lines

       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.

Quoted 12 lines
Quoted 4 lines

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
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

#5 lore raw
Quoted 24 lines · [email protected] wrote:
Quoted 21 lines · Vladimir 'phcoder' Serbinenko
Quoted 8 lines · Robert Millan

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:

(quoted diff) +4 -0
+  /* 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");
Quoted 10 lines
Quoted 3 lines
     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

Quoted 10 lines
Quoted 5 lines
       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.

Quoted 20 lines
Quoted 6 lines
Quoted 5 lines

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

Quoted 6 lines

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel