This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch to remove warning flags from non-GCC compilers.


While trying to build binutils on HP-UX with the system compiler I found
that I got an error because of the AM_BINUTILS_WARNINGS macro.  It was
adding -Wall (and other -W options) and this caused the system compiler
to abort because -W means something else to the HP compiler.  I would
like to change the AM_BINUTILS_WARNINGS macro to not set WARN_CFLAGS (or
NO_WERROR) when the compiler is not GCC.  Currently, even if I set
--disable-build-warnings, this macro sets WARN_CFLAGS to -w.  I think
that if the compiler is not GCC we should not set WARN_CFLAGS to
anything because we don't know what those flags mean to the compiler we
are using.

This patch makes that change and also adds an output line (if not
silent) that says:

	Compiler is not GCC, not setting warning flags

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-03  Steve Ellcey  <sje@cup.hp.com>

	* warning.m4 (AM_BINUTILS_WARNINGS): Do nothing if target
	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	Thu Nov  3 15:55:46 2005
***************
*** 1,41 ****
  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],
!   [case "${enableval}" in
!      yes | y) ERROR_ON_WARNING="yes" ;;
!      no | n)  ERROR_ON_WARNING="no" ;;
!      *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
!    esac])
  
  # Enable -Werror by default when using gcc
! if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
      ERROR_ON_WARNING=yes
! fi
  
! 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])
  
! if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
!   echo "Setting warning flags = $WARN_CFLAGS" 6>&1
  fi
  
  AC_SUBST(WARN_CFLAGS)
--- 1,48 ----
  dnl Common configure.in fragment
  
  AC_DEFUN([AM_BINUTILS_WARNINGS],[
  
! if test "$GCC" = yes; then
!   WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
! 
!   AC_ARG_ENABLE(werror,
!     [  --enable-werror    treat compile warnings as errors],
!     [case "${enableval}" in
!        yes | y) ERROR_ON_WARNING="yes" ;;
!        no | n)  ERROR_ON_WARNING="no" ;;
!        *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
!      esac])
  
  # Enable -Werror by default when using gcc
!   if -z "${ERROR_ON_WARNING}" ; then
      ERROR_ON_WARNING=yes
!   fi
  
!   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])
  
!   if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
!     echo "Setting warning flags = $WARN_CFLAGS" 6>&1
!   fi
! else
!   if test x"$silent" != x"yes"; then
!     echo "Compiler is not GCC, not setting warning flags" 6>&1
!   fi
  fi
  
  AC_SUBST(WARN_CFLAGS)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]