On 2014-01-07 21:30:29 -0800, Ben Pfaff wrote:
> On Fri, Jan 03, 2014 at 10:22:27PM +0100, Vincent Lefevre wrote:
> > A developer may want to test his software with
> > -Werror=old-style-definition (in particular because such definitions
> > could be a real bug in the software). But configure fails because
> > autoconf generates such a function definition. For instance:
>
> In my opinion, it's a mistake to run "configure" tests with -Werror.
I don't see why.
> I suggest adding such flags after configure tests have been run, as
> with the --enable-Werror configure flag supported by Open vSwitch:
>
> dnl OVS_ENABLE_WERROR
> AC_DEFUN([OVS_ENABLE_WERROR],
> [AC_ARG_ENABLE(
> [Werror],
> [AC_HELP_STRING([--enable-Werror], [Add -Werror to CFLAGS])],
> [], [enable_Werror=no])
> AC_CONFIG_COMMANDS_PRE(
> [if test "X$enable_Werror" = Xyes; then
> CFLAGS="$CFLAGS -Werror"
> fi])])
This doesn't solve the problem at all: whether -Werror is used via
--enable-Werror or via
./configure ... CFLAGS="... -Werror"
the same errors will occur.
> I guess that -Werror=old-style-definition is somewhat more restricted,
> but a similar solution can be used.
Actually I wasn't using -Werror=old-style-definition directly, but
./configure CFLAGS="-Wall -Wold-style-declaration -Wold-style-definition
-Wmissing-parameter-type -Wmissing-prototypes -Wmissing-declarations
-Wmissing-field-initializers -Werror"
IMHO, this is a good thing developers test that their software doesn't
generate warnings, possibly with some exceptions; some errors can be
avoided with -Wno-error=..., e.g. one needs -Wno-error=unused-function
in the case of MPFR (and also gcc-snapshot). The -Werror allows one to
do that in automatic tests without filtering the output.
Indeed if some new code generates a new warning, it may correspond to
a bug.
In the particular case of -Werror=old-style-definition, this has
corresponded to an obsolescent feature of C for more than 14 years,
so that there are no reasons why programs would still use this old
style definition.
My proposed patch concerning autoconf:
http://lists.gnu.org/archive/html/autoconf-patches/2014-01/msg00003.html
--
Vincent Lefèvre <[email protected]> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]