Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -2008,10 +2008,12 @@ AS_HELP_STRING([--disable-werror], [do not build with -Werror])) AS_IF([test x"$enable_werror" != x"no"], [ OBJCFLAGS="$OBJCFLAGS -Werror" ]) + old_OBJCFLAGS="$OBJCFLAGS" + OBJCFLAGS="$OBJCFLAGS -Werror" AC_MSG_CHECKING(whether we need -Wno-strict-aliasing due to GCC bugs) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([ #ifdef __has_attribute # if __has_attribute(objc_root_class) @@ -2031,15 +2033,18 @@ Foo *test = (Foo *)&object; (void)test; /* Get rid of unused variable warning */ ]) ], [ AC_MSG_RESULT(no) + OBJCFLAGS="$old_OBJCFLAGS" ], [ AC_MSG_RESULT(yes) - OBJCFLAGS="$OBJCFLAGS -Wno-strict-aliasing" + OBJCFLAGS="$old_OBJCFLAGS -Wno-strict-aliasing" ]) + old_OBJCFLAGS="$OBJCFLAGS" + OBJCFLAGS="$OBJCFLAGS -Werror" AC_MSG_CHECKING( whether we need -Wno-unused-property-ivar due to Clang bugs) AC_COMPILE_IFELSE([ AC_LANG_SOURCE([ #ifdef __has_attribute @@ -2067,17 +2072,18 @@ } @end ]) ], [ AC_MSG_RESULT(no) + OBJCFLAGS="$old_OBJCFLAGS" ], [ AC_MSG_RESULT(yes) - OBJCFLAGS="$OBJCFLAGS -Wno-unused-property-ivar" + OBJCFLAGS="$old_OBJCFLAGS -Wno-unused-property-ivar" ]) old_OBJCFLAGS="$OBJCFLAGS" - OBJCFLAGS="$OBJCFLAGS -Wcast-align" + OBJCFLAGS="$OBJCFLAGS -Wcast-align -Werror" AC_MSG_CHECKING(whether -Wcast-align is buggy) AC_COMPILE_IFELSE([ AC_LANG_SOURCE([ #ifdef __has_attribute # if __has_attribute(objc_root_class) @@ -2098,17 +2104,18 @@ } @end ]) ], [ AC_MSG_RESULT(no) + OBJCFLAGS="$old_OBJCFLAGS -Wcast-align" ], [ AC_MSG_RESULT(yes) OBJCFLAGS="$old_OBJCFLAGS" ]) old_OBJCFLAGS="$OBJCFLAGS" - OBJCFLAGS="$OBJCFLAGS -Wunreachable-code" + OBJCFLAGS="$OBJCFLAGS -Wunreachable-code -Werror" AC_MSG_CHECKING(whether -Wunreachable-code can be used) AC_COMPILE_IFELSE([ AC_LANG_SOURCE([[ #include @@ -2174,17 +2181,18 @@ } @end ]]) ], [ AC_MSG_RESULT(yes) + OBJCFLAGS="$old_OBJCFLAGS -Wunreachable-code" ], [ AC_MSG_RESULT(no) OBJCFLAGS="$old_OBJCFLAGS" ]) old_OBJCFLAGS="$OBJCFLAGS" - OBJCFLAGS="$OBJCFLAGS -Wdocumentation" + OBJCFLAGS="$OBJCFLAGS -Wdocumentation -Werror" AC_MSG_CHECKING(whether -Wdocumentation works correctly) AC_COMPILE_IFELSE([ AC_LANG_SOURCE([ /** * @class Test conftest.m conftest.m @@ -2202,18 +2210,19 @@ */ typedef struct {} Foo; ]) ], [ AC_MSG_RESULT(yes) + OBJCFLAGS="$old_OBJCFLAGS -Wdocumentation" ], [ AC_MSG_RESULT(no) OBJCFLAGS="$old_OBJCFLAGS" ]) AS_IF([test x"$check_pedantic" = x"yes"], [ old_OBJCFLAGS="$OBJCFLAGS" - OBJCFLAGS="$OBJCFLAGS -pedantic" + OBJCFLAGS="$OBJCFLAGS -pedantic -Werror" AC_MSG_CHECKING(whether -pedantic is buggy) AC_COMPILE_IFELSE([ AC_LANG_SOURCE([ #include @@ -2245,31 +2254,37 @@ } @end ]) ], [ AC_MSG_RESULT(no) + OBJCFLAGS="$old_OBJCFLAGS -pedantic" ], [ AC_MSG_RESULT(yes) OBJCFLAGS="$old_OBJCFLAGS" ]) ]) + old_OBJCFLAGS="$OBJCFLAGS" + OBJCFLAGS="$OBJCFLAGS -Werror" AC_MSG_CHECKING(whether we need -Wno-strict-prototypes) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([ #include ], [ signal(SIGINT, SIG_DFL); ]) ], [ AC_MSG_RESULT(no) + OBJCFLAGS="$old_OBJCFLAGS" ], [ AC_MSG_RESULT(yes) - OBJCFLAGS="$OBJCFLAGS -Wno-strict-prototypes" + OBJCFLAGS="$old_OBJCFLAGS -Wno-strict-prototypes" ]) AS_IF([test x"$ac_cv_header_complex_h" = x"yes"], [ + old_OBJCFLAGS="$OBJCFLAGS" + OBJCFLAGS="$OBJCFLAGS -Werror" AC_MSG_CHECKING(whether we need -Wno-gnu-imaginary-constant) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([ #include ], [ @@ -2276,13 +2291,14 @@ complex float f = 0.5 + 0.5 * I; (void)f; ]) ], [ AC_MSG_RESULT(no) + OBJCFLAGS="$old_OBJCFLAGS" ], [ AC_MSG_RESULT(yes) - OBJCFLAGS="$OBJCFLAGS -Wno-gnu-imaginary-constant" + OBJCFLAGS="$old_OBJCFLAGS -Wno-gnu-imaginary-constant" ]) ]) ]) AS_IF([test x"$cross_compiling" = x"yes"], [