This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Feature ideas
- From: Fergus Henderson <fjh at cs dot mu dot OZ dot AU>
- To: Gareth Pearce <tilps at hotmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 8 Nov 2002 20:13:06 +1100
- Subject: Re: Feature ideas
- References: <OE34sML51O0aAGgWtpe00000686@hotmail.com>
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.
Recursion is much more common in Mercury than in C, so the benefit may
be less in C, but nevertheless I would still be favourably disposed to
including this warning in GNU C, provided the implementation of the warning
wasn't too complicated.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.