henry@utzoo.UUCP (Henry Spencer) (03/21/85)
For those of you concerned about possible (mis)use of the Reiser preprocessor features in code you maintain, enclosed is a dead-simple shell program that looks for worrisome constructs in C source files. It's really too simplistic, and does produce false alarms, but it will nevertheless reduce the amount of code to be inspected by a couple of orders of magnitude. It looks for macro substitution in strings using the (somewhat naive) heuristic that any parameterized macro containing a string is suspect. This produces some false alarms for things like printf's in macros, but not many. It looks for token concatenatation by looking for the magic /**/ sequence that accomplishes it in the Reiser preprocessor. ----- : 'Simplistic search for possible Reiserisms in C source files.' PATH=/bin:/usr/bin ; export PATH : 'Look for parameterized macros containing strings.' egrep '^#[ ]*define[ ]+[a-zA-Z_][a-zA-Z0-9_]*\(.*["'"']" $* : 'Look for the magic /**/ that vanishes, causing token concatenation.' egrep '^#[ ]*define[ ]+.*/\*\*/' $* ----- -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry