From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126371 invoked by alias); 3 Apr 2016 17:17:12 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 126359 invoked by uid 89); 3 Apr 2016 17:17:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=4836, 6437, 04, Stop X-HELO: paperclip.tbsaunde.org Received: from tbsaunde.org (HELO paperclip.tbsaunde.org) (66.228.47.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 03 Apr 2016 17:17:01 +0000 Received: from keg.corp.tor1.mozilla.com (unknown [66.207.193.21]) by paperclip.tbsaunde.org (Postfix) with ESMTPSA id 0D537C06B; Sun, 3 Apr 2016 17:17:00 +0000 (UTC) From: tbsaunde+binutils@tbsaunde.org To: binutils@sourceware.org Cc: Trevor Saunders Subject: [PATCH] move the computation of C++ warning flags to bfd/warning.m4 Date: Sun, 03 Apr 2016 17:17:00 -0000 Message-Id: <1459704127-16182-1-git-send-email-tbsaunde+binutils@tbsaunde.org> X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg00031.txt.bz2 From: Trevor Saunders Hi, There isn't anything specific to gold about this code, so it would seem to make sense to compute C and C++ warning flags in the same place. This also means that anything else that wants C++ warning flags won't have to roll there own. The only real difference between the C and C++ flags other than getting rid of flags that don't make sense, and so don't exist in C++ is removing -Wshadow because currently the bfd headers aren't compatable with it. I tested this produces the same set of warning flags for gold/ as before, ok? Trev gprof/ChangeLog: 2016-04-03 Trevor Saunders * configure: Regenerate. opcodes/ChangeLog: 2016-04-03 Trevor Saunders * configure: Regenerate. gas/ChangeLog: 2016-04-03 Trevor Saunders * configure: Regenerate. bfd/ChangeLog: 2016-04-03 Trevor Saunders * configure: Regenerate. * warning.m4: Compute C++ warning flags as well as flags for C. gold/ChangeLog: 2016-04-03 Trevor Saunders * configure: Regenerate. * configure.ac: Stop computing C++ warning flags. binutils/ChangeLog: 2016-04-03 Trevor Saunders * configure: Regenerate. ld/ChangeLog: 2016-04-03 Trevor Saunders * configure: Regenerate. --- bfd/configure | 28 ++++++++++++++++++++++++---- bfd/warning.m4 | 17 +++++++++++++---- binutils/configure | 28 ++++++++++++++++++++++++---- gas/configure | 28 ++++++++++++++++++++++++---- gold/configure | 30 ++++++++++++++++++++++++------ gold/configure.ac | 3 --- gprof/configure | 28 ++++++++++++++++++++++++---- ld/configure | 28 ++++++++++++++++++++++++---- opcodes/configure | 28 ++++++++++++++++++++++++---- 9 files changed, 181 insertions(+), 37 deletions(-) diff --git a/bfd/configure b/bfd/configure index 51581ba..138eddb 100755 --- a/bfd/configure +++ b/bfd/configure @@ -659,6 +659,7 @@ MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE WARN_WRITE_STRINGS NO_WERROR +WARN_CXXFLAGS WARN_CFLAGS REPORT_BUGS_TEXI REPORT_BUGS_TO @@ -12226,6 +12227,7 @@ fi # Default set of GCC warnings to enable. GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" +GCC_WARN_CXXFLAGS="-W -Wall" # Add -Wshadow if the compiler is a sufficiently recent version of GCC. cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12254,6 +12256,18 @@ else fi rm -f conftest* +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-4]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wstack-usage=262144" +fi +rm -f conftest* + # Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. WARN_WRITE_STRINGS="" @@ -12285,6 +12299,7 @@ case "${host}" in *-*-mingw32*) if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wno-format" fi ;; *) ;; @@ -12298,31 +12313,36 @@ fi NO_WERROR= if test "${ERROR_ON_WARNING}" = yes ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Werror" NO_WERROR="-Wno-error" fi if test "${GCC}" = yes ; then WARN_CFLAGS="${GCC_WARN_CFLAGS}" + WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}" fi # Check whether --enable-build-warnings was given. if test "${enable_build_warnings+set}" = set; then : enableval=$enable_build_warnings; case "${enableval}" in - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";; + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}";; no) if test "${GCC}" = yes ; then WARN_CFLAGS="-w" + WARN_CXXFLAGS="-w" fi;; ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";; *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";; - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${t} ${GCC_WARN_CXXFLAGS}";; + *) t=`echo "${enableval}" | sed -e "s/,/ /g"` + WARN_CFLAGS="${t}" WARN_CXXFLAGS="${t}";; esac fi if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then - echo "Setting warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C++ warning flags = $WARN_CXXFLAGS" 6>&1 fi diff --git a/bfd/warning.m4 b/bfd/warning.m4 index 4c5b55d..88b38a1 100644 --- a/bfd/warning.m4 +++ b/bfd/warning.m4 @@ -23,12 +23,14 @@ AC_DEFUN([AM_BINUTILS_WARNINGS],[ # Default set of GCC warnings to enable. GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" +GCC_WARN_CXXFLAGS="-W -Wall" # Add -Wshadow if the compiler is a sufficiently recent version of GCC. AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow") # Add -Wstack-usage if the compiler is a sufficiently recent version of GCC. AC_EGREP_CPP([^[0-4]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144") +AC_EGREP_CPP([^[0-4]$],[__GNUC__],,GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wstack-usage=262144") # Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. WARN_WRITE_STRINGS="" @@ -47,6 +49,7 @@ case "${host}" in *-*-mingw32*) if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wno-format" fi ;; *) ;; @@ -60,32 +63,38 @@ fi NO_WERROR= if test "${ERROR_ON_WARNING}" = yes ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Werror" NO_WERROR="-Wno-error" fi if test "${GCC}" = yes ; then WARN_CFLAGS="${GCC_WARN_CFLAGS}" + WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}" fi AC_ARG_ENABLE(build-warnings, [ --enable-build-warnings enable build-time compiler warnings], [case "${enableval}" in - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";; + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}";; no) if test "${GCC}" = yes ; then WARN_CFLAGS="-w" + WARN_CXXFLAGS="-w" fi;; ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";; *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";; - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${t} ${GCC_WARN_CXXFLAGS}";; + *) t=`echo "${enableval}" | sed -e "s/,/ /g"` + WARN_CFLAGS="${t}" WARN_CXXFLAGS="${t}";; esac]) if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then - echo "Setting warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C++ warning flags = $WARN_CXXFLAGS" 6>&1 fi AC_SUBST(WARN_CFLAGS) +AC_SUBST(WARN_CXXFLAGS) AC_SUBST(NO_WERROR) AC_SUBST(WARN_WRITE_STRINGS) ]) diff --git a/binutils/configure b/binutils/configure index 0e88476..b9edea6 100755 --- a/binutils/configure +++ b/binutils/configure @@ -652,6 +652,7 @@ YFLAGS YACC WARN_WRITE_STRINGS NO_WERROR +WARN_CXXFLAGS WARN_CFLAGS OTOOL64 OTOOL @@ -11944,6 +11945,7 @@ _ACEOF # Default set of GCC warnings to enable. GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" +GCC_WARN_CXXFLAGS="-W -Wall" # Add -Wshadow if the compiler is a sufficiently recent version of GCC. cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11972,6 +11974,18 @@ else fi rm -f conftest* +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-4]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wstack-usage=262144" +fi +rm -f conftest* + # Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. WARN_WRITE_STRINGS="" @@ -12003,6 +12017,7 @@ case "${host}" in *-*-mingw32*) if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wno-format" fi ;; *) ;; @@ -12016,31 +12031,36 @@ fi NO_WERROR= if test "${ERROR_ON_WARNING}" = yes ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Werror" NO_WERROR="-Wno-error" fi if test "${GCC}" = yes ; then WARN_CFLAGS="${GCC_WARN_CFLAGS}" + WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}" fi # Check whether --enable-build-warnings was given. if test "${enable_build_warnings+set}" = set; then : enableval=$enable_build_warnings; case "${enableval}" in - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";; + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}";; no) if test "${GCC}" = yes ; then WARN_CFLAGS="-w" + WARN_CXXFLAGS="-w" fi;; ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";; *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";; - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${t} ${GCC_WARN_CXXFLAGS}";; + *) t=`echo "${enableval}" | sed -e "s/,/ /g"` + WARN_CFLAGS="${t}" WARN_CXXFLAGS="${t}";; esac fi if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then - echo "Setting warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C++ warning flags = $WARN_CXXFLAGS" 6>&1 fi diff --git a/gas/configure b/gas/configure index 131dd2d..eef64fc 100755 --- a/gas/configure +++ b/gas/configure @@ -642,6 +642,7 @@ cgen_cpu_prefix GDBINIT WARN_WRITE_STRINGS NO_WERROR +WARN_CXXFLAGS WARN_CFLAGS OTOOL64 OTOOL @@ -11717,6 +11718,7 @@ using_cgen=no # Default set of GCC warnings to enable. GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" +GCC_WARN_CXXFLAGS="-W -Wall" # Add -Wshadow if the compiler is a sufficiently recent version of GCC. cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11745,6 +11747,18 @@ else fi rm -f conftest* +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-4]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wstack-usage=262144" +fi +rm -f conftest* + # Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. WARN_WRITE_STRINGS="" @@ -11776,6 +11790,7 @@ case "${host}" in *-*-mingw32*) if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wno-format" fi ;; *) ;; @@ -11789,31 +11804,36 @@ fi NO_WERROR= if test "${ERROR_ON_WARNING}" = yes ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Werror" NO_WERROR="-Wno-error" fi if test "${GCC}" = yes ; then WARN_CFLAGS="${GCC_WARN_CFLAGS}" + WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}" fi # Check whether --enable-build-warnings was given. if test "${enable_build_warnings+set}" = set; then : enableval=$enable_build_warnings; case "${enableval}" in - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";; + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}";; no) if test "${GCC}" = yes ; then WARN_CFLAGS="-w" + WARN_CXXFLAGS="-w" fi;; ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";; *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";; - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${t} ${GCC_WARN_CXXFLAGS}";; + *) t=`echo "${enableval}" | sed -e "s/,/ /g"` + WARN_CFLAGS="${t}" WARN_CXXFLAGS="${t}";; esac fi if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then - echo "Setting warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C++ warning flags = $WARN_CXXFLAGS" 6>&1 fi diff --git a/gold/configure b/gold/configure index d0cfc95..68e80c7 100755 --- a/gold/configure +++ b/gold/configure @@ -609,6 +609,7 @@ GOLD_LDFLAGS WARN_CXXFLAGS WARN_WRITE_STRINGS NO_WERROR +WARN_CXXFLAGS WARN_CFLAGS IFUNC_STATIC_FALSE IFUNC_STATIC_TRUE @@ -6690,6 +6691,7 @@ fi # Default set of GCC warnings to enable. GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" +GCC_WARN_CXXFLAGS="-W -Wall" # Add -Wshadow if the compiler is a sufficiently recent version of GCC. cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6718,6 +6720,18 @@ else fi rm -f conftest* +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-4]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wstack-usage=262144" +fi +rm -f conftest* + # Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. WARN_WRITE_STRINGS="" @@ -6749,6 +6763,7 @@ case "${host}" in *-*-mingw32*) if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wno-format" fi ;; *) ;; @@ -6762,31 +6777,36 @@ fi NO_WERROR= if test "${ERROR_ON_WARNING}" = yes ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Werror" NO_WERROR="-Wno-error" fi if test "${GCC}" = yes ; then WARN_CFLAGS="${GCC_WARN_CFLAGS}" + WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}" fi # Check whether --enable-build-warnings was given. if test "${enable_build_warnings+set}" = set; then : enableval=$enable_build_warnings; case "${enableval}" in - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";; + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}";; no) if test "${GCC}" = yes ; then WARN_CFLAGS="-w" + WARN_CXXFLAGS="-w" fi;; ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";; *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";; - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${t} ${GCC_WARN_CXXFLAGS}";; + *) t=`echo "${enableval}" | sed -e "s/,/ /g"` + WARN_CFLAGS="${t}" WARN_CXXFLAGS="${t}";; esac fi if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then - echo "Setting warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C++ warning flags = $WARN_CXXFLAGS" 6>&1 fi @@ -6794,8 +6814,6 @@ fi -WARN_CXXFLAGS=`echo ${WARN_CFLAGS} | sed -e 's/-Wstrict-prototypes//' -e 's/-Wmissing-prototypes//' -e 's/-Wshadow//'` - # Check whether --with-gold-ldflags was given. diff --git a/gold/configure.ac b/gold/configure.ac index 695a2fd..a65f352 100644 --- a/gold/configure.ac +++ b/gold/configure.ac @@ -483,9 +483,6 @@ AM_CONDITIONAL(IFUNC_STATIC, test "$gold_cv_lib_glibc_ifunc" = "both") AM_BINUTILS_WARNINGS -WARN_CXXFLAGS=`echo ${WARN_CFLAGS} | sed -e 's/-Wstrict-prototypes//' -e 's/-Wmissing-prototypes//' -e 's/-Wshadow//'` -AC_SUBST(WARN_CXXFLAGS) - AC_ARG_WITH(gold-ldflags, [ --with-gold-ldflags=FLAGS additional link flags for gold], [if test "$withval" = "no" -o "$withval" = "yes"; then diff --git a/gprof/configure b/gprof/configure index 5b8fbd7..ab66159 100755 --- a/gprof/configure +++ b/gprof/configure @@ -604,6 +604,7 @@ LTLIBOBJS LIBOBJS WARN_WRITE_STRINGS NO_WERROR +WARN_CXXFLAGS WARN_CFLAGS GENINSRC_NEVER_FALSE GENINSRC_NEVER_TRUE @@ -12100,6 +12101,7 @@ fi # Default set of GCC warnings to enable. GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" +GCC_WARN_CXXFLAGS="-W -Wall" # Add -Wshadow if the compiler is a sufficiently recent version of GCC. cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12128,6 +12130,18 @@ else fi rm -f conftest* +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-4]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wstack-usage=262144" +fi +rm -f conftest* + # Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. WARN_WRITE_STRINGS="" @@ -12159,6 +12173,7 @@ case "${host}" in *-*-mingw32*) if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wno-format" fi ;; *) ;; @@ -12172,31 +12187,36 @@ fi NO_WERROR= if test "${ERROR_ON_WARNING}" = yes ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Werror" NO_WERROR="-Wno-error" fi if test "${GCC}" = yes ; then WARN_CFLAGS="${GCC_WARN_CFLAGS}" + WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}" fi # Check whether --enable-build-warnings was given. if test "${enable_build_warnings+set}" = set; then : enableval=$enable_build_warnings; case "${enableval}" in - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";; + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}";; no) if test "${GCC}" = yes ; then WARN_CFLAGS="-w" + WARN_CXXFLAGS="-w" fi;; ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";; *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";; - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${t} ${GCC_WARN_CXXFLAGS}";; + *) t=`echo "${enableval}" | sed -e "s/,/ /g"` + WARN_CFLAGS="${t}" WARN_CXXFLAGS="${t}";; esac fi if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then - echo "Setting warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C++ warning flags = $WARN_CXXFLAGS" 6>&1 fi diff --git a/ld/configure b/ld/configure index 24f9316..126f49e 100755 --- a/ld/configure +++ b/ld/configure @@ -646,6 +646,7 @@ LIBINTL USE_NLS WARN_WRITE_STRINGS NO_WERROR +WARN_CXXFLAGS WARN_CFLAGS installed_linker install_as_default @@ -15543,6 +15544,7 @@ fi # Default set of GCC warnings to enable. GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" +GCC_WARN_CXXFLAGS="-W -Wall" # Add -Wshadow if the compiler is a sufficiently recent version of GCC. cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -15571,6 +15573,18 @@ else fi rm -f conftest* +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-4]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wstack-usage=262144" +fi +rm -f conftest* + # Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. WARN_WRITE_STRINGS="" @@ -15602,6 +15616,7 @@ case "${host}" in *-*-mingw32*) if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wno-format" fi ;; *) ;; @@ -15615,31 +15630,36 @@ fi NO_WERROR= if test "${ERROR_ON_WARNING}" = yes ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Werror" NO_WERROR="-Wno-error" fi if test "${GCC}" = yes ; then WARN_CFLAGS="${GCC_WARN_CFLAGS}" + WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}" fi # Check whether --enable-build-warnings was given. if test "${enable_build_warnings+set}" = set; then : enableval=$enable_build_warnings; case "${enableval}" in - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";; + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}";; no) if test "${GCC}" = yes ; then WARN_CFLAGS="-w" + WARN_CXXFLAGS="-w" fi;; ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";; *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";; - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${t} ${GCC_WARN_CXXFLAGS}";; + *) t=`echo "${enableval}" | sed -e "s/,/ /g"` + WARN_CFLAGS="${t}" WARN_CXXFLAGS="${t}";; esac fi if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then - echo "Setting warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C++ warning flags = $WARN_CXXFLAGS" 6>&1 fi diff --git a/opcodes/configure b/opcodes/configure index 747c939..acfd98b 100755 --- a/opcodes/configure +++ b/opcodes/configure @@ -643,6 +643,7 @@ MAINTAINER_MODE_TRUE NO_WMISSING_FIELD_INITIALIZERS WARN_WRITE_STRINGS NO_WERROR +WARN_CXXFLAGS WARN_CFLAGS OTOOL64 OTOOL @@ -11507,6 +11508,7 @@ fi # Default set of GCC warnings to enable. GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" +GCC_WARN_CXXFLAGS="-W -Wall" # Add -Wshadow if the compiler is a sufficiently recent version of GCC. cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11535,6 +11537,18 @@ else fi rm -f conftest* +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__GNUC__ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "^[0-4]$" >/dev/null 2>&1; then : + +else + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wstack-usage=262144" +fi +rm -f conftest* + # Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings. WARN_WRITE_STRINGS="" @@ -11566,6 +11580,7 @@ case "${host}" in *-*-mingw32*) if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Wno-format" fi ;; *) ;; @@ -11579,31 +11594,36 @@ fi NO_WERROR= if test "${ERROR_ON_WARNING}" = yes ; then GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror" + GCC_WARN_CXXFLAGS="$GCC_WARN_CXXFLAGS -Werror" NO_WERROR="-Wno-error" fi if test "${GCC}" = yes ; then WARN_CFLAGS="${GCC_WARN_CFLAGS}" + WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}" fi # Check whether --enable-build-warnings was given. if test "${enable_build_warnings+set}" = set; then : enableval=$enable_build_warnings; case "${enableval}" in - yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";; + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${GCC_WARN_CXXFLAGS}";; no) if test "${GCC}" = yes ; then WARN_CFLAGS="-w" + WARN_CXXFLAGS="-w" fi;; ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";; *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";; - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}" WARN_CXXFLAGS="${t} ${GCC_WARN_CXXFLAGS}";; + *) t=`echo "${enableval}" | sed -e "s/,/ /g"` + WARN_CFLAGS="${t}" WARN_CXXFLAGS="${t}";; esac fi if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then - echo "Setting warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C warning flags = $WARN_CFLAGS" 6>&1 + echo "Setting C++ warning flags = $WARN_CXXFLAGS" 6>&1 fi -- 2.1.4