You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifies how the compiler generates warnings for a given compilation.
10
11
@@ -31,23 +32,28 @@ Specifies how the compiler generates warnings for a given compilation.
31
32
32
33
The warning options specify which compiler warnings to display and the warning behavior for the entire compilation.
33
34
34
-
The warning options and related arguments are described in the following table:
35
+
The warning options and related arguments are described in the following tables:
35
36
36
-
|Option|Description|
37
-
------------|-----------------|
38
-
|**/w**|Suppresses all compiler warnings.|
39
-
|**/W0**<br /><br /> **/W1**<br /><br /> **/W2**<br /><br /> **/W3**<br /><br /> **/W4**|Specifies the level of warnings to be generated by the compiler. Valid warning levels range from 0 to 4:<br />**/W0** suppresses all warnings. This is equivalent to **/w**.<br />**/W1** displays level 1 (severe) warnings. **/W1** is the default setting in the command line compiler.<br />**/W2** displays level 1 and level 2 (significant) warnings.<br />**/W3** displays level 1, level 2 and level 3 (production quality) warnings. **/W3** is the default setting in the IDE.<br />**/W4** displays level 1, level 2, and level 3 warnings, and all level 4 (informational) warnings that are not turned off by default. We recommend that you use this option to provide lint-like warnings. For a new project, it may be best to use **/W4** in all compilations; this will ensure the fewest possible hard-to-find code defects.|
40
-
|**/Wall**|Displays all warnings displayed by **/W4** and all other warnings that **/W4** does not include—for example, warnings that are off by default. For more information, see [Compiler Warnings That Are Off By Default](../../preprocessor/compiler-warnings-that-are-off-by-default.md).|
41
-
|**/Wv**\[**:**_version_]|Displays only warnings introduced in compiler version *version* and earlier. You can use this option to suppress new warnings in code when you migrate to a newer version of the compiler, and to maintain your existing build process while you fix them. The optional parameter *version* takes the form *nn*[.*mm*[.*bbbbb*]] where *nn* is the major version number, *mm* is the optional minor version number, and *bbbbb* is the optional build number of the compiler. For example, use */Wv:17* to display warnings introduced in Visual Studio 2012 (that is, any version of the compiler that has a major version number of 17) or earlier, but suppress warnings introduced in Visual Studio 2013 (major version 18) and later. By default, **/Wv** uses the current compiler version number, and no warnings are suppressed. For information about which warnings are suppressed by compiler version, see [Compiler Warnings by compiler version](../../error-messages/compiler-warnings/compiler-warnings-by-compiler-version.md).|
42
-
|**/WX**|Treats all compiler warnings as errors. For a new project, it may be best to use **/WX** in all compilations; resolving all warnings ensures the fewest possible hard-to-find code defects.<br /><br /> The linker also has a **/WX** option. For more information, see [/WX (Treat Linker Warnings as Errors)](wx-treat-linker-warnings-as-errors.md).|
43
-
|**/w1**_nnnn_<br /><br /> **/w2**_nnnn_<br /><br /> **/w3**_nnnn_<br /><br /> **/w4**_nnnn_|Sets the warning level for the warning number specified by _nnnn_. This lets you change the compiler behavior for that warning when a specific warning level is set. You can use these options in combination with other warning options to enforce your own coding standards for warnings, rather than the default ones provided by Visual Studio.<br /><br /> For example, **/w34326** causes C4326 to be generated as a level 3 warning instead of level 1. If you compile by using both the **/w34326** option and the **/W2** option, warning C4326 is not generated.|
44
-
|**/wd**_nnnn_|Suppresses the compiler warning that is specified by _nnnn_.<br /><br /> For example, **/wd4326** suppresses compiler warning C4326.|
45
-
|**/we**_nnnn_|Treats the compiler warning that is specified by _nnnn_ as an error.<br /><br /> For example, **/we4326** causes warning number C4326 to be treated as an error by the compiler.|
46
-
|**/wo**_nnnn_|Reports the compiler warning that is specified by _nnnn_ only once.<br /><br /> For example, **/wo4326** causes warning C4326 to be reported only once, the first time it is encountered by the compiler.|
37
+
Option | Description
38
+
------ | -----------
39
+
**/w** | Suppresses all compiler warnings.
40
+
**/W0**<br /><br /> **/W1**<br /><br /> **/W2**<br /><br /> **/W3**<br /><br /> **/W4** | Specifies the level of warnings to be generated by the compiler. Valid warning levels range from 0 to 4:<br />**/W0** suppresses all warnings. It's equivalent to **/w**.<br />**/W1** displays level 1 (severe) warnings. **/W1** is the default setting in the command-line compiler.<br />**/W2** displays level 1 and level 2 (significant) warnings.<br />**/W3** displays level 1, level 2, and level 3 (production quality) warnings. **/W3** is the default setting in the IDE.<br />**/W4** displays level 1, level 2, and level 3 warnings, and all level 4 (informational) warnings that aren't off by default. We recommend that you use this option to provide lint-like warnings. For a new project, it may be best to use **/W4** in all compilations. This option helps ensure the fewest possible hard-to-find code defects.
41
+
**/Wall** | Displays all warnings displayed by **/W4** and all other warnings that **/W4** doesn't include—for example, warnings that are off by default. For more information, see [Compiler warnings that are off by default](../../preprocessor/compiler-warnings-that-are-off-by-default.md).
42
+
**/Wv**\[**:**_version_] | Displays only warnings introduced in the *version* compiler version and earlier. You can use this option to suppress new warnings in code when you migrate to a newer version of the compiler. It lets you maintain your existing build process while you fix them. The optional parameter *version* takes the form *nn*\[.*mm*\[.*bbbbb*]], where *nn* is the major version number, *mm* is the optional minor version number, and *bbbbb* is the optional build number of the compiler. For example, use **/Wv:17** to display only warnings introduced in Visual Studio 2012 (major version 17) or earlier. That is, it displays warnings from any version of the compiler that has a major version number of 17 or less. It suppresses warnings introduced in Visual Studio 2013 (major version 18) and later. By default, **/Wv** uses the current compiler version number, and no warnings are suppressed. For information about which warnings are suppressed by compiler version, see [Compiler warnings by compiler version](../../error-messages/compiler-warnings/compiler-warnings-by-compiler-version.md).
43
+
**/WX** | Treats all compiler warnings as errors. For a new project, it may be best to use **/WX** in all compilations; resolving all warnings ensures the fewest possible hard-to-find code defects.<br /><br /> The linker also has a **/WX** option. For more information, see [/WX (Treat linker warnings as errors)](wx-treat-linker-warnings-as-errors.md).
47
44
48
-
If you use any of the warning options when you create a precompiled header by using the [/Yc](yc-create-precompiled-header-file.md) option, any use of the precompiled header by using the [/Yu](yu-use-precompiled-header-file.md)option causes those same warning options to be in effect again. You can override the warning options set in the precompiled header by using another warning option on the command line.
45
+
The following options are mutually exclusive with each other. The last option that's specified from this group is the one applied:
49
46
50
-
You can use a [#pragma warning](../../preprocessor/warning.md) directive to control the level of warning that is reported at compile time in specific source files.
47
+
Option | Description
48
+
------ | -----------
49
+
**/w1**_nnnn_<br /><br /> **/w2**_nnnn_<br /><br /> **/w3**_nnnn_<br /><br /> **/w4**_nnnn_ | Sets the warning level for the warning number specified by _nnnn_. These options let you change the compiler behavior for that warning when a specific warning level is set. You can use these options in combination with other warning options to enforce your own coding standards for warnings, rather than the default ones provided by Visual Studio.<br /><br /> For example, **/w34326** causes C4326 to be generated as a level 3 warning instead of level 1. If you compile by using both the **/w34326** option and the **/W2** option, warning C4326 isn't generated.
50
+
**/wd**_nnnn_ | Suppresses the compiler warning that is specified by _nnnn_.<br /><br /> For example, **/wd4326** suppresses compiler warning C4326.
51
+
**/we**_nnnn_ | Treats the compiler warning that is specified by _nnnn_ as an error.<br /><br /> For example, **/we4326** causes warning number C4326 to be treated as an error by the compiler.
52
+
**/wo**_nnnn_ | Reports the compiler warning that is specified by _nnnn_ only once.<br /><br /> For example, **/wo4326** causes warning C4326 to be reported only once, the first time it's encountered by the compiler.
53
+
54
+
If you use any warning options when you create a precompiled header, it keeps those settings. Using the precompiled header puts those same warning options in effect again. To override the precompiled header warning options, set another warning option on the command line.
55
+
56
+
You can use a [#pragma warning](../../preprocessor/warning.md) directive to control the level of warning that's reported at compile time in specific source files.
51
57
52
58
Warning pragma directives in source code are unaffected by the **/w** option.
53
59
@@ -57,7 +63,7 @@ The [build errors documentation](../../error-messages/compiler-errors-1/c-cpp-bu
57
63
58
64
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
59
65
60
-
1. To set the **/W0**, **/W1**, **/W2**, **/W3**, **/W4**, **/Wall**, **/Wv**, **/WX** or **/WX-** options, select the **Configuration Properties** > **C/C++** > **General** property page.
66
+
1. To set the **/W0**, **/W1**, **/W2**, **/W3**, **/W4**, **/Wall**, **/Wv**, **/WX**, or **/WX-** options, select **Configuration Properties** > **C/C++** > **General**.
61
67
62
68
- To set the **/W0**, **/W1**, **/W2**, **/W3**, **/W4**, or **/Wall** options, modify the **Warning Level** property.
63
69
@@ -67,9 +73,9 @@ The [build errors documentation](../../error-messages/compiler-errors-1/c-cpp-bu
67
73
68
74
1. To set the **/wd** or **/we** options, select the **Configuration Properties** > **C/C++** > **Advanced** property page.
69
75
70
-
- To set the **/wd** option, select the **Disable Specific Warnings** property drop down control and then choose **Edit**. In the edit box in the **Disable Specific Warnings** dialog, enter the warning number. To enter more than one warning, separate the values by using a semicolon (**;**). For example, to disable both C4001 and C4010, enter **4001;4010**. Choose **OK** to save your changes and return to the **Property Pages** dialog.
76
+
- To set the **/wd** option, select the **Disable Specific Warnings** property dropdown control and then choose **Edit**. In the edit box in the **Disable Specific Warnings** dialog, enter the warning number. To enter more than one warning, separate the values by using a semicolon (**;**). For example, to disable both C4001 and C4010, enter **4001;4010**. Choose **OK** to save your changes and return to the **Property Pages** dialog.
71
77
72
-
- To set the **/we** option, Select the **Treat Specific Warnings As Errors** property drop down control and then choose **Edit**. In the edit box in the **Treat Specific Warnings As Errors** dialog, enter the warning number. To enter more than one warning, separate the values by using a semicolon (**;**). For example, to treat both C4001 and C4010 as errors, enter **4001;4010**. Choose **OK** to save your changes and return to the **Property Pages** dialog.
78
+
- To set the **/we** option, Select the **Treat Specific Warnings As Errors** property dropdown control and then choose **Edit**. In the edit box in the **Treat Specific Warnings As Errors** dialog, enter the warning number. To enter more than one warning, separate the values by using a semicolon (**;**). For example, to treat both C4001 and C4010 as errors, enter **4001;4010**. Choose **OK** to save your changes and return to the **Property Pages** dialog.
73
79
74
80
1. To set the **/wo** option, select the **Configuration Properties** > **C/C++** > **Command Line** property page. Enter the compiler option in the **Additional Options** box.
75
81
@@ -81,5 +87,5 @@ The [build errors documentation](../../error-messages/compiler-errors-1/c-cpp-bu
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/fegetexceptflag2.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ The **fegetexceptflag** function stores the current state of the floating-point
45
45
|FE_INVALID|A domain error occurred in an earlier floating-point operation.|
46
46
|FE_OVERFLOW|A range error occurred; an earlier floating-point operation result was too large to be represented.|
47
47
|FE_UNDERFLOW|An earlier floating-point operation result was too small to be represented at full precision; a denormal value was created.|
48
-
|FE_ALLEXCEPT|The bitwise OR of all supported floating-point exceptions.|
48
+
|FE_ALL_EXCEPT|The bitwise OR of all supported floating-point exceptions.|
49
49
50
50
The *excepts* argument may be zero, one of the supported floating-point exception macros, or the bitwise OR of two or more of the macros. The effect of any other argument value is undefined.
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/feraiseexcept.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ The **feraiseexcept** function attempts to raise the floating-point exceptions s
40
40
|FE_INVALID|A domain error occurred in an earlier floating-point operation.|
41
41
|FE_OVERFLOW|A range error occurred; an earlier floating-point operation result was too large to be represented.|
42
42
|FE_UNDERFLOW|An earlier floating-point operation result was too small to be represented at full precision; a denormal value was created.|
43
-
|FE_ALLEXCEPT|The bitwise OR of all supported floating-point exceptions.|
43
+
|FE_ALL_EXCEPT|The bitwise OR of all supported floating-point exceptions.|
44
44
45
45
The *excepts* argument may be zero, one of the exception macro values, or the bitwise OR of two or more of the supported exception macros. If one of the specified exception macros is FE_OVERFLOW or FE_UNDERFLOW, the FE_INEXACT exception may be raised as a side-effect.
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/fesetexceptflag2.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ The **fesetexceptflag** function sets the state of the floating-point exception
45
45
|FE_INVALID|A domain error occurred in an earlier floating-point operation.|
46
46
|FE_OVERFLOW|A range error occurred; an earlier floating-point operation result was too large to be represented.|
47
47
|FE_UNDERFLOW|An earlier floating-point operation result was too small to be represented at full precision; a denormal value was created.|
48
-
|FE_ALLEXCEPT|The bitwise OR of all supported floating-point exceptions.|
48
+
|FE_ALL_EXCEPT|The bitwise OR of all supported floating-point exceptions.|
49
49
50
50
The *excepts* argument may be zero, one of the supported floating-point exception macros, or the bitwise OR of two or more of the macros. The effect of any other argument value is undefined.
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/fetestexcept1.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ Use the fetestexcept function to determine which exceptions were raised by a flo
41
41
|FE_INVALID|A domain error occurred in an earlier floating-point operation.|
42
42
|FE_OVERFLOW|A range error occurred; an earlier floating-point operation result was too large to be represented.|
43
43
|FE_UNDERFLOW|An earlier floating-point operation result was too small to be represented at full precision; a denormal value was created.|
44
-
|FE_ALLEXCEPT|The bitwise OR of all supported floating-point exceptions.|
44
+
|FE_ALL_EXCEPT|The bitwise OR of all supported floating-point exceptions.|
45
45
46
46
The specified *excepts* argument may be 0, one of the supported floating-point exception macros, or the bitwise OR of two or more of the macros. The effect of any other *excepts* argument value is undefined.
0 commit comments