/W, /w - Set Warning Level
This option controls the number of warning messages produced by the compiler. Warnings indicate potential problems, rather than actual coding errors, with statements that may not compile as you intend.
/W{0 | 1 | 2 | 3 | 4 | X}
/w
A space between /W and 0, 1, 2, 3, 4, or X is optional. Compiler warning messages are any messages beginning with C4. The /W options affect only source files named on the command line; they do not apply to object files.
W1 warnings are the most serious, and W4 warnings are the least serious. The following table describes the warning-level options.
Warning Level | Description |
---|---|
/w | Turns off all warning messages. Use this option when you compile programs that deliberately include questionable statements. The /w option applies to the remainder of the command line, or applies until the next occurrence of a /w option on the command line. /W and /W0 are the same as /w. |
/W1 | Default. Displays severe warning messages. |
/W2 | Displays an intermediate level of warning messages. Level 2 includes warnings such as the following:
|
/W3 | Displays a less severe level of warning messages, including warnings about function calls that precede their function prototypes in the source code. |
/W4 | Displays the least severe level of warning messages, including warnings about the use of non-ANSI features and extended keywords. |
/WX | Treats all warnings as errors. If there are any warning messages, the compiler generates an error message, and continues compilation. |
The following example shows how to enable all possible warning messages for source files Crunch.c and Print.c. Microsoft C/C++ provides a pragma to control warning messages.
CLxxx /W4 CRUNCH.C PRINT.C
Where CLxxx is the name of the compiler for the target processor family.
See Also
About Microprocessor Compilers | ARM Guide | Hitachi Guide | MIPS Guide
Last updated on Thursday, April 08, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.