<div dir="ltr"><br><br><div class="gmail_quote">On Thu, Apr 5, 2012 at 11:07 AM, Jonathan Ben Avraham <span dir="ltr"><<a href="mailto:yba@tkos.co.il">yba@tkos.co.il</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Nadav,<br>
Your point is well taken.<br>
<br>
-Werror has been in GCC for a long time (4.2.2 at least).<br>
<br>
I don't know how long it has been a default flag in the kernel, but I understand why it is. You really do want the compilation to stop and to take a look at what is going on.<br>
<br>
For other projects I think that the Makefile or build system that is distributed with the project should only use -Werror after checking that the GCC version is the same as the version used by the developers for the release.<br>
</blockquote><div><br></div><div>Same or earlier:</div><div>1. I expect compilers to identify more problems (some of which are annoying false positives) as they develop. </div><div>2. Who says all developers use the same compiler version?</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
- yba<br>
<br>
<br>
On Thu, 5 Apr <a href="tel:2012" value="+9722012" target="_blank">2012</a>, Nadav Har'El wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Date: Thu, 5 Apr <a href="tel:2012" value="+9722012" target="_blank">2012</a> 10:57:19 +0300<br>
From: Nadav Har'El <<a href="mailto:nyh@math.technion.ac.il" target="_blank">nyh@math.technion.ac.il</a>><br>
To: Oleg Goldshmidt <<a href="mailto:pub@goldshmidt.org" target="_blank">pub@goldshmidt.org</a>><br>
Cc: Jonathan Ben Avraham <<a href="mailto:yba@tkos.co.il" target="_blank">yba@tkos.co.il</a>>, ILUG <<a href="mailto:linux-il@cs.huji.ac.il" target="_blank">linux-il@cs.huji.ac.il</a>><br>
Subject: Re: [YBA] kernel compile errors with GCC >= 4.6<div><div></div><div class="h5"><br>
<br>
On Wed, Apr 04, <a href="tel:2012" value="+9722012" target="_blank">2012</a>, Oleg Goldshmidt wrote about "Re: [YBA] kernel compile errors with GCC >= 4.6":<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, Apr 4, <a href="tel:2012" value="+9722012" target="_blank">2012</a> at 10:03 AM, Jonathan Ben Avraham <<a href="mailto:yba@tkos.co.il" target="_blank">yba@tkos.co.il</a>>wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear linux-il colleagues,<br>
GCC 4.6 introduced many new warnings that cause -Werror to stop the<br>
compilation for some platforms, such as powerpc, in various files.<br>
</blockquote>
<br>
Oh, I didn't even know they finally introduced -Werror... Good.<br>
</blockquote>
<br>
Why is this good?<br>
<br>
In the (very) old days, there was a clear separation: The compiler<br>
gave you *errors*, and a separate program, call "lint",<br>
(<a href="http://en.wikipedia.org/wiki/Lint_%28software%29" target="_blank">http://en.wikipedia.org/wiki/<u></u>Lint_%28software%29</a>) was used to find<br>
various risky code, possible bugs, unused variables, and so on, and<br>
warn on them.<br>
<br>
I *don't* like the fact that modern compilers decide to complain on<br>
issues of questionable style, such having a variable which is never<br>
used, using "=" (deliberately, not ==) in an "if"'s expression, and so<br>
on. I like even less the trend to use something like "-Werror" to *abort*,<br>
not just warn, on these cases.<br>
<br>
After our last Hspell release, I started receiving complaints from<br>
various people who used slightly different compilers than I did, so got<br>
different *warnings* that I didn't get. This was very annoying, because<br>
although I could (and did) fix those warnings, most of them did not have<br>
any merit, and the only reason why I made many of these changes was to<br>
"appease" the compilers. In one example, the compiler wrongly deduced that a<br>
variable could be used before being set, which was false (I can explain why,<br>
but the details aren't important here). In another example, a header file<br>
defined a few static arrays, and not all of them were needed in each<br>
including file - and the compiler complained about the defined-but-not-used<br>
static arrays.<br>
<br>
I think all of this is bad. I agree that it's useful to have a tool<br>
(lint, gcc -Wall, or whatever), for the *developer* to find possible<br>
problems. But the developer shouldn't *have* to change the code to<br>
appease this tool, if he doesn't want to. The compiler that a *user*<br>
of this code uses should definitely not attempt to look for such<br>
"possible" problems, and most definitely should not abort the<br>
compilation if it finds some. The contract between the programmer and<br>
the user is that the programmer writes the code as carefully as he can -<br>
and the user tries the best he can to compile it, NOT find reasons for<br>
the compilation to fail. See also <a href="http://en.wikipedia.org/wiki/Postel%27s_law" target="_blank">http://en.wikipedia.org/wiki/<u></u>Postel%27s_law</a><br>
<br>
If -Werror is used in a big-enough project, there is a very high<br>
probability that compilation will always fail when a new version of the<br>
compiler is first tried. I fail to see why this is a good thing.<br>
<br>
<br>
</div></div></blockquote><font color="#888888">
<br>
-- <br>
EE 77 7F 30 4A 64 2E C5 83 5F E7 49 A6 <a href="tel:82%2029" value="+9728229" target="_blank">82 29</a> BA ~. .~ Tk Open Systems<br>
=}----------------------------<u></u>--------------------ooO--U--<u></u>Ooo------------{=<br>
- <a href="mailto:yba@tkos.co.il" target="_blank">yba@tkos.co.il</a> - tel: <a href="tel:%2B972.2.679.5364" value="+97226795364" target="_blank">+972.2.679.5364</a>, <a href="http://www.tkos.co.il" target="_blank">http://www.tkos.co.il</a> -</font><div>
<div></div><div class="h5"><br>
<br>
______________________________<u></u>_________________<br>
Linux-il mailing list<br>
<a href="mailto:Linux-il@cs.huji.ac.il" target="_blank">Linux-il@cs.huji.ac.il</a><br>
<a href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il" target="_blank">http://mailman.cs.huji.ac.il/<u></u>mailman/listinfo/linux-il</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Orna Agmon Ben-Yehuda.<br><a href="http://ladypine.org">http://ladypine.org</a><br>
</div>