Path: utzoo!utgpu!watserv1!watmath!att!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.unix.programmer Subject: Re: hiding lint's ravings (was Re: FAQ - malloc array - clarify) Keywords: malloc, Sun, lint Message-ID: <9451@jpl-devvax.JPL.NASA.GOV> Date: 10 Sep 90 21:19:12 GMT References: <8056@helios.TAMU.EDU> <1990Sep08.022034.8444@virtech.uucp> <8086@helios.TAMU.EDU> <11730@crdgw1.crd.ge.com> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 74 Here's a nifty little gizmo that implements /*NOSTRICT*/ by postprocessing lint's output for you. #!/usr/bin/perl 'di'; 'ig00'; # # $Header: nostrict,v 1.1 90/08/11 13:26:31 lwall Locked $ # # $Log: nostrict,v $ # Revision 1.1 90/08/11 13:26:31 lwall # Initial revision # for $arg (@ARGV) { next unless $arg =~ /\.[ch]$/; open(IN,$arg); while () { vec($ok{$arg}, $., 1) = 1 if m#/\*\s*NOSTRICT\s*\*/# .. m#;\s*($|/\*)#; } close IN; } open(LINT, "-|") || exec @ARGV; while () { next unless ($file,$line) = /(\S+)\((\d+\))/; next unless defined $ok{$file}; $_ = '' if vec($ok{$file}, $line, 1); next unless ($file,$line) = /::\s*(\S+)\((\d+\))/; next unless defined $ok{$file}; $_ = '' if vec($ok{$file}, $line, 1); } continue { print; } ############################################################################## # These next few lines are legal in both Perl and nroff. .00; # finish .ig 'di \" finish diversion--previous line must be blank .nr nl 0-1 \" fake up transition to first page again .nr % 0 \" start at page 1 '; __END__ ############# From here on it's a standard manual page ############ .TH NOSTRICT 1 "August 11, 1990" .AT 3 .SH NAME nostrict \- postprocesses lint output to implement NOSTRICT directives .SH SYNOPSIS .B nostrict lint [lint_args] .SH DESCRIPTION .I Nostrict runs the command supplied in the rest of the arguments on the command line, and then weeds out any lint complaints referring to statements preceded by the /*NOSTRICT*/ directive that the lint documentation documents but that lint doesn't implement. .SH ENVIRONMENT No environment variables are used. .SH FILES None. .SH AUTHOR Larry Wall .SH "SEE ALSO" lint(1) .SH DIAGNOSTICS None. Relies on lint to tell you about missing files. .SH BUGS Should probably differentiate the errors you want NOSTRICT for from the errors you don't. Larry Wall lwall@jpl-devvax.jpl.nasa.gov