From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14403 invoked by alias); 15 Jan 2006 20:04:41 -0000 Received: (qmail 14385 invoked by uid 22791); 15 Jan 2006 20:04:40 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 15 Jan 2006 20:04:35 +0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.4/8.13.4) with ESMTP id k0FK41KF005260; Sun, 15 Jan 2006 21:04:01 +0100 (CET) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.4/8.13.3) with ESMTP id k0FK41W0013532; Sun, 15 Jan 2006 21:04:01 +0100 (CET) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.4/8.13.4/Submit) id k0FK41sV010809; Sun, 15 Jan 2006 21:04:01 +0100 (CET) Date: Sun, 15 Jan 2006 20:04:00 -0000 Message-Id: <200601152004.k0FK41sV010809@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: drow@false.org CC: gdb-patches@sourceware.org In-reply-to: <20060115182055.GA8189@nevyn.them.org> (message from Daniel Jacobowitz on Sun, 15 Jan 2006 13:20:55 -0500) Subject: Re: [RFA] Turn on -Werror by default References: <200601081759.k08HxOxP007121@elgar.sibelius.xs4all.nl> <20060108222546.GA4147@nevyn.them.org> <200601082253.k08MrLY1000252@elgar.sibelius.xs4all.nl> <20060115170103.GA5830@nevyn.them.org> <200601151755.k0FHtSR9016305@elgar.sibelius.xs4all.nl> <20060115182055.GA8189@nevyn.them.org> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-01/txt/msg00179.txt.bz2 > Date: Sun, 15 Jan 2006 13:20:55 -0500 > From: Daniel Jacobowitz > > On Sun, Jan 15, 2006 at 06:55:28PM +0100, Mark Kettenis wrote: > > From time to time I play with GCC 4, and try to fix a few problems, > > but I get the feeling I'm the only one. > > You may be the only one who prioritizes fixing these warnings, which I > still maintain are mostly useless. I think your sample is seriously > biased. A few points: > - You're the only active GDB developer I can think of offhand that > considers the warnings a serious problem. I do consider them a > problem - one which should be fixed, before we make policy > statements about them. Sorry, but you misunderstood me here. I do not consider these *new* GCC 4 warnings a problem. What I do consider to be a problem is that it makes people ignore other, useful warnings. > - You're primarily focused on the BSDs, and the BSD system compilers > can currently build GDB without warning. Indeed. > - Debian/unstable and Fedora Core, both popular development > platforms, can not. It truly amazes me that they are popular develepment platforms for the average application developer (as opposed to Debian and Fedora Core developers). That shows that these people don't understand what backwards compatibility means, and fully explains why so many applications don't even compile on my Linux desktop system at work. > - Many people doing development on GDB HEAD are likely to have GCC > HEAD lying around, which also can't build GDB with -Werror. True. And in fact it is important for us to make sure GDB can be used to debug code compiled with at least the latest official release of GCC. Tracking GCC HEAD, and using it to compile GDB, may very well be the only way to achieve that goal. > This patch is a policy statement that the GDB developers agree with you > on the importance of warning-free code, which will inconvenience you > not at all, and me a great deal. Can you see where I'm coming from? Yes. But warning-free code used to be the policy back in the GCC 3 days. I'm not aware that we dropped that policy; MAINTAINERS still lists -Werror in the "Target ISA" section. > I maintain that the correct way to turn on -Werror is to first fix the > warnings. As the developer who thinks -Werror is an important step > forward, the burden is on you to make GDB warning-free on a reasonable > set of platforms - I think we both agree on that already. I'm > disputing your reasonable set of platforms, however. Since we also seem to agree that the "warn for pointer argument passing or assignment with different signedness" warning from GCC 4 is mostly pedantry, how about the attached patch, which adds -Wno-pointer-sign" to the mix. I can add that bit first, and then when we've fixed the few remaining warnings, we can enable -Werror. Mark Index: configure.ac =================================================================== RCS file: /cvs/src/src/gdb/configure.ac,v retrieving revision 1.25 diff -u -p -r1.25 configure.ac --- configure.ac 17 Dec 2005 22:33:59 -0000 1.25 +++ configure.ac 15 Jan 2006 20:00:55 -0000 @@ -1109,6 +1109,24 @@ AC_ARG_WITH(sysroot, AC_SUBST(TARGET_SYSTEM_ROOT) AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) +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 + +WERROR_CFLAGS="" +if test "${ERROR_ON_WARNING}" = yes ; then + WERROR_CFLAGS="-Werror" +fi + # NOTE: Don't add -Wall or -Wunused, they both include # -Wunused-parameter which reports bogus warnings. # NOTE: If you add to this list, remember to update @@ -1116,6 +1134,9 @@ AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \ -Wformat -Wparentheses -Wpointer-arith -Wformat-nonliteral \ -Wunused-label -Wunused-function" +# NOTE: GCC 4 emits some warnings that are not very useful. We need +# to clean up our source tree, but until we do disabled them. +build_warnings="${build_warnings} -Wno-pointer-sign" # GCC supports -Wuninitialized only with -O or -On, n != 0. if test x${CFLAGS+set} = xset; then @@ -1164,7 +1185,6 @@ if test x"$silent" != x"yes" && test x"$ echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1 fi])dnl WARN_CFLAGS="" -WERROR_CFLAGS="" if test "x${build_warnings}" != x -a "x$GCC" = xyes then AC_MSG_CHECKING(compiler warning flags)