#pragma MESSAGE: Message Setting

Scope

Compilation Unit or until the next MESSAGE pragma

Syntax

#pragma MESSAGE {(WARNING|ERROR|INFORMATION|DISABLE|DEFAULT){<CNUM>}}

Synonym

None

Arguments

<CNUM>: Number of messages to be set in the C1234 format

Default

None

Description

Messages are selectively set to an information message, a warning message, a disable message, or an error message.

Note: This pragma has no effect for messages which are produced during preprocessing. The reason is that the pragma parsing has to be done during normal source parsing but not during preprocessing.
Note: This pragma (as other pragmas) has to be specified outside of the function's scope. For example, it is not possible to change a message inside a function or for a part of a function.
Example

In the example shown in the following listing, parentheses ( ) were omitted.

Listing: Using the MESSAGE Pragma


/* treat C1412: Not a function call, */
/* address of a function, as error */

#pragma MESSAGE ERROR C1412

void f(void);

void main(void) {

  f; /* () is missing, but still legal in C */

/* ERROR because of pragma MESSAGE */

}
See also

Compiler options :