speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH] Fix most warnings with gcc 4.4 on Linux


From: Boris Dusek
Subject: [PATCH] Fix most warnings with gcc 4.4 on Linux
Date: Tue, 7 Sep 2010 21:27:16 +0200

On Sep 7, 2010, at 7:10 PM, Trevor Saunders wrote:

>> be the time to celebrate by turning on -Werror :-)
> 
> no errors is very nice, but imho werror is a pain, and should never be
> in the production branch of a makefile.  when I'm building $random_project I
> don't want the build to fail because of some sily warning.  Personally I just
> run a script that runs a complete rebuild, and gets rid of normal make 
> messages,
> leaving only warnings, and 0 warnings makes this easier.  The issue with
> werror is that while working on stuff you have to make sure your code
> doesn't have silly warnings like the mixed declarations and code one.
> At least the way I work I want to make it work correctly before I worry
> about neatness, but that may just be me.

I gave this a bit of thought, and came to the conclusion that -Werror should
not be present by default. -Werror can be useful to developers: on longer build
(and I consider SD's build longer), the build log is long and it's not easy to
find warnings without an IDE. So -Werror can be useful to the developer. But it
is of no use to the "compiling user" or "packager".

I considered a scenario where we ship 0.7.1 with 0 warnings and no intention to
make 0.7.2, and then someone wants to build this software later with different
version of gcc which introduces new warnings. This would be bad. Also sometimes
builds take place on remote machines which you can't (or it is not easy to)
exactly reproduce (e.g. packaging build servers like Ubuntu PPA's) and
therefore you have no other way to test your warning fix then to resubmit the
package to the build server and pray that it finally compiles.

I also considered a case where a system header file or other 3rd-party header
produces warning itself. In such case we would not be able to do anything about
the warning and -Werror would be fatal.

That said, I believe code should generally strive for 0 warnings, even if some
of them are silly (and they are always some that are silly). But it's a price
you pay in order to not overlook the warnings that are not silly and point at
real bugs. Such valid warnings, in my experience, can easily get lost in other
warnings that are silly.

So the opinion I came to is that 0 warnings is a good compromise, -Werror can
help a developer to achieve that in their personal builds, but that -Werror
does not belong to our Makefiles (as opposed to what I initially suggested).

Boris


reply via email to

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