Messages in this thread | | | Date | Wed, 2 Jun 2004 15:16:23 +0200 | From | Jörn Engel <> | Subject | Re: [RFC PATCH] explicitly mark recursion count |
| |
On Tue, 1 June 2004 12:58:12 -0700, Linus Torvalds wrote: > On Tue, 1 Jun 2004, Horst von Brand wrote: > > > > If the comment gets out of sync, you are toast. Too easy for that to > > happen, IMVHO. > > Yes. > > Recursion should be detectable automatically, the only thing you can't > detect easily is the reason to _break_ recursion.
Correct. My tool already detects recursions and prints warning, it just cannot make out the harmful ones and gives a warning for each.
> So how about just having a simple loop finder, and then the only comment > you need is a simple /* max recursion: N */ for any point in the loop.
That's what I basically want, at least for trivial recursions with only one function involved.
For a->b->c->a type recursions, I also need to identify all involved functions in the correct order, that's where my ugly format comes from.
RECURSION: 2 STEP: a STEP: b STEP: c
This mean that the recursion from a to b to c and back can happen twice at most.
Sure, the format is ugly. If anyone really cares I can change it into any other. But it gets the job done, so I don't care.
> That still makes it interesting if one function is part of two loops, and > is logically the place that breaks the recursion for one (or both - with > different logic) of them. But does that actually happen?
"Interesting" is the wrong word, really. Imo it doesn't make any sense to write such code and therefore I don't want to deal with it either. Print a warning and be done with it. See my output:
WARNING: multiple recursions around check_sig()
Jörn
-- A victorious army first wins and then seeks battle. -- Sun Tzu - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |