Skip to main content
Topic: [PATCH] fix some compiler warnings (Read 5948 times) previous topic - next topic

[PATCH] fix some compiler warnings

Hi,

This patch series fixes some compiler warning with gcc 4.3.1.  They are mostly of the form
Quote
warning: suggest parentheses around && within ||

I think one of them was a bug, see the first patch.

Regards,
Ansgar

PS: I think a mailing list to send patches to would be more comfortable :-)

Re: [PATCH] fix some compiler warnings

Reply #1
The patch for line id seems wrong too me, really a number above 12345 is desired ... But there was indeed an error with the map. Thank you.

And given the amount of patches submitted in the last year (above 30) so far this forum does well. But if the number increases we can think of setting up a mailing list. (Another possibility would be opening of the tracker at sourceforge.)

Re: [PATCH] fix some compiler warnings

Reply #2
Code: [Select]
-		id += 12345+(7*id)&0x0FFF;
+ id += (12345 + 7*id) & 0x0FFF;

Operator precedence in C is *, +, & (with * being the strongest), so the first line is the same as
Code: [Select]
id += (12345 + (7*id)) & 0x0FFF;
then I only dropped the parenthesis around the multiplication.

All patches except the first one should not change the behavior of the program in any way.

Ansgar

 

Re: [PATCH] fix some compiler warnings

Reply #3
Then the code did not do what it was intended to do. Then this is another cases of warnings showing an error.