This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Warnings in the C++ Front-End and GCC in General
- To: Gerald Pfeifer <pfeifer at dbai dot tuwien dot ac dot at>
- Subject: Re: Warnings in the C++ Front-End and GCC in General
- From: Bill Currie <bcurrie at tssc dot co dot nz>
- Date: Mon, 14 Sep 1998 09:42:19 +1200
- CC: egcs at cygnus dot com, Per Bothner <bothner at cygnus dot com>, Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>, Mark Mitchell <mark at markmitchell dot com>
- Organization: NZ Telecommunication Systems Support Centre
- References: <Pine.GSO.4.03.9809112130270.21860-100000@markab.dbai.tuwien.ac.at>
Gerald Pfeifer wrote:
>
> On Wed, 9 Sep 1998, Bill Currie wrote:
> > And what about those people who insist upon compiling with -Werror (like
> > me), hmm?
>
> Bill, do your really manage to succeed with that?
In general, yes (X11 caused some problems, but I hacked my headers to
fix them (put in int's)). Oh, I should have been a little more clear: I
once tried to compile some page with -Wall -Werror and didn't get far
(can't remember which one). I now (usually) only use -Wall -Werror on
my own code.
> We originally strived for a zero warning policy, but EGCS -- not our
> code! -- still has way to many bugs which trigger incorrect warnings.
I haven't used egcs all that much yet, but I *HAVE* succeeded in
compiling some my code with egcs.
> For example, as I have reported back last December, even the one-liner
> main() { for(int i=1;;i++); for(int i=1;;i++); }
> causes
> warning: declaration of `i' shadows previous local
> with egcs-1.1 and egcs-current when -Wshadow is used.
Doesn't -Wall trigger -Wshadow, or has that changed since gcc-2.7.2.1?
Hmm, then again, I don't think I have any code that looks like your
main. I think my example would look like:
main() { if (foo) { for(int i=1;;i++); } else { for(int i=1;;i++); }}
ie the two declarations in different scopes. However, I'm sure I've got
some code that does what your main does, but I may not have compiled it
with egcs yet. (BTW, neither of the above would compile for me: default
int, no return, etc)
I can actually see why egcs would get confused in your case: I beleive
egcs still warns about the following:
{
for (int i=0;!data[i];i++);
if (i) return;
}
with the `old scoping rule' warning. I suppose this could confuse egcs
(though it shouldn't).
Bill
--
Leave others their otherness