The #pragma report directive controls the generation of specific messages. The pragma will take precedence over #pragma info. Specifying #pragma report(pop) will revert the report level to the previous level. If no previous report level was specified, then a warning will be issued and the report level will remain unchanged.
>>-#--pragma--report--(--+-level--,--+-E-+----------------+--)->< | +-W-+ | | '-I-' | +-+-enable--+--,--message_number-+ | '-disable-' | '-pop----------------------------'
where:
level | Indicates the minimum severity level of diagnostic messages to display. |
E | W | I | Used in conjunction with level to determine the
type of diagnostic messages to display.
|
enable | disable | Enables or disables the specified message number. |
message_number | Is an identifier containing the message number prefix, followed by the message number. An example of a message number is: CPPC1004 |
pop | resets the report level back to the previous report level. If a pop operation is performed on an empty stack, the report level will remain unchanged and no message will be generated. |
1 #pragma info(all) 2 #pragma report(level, W)
1 #pragma report(enable, CPPC1000) // enables message number CPPC1000 2 #pragma report(level, E) // display only error messages.Changing the order of the code like so:
1 #pragma report(level, E) 2 #pragma report(enable, CPPC1000)would yield the same result. The order in which the two lines of code appear in, does not affect the outcome. However, if the message was 'disabled', then regardless of what report level is set and order the lines of code appear in, the diagnostic message will not be displayed.
1 #pragma report(level, I) 2 #pragma report(enable, CPPC1000) 3 #pragma report(level, E) 4 #pragma report(pop)
Related information