Re: disabling -Werror on a autotools based build

2011-03-28 Thread Richard W.M. Jones
On Sun, Mar 27, 2011 at 02:54:56PM -0300, Sergio Belkin wrote:
 2011/3/27 Ralf Corsepius rc040...@freenet.de:
  On 03/27/2011 11:22 AM, gia...@gmail.com wrote:
  I'm trying to rebuild a package with an autotools based toolchain and
  it's failing because they use -Werror and gcc 4.6 spits out few new
  warnings on the code.
 
  Packages adding -Werror by themselves are poorly designed.
 
 
 Just to learn: Ralf, Why do you say that? :-)

Because it's an invitation for the package build to fail, often for
fairly spurious reasons.  eg. There was a bug that I found in gcc 4.6
(now fixed) which caused any program that used glibc + -O3 + strcmp to
give a warning, which would cause it to fail to compile with -Werror.

However developers themselves should definitely be using compiler
warnings and fixing them.

In libguestfs we have some pretty complex autotools magic to deal with
all this:

http://git.annexia.org/?p=libguestfs.git;a=blob;f=configure.ac;h=f1b56d2dbe9a118901f7426bcc176f624d841f63;hb=HEAD#l67

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel


Re: disabling -Werror on a autotools based build

2011-03-28 Thread Ben Boeckel
Richard W.M. Jones rjo...@redhat.com wrote:
 In libguestfs we have some pretty complex autotools magic to deal with
 all this:
 
 http://git.annexia.org/?p=libguestfs.git;a=blob;f=configure.ac;h=f1b56d2dbe9a118901f7426bcc176f624d841f63;hb=HEAD#l67

CHASM has similar logic for CMake (also clang support):

http://git.benboeckel.net/?p=chasmd.git;a=blob;f=CMakeLists.txt

--Ben

-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel


Re: disabling -Werror on a autotools based build

2011-03-28 Thread Ralf Corsepius
On 03/28/2011 04:58 PM, Ben Boeckel wrote:
 Richard W.M. Jonesrjo...@redhat.com  wrote:
 In libguestfs we have some pretty complex autotools magic to deal with
 all this:

 http://git.annexia.org/?p=libguestfs.git;a=blob;f=configure.ac;h=f1b56d2dbe9a118901f7426bcc176f624d841f63;hb=HEAD#l67

 CHASM has similar logic for CMake (also clang support):

  http://git.benboeckel.net/?p=chasmd.git;a=blob;f=CMakeLists.txt

Superflous and error-prone featuritis if you'd ask me ;)

Ralf
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel


Re: disabling -Werror on a autotools based build

2011-03-28 Thread Conrad Meyer
On Mon, 28 Mar 2011 17:08:33 +0200
Ralf Corsepius rc040...@freenet.de wrote:

 On 03/28/2011 04:58 PM, Ben Boeckel wrote:
  Richard W.M. Jonesrjo...@redhat.com  wrote:
  In libguestfs we have some pretty complex autotools magic to deal
  with all this:
 
  http://git.annexia.org/?p=libguestfs.git;a=blob;f=configure.ac;h=f1b56d2dbe9a118901f7426bcc176f624d841f63;hb=HEAD#l67
 
  CHASM has similar logic for CMake (also clang support):
 
   http://git.benboeckel.net/?p=chasmd.git;a=blob;f=CMakeLists.txt
 
 Superflous and error-prone featuritis if you'd ask me ;)
 
 Ralf

No one asked you, Ralf.

-- 
Conrad Meyer ceme...@u.washington.edu
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel


Re: disabling -Werror on a autotools based build

2011-03-28 Thread Ralf Corsepius
On 03/28/2011 07:40 PM, Conrad Meyer wrote:
 On Mon, 28 Mar 2011 17:08:33 +0200
 Ralf Corsepiusrc040...@freenet.de  wrote:

 On 03/28/2011 04:58 PM, Ben Boeckel wrote:
 Richard W.M. Jonesrjo...@redhat.com   wrote:
 In libguestfs we have some pretty complex autotools magic to deal
 with all this:

 http://git.annexia.org/?p=libguestfs.git;a=blob;f=configure.ac;h=f1b56d2dbe9a118901f7426bcc176f624d841f63;hb=HEAD#l67

 CHASM has similar logic for CMake (also clang support):

   http://git.benboeckel.net/?p=chasmd.git;a=blob;f=CMakeLists.txt

 Superflous and error-prone featuritis if you'd ask me ;)

 Ralf

 No one asked you, Ralf.

Your liberty not to listen ...

I am well aware many people are keen and proud of overloading 
configure-scripts instead of keeping things simple until they one day 
are being hit by the limitations of their implementations.

Ralf


-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel


Re: disabling -Werror on a autotools based build

2011-03-27 Thread Jan Kratochvil
On Sun, 27 Mar 2011 11:22:48 +0200, gia...@gmail.com wrote:
 I'm trying to rebuild a package with an autotools based toolchain and
 it's failing because they use -Werror and gcc 4.6 spits out few new
 warnings on the code.

You should fix those erors and and submit them upstream.


 Now, is it possible to quickly disable -Werror from the ./configure
 command line? Right now the only solution I found (short of fixing the
 code...) is to patch Makefile.in but that does seem very robust.

It depends on the specific package.  For example GDB has --disable-werror:
$ ./configure --help|grep werror
  --enable-werror treat compile warnings as errors

Or if there is Makefile.am you should patch it instead of Makefile.in.

If -Werror is contained in Makefile.in and there is no Makefile.am then your
choice is the best way how to disable it (but you should fix the errors
instead).


Regards,
Jan
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel


Re: disabling -Werror on a autotools based build

2011-03-27 Thread Ralf Corsepius
On 03/27/2011 11:22 AM, gia...@gmail.com wrote:
 I'm trying to rebuild a package with an autotools based toolchain and
 it's failing because they use -Werror and gcc 4.6 spits out few new
 warnings on the code.

Packages adding -Werror by themselves are poorly designed. Contact their 
upstreams and tell them they are doing it wrong.

 Now, is it possible to quickly disable -Werror from the ./configure
 command line?

Theoretically, configure CFLAGS=whatever should always work.
However, packages whose authors are adding -Werror inside of a configure 
script, they also get this wrong.

In some (rare) cases, packages adding -Werror have --disable-werror 
option or similar.

 Right now the only solution I found (short of fixing the
 code...) is to patch Makefile.in but that does seem very robust.
What to do depends upon the details of a package.

For packages which are based on autoconf only, patching Makefile.ins 
could be a solution (the Makefile.ins are source files), in 
automake-based packages, the appropriate files to patch would be the 
Makefile.am (The Makefile.in's are generated).



Ralf
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel


Re: disabling -Werror on a autotools based build

2011-03-27 Thread Sergio Belkin
2011/3/27 Ralf Corsepius rc040...@freenet.de:
 On 03/27/2011 11:22 AM, gia...@gmail.com wrote:
 I'm trying to rebuild a package with an autotools based toolchain and
 it's failing because they use -Werror and gcc 4.6 spits out few new
 warnings on the code.

 Packages adding -Werror by themselves are poorly designed.


Just to learn: Ralf, Why do you say that? :-)

-- 
--
Sergio Belkin  http://www.sergiobelkin.com
Watch More TV http://sebelk.blogspot.com
LPIC-2 Certified - http://www.lpi.org
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel


Re: disabling -Werror on a autotools based build

2011-03-27 Thread Kevin Kofler
Sergio Belkin wrote:

 2011/3/27 Ralf Corsepius rc040...@freenet.de:
 Packages adding -Werror by themselves are poorly designed.
 
 Just to learn: Ralf, Why do you say that? :-)

Using -Werror by default is a very bad idea. Warnings can have false 
positives, or otherwise be harmless. And in particular, different compiler 
versions can trigger different warnings: false positives get fixed, but new 
warnings get added. So using -Werror makes you very dependent on the 
compiler version. And really, a warning is not an error for a reason.

It makes sense to use -Werror-* for some specific warnings, e.g.
-Werror-implicit-function-declaration in C, but a blanket -Werror in shipped 
tarballs is a very bad idea.

Kevin Kofler

-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel


Re: disabling -Werror on a autotools based build

2011-03-27 Thread Ralf Corsepius
On 03/28/2011 12:48 AM, Kevin Kofler wrote:
 Sergio Belkin wrote:

 2011/3/27 Ralf Corsepiusrc040...@freenet.de:
 Packages adding -Werror by themselves are poorly designed.

 Just to learn: Ralf, Why do you say that? :-)

 Using -Werror by default is a very bad idea. Warnings can have false
 positives, or otherwise be harmless.  And in particular, different compiler
 versions can trigger different warnings: false positives get fixed, but new
 warnings get added. So using -Werror makes you very dependent on the
 compiler version.

.. and the architecture and other cflags ...

In practice, people who are adding -Werror to their configurations by 
default sooner or later will experience, their code will to not compile 
in environments different from theirs, because different warnings will 
be raised and because minor warnings are being escalated to errors by 
-Werror.

Surely, warnings indicate there might be something wrong with the code, 
somebody may want to look into, but blindly making warnings errors 
isn't wise either.

Less theoretical: gcc-4.6.0 for instance warns about 
unused-but-set-variable, at places where gcc  4.6.0 had been silent:

foo.c:89:34: warning: variable 'status' set but not used 
[-Wunused-but-set-variable]

When looking into the code, you will discover cases like this:

int doXXX()
{
int status = doXXX();
...
}

Nothing wrong with code, just an overly nervous compiler.

 And really, a warning is not an error for a reason.

Exactly.

 It makes sense to use -Werror-* for some specific warnings, e.g.
 -Werror-implicit-function-declaration in C, but a blanket -Werror in shipped
 tarballs is a very bad idea.

ACK.

More generally speaking, -Werror is suitable for upstream developers, 
when trying to go after issues with their code, but automatically adding 
it is hardly suitable for production SW-packages.

Ralf


-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel