lint2 bug +FIX
Jeff Gilliam
jeff at voder.UUCP
Fri May 6 08:44:06 AEST 1988
Subject: lint2 bug +FIX
Index: usr.bin/lint/{Makefile,hash.c} 4.3BSD
Description:
The 4.3 lint wastes enormous amounts of CPU time needlessly,
because of a "broken" hashing function. Sometime before the
4.3 release someone reorganized the lint sources, with the
result that most of lint gets compiled with FLEXNAMES defined,
but hash.c gets compiled without FLEXNAMES being defined. This
results in a hashstr() function that always returns 0! So,
lint's pass2 spends most of its time in hash() searching the
hash tables. Pass 1 uses a slightly different hash function
defined in a different place, and so doesn't suffer from this
problem.
Repeat-By:
Lint any large program. The 4.3 kernel is handy. Watch
lint take a *long* time.
Fix:
The following patches make lint2 about 10 times faster, as
measured by linting the kernel.
RCS file: RCS/Makefile,v
retrieving revision 1.1
diff -c -r1.1 Makefile
*** /tmp/,RCSt1007336 Thu May 5 14:06:00 1988
--- Makefile Thu May 5 13:41:24 1988
***************
*** 93,98 ****
--- 93,101 ----
lpass2.o: $M/manifest.h lmanifest.h pcclocal.h macdefs.h
${CC} ${CFLAGS} -c -I$M -I. lpass2.c
+ hash.o: $M/config.h
+ $(CC) -c $(CFLAGS) -I$M -I. hash.c
+
lintall:
lint -hpv -I. -I$M $M/cgram.c $M/xdefs.c $M/scan.c \
$M/pftn.c $M/trees.c $M/optim.c lint.c
RCS file: RCS/hash.c,v
retrieving revision 1.1
diff -c -r1.1 hash.c
*** /tmp/,RCSt1007341 Thu May 5 14:06:07 1988
--- hash.c Thu May 5 13:38:46 1988
***************
*** 2,7 ****
--- 2,9 ----
static char sccsid[] = "@(#)hash.c 1.1 (Berkeley) 3/29/83";
#endif lint
+ #include "config.h"
+
/*
* Hash function. Used for pass 2 symbol table and string table,
* and structure/union name passing between passes.
--
Jeff Gilliam {ucbvax,pyramid,nsc}!voder!jeff
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list