Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The /warnings option applies a filter to a warning log before the OACR command is performed on the log. The filtering can be based on warning numbers or warning locations (that is, the source file in which the warning is located). For information about the commands and their options, see Microsoft Auto Code Review (OACR) Commands.
The /warnings option has the following syntax:
/warnings [all ] | [ num ] | [range] | [setname] | [filename]
You can use a semicolon to separate a list of warning numbers and warning location sets. The sets are processed from left to right. This means that a set can partially or completely override a set that is further to the left. This allows you to include all warnings of a particular warning level, and then exclude certain warnings from that level.
For example, you could use the following command to include all warnings in the level 3 warning set with the exception of warning 28101.
/warnings level3;!28101
Warning number sets and warning location sets
A warning number set can be one of the following:
all
A predefined set that includes all warning numbers and locations.num
The warning number, for example, 6540.range
A range of warning numbers. Specify a starting number and an ending number separated by a hyphen, for example, 6540-6550.setname
A warning number set that is defined in the configuration files (Oacr.ini, Oacruser.ini), for example, level1.
A warning location set can be one of the following:
Filename
The file name specification, for example, src\*.cppThe following wildcards are supported:The exclamation mark (?) matches exactly 1 character except, colon (:), backslash (\), or period (.).
The asterisk (*) matches any characters, except colon (:) and backslash (\).'
The hypen (-) matches any character.
A warning number or warning location set can be negated with a leading logical negation operator (!). Negating the warning number or warning location set excludes (or filters out) those warning numbers.
Error number sets and the /errors option
The /errors option performs the same filtering as the /warnings option. In addition, the /errors option applies the project-specific error numbers filter, which defines the subset of warnings that are to be treated as errors. For example, the project-specific errors are specified in the Oacr.ini file using the ErrorNumbers setting. (ErrorNumbers=<level0>;<level1>; The /errors and /warnings options cannot be used together.
The /errors option has the same syntax as the /warnings option.
/errors [all ] | [ num ] | [range] | [setname] | [filename]
Examples
/warnings level1;gel\...
Specifies level-1 warnings that are below the gel directory./warnings level1;!300-310
Level-1 warnings that are not in the range 300 to 310./errors *.cpp;!foo.cpp
Errors in *.cpp files, except for Foo.cpp
To see the list of available warning number sets and warning location sets, use the oacr showini /filters command.
Filtering files
The /files option applies a filter to a project queue (the list of source files to be checked). The filtering is based on the full pathname of the source files in the queue.
The argument of the /files option is a list of file sets that are separated by semicolons.
The syntax is the same as for warning location sets.
Send comments about this topic to Microsoft
Build date: 5/3/2011