Werror

Previous Entry Add to Memories Tell a Friend Next Entry
Thomas, because it's a GNUism and not supported by any non-GNU compilers I can think of (except perhaps PathScale). I admittedly haven't tried a recent version of the Intel compiler either, but that never used to understand it.

Additionally, released code should never have -Werror set, because sometimes there are warnings (perhaps from dependancies that have changed their prototype subtly) and now suddenly your code (which would have had no problems) can't even be compiled.

For maintainers, I recommend adding the --enable-more-warnings directive to your configure.in. This is taken from Nautilus' configure.in:
AC_ARG_ENABLE(more-warnings,
[  --enable-more-warnings  Maximum compiler warnings],
set_more_warnings="$enableval",[
    set_more_warnings=no
])
AC_MSG_CHECKING(for more warnings, including -Werror)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
    AC_MSG_RESULT(yes)
    CFLAGS="\
    -Wall \
    -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
    -Wnested-externs -Wpointer-arith \
    -Wcast-align -Wsign-compare \
    -std=gnu89 \
    $CFLAGS"

    for option in -Wno-strict-aliasing -Wno-sign-compare; do
        SAVE_CFLAGS="$CFLAGS"
        CFLAGS="$CFLAGS $option"
        AC_MSG_CHECKING([whether gcc understands $option])
        AC_TRY_COMPILE([], [],
            has_option=yes,
            has_option=no,)
        if test $has_option = no; then
            CFLAGS="$SAVE_CFLAGS"
        fi
        AC_MSG_RESULT($has_option)
        unset has_option
        unset SAVE_CFLAGS
    done
    unset option
else
    AC_MSG_RESULT(no)
fi
Posted 12/2/06 17:17 — 0 comments

Comments

No comments yet.

Post Comment