Re: [PATCH 02/36] Add --enable-build-with-cxx configure switch

Yao Qi
2015-02-10T22:11:50Z

On 02/09/2015 11:20 PM, Pedro Alves wrote:
> so that the compiler carries on compiling the file. -Werror still
> catches the warnings, so nothing is lost, only our lifes are made
> easier by concentrating on getting other other more important things
> out of the way first.

Yes, I agree on this.

> @@ -172,11 +186,17 @@ then
> for w in ${build_warnings}; do
> case $w in
> -Werr*) WERROR_CFLAGS=-Werror ;;
> - *) # Check that GCC accepts it
> + *)
> + # Check whether GCC accepts it. Append -Werror to CFLAGS

s/CFLAGS/CXXFLAGS/ ? Since you want to catch cc1plus warnings, so
option should be append CXXFLAGS.

> + # so that configure can catch warnings like:
> + # cc1plus: warning: command line option '-Wpointer-sign' is valid for C/ObjC but not for C++ [enabled by default]
> saved_CFLAGS="$CFLAGS"
> - CFLAGS="$CFLAGS $w"
> + CFLAGS="$CFLAGS -Werror $w"
> + saved_CXXFLAGS="$CXXFLAGS"
> + CXXFLAGS="$CXXFLAGS -Werror $w"
> AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
> CFLAGS="$saved_CFLAGS"
> + CXXFLAGS="$saved_CXXFLAGS"
> esac
> done
> AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS})

--
Yao