[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: warning: module to simplify adding compiler warnings
From: |
Simon Josefsson |
Subject: |
Re: warning: module to simplify adding compiler warnings |
Date: |
Tue, 11 Nov 2008 10:32:42 +0100 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux) |
Bruno Haible <address@hidden> writes:
> Simon Josefsson wrote:
>> It allows me to add to configure.ac this:
>>
>> gl_WARN_ADD([-Wall])
>> gl_WARN_ADD([-Wpointer-arith])
>> gl_WARN_ADD([-Wstrict-prototypes])
>> gl_WARN_ADD([-Wno-pointer-sign])
>
> Will $WARN_CFLAGS be used before or after $CFLAGS? I.e. can the user
> disable these warning flags or not?
That's up to each maintainer, WARN_CFLAGS isn't added to CFLAGS
automatically. I'm using this in libtasn1's src/Makefile.am:
AM_CFLAGS = $(WARN_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_builddir)/gl
...
This makes it possible to gradually fix code, just add $(WARN_CFLAGS) in
those directories that you've solved all warnings for. (For example, in
some projects the gnulib directory triggers warning that I would want to
fix elsewhere in the project, but I don't want the build to fail because
of the gnulib code.)
>> gl_WARN_ADD([-Werror])
>
> This is a bad idea. It will cause gratuitous frustration for users on
> platforms that you haven't tested. Remember that many warnings do not
> indicate something really wrong with the program, only the _possibility_
> that something is wrong. The user will then need two attempts to build a
> package, instead of only one. Or he will choose to build with a proprietary
> compiler rather than with gcc.
>
> IMO this is just the opposite of portability.
I agree, however, -Werror is useful during 'make distcheck'. I'm going
to remove the above line from configure.ac and pass the flag to
configure in cfg.mk instead.
> It would be better to make the macro bail out at autoconf time if someone
> attempts to put gl_WARN_ADD([-Werror]) into his configure.ac file.
This is too much, I think, and would break an IMHO realistic use-case of
putting -Werror in WARN_CFLAGS during make distcheck.
I've pushed the module.
/Simon
- Re: warning: module to simplify adding compiler warnings, (continued)
- Re: warning: module to simplify adding compiler warnings, Bruno Haible, 2008/11/11
- Re: warning: module to simplify adding compiler warnings, Simon Josefsson, 2008/11/12
- Re: warning: module to simplify adding compiler warnings, Bruno Haible, 2008/11/12
- Re: warning: module to simplify adding compiler warnings, Simon Josefsson, 2008/11/12
- Re: warning: module to simplify adding compiler warnings, Simon Josefsson, 2008/11/12
- Re: warning: module to simplify adding compiler warnings, Bruno Haible, 2008/11/11
- Re: warning: module to simplify adding compiler warnings, Paolo Bonzini, 2008/11/11
- Re: warning: module to simplify adding compiler warnings, Simon Josefsson, 2008/11/12
- Re: warning: module to simplify adding compiler warnings, Simon Josefsson, 2008/11/11
Re: warning: module to simplify adding compiler warnings, Bruno Haible, 2008/11/10
- Re: warning: module to simplify adding compiler warnings,
Simon Josefsson <=
Re: warning: module to simplify adding compiler warnings, Bruno Haible, 2008/11/11
Re: warning: module to simplify adding compiler warnings, Simon Josefsson, 2008/11/11