[cairo-commit] build/configure.ac.warnings

Chris Wilson ickle at kemper.freedesktop.org
Sun Oct 21 09:34:19 PDT 2012


 build/configure.ac.warnings |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit d49b2284b505e93cd415af4da3cd2cc2d3d168d3
Author: Gilles Espinasse <g.esp at free.fr>
Date:   Sat Oct 20 20:22:51 2012 +0200

    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 at free.fr>
    [ickle: slight modification to test both -W and -Wno variants to ideally
    preserve compatability with non-GCC compilers sharing GCC options!]

diff --git a/build/configure.ac.warnings b/build/configure.ac.warnings
index 9b9c742..f984eb2 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
 


More information about the cairo-commit mailing list