9.5.5 Diagnostic directives
The diagnostic directives are used to explicitly generate error and warning
messages that are reported in the same
way as other compile-time errors and warnings.
pp-diagnostic::
whitespaceopt # whitespaceopt error pp-message
whitespaceopt # whitespaceopt warning pp-message
pp-message::
new-line
whitespace input-charactersopt new-line
[Example: The example
#warning Code review needed before check-in
#if Debug && Retail
#error A build can’t be both debug and retail
#endif
class Test {.}
always produces a warning (.Code review needed before check-in.), and
produces a compile-time error
if the pre-processing identifiers Debug and Retail are both defined. Note
that a pp-message can contain
arbitrary text; specifically, it need not contain well-formed tokens, as
shown by the single quote in the word
can.t. end example]
The diagnostic directives are used to explicitly generate error and warning
messages that are reported in the same
way as other compile-time errors and warnings.
pp-diagnostic::
whitespaceopt # whitespaceopt error pp-message
whitespaceopt # whitespaceopt warning pp-message
pp-message::
new-line
whitespace input-charactersopt new-line
[Example: The example
#warning Code review needed before check-in
#if Debug && Retail
#error A build can’t be both debug and retail
#endif
class Test {.}
always produces a warning (.Code review needed before check-in.), and
produces a compile-time error
if the pre-processing identifiers Debug and Retail are both defined. Note
that a pp-message can contain
arbitrary text; specifically, it need not contain well-formed tokens, as
shown by the single quote in the word
can.t. end example]