CL /wo

Syntax

/wonumber

The required argument consists of whatever follows immediately within the same command-line token, else is the whole of the next command-line token if this token does not begin with a hyphen or forward slash.

The argument is formally numeric. Values outside the range 4001 to 4999 inclusive are coerced to 4999, with a warning (D4014).

Relations

The /wo option has no syntactical relations with other options.

This option passes to both the front-end and back-end compilers (C1, C1XX and C2).

Behaviour

This option sets the given warning number to be reported only on the first occurrence of the associated condition. Internally, this is implemented by disabling the warning (as for /wd) after reporting it.

This option is ineffective for warning C4200. All C and C++ source files, even if empty, are compiled with a forced inclusion at the very start. This “file” of predefined types is hard-coded into the compiler. Some of these types have unsized arrays as members. Each instance is preceded by #pragma warning (disable : 4200) and followed by #pragma warning (default : 4200). This is arguably pointless, since the compiler disables warnings and errors (though not fatal errors) while processing this built-in inclusion, but a side-effect is that when the compiler progresses to the user-supplied source code, warning C4200 has already been set to its default behaviour. Whatever may have been intended by giving 4200 as the argument to a /w1, /w2, /w3, /w4, /wd, /we or /wo option on the command line is then irrelevant, essentially as if #pragma warning (default : 4200) had been the first line of the source file.

Some warning numbers are ordinarily set for reporting just once, as if the corresponding /wo option were generated internally before acting on any options from the command line. For instance, the following table shows the warnings that are configured this way by the C++ front-end compiler (C1XX). One seems to be undocumented and is highlighted yellow.

C4001 nonstandard extension 'single line comment' was used
C4069 long double is the same precision as double
C4168 compiler limit : out of debugger types, delete program database 'database' and rebuild
C4169 compiler limit : out of debugger types, break up this module or use /Yd if /Yc is enabled
C4530 C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
C4535 calling _set_se_translator() requires /EHa
C4611 interaction between 'function' and C++ object destruction is non-portable