#pragma report (C++ only)

Category

Listings, messages and compiler information

Purpose

Controls the generation of diagnostic messages.

The pragma allows you to specify a minimum severity level for a message for it to display, or allows you to enable or disable a specific message regardless of the prevailing report level.

Syntax

Read syntax diagramSkip visual syntax diagram
                                     .-I-.                         
>>-#--pragma--report--(--+-level--,--+-E-+------------------+--)-><
                         |           '-W-'                  |      
                         +-+-enable--+--,--"message_number"-+      
                         | '-disable-'                      |      
                         '-pop------------------------------'      

Defaults

The default report level is Informational (I), which displays messages of all types.

Parameters

level
Indicates that the pragma is set according to the minimum severity level of diagnostic messages to display.
E
Indicates that only error messages will display. Error messages are of the highest severity. This is equivalent to the -qflag=e:e compiler option.
W
Indicates that warning and error messages will display. This is equivalent to the -qflag=w:w compiler option.
I
Indicates that all diagnostic messages will display: warning, error and informational messages. Informational messages are of the lowest severity. This is equivalent to the -qflag=i:i compiler option.
enable
Enables the specified "message_number".
disable
Disables the specified "message_number".
"message_number"
Represents a message identifier, which consists of a prefix followed by the message number in quotation marks; for example, "CCN1004".
Note: You must use quotation marks with message_number as in the preceding example "CCN1004".
pop
Reverts the report level to that which was previously in effect. If no previous report level has been specified, a warning is issued, and the report level remains unchanged.

Usage

The pragma takes precedence over #pragma info and most compiler options. For example, if you use #pragma report to disable a compiler message, that message will not be displayed with any -qflag compiler option setting.

Related information