diff options
author | Gilles Espinasse <g.esp@free.fr> | 2012-10-20 20:22:51 +0200 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-10-21 17:32:53 +0100 |
commit | d49b2284b505e93cd415af4da3cd2cc2d3d168d3 (patch) | |
tree | 50cb41dd41a7b5d8a68b1d9110b22e1fce970ee5 /build | |
parent | b12a94b98306d87689bad23dad4c0ec033037046 (diff) |
configure: fix unrecognized -Wno option
gcc-4.4 and later accept every -Wno option. So we can test for the
option without no in the name to check if the option is supported.
Each time a warning is emitted and without this fix, on gcc-4.4 that will
add this warning:
cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"
bugs.freedesktop.org #51633, rediffed after 1.12.4
Of course this assumes that all compilers will behave like gcc, which is
reasonably implicit in the set of warning flags.
Signed-off-by: Gilles Espinasse <g.esp@free.fr>
[ickle: slight modification to test both -W and -Wno variants to ideally
preserve compatability with non-GCC compilers sharing GCC options!]
Diffstat (limited to 'build')
-rw-r--r-- | build/configure.ac.warnings | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/build/configure.ac.warnings b/build/configure.ac.warnings index 9b9c742a..f984eb29 100644 --- a/build/configure.ac.warnings +++ b/build/configure.ac.warnings @@ -21,8 +21,11 @@ MAYBE_WARN="-Wall -Wextra \ -Wno-missing-field-initializers -Wno-unused-parameter \ -Wno-attributes -Wno-long-long -Winline" +# New -Wno options should be added here +# gcc-4.4 and later accept every -Wno- option but may complain later that this +# option is unknow each time another warning happen. # -Wunused-but-set-variable is too noisy at present -NO_WARN="-Wno-unused-but-set-variable" +NO_WARN="unused-but-set-variable" dnl Sun Studio 12 likes to rag at us for abusing enums like dnl having cairo_status_t variables hold cairo_int_status_t @@ -48,8 +51,6 @@ MAYBE_WARN="$MAYBE_WARN -fno-strict-aliasing -fno-common" dnl Also to turn various gcc/glibc-specific preprocessor checks MAYBE_WARN="$MAYBE_WARN -Wp,-D_FORTIFY_SOURCE=2" -MAYBE_WARN="$MAYBE_WARN $NO_WARN" - # invalidate cached value if MAYBE_WARN has changed if test "x$cairo_cv_warn_maybe" != "x$MAYBE_WARN"; then unset cairo_cv_warn_cflags @@ -72,7 +73,9 @@ AC_CACHE_CHECK([for supported warning flags], cairo_cv_warn_cflags, [ for W in $MAYBE_WARN; do CAIRO_CC_TRY_FLAG([$W],, [WARN_CFLAGS="$WARN_CFLAGS $W"]) done - + for W in $NO_WARN; do + CAIRO_CC_TRY_FLAG([-W$W -Wno-$W],, [WARN_CFLAGS="$WARN_CFLAGS -Wno-$W"]) + done cairo_cv_warn_cflags=$WARN_CFLAGS cairo_cv_warn_maybe=$MAYBE_WARN |