cappella@convex.UUCP (03/08/88)
On many occasions, I have found source files which have either obsoleted or unnecessary #include's. But finding them is usually by chance. I am hoping that someone out there has already written a utility to check for these extraneous include file usages. If you have such a program, please let me know via email. -------------------------------------------------------------------------------- Mike Cappella Convex Computer Corporation Richardson, Texas {ihnp4,cbosgd,allegra,sun}!convex!cappella
lampman@heurikon.UUCP (Ray Lampman) (03/10/88)
In article <62800004@convex> cappella@convex.UUCP writes: > On many occasions, I have found source files which have either obsoleted > or unnecessary #include's. But finding them is usually by chance. I limit include file usage either visually (when I am familiar with the included file) or by commenting-out the #include line and seeing if the compiler complains. I too would like a more automated way of doing this. Please mail or post any suggestions. Thanks in advance, -- - Ray Lampman (lampman@heurikon.UUCP)
bobm@rtech.UUCP (Bob McQueer) (03/12/88)
I've been fiddling around with a header file analysis tool which might answer the need. What I'm really interested in is following out header file dependencies, sorting the files into topological order based on the definitions & typedefs from one header which are needed by others, and giving you a cross reference of what things are defined (or multiply defined) in what files and undefined in the whole mess. I haven't really honed up this thing the way I want it yet, but what you would do is say: hat <header files> -q <source file> and among the voluminous output would be the dependencies of <source file> on the other files. The -q says to take any symbols which are included in unrecognized syntax, and treat them as references instead of ignoring them. I've really only implemented recognition of the syntax for preprocessor stuff and typedef's, not executable c code since I was intending the tool to analyze sets of headers. It might not do to bad on source files, if spiffed up to recognize a bit more syntax, such as declarations and statement keywords so that they don't turn up as bogus undefined "references". If there is interest, I would post the thing.