* [PATCH] move the computation of C++ warning flags to bfd/warning.m4
@ 2016-04-03 17:17 tbsaunde+binutils
2016-04-04 0:38 ` Alan Modra
2016-04-04 9:42 ` Pedro Alves
0 siblings, 2 replies; 3+ messages in thread
From: tbsaunde+binutils @ 2016-04-03 17:17 UTC (permalink / raw)
To: binutils; +Cc: Trevor Saunders
From: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
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 <tbsaunde+binutils@tbsaunde.org>
* configure: Regenerate.
opcodes/ChangeLog:
2016-04-03 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* configure: Regenerate.
gas/ChangeLog:
2016-04-03 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* configure: Regenerate.
bfd/ChangeLog:
2016-04-03 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* configure: Regenerate.
* warning.m4: Compute C++ warning flags as well as flags for C.
gold/ChangeLog:
2016-04-03 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* configure: Regenerate.
* configure.ac: Stop computing C++ warning flags.
binutils/ChangeLog:
2016-04-03 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* configure: Regenerate.
ld/ChangeLog:
2016-04-03 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] move the computation of C++ warning flags to bfd/warning.m4
2016-04-03 17:17 [PATCH] move the computation of C++ warning flags to bfd/warning.m4 tbsaunde+binutils
@ 2016-04-04 0:38 ` Alan Modra
2016-04-04 9:42 ` Pedro Alves
1 sibling, 0 replies; 3+ messages in thread
From: Alan Modra @ 2016-04-04 0:38 UTC (permalink / raw)
To: tbsaunde+binutils; +Cc: binutils
On Sun, Apr 03, 2016 at 01:22:07PM -0400, tbsaunde+binutils@tbsaunde.org wrote:
> 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.
I think I prefer things the way they are, but in any case will defer
to Cary's opinion on whether this patch should be accepted.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] move the computation of C++ warning flags to bfd/warning.m4
2016-04-03 17:17 [PATCH] move the computation of C++ warning flags to bfd/warning.m4 tbsaunde+binutils
2016-04-04 0:38 ` Alan Modra
@ 2016-04-04 9:42 ` Pedro Alves
1 sibling, 0 replies; 3+ messages in thread
From: Pedro Alves @ 2016-04-04 9:42 UTC (permalink / raw)
To: tbsaunde+binutils, binutils
On 04/03/2016 06:22 PM, tbsaunde+binutils@tbsaunde.org wrote:
> 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.
It might be interesting to look at reusing and unifying with gdb's
gdb/warning.m4. gdb's version knows to enable each warning iff the compiler
actually supports it, by probing support for each warning, in a loop.
That allows gdb adding newer gcc warnings without hardcoding gcc versions
and/or worry of making older compilers complain about unknown options.
It supports both C and C++ too.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-04 9:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-03 17:17 [PATCH] move the computation of C++ warning flags to bfd/warning.m4 tbsaunde+binutils
2016-04-04 0:38 ` Alan Modra
2016-04-04 9:42 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).