From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29158 invoked by alias); 7 Dec 2001 11:32:22 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 29105 invoked from network); 7 Dec 2001 11:32:13 -0000 Received: from unknown (HELO fencepost.gnu.org) (199.232.76.164) by sources.redhat.com with SMTP; 7 Dec 2001 11:32:13 -0000 Received: from puce.csi.cam.ac.uk ([131.111.8.40]) by fencepost.gnu.org with esmtp (Exim 3.22 #1 (Debian)) id 16CJEi-000326-00 for ; Fri, 07 Dec 2001 06:32:13 -0500 Received: from student.cusu.cam.ac.uk ([131.111.179.82] helo=kern.srcf.societies.cam.ac.uk ident=mail) by puce.csi.cam.ac.uk with esmtp (Exim 3.22 #1) id 16CJEe-0002WW-00; Fri, 07 Dec 2001 11:32:08 +0000 Received: from jsm28 (helo=localhost) by kern.srcf.societies.cam.ac.uk with local-esmtp (Exim 3.12 #1 (Debian)) id 16CJEe-0001wl-00; Fri, 07 Dec 2001 11:32:08 +0000 Date: Fri, 07 Dec 2001 04:15:00 -0000 From: "Joseph S. Myers" X-X-Sender: To: "David E. Weekly" cc: Subject: Re: Patch to Add -Wunused-returns In-Reply-To: <0c4f01c17edd$5bbbefc0$5c044589@legato.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2001-12/txt/msg00357.txt.bz2 On Thu, 6 Dec 2001, David E. Weekly wrote: > Thanks for your wide response (generally along the lines of "okay, if you > want it - do it!"). I've resurrected Gray Watson's patch > (http://256.com/gray/) and 95% of the credit of this patch belongs to him. A current copyright assignment or disclaimer from him will probably be needed, then. (The old copy of copyright.list I have only shows CCCP Gray Watson 1992-04-21 Disclaims changes to cccp. CCCP Antaire Corporation 1992-04-21 Disclaims changes made by Gray Watson to cccp. info@antaire.com .) > (I obtained his permission to resurrect this patch.) I basically just > slapped his code in there my way and gave it a quick check. Seems to work on > some simple test cases just fine. Testcases need to be included in a form suitable for the testsuite (see existing tests for warnings in gcc.dg). They should probably test at least: * Void value ignored, no warning. * Non-void value ignored, warning. * Non-void value cast to void, no warning. > Incidentally, when running my diff it became clear that some files are in > CVS that oughtn't be -- i.e., are autogenerated! Here they are: > > fastjar/Makefile.in (made from fastjar/Makefile.am) > fastjar/configure (made from configure.in) > > Needless to say, having these auto-generated files in CVS makes diffing > annoying. =) You should use contrib/gcc_update --touch to avoid files getting spuriously rebuilt. These files need to be in CVS for just running configure and building the compiler from CVS to work - and there are strong restrictions on the suitable versions of autoconf. > There were also numerous warnings when compiling GCC from GCC 2.96 and XGCC > itself. Is this okay, or is the hope to someday have a smooth, clean build? You should make sure your changes don't add any new warnings. > + warning("return value from function ignored"); Space before open parenthesis. > +@item -Wunused-returns @r{(C only)} > +@opindex Wunused-returns > +Warn whenever the result of a non-void function is implicitly cast away. > +It is not included in the above, because it requires @code{void} casting > +returns of all sorts of regular functions, like @code{close} and > +@code{printf}, whose return value you usually don't care about. This makes > +GCC more like Lint. The position you've put this in the file implies it's included in -Wall, since -Wall below says that all the above -W options are included. It should go somewhere below -W in the file. Please also update trouble.texi so that it says, this is why we don't warn by default but we have this option if you do want these warnings. (Similar to how below it says to use -pedantic-errors to make constraint violations into errors rather than warnings.) -- Joseph S. Myers jsm28@cam.ac.uk