hiding lint's ravings (was Re: FAQ - malloc array - clarify)

Larry Wall lwall at jpl-devvax.JPL.NASA.GOV
Tue Sep 11 07:19:12 AEST 1990


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 (<IN>) {
	vec($ok{$arg}, $., 1) = 1 if m#/\*\s*NOSTRICT\s*\*/# .. m#;\s*($|/\*)#;
    }
    close IN;
}

open(LINT, "-|") || exec @ARGV;

while (<LINT>) {
    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 at jpl-devvax.jpl.nasa.gov



More information about the Comp.unix.programmer mailing list