This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Patch to remove warning flags from non-GCC compilers.
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: amodra at bigpond dot net dot au, binutils at sourceware dot org
- Date: Fri, 4 Nov 2005 11:15:57 -0800 (PST)
- Subject: Re: Patch to remove warning flags from non-GCC compilers.
Here is a new version of my patch. WARN_CFLAGS is set to the empty
string by default if you have a non-GCC compiler but if you use
"--enable-build-warnings" you get the GCC standard warning flags. If
you use --enable-build-warnings="-foobar" then you get WARN_CFLAGS set
to -foobar (regardless of what your compiler is).
I think it is important that the default behaviour for non-GCC compilers
not add GCC flags to the compile line so that users of HP-UX systems can
compile binutils with the HP compiler with the default configure/make
commands and not have to explicitly turn off warnings for the build to
work at all.
It also fixes the problem of setting WARN_CFLAGS to -w for non-GCC
compilers when --disable-build-warnings is used.
Tested on IA64 HP-UX with GCC and with the system compiler. OK for
checkin?
Steve Ellcey
sje@cup.hp.com
------------------
bfd/ChangeLog
2005-11-04 Steve Ellcey <sje@cup.hp.com>
* warning.m4 (AM_BINUTILS_WARNINGS): Default to empty string
if compiler is not GCC.
* configure: Regenerate
binutils/ChangeLog
gas/ChangeLog
gprof/ChangeLog
ld/ChangeLog
opcodes/ChangeLog
2005-11-03 Steve Ellcey <sje@cup.hp.com>
* configure: Regenerate
------------------
*** src.orig/bfd/warning.m4 Thu Nov 3 15:55:42 2005
--- src/bfd/warning.m4 Fri Nov 4 11:07:08 2005
***************
*** 1,7 ****
dnl Common configure.in fragment
AC_DEFUN([AM_BINUTILS_WARNINGS],[
! WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
AC_ARG_ENABLE(werror,
[ --enable-werror treat compile warnings as errors],
--- 1,7 ----
dnl Common configure.in fragment
AC_DEFUN([AM_BINUTILS_WARNINGS],[
! GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
AC_ARG_ENABLE(werror,
[ --enable-werror treat compile warnings as errors],
*************** fi
*** 18,36 ****
NO_WERROR=
if test "${ERROR_ON_WARNING}" = yes ; then
! WARN_CFLAGS="$WARN_CFLAGS -Werror"
NO_WERROR="-Wno-error"
fi
AC_ARG_ENABLE(build-warnings,
[ --enable-build-warnings Enable build-time compiler warnings],
[case "${enableval}" in
! yes) ;;
! no) WARN_CFLAGS="-w";;
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
! WARN_CFLAGS="${WARN_CFLAGS} ${t}";;
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
! WARN_CFLAGS="${t} ${WARN_CFLAGS}";;
*) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac])
--- 18,42 ----
NO_WERROR=
if test "${ERROR_ON_WARNING}" = yes ; then
! GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
NO_WERROR="-Wno-error"
fi
+ if test "${GCC}" = yes ; then
+ WARN_CFLAGS="${GCC_WARN_CFLAGS}"
+ fi
+
AC_ARG_ENABLE(build-warnings,
[ --enable-build-warnings Enable build-time compiler warnings],
[case "${enableval}" in
! yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
! no) if test "${GCC}" = yes ; then
! WARN_CFLAGS="-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"`;;
esac])