Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/17/84; site elsie.UUCP Path: utzoo!watmath!clyde!burl!hou3c!hocda!houxm!ihnp4!zehntel!hplabs!hao!seismo!umcp-cs!cvl!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: net.unix-wizards,net.bugs.4bsd Subject: 4.?bsd (and others?) lint bugs (with fixes) Message-ID: <5@elsie.UUCP> Date: Mon, 24-Sep-84 20:30:06 EDT Article-I.D.: elsie.5 Posted: Mon Sep 24 20:30:06 1984 Date-Received: Thu, 27-Sep-84 04:18:10 EDT Distribution: net Organization: NIH-LEC, Bethesda, MD Lines: 87 Bugged: /usr/bin/lint Bugs: lint sometimes wrongly believes you've used a "-n" or "-p" option; it gives a dumb error message if you use "-O"; it mishandles cases where "-p" is used with "-l". Repeat by: First bug: cat << EOF > file.c #includemain() { printf("%s\n", "Hello"); printf("Goodbye\n"); } EOF lint -DNONSENSE file.c lint -Dnonsense file.c ...and note that the two lint runs give different results. Second bug: echo 'main(){}' > file.c lint -O file.c ...and note the spurious diagnostic. Third bug: cat << EOF > file.c #include #include main() { werase(stdscr); } EOF lint file.c -lcurses lint -p file.c -lcurses ...and note the spurious complaint about argument use from the second lint run. Analysis: First bug: The "/usr/bin/lint" script mistakes any argument of the form "-*n*", even something like "-Dnonsense", for "-n". Second bug: The "/usr/bin/lint" script passes any "-O" argument to "/lib/cpp", which has no idea what to do with it. Third bug: While two "pre-compiled" versions of "lint library files" are maintained for "stdio" functions--one version to be used when you say "lint -p", the other to be used when you leave off the "-p"--there's only one version of such files for things like the "curses" library. Fix: I recommend copying "/usr/bin/lint" to "/usr/local/lint" (or whatever your "local" directory is), then applying these edits. The trade secret status of "/usr/bin/lint" precludes posting things in a clearer way. ed - lint << EOF /-\*n\*/i -[IDU]*) ;; -l*) ;; . /IDOU/s//IDU/ /-l.*cat/c -l*) case \$P in port) ( /lib/cpp \$O \$LL/llib\$A | \${L}1 -v\$X >> \$T ) 2>&1 ;; *) cat \$LL/llib\$A.ln >> \$T ;; esac ;; . /\*\.ln)/m/-\*)/ w q EOF -- UNIX and Bugs are AT&T Bell Laboratories and Warner Brothers trademarks. -- ...decvax!seismo!umcp-cs!elsie!ado (301) 496-5688 DEC, VAX and Elsie are Digital Equipment Corp. and Borden's trademarks.