tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD GSoC wcc(1)



On Mon, Mar 24, 2008 at 10:06:58AM +0100, geoffroy weisenhorn wrote:
 > I'm interesting for a project that seems to be very interesting : wcc(1)
 > Also , Can I have more informations about how each file should be
 > counted and the needs for combining counts at "link" time ? A tiny
 > parser would be useful in order to build a direct acyclic graph of
 > dependence files ?

You would need at least part of a cpp(1) implementation in order to
process #include files and remove comments while still counting lines
accurately. This is more than a tiny parser, although it is not all
that hard.

The idea is that each distinct source file should be counted exactly
once, so that if I have a 500-line header file and two 1000-line
source files that #include it once, the total line count would be
2500, not 3000. If both source files actually #include it twice for
some reason, the total line count would still be 2500 and not 4000.

This means that the ".o" file generated by compiling one of the source
files would need to hold the information "foo.c 1000" and "foo.h 500";
the other one would contain "bar.c 1000" and "foo.h 500". When you
"linked" these, the output file would want to contain each of these
entries exactly once.

Note that to get accurate counts of some projects you need to be able
to deal with files that appear under multiple names because they're
sometimes reached via links.

Does that help? I am not absolutely certain I understand your
question.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index