emacs.d/clones/lisp/www.cs.cmu.edu/Groups/AI/html/cltl/clm/node225.html

103 lines
6.1 KiB
HTML
Raw Normal View History

2022-08-26 19:11:35 +02:00
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
<HEAD>
<TITLE>25.1.1. Compiler Diagnostics</TITLE>
</HEAD>
<BODY>
<meta name="description" value=" Compiler Diagnostics">
<meta name="keywords" value="clm">
<meta name="resource-type" value="document">
<meta name="distribution" value="global">
<P>
<b>Common Lisp the Language, 2nd Edition</b>
<BR> <HR><A NAME=tex2html4374 HREF="node226.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html4372 HREF="node224.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html4366 HREF="node224.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html4376 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html4377 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html4375 HREF="node226.html"> Compiled Functions</A>
<B>Up:</B> <A NAME=tex2html4373 HREF="node224.html"> The Compiler</A>
<B> Previous:</B> <A NAME=tex2html4367 HREF="node224.html"> The Compiler</A>
<HR> <P>
<H2><A NAME=SECTION002911000000000000000>25.1.1. Compiler Diagnostics</A></H2>
<P>
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
<A NAME=COMPILERDIAGNOSTICSSECTION>X3J13</A>
voted in June 1987 (COMPILER-WARNING-STREAM) <A NAME=28558>&#160;</A> to specify
that <tt>compile</tt> and <tt>compile-file</tt>
may output warning messages; any such messages should
go to the stream that is the value of <tt>*error-output*</tt>.
<P>
X3J13 voted in June 1989 (COMPILER-DIAGNOSTICS) <A NAME=28562>&#160;</A>
to specify the use of conditions to signal various erroneous situations
during compilation.
First, note that
<tt>error</tt> and <tt>warning</tt> conditions may be signaled either by the compiler itself
or by code being processed by the compiler (for example, arbitrary errors may
occur during compile-time macro expansion or processing of <tt>eval-when</tt>
forms).
Considering only those conditions signaled <i>by the compiler</i> (as
opposed to <i>during compilation</i>):
<UL><LI> Conditions of type <tt>error</tt> may be signaled by the compiler in
situations where the compilation cannot proceed without
intervention. Examples of such situations may include errors when opening
a file or syntax errors.
<P>
<LI> Conditions of type <tt>warning</tt> may be signaled by the compiler in
situations where the standard explicitly states that a warning must,
should, or may be signaled. They may also be signaled
when the compiler can determine
that a situation would result at runtime that would have
undefined consequences or would cause
an error to be signaled.
Examples of such situations may include
violations of type declarations,
altering or rebinding a constant defined with <tt>defconstant</tt>,
calls to built-in Lisp functions with too few or too many arguments
or with malformed keyword argument lists,
referring to a variable declared <tt>ignore</tt>, or
unrecognized declaration specifiers.
<P>
<LI> The compiler is permitted to signal diagnostics about matters of
programming style as conditions of type <tt>style-warning</tt>, a subtype
of <tt>warning</tt>. Although
a <tt>style-warning</tt> condition <i>may</i> be signaled in these situations, no
implementation is <i>required</i> to do so. However, if an
implementation does choose to signal a condition, that condition
will be of type <tt>style-warning</tt> and will be signaled by a call to
the function <tt>warn</tt>.
Examples of such situations may include
redefinition of a function with an incompatible argument list,
calls to functions (other than built-in functions)
with too few or too many arguments
or with malformed keyword argument lists,
unreferenced local variables not declared <tt>ignore</tt>, or
standard declaration specifiers that are ignored by
the particular compiler in question.
</UL>
<P>
Both <tt>compile</tt> and <tt>compile-file</tt> are permitted (but not
required) to establish a handler for conditions of type <tt>error</tt>.
Such a handler
might, for example, issue a warning and restart compilation from some
implementation-dependent point in order to let the compilation
proceed without manual intervention.
<P>
The functions <tt>compile</tt> and <tt>compile-file</tt> each return three values.
See the definitions of these functions for descriptions of the first value.
The second value is <tt>nil</tt> if no compiler diagnostics were issued, and
true otherwise.
The third value is <tt>nil</tt> if no compiler diagnostics other than style
warnings were issued; a non-<tt>nil</tt> value indicates that there were
``serious'' compiler diagnostics issued or that other conditions of
type <tt>error</tt> or <tt>warning</tt> (but not <tt>style-warning</tt>) were signaled during
compilation.
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
<P>
<BR> <HR><A NAME=tex2html4374 HREF="node226.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html4372 HREF="node224.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html4366 HREF="node224.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html4376 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html4377 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html4375 HREF="node226.html"> Compiled Functions</A>
<B>Up:</B> <A NAME=tex2html4373 HREF="node224.html"> The Compiler</A>
<B> Previous:</B> <A NAME=tex2html4367 HREF="node224.html"> The Compiler</A>
<HR> <P>
<HR>
<P><ADDRESS>
AI.Repository@cs.cmu.edu
</ADDRESS>
</BODY>