scottl@mercury.sybase.com (Scott Luebking) (09/25/90)
We were wondering if anyone knows of a tool which can intelligently
augment C source files. One thing we would like the tool to do
is add arbitrary function calls to the beginning of functions, regardless of
pre-processor, formatting or declaration considerations, e.g.,:
foo() foo()
{ {
declarations declarations
. .
. .
. .
statements NEW_FUNCTION("foo");
statements
Another thing would be to preceed return statements with functions, e.g.:
return some_expression FLAG_RETURN("foo",(long) (some_expression));
return some_expression
without worrying about 'return' in comments.
Since we work with a wide range of platforms, it would be very helpful
that the tool be very portable. Has anyone heard of a tool like this?
Thanks very much
Scott Luebking
{mtxinu,sun,pyramid,pacbell}!sybase!scottl
scottl@sybase.comok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) (09/25/90)
In article <11054@sybase.sybase.com>, scottl@mercury.sybase.com (Scott Luebking) writes: > Another thing would be to preceed[sic] return statements with functions, e.g.: > return some_expression FLAG_RETURN("foo",(long) (some_expression)); > return some_expression Um, do you _really_ want to evaluate "some_expression" twice? And how do you expect this to work when I have struct complex Cadd(x, y) struct complex x, y; { struct complex s; ... return s; } If it's just for your own use, you could pick up the sources of Alan Holub's C compiler for US$60 and modify it to act as the processor you want. You really do want your tool to understand C types so that it doesn't try to cast structs to longs. And if you want to catch all returns, you don't want to miss the implicit one at the end of a void function. -- Heuer's Law: Any feature is a bug unless it can be turned off.