Feature ideas
Gareth Pearce
tilps@hotmail.com
Fri Nov 8 03:36:00 GMT 2002
> On 08-Nov-2002, Gareth Pearce <tilps@hotmail.com> wrote:
> > and -Wdirect-infninte-recursion and -Wprobable-direct-infinite-recursion
> >
> > first one detects
> >
> > int blah(int a, int b) {
> > ... no branches no early outs no modification of a or b ...
> > return blah(a,b)
> > }
>
> We have implemented a warning which is similar to this in the Mercury
> compiler, and it has proved useful. It is enabled by default and there
> is no way to turn it off. It doesn't trigger very often, but when it
> does, it invariably indicates a bug. I suspect it is most useful to
> novice programmers who are more likely to make mistakes of this kind.
novice programmers - and also odd interactions when porting software
to new platforms. I spent a week (of spare time - not terribly much right
now) trying to work out why linking the cygwin port of xerces-c was
causing some applications to crash. Even some which didnt use xerces
at all. Turns out that a couple of #defines in string.h meant that
int stricmp(a,b) {return strcasecmp(a.b)} in xerces code was now
int strcasecmp(a,b) {return strcasecmp(a,b)}
a warning would of solved that very simply.
(even a '#define replacement makes function Blah self-recusive' warning
would do it - but I would prefer a more general solution)
Gareth
More information about the Gcc
mailing list