On 7/10/07, Joe Wilson <[EMAIL PROTECTED]> wrote:

--- Ted Mielczarek <[EMAIL PROTECTED]> wrote:
> I was wondering if it's possible to strip comment blocks from source
> files when generating sqlite3.c?  It seems that since it's a generated
> file anyway, the comments shouldn't be terribly important.  I ran a
> quick test on the sqlite-3.4.0 sources, and I got:
> wc -l sqlite3*.c
>   67479 sqlite3.c
>   49585 sqlite3-trimmed.c

+1 vote on this. Had the same debug issue on a MIPS GCC target.


My source code line counter, http://cloc.sourceforge.net, has an option to
remove comments from code.  You could use it until the amagamation is
delivered without comments.  It is a pretty simple process:

/tmp> cloc --strip_comments=nc sqlite3.c
      1 text file.
      1 unique file.
Wrote sqlite3.c.nc
      0 files ignored.

http://cloc.sourceforge.net v 0.80  T=7.0 s (0.1 files/s, 9639.9 lines/s)
-------------------------------------------------------------------------------
Language          files     blank   comment      code    scale   3rd gen.
equiv
-------------------------------------------------------------------------------
C                     1      3971     21278     42230 x   0.77 =
32517.10
-------------------------------------------------------------------------------
SUM:                  1      3971     21278     42230 x   0.77 =
32517.10
-------------------------------------------------------------------------------


Check that the resulting code is correct by comparing object
files produced from source with and without comments:

# original with comments:
/tmp> gcc -c sqlite3.c ; md5sum sqlite3.o
7da5779ac3becd4e2b1509117872cc6b  sqlite3.o

# after cloc has removed comments:
/tmp> mv sqlite3.c.nc sqlite3.c ; rm sqlite3.o ; gcc -c sqlite3.c ; md5sum
sqlite3.o
7da5779ac3becd4e2b1509117872cc6b  sqlite3.o
/tmp> wc -l sqlite3.c
42230 sqlite3.c

-- Al

Reply via email to