#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 message to be set in the C1234 format

Default

None

Description

This pragma selectively sets messages to information, warning, disable, or error.

Note: This pragma does not affect messages produced during preprocessing, because pragma parsing is done during normal source parsing but not during preprocessing.
Note: This pragma (as other pragmas) must be specified outside of the function scope. It is not possible to change a message inside a function or for a part of a function.
Example

In the following listing, parentheses ( ) were left out.

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

-WmsgSd: Setting a Message to Disable

-WmsgSe: Setting a Message to Error

-WmsgSi: Setting a Message to Information

-WmsgSw: Setting a Message to Warning