2 USING: help.markup help.syntax vocabs.loader words io
3 quotations compiler.errors.private ;
5 ARTICLE: "compiler-errors" "Compiler warnings and errors"
6 "The compiler saves various notifications in a global variable:"
7 { $subsection compiler-errors }
8 "These notifications can be viewed later:"
9 { $subsection :errors }
10 { $subsection :warnings }
11 { $subsection :linkage }
12 "Words such as " { $link require } " use a combinator which counts errors and prints a report at the end:"
13 { $link with-compiler-errors } ;
16 { $var-description "Global variable holding an assoc mapping words to compiler errors. This variable is set by " { $link with-compiler-errors } "." } ;
19 { $values { "error" "an error" } { "word" word } }
20 { $description "If inside a " { $link with-compiler-errors } ", saves the error for future persual via " { $link :errors } ", " { $link :warnings } " and " { $link :linkage } ". If not inside a " { $link with-compiler-errors } ", ignores the error." } ;
23 { $values { "error" "an error" } { "word" word } }
24 { $description "Prints a compiler error to " { $link output-stream } "." } ;
26 HELP: compiler-errors.
27 { $values { "type" symbol } }
28 { $description "Prints compiler errors to " { $link output-stream } ". The type parameter is one of " { $link +error+ } ", " { $link +warning+ } ", or " { $link +linkage+ } "." } ;
30 { $description "Prints all serious compiler errors from the most recent compile to " { $link output-stream } "." } ;
33 { $description "Prints all ignorable compiler warnings from the most recent compile to " { $link output-stream } "." } ;
36 { $description "Prints all C library interface linkage errors from the most recent compile to " { $link output-stream } "." } ;
38 { :errors :warnings } related-words
40 HELP: with-compiler-errors
41 { $values { "quot" quotation } }
42 { $description "Calls the quotation and collects any compiler warnings and errors. Compiler warnings and errors are summarized at the end and can be viewed with " { $link :errors } ", " { $link :warnings } ", and " { $link :linkage } "." }
43 { $notes "Nested calls to " { $link with-compiler-errors } " are ignored, and only the outermost call collects warnings and errors." } ;