t or an output stream.
Lisp code that calls the compiler.
analyzing-special-variables-usage executes the code in body, which needs to call the compiler, typically many times (compiling a whole system, for example). When body exits, it prints a simple analysis of symbols that were proclaimed and how they were proclaimed, in a way that is intended to be helpful in improving declarations. For a full explanation of how you might add or alter declarations, see Usage of special variables.
all and default are convenience arguments to control groups of the other keyword arguments, which are all boolean flags. The default value of all is
nil. all provides the default value of maybe-globals and maybe-dynamics. The default value of default is
t. default provides the default value of unused, only-bound, wrong-global and inconsistent.
Since such unused variables do not affect the code, unused is normally useful only for finding and eliminating dead declarations, but it can also flag situations when the wrong variable is used (if the variable that is supposed to be used is not used elsewhere)
maybe-globals controls whether to report symbols that were not seen bound. If these symbols are really never bound, they can be proclaimed global by defining them with defglobal-parameter and defglobal-variable), or proclaimed
hcl:special-global), both for speed and also to prevent them getting bound by mistake.
maybe-dynamics controls whether to report symbols that have been seen bound, and are proclaimed special, but not
hcl:special-global. Some of these may be proclaimed
The report that is generated is grouped according to the file in which a proclamation was found. If a variable was proclaimed in multiple files, it will appear multiple times in the output. Within each file the output is grouped according to what is reported.
For the keyword arguments except inconsistent, the symbols are simply listed. For the inconsistent report, it outputs several lines for each symbol. Each line starts with one of the symbols
hcl:special-fast-access (these four signify a proclamation),
:accessed (these two indicate the usage). It is followed by the pathname of the file in which this one found. Only occurrences which give rise to inconsistency are listed.
The report about inconsistent usage is almost always useful. unused and only-bound are mostly useful when body force compiles many files, though they have limited utility in partial compilation too. maybe-globals and maybe-dynamics need full compilation to be really useful. Of the latter maybe-globals is the more useful.
LispWorks User Guide and Reference Manual - 20 Sep 2017