warning pragma Directive
Pragma directive that modifies the behavior of compiler warning messages.
#pragma warning( warning-specifier : warning-number-list [; warning-specifier : warning-number-list...] ) |
---|
Parameters
Item | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
warning-specifier |
Behavior to set for the specified warnings. This parameter can take one of the values listed in the following table.
|
||||||||||||
warning-number-list |
White space-delimited list of the numbers of the warnings to modify the behavior of. |
Remarks
You can specify any number of distinct warning behavior changes within the same warning pragma by separating the changes with semicolons.
The compiler will add 4000 to any warning number that is between 0 and 999. For warning numbers greater than 4699, (those associated with code generation) the warning pragma has effect only when placed outside function definitions. The pragma is ignored if it specifies a number greater than 4699 and is used inside a function.
The HLSL warning pragma does not support the push and pop functionality of the warning pragma included in the C++ compiler.
Examples
The following example disables warnings 4507 and 4034, displays warning 4385 once, and reports warning 4164 as an error.
#pragma warning( disable : 4507 34; once : 4385; error : 164 )
The preceding example is functionally equivalent to the following:
#pragma warning( disable : 4507 34 )
#pragma warning( once : 4385 )
#pragma warning( error : 164 )