next up previous contents
Next: 4.4 Interpreting Error Messages Up: 4.3 Compilation Units Previous: 4.3 Compilation Units

4.3.1 Undefined Warnings

  Warnings about undefined variables, functions and types are delayed until the end of the current compilation unit. The compiler entry functions (compile, etc.) implicitly use with-compilation-unit, so undefined warnings will be printed at the end of the compilation unless there is an enclosing with-compilation-unit. In order the gain the benefit of this mechanism, you should wrap a single with-compilation-unit around the calls to compile-file, i.e.:

(with-compilation-unit ()
  (compile-file "file1")
  (compile-file "file2")
  ...)

Unlike for functions and types, undefined warnings for variables are not suppressed when a definition (e.g. defvar) appears after the reference (but in the same compilation unit.) This is because doing special declarations out of order just doesn't work--although early references will be compiled as special, bindings will be done lexically.

Undefined warnings are printed with full source context (see section 4.4), which tremendously simplifies the problem of finding undefined references that resulted from macroexpansion. After printing detailed information about the undefined uses of each name, with-compilation-unit also prints summary listings of the names of all the undefined functions, types and variables.

[Variable]
* undefined-warning-limit*

This variable controls the number of undefined warnings for each distinct name that are printed with full source context when the compilation unit ends. If there are more undefined references than this, then they are condensed into a single warning:

Warning: count more uses of undefined function name.
  
When the value is 0, then the undefined warnings are not broken down by name at all: only the summary listing of undefined names is printed.



Raymond Toy
Mon Jul 14 09:11:27 EDT 1997