mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-17 13:10:12 +08:00
bfd: Stop using -Wstack-usage=262144 when built with Clang
Some components of GNU Binutils will pass "-Wstack-usage=262144" when "GCC >= 5.0" is detected. However, Clang does not support "-Wstack-usage", despite that related configuration part in bfd/warning.m4 handles the latest Clang (15.0.0 as of this writing) as "GCC >= 5.0". The option "-Wstack-usage" was ignored when the first version of Clang is released but even this "ignoring" behavior is removed before Clang 4.0.0. So, if we give Clang "-Wstack-usage=262144", it generates a warning, making the build failure. This commit checks "__clang__" macro to prevent adding the option if the compiler is identified as Clang. bfd/ChangeLog: * warning.m4: Stop appending "-Wstack-usage=262144" option when compiled with Clang. * configure: Regenerate. binutils/ChangeLog: * configure: Regenerate. gas/ChangeLog: * configure: Regenerate. gold/ChangeLog: * configure: Regenerate. gprof/ChangeLog: * configure: Regenerate. ld/ChangeLog: * configure: Regenerate. opcodes/ChangeLog: * configure: Regenerate.
This commit is contained in:
parent
fdbca36115
commit
491cf3178f
18
bfd/configure
vendored
18
bfd/configure
vendored
@ -12093,10 +12093,19 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then :
|
||||
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
__clang__
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "^__clang__$" >/dev/null 2>&1; then :
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144"
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings.
|
||||
WARN_WRITE_STRINGS=""
|
||||
@ -12138,10 +12147,19 @@ if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then :
|
||||
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
__clang__
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "^__clang__$" >/dev/null 2>&1; then :
|
||||
GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
# Check whether --enable-werror was given.
|
||||
if test "${enable_werror+set}" = set; then :
|
||||
|
@ -50,7 +50,8 @@ GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
|
||||
AC_EGREP_CPP([(^[0-3]$|^__GNUC__$)],[__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__$)],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144")
|
||||
AC_EGREP_CPP([(^[0-4]$|^__GNUC__$)],[__GNUC__],,dnl
|
||||
[AC_EGREP_CPP([^__clang__$],[__clang__],[GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144"],)])
|
||||
|
||||
# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings.
|
||||
WARN_WRITE_STRINGS=""
|
||||
@ -62,7 +63,8 @@ AC_EGREP_CPP([(^[0-3]$|^__GNUC__$)],[__GNUC__],,WARN_WRITE_STRINGS="-Wwrite-stri
|
||||
AC_EGREP_CPP_FOR_BUILD([(^[0-3]$|^__GNUC__$)],[__GNUC__],,GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow")
|
||||
|
||||
# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
|
||||
AC_EGREP_CPP_FOR_BUILD([(^[0-4]$|^__GNUC__$)],[__GNUC__],,GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144")
|
||||
AC_EGREP_CPP_FOR_BUILD([(^[0-4]$|^__GNUC__$)],[__GNUC__],,dnl
|
||||
[AC_EGREP_CPP_FOR_BUILD([^__clang__$],[__clang__],[GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"],)])
|
||||
|
||||
AC_ARG_ENABLE(werror,
|
||||
[ --enable-werror treat compile warnings as errors],
|
||||
|
18
binutils/configure
vendored
18
binutils/configure
vendored
@ -11932,10 +11932,19 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then :
|
||||
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
__clang__
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "^__clang__$" >/dev/null 2>&1; then :
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144"
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings.
|
||||
WARN_WRITE_STRINGS=""
|
||||
@ -11977,10 +11986,19 @@ if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then :
|
||||
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
__clang__
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "^__clang__$" >/dev/null 2>&1; then :
|
||||
GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
# Check whether --enable-werror was given.
|
||||
if test "${enable_werror+set}" = set; then :
|
||||
|
18
gas/configure
vendored
18
gas/configure
vendored
@ -11588,10 +11588,19 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then :
|
||||
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
__clang__
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "^__clang__$" >/dev/null 2>&1; then :
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144"
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings.
|
||||
WARN_WRITE_STRINGS=""
|
||||
@ -11633,10 +11642,19 @@ if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then :
|
||||
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
__clang__
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "^__clang__$" >/dev/null 2>&1; then :
|
||||
GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
# Check whether --enable-werror was given.
|
||||
if test "${enable_werror+set}" = set; then :
|
||||
|
18
gold/configure
vendored
18
gold/configure
vendored
@ -7938,10 +7938,19 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then :
|
||||
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
__clang__
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "^__clang__$" >/dev/null 2>&1; then :
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144"
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings.
|
||||
WARN_WRITE_STRINGS=""
|
||||
@ -7983,10 +7992,19 @@ if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then :
|
||||
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
__clang__
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "^__clang__$" >/dev/null 2>&1; then :
|
||||
GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
# Check whether --enable-werror was given.
|
||||
if test "${enable_werror+set}" = set; then :
|
||||
|
18
gprof/configure
vendored
18
gprof/configure
vendored
@ -11890,10 +11890,19 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then :
|
||||
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
__clang__
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "^__clang__$" >/dev/null 2>&1; then :
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144"
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings.
|
||||
WARN_WRITE_STRINGS=""
|
||||
@ -11935,10 +11944,19 @@ if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then :
|
||||
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
__clang__
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "^__clang__$" >/dev/null 2>&1; then :
|
||||
GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
# Check whether --enable-werror was given.
|
||||
if test "${enable_werror+set}" = set; then :
|
||||
|
18
ld/configure
vendored
18
ld/configure
vendored
@ -15855,10 +15855,19 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then :
|
||||
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
__clang__
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "^__clang__$" >/dev/null 2>&1; then :
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144"
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings.
|
||||
WARN_WRITE_STRINGS=""
|
||||
@ -15900,10 +15909,19 @@ if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then :
|
||||
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
__clang__
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "^__clang__$" >/dev/null 2>&1; then :
|
||||
GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
# Check whether --enable-werror was given.
|
||||
if test "${enable_werror+set}" = set; then :
|
||||
|
18
opcodes/configure
vendored
18
opcodes/configure
vendored
@ -11445,10 +11445,19 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then :
|
||||
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
__clang__
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "^__clang__$" >/dev/null 2>&1; then :
|
||||
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wstack-usage=262144"
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
# Set WARN_WRITE_STRINGS if the compiler supports -Wwrite-strings.
|
||||
WARN_WRITE_STRINGS=""
|
||||
@ -11490,10 +11499,19 @@ if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "(^[0-4]$|^__GNUC__$)" >/dev/null 2>&1; then :
|
||||
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
__clang__
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "^__clang__$" >/dev/null 2>&1; then :
|
||||
GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
fi
|
||||
rm -f conftest*
|
||||
|
||||
|
||||
# Check whether --enable-werror was given.
|
||||
if test "${enable_werror+set}" = set; then :
|
||||
|
Loading…
Reference in New Issue
Block a user