From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23428 invoked by alias); 25 Feb 2009 13:02:06 -0000 Received: (qmail 23238 invoked by uid 22791); 25 Feb 2009 13:02:05 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mail8.primus.ca (HELO mail-09.primus.ca) (216.254.141.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 25 Feb 2009 13:01:59 +0000 Received: from ottawa-hs-209-217-122-41.s-ip.magma.ca ([209.217.122.41] helo=[192.168.8.100]) by mail-09.primus.ca with esmtpa (Exim 4.63) (envelope-from ) id 1LcJOf-0005uV-2P; Wed, 25 Feb 2009 08:01:57 -0500 Message-ID: <49A54157.20701@ellipticsemi.com> Date: Wed, 25 Feb 2009 13:02:00 -0000 From: Tom St Denis User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: "John (Eljay) Love-Jensen" CC: GCC-help Subject: Re: Where did the warning go? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2009-02/txt/msg00208.txt.bz2 John (Eljay) Love-Jensen wrote: > Hi everyone, > > [Tom]> I think most long term developers really just want the warnings for > two things. Things that are undefined behaviour, and things that are lik= ely > a typo... > > I don=B9t mind keeping -Wall with the current meaning, and not deprecatin= g it. > > I, as a long term developer who has been developing for over 30 years, and > in C/C++ for over 20 years, using GCC since 2.95 came out, do wish that > there was a -Weverything flag that enabled all -W* toggle warnings. >=20=20=20 I'm actually ok with *adding* a new macro flag [e.g. -Weverything]. I=20 just don't want the defaults to change so radically. > Why? > > Because I use GCC as a lint-like tool. > > I like to be able to see what warnings my code generates, vet those warni= ngs > and vet my code, then decide to disable the warning or fix my code. >=20=20=20 Which sounds reasonable to me. I don't dismiss things like splint=20 because I'm lazy or dislike standards. My position stems from=20 experience with the tools and to this day never finding a bug in my=20 software because of it. -Wall has found bugs, valgrind/gdb have helped=20 me find bugs, but never have I ran splint on my code base and actually=20 found a bug. Maybe your situation is different, and I don't dismiss that. > I deeply appreciate that GCC has taken on incorporating (sensible) lint-l= ike > functionality into the compiler itself, which uses -Wfoo toggles. (I can > even appreciate that -Wall is "select popular warnings", and -Wextra is > "select additional less popular warnings".) > > Right now, I have a command-line for GCC g++ that is very, very, very, ve= ry > long, because I enable the warnings I know about. But I may have missed = one > or two. And more may come out with the next version of GCC that I am > unaware about. > > I wish I had a -Weverything flag. >=20=20=20 I'd be more interested in better static analysis than more syntax=20 warnings. And GCC has done a bit of that, if for example, you use a=20 constant in an array index for an array of known dimensions GCC will=20 warn if the value is out of range. Things like that are more useful I'd=20 think. I guess it also depends on your work flow standards too. Where I work=20 our standards are basically reasonably close to ISO C (except where we=20 start doing kernel or embedded work), and pass with the standard set of=20 "-Wall -W" flags without warnings.=20 Not to say we're 100% defect free, but of the (few) defects we have had,=20 extra syntax checks would not have found them. Typically they'd be=20 things like structure size mismatches, off by one errors, etc. > As long as I'm making wishes, I also wish warnings were emitted like this: > test.cpp:6: -Wunused warning: unused variable 'u' > ...rather than... > test.cpp:6: warning: unused variable 'u' > > Just my $0.02. >=20=20=20 Perhaps a variant of that where it outputs a code instead and you can=20 look it up in a manpage so the output isn't as verbose, e.g. test.cpp:6: (W43) warning: blah Where W43 refers to -Wunused or something. If you want to get on about formatting though, it would be nice to give=20 gcc a "I'm in 2009 with an ANSI VT100 terminal can you please highlight=20 text for me" option so that file names, line numbers, and the warning=20 appear in different colours allowing them to be scanned relatively quickly. :-) Tom