1 .\" $NetBSD: error.1,v 1.12 2003/08/07 11:13:36 agc Exp $
3 .\" Copyright (c) 1980, 1990, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the University nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" @(#)error.1 8.1 (Berkeley) 6/6/93
37 .Nd analyze and disperse compiler error messages
44 .Op Fl t Ar suffixlist
45 .Op Fl I Ar ignorefile
49 analyzes and optionally disperses the diagnostic error messages
50 produced by a number of compilers and language processors to the source
51 file and line where the errors occurred. It can replace the painful,
52 traditional methods of scribbling abbreviations of errors on paper, and
53 permits error messages and source code to be viewed simultaneously
54 without machinations of multiple windows in a screen editor.
61 touch any files; all error messages are sent to the
66 whether s/he wants to touch the file.
67 A ``y'' or ``n'' to the question is necessary to continue.
70 option implies that all referenced files
71 (except those referring to discarded error messages)
74 After all files have been touched,
75 overlay the visual editor
77 with it set up to edit all files touched,
78 and positioned in the first touched file at the first error.
87 Take the following argument as a suffix list.
88 Files whose suffixes do not appear in the suffix list are not touched.
89 The suffix list is dot separated, and ``*'' wildcards work.
96 to touch files ending with ``.c'', ``.y'', ``.foo*'' and ``.h''.
100 regarding the error categorization.
105 looks at the error messages,
106 either from the specified file
108 or from the standard input,
109 and attempts to determine which
110 language processor produced each error message,
111 determines the source file and line number to which the error message refers,
112 determines if the error message is to be ignored or not,
113 and inserts the (possibly slightly modified) error message into
114 the source file as a comment on the line preceding to which the
115 line the error message refers.
116 Error messages which can't be categorized by language processor
117 or content are not inserted into any file,
118 but are sent to the standard output.
120 touches source files only after all input has been read.
123 is intended to be run
124 with its standard input
125 connected via a pipe to the error message source.
126 Some language processors put error messages on their standard error file;
127 others put their messages on the standard output.
128 Hence, both error sources should be piped together into
130 For example, when using the
134 .Dl make \-s lint \&| error \-q \-v
136 will analyze all the error messages produced
139 runs when making lint.
142 knows about the error messages produced by:
154 .Em DEC Western Research Modula\-2 .
156 knows a standard format for error messages produced by
157 the language processors,
158 so is sensitive to changes in these formats.
159 For all languages except
161 error messages are restricted to be on one line.
162 Some error messages refer to more than one line in more than
165 will duplicate the error message and insert it at
166 all of the places referenced.
169 will do one of six things with error messages.
170 .Bl -tag -width synchronize
172 Some language processors produce short errors describing
173 which file it is processing.
175 uses these to determine the file name for languages that
176 don't include the file name in each error message.
177 These synchronization messages are consumed entirely by
182 that refer to one of the two
185 .Pa /usr/libdata/lint/llib-lc
187 .Pa /usr/libdata/lint/llib-port
189 to prevent accidentally touching these libraries.
190 Again, these error messages are consumed entirely by
195 can be nullified if they refer to a specific function,
196 which is known to generate diagnostics which are not interesting.
197 Nullified error messages are not inserted into the source file,
198 but are written to the standard output.
199 The names of functions to ignore are taken from
200 either the file named
202 in the user's home directory,
203 or from the file named by the
206 If the file does not exist,
207 no error messages are nullified.
208 If the file does exist, there must be one function
210 .It Em not file specific
211 Error messages that can't be intuited are grouped together,
212 and written to the standard output before any files are touched.
213 They will not be inserted into any source file.
215 Error message that refer to a specific file,
216 but to no specific line,
217 are written to the standard output when
218 that file is touched.
220 Error messages that can be intuited are candidates for
221 insertion into the file to which they refer.
224 Only true error messages are candidates for inserting into
225 the file they refer to.
226 Other error messages are consumed entirely by
228 or are written to the standard output.
230 inserts the error messages into the source file on the line
231 preceding the line the language processor found in error.
232 Each error message is turned into a one line comment for the
234 and is internally flagged
235 with the string ``###'' at
236 the beginning of the error,
237 and ``%%%'' at the end of the error.
238 This makes pattern searching for errors easier with an editor,
239 and allows the messages to be easily removed.
240 In addition, each error message contains the source line number
241 for the line the message refers to.
242 A reasonably formatted source program can be recompiled
243 with the error messages still in it,
244 without having the error messages themselves cause future errors.
245 For poorly formatted source programs in free format languages,
247 it is possible to insert a comment into another comment,
248 which can wreak havoc with a future compilation.
249 To avoid this, programs with comments and source
250 on the same line should be formatted
251 so that language statements appear before comments.
254 catches interrupt and terminate signals,
255 and if in the insertion phase,
256 will orderly terminate what it is doing.
258 .Bl -tag -width ~/.errorrc -compact
260 function names to ignore for
275 Opens the teletype directly to do user querying.
277 Source files with links make a new copy of the file with
280 Changing a language processor's format of error messages
283 to not understand the error message.
286 since it is purely mechanical,
287 will not filter out subsequent errors caused by `floodgating'
288 initiated by one syntactically trivial error.
289 Humans are still much better at discarding these related errors.
291 Pascal error messages belong after the lines affected
292 (error puts them before). The alignment of the `\\' marking
293 the point of error is also disturbed by
297 was designed for work on
299 at reasonably high speed.
300 It is less pleasant on slow speed terminals, and has never been
301 used on hardcopy terminals.