cpp: Diagnostics
1
1 5 Diagnostics
1 *************
1
1 The directive '#error' causes the preprocessor to report a fatal error.
1 The tokens forming the rest of the line following '#error' are used as
1 the error message.
1
1 You would use '#error' inside of a conditional that detects a
1 combination of parameters which you know the program does not properly
1 support. For example, if you know that the program will not run
1 properly on a VAX, you might write
1
1 #ifdef __vax__
1 #error "Won't work on VAXen. See comments at get_last_object."
1 #endif
1
1 If you have several configuration parameters that must be set up by
1 the installation in a consistent way, you can use conditionals to detect
1 an inconsistency and report it with '#error'. For example,
1
1 #if !defined(FOO) && defined(BAR)
1 #error "BAR requires FOO."
1 #endif
1
1 The directive '#warning' is like '#error', but causes the
1 preprocessor to issue a warning and continue preprocessing. The tokens
1 following '#warning' are used as the warning message.
1
1 You might use '#warning' in obsolete header files, with a message
1 directing the user to the header file which should be used instead.
1
1 Neither '#error' nor '#warning' macro-expands its argument. Internal
1 whitespace sequences are each replaced with a single space. The line
1 must consist of complete tokens. It is wisest to make the argument of
1 these directives be a single string constant; this avoids problems with
1 apostrophes and the like.
1