Skip to content

Commit 7e6aab2

Browse files
author
Colin Robertson
committed
Merge branch 'master' into cr-meta-1
2 parents b4c1ace + 8cc0984 commit 7e6aab2

6 files changed

Lines changed: 135 additions & 86 deletions

File tree

Lines changed: 81 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "-analyze (Code Analysis) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "04/26/2018"
55
ms.reviewer: ""
66
ms.suite: ""
77
ms.technology: ["cpp-tools"]
@@ -18,55 +18,90 @@ manager: "ghogen"
1818
ms.workload: ["cplusplus"]
1919
---
2020
# /analyze (Code Analysis)
21-
Enables code analysis and control options.
22-
23-
## Syntax
24-
25-
```
26-
/analyze[-][:WX-][:log filename][:quiet][:stacksize number][:max_paths number][:only]
27-
```
28-
29-
## Arguments
21+
22+
Enables code analysis and control options.
23+
24+
## Syntax
25+
26+
```cmd
27+
/analyze[-][:WX-][:log filename][:quiet][:stacksize number][:max_paths number][:only][:ruleset]
28+
```
29+
30+
## Arguments
31+
3032
/analyze
31-
Turns on analysis in the default mode. Analysis output goes to the **Output** window like other error messages. Use **/analyze-** to explicitly turn off analysis.
32-
33+
Turns on analysis in the default mode. Analysis output goes to the **Output** window like other error messages. Use **/analyze-** to explicitly turn off analysis.
34+
3335
/analyze:WX-
34-
Specifying **/analyze:WX-** means that code analysis warnings are not treated as errors when you compile by using **/WX**. For more information, see [/w, /W0, /W1, /W2, /W3, /W4, /w1, /w2, /w3, /w4, /Wall, /wd, /we, /wo, /Wv, /WX (Warning Level)](../../build/reference/compiler-option-warning-level.md).
35-
36+
Specifying **/analyze:WX-** means that code analysis warnings are not treated as errors when you compile by using **/WX**. For more information, see [/w, /W0, /W1, /W2, /W3, /W4, /w1, /w2, /w3, /w4, /Wall, /wd, /we, /wo, /Wv, /WX (Warning Level)](../../build/reference/compiler-option-warning-level.md).
37+
3638
/analyze:log `filename`
37-
Detailed analyzer results are written as XML to the file that is specified by `filename`.
38-
39+
Detailed analyzer results are written as XML to the file that is specified by `filename`.
40+
3941
/analyze:quiet
40-
Turns off analyzer output to the **Output** window.
41-
42+
Turns off analyzer output to the **Output** window.
43+
4244
/analyze:stacksize `number`
43-
The `number` parameter that is used with this option specifies the size, in bytes, of the stack frame for which warning [C6262](/visualstudio/code-quality/c6262) is generated. If this parameter is not specified, the stack frame size is 16KB by default.
44-
45+
The `number` parameter that is used with this option specifies the size, in bytes, of the stack frame for which warning [C6262](/visualstudio/code-quality/c6262) is generated. If this parameter is not specified, the stack frame size is 16KB by default.
46+
4547
/analyze:max_paths `number`
46-
The `number` parameter that is used with this option specifies the maximum number of code paths to be analyzed. If this parameter is not specified, the number is 256 by default. Larger values perform more thorough checking, but the analysis might take longer.
47-
48+
The `number` parameter that is used with this option specifies the maximum number of code paths to be analyzed. If this parameter is not specified, the number is 256 by default. Larger values perform more thorough checking, but the analysis might take longer.
49+
4850
/analyze:only
49-
Typically, the compiler generates code and does more syntax checking after it runs the analyzer. The **/analyze:only** option turns off this code generation pass; this makes analysis faster but compile errors and warnings that might have been discovered by the code generation pass of the compiler are not emitted. If the program is not free of code-generation errors, analysis results might be unreliable; therefore, we recommend that you use this option only if the code already passes code-generation syntax checking without errors.
50-
51-
## Remarks
52-
For more information, see [Code Analysis for C/C++ Overview](/visualstudio/code-quality/code-analysis-for-c-cpp-overview) and [Code Analysis for C/C++ Warnings](/visualstudio/code-quality/code-analysis-for-c-cpp-warnings).
53-
54-
### To set this compiler option in the Visual Studio development environment
55-
56-
1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md).
57-
58-
2. Expand the **Configuration Properties** node.
59-
60-
3. Expand the **Code Analysis** node.
61-
62-
4. Select the **General** property page.
63-
64-
5. Modify one or more of the **Code Analysis** properties.
65-
66-
### To set this compiler option programmatically
67-
68-
1. See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.EnablePREfast%2A>.
69-
70-
## See Also
71-
[Compiler Options](../../build/reference/compiler-options.md)
72-
[Setting Compiler Options](../../build/reference/setting-compiler-options.md)
51+
Typically, the compiler generates code and does more syntax checking after it runs the analyzer. The **/analyze:only** option turns off this code generation pass; this makes analysis faster but compile errors and warnings that might have been discovered by the code generation pass of the compiler are not emitted. If the program is not free of code-generation errors, analysis results might be unreliable; therefore, we recommend that you use this option only if the code already passes code-generation syntax checking without errors.
52+
53+
/analyze:ruleset `<file_path>.ruleset`
54+
Enables you to specify which rule sets to analyze, including custom rule sets that you can create yourself. When this switch is set, the rules engine is more efficient because it excludes non-members of the specified rule set before running. When the switch is not set, the engine checks all rules.
55+
56+
The rulesets that ship with Visual Studio are found in **%VSINSTALLDIR%\Team Tools\Static Analysis Tools\Rule Sets.**
57+
58+
The following sample custom rule set tells the rules engine to check for C6001 and C26494. You can place this file anywhere as long as it has a `.ruleset` extension and you provide the full path in the argument.
59+
60+
```xml
61+
<?xml version="1.0" encoding="utf-8"?>
62+
<RuleSet Name="New Rule Set" Description=" " ToolsVersion="15.0">
63+
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
64+
<Rule Id="C6001" Action="Warning" />
65+
<Rule Id="C26494" Action="Warning" />
66+
</Rules>
67+
</RuleSet>
68+
```
69+
70+
/analyze:plugin
71+
Enables the specified PREfast plugin as part of code analysis runs.
72+
LocalEspC.dll is the plugin that implements concurrency-related code analysis checks in the range of C261XX warnings. For example, [C26100](/visualstudio/code-quality/c26100), [C26101](/visualstudio/code-quality/c26101), ..., [C26167](/visualstudio/code-quality/c26167).
73+
74+
To run LocalEspC.dll, use this compiler option: **/analyze:plugin LocalEspC.dll**
75+
76+
To run CppCoreCheck.dll, first run this command from a developer command prompt:
77+
78+
```cmd
79+
set Esp.Extensions=CppCoreCheck.dll
80+
```
81+
82+
Then use this compiler option: **/analyze:plugin EspXEngine.dll**.
83+
84+
## Remarks
85+
86+
For more information, see [Code Analysis for C/C++ Overview](/visualstudio/code-quality/code-analysis-for-c-cpp-overview) and [Code Analysis for C/C++ Warnings](/visualstudio/code-quality/code-analysis-for-c-cpp-warnings).
87+
88+
### To set this compiler option in the Visual Studio development environment
89+
90+
1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md).
91+
92+
1. Expand the **Configuration Properties** node.
93+
94+
1. Expand the **Code Analysis** node.
95+
96+
1. Select the **General** property page.
97+
98+
1. Modify one or more of the **Code Analysis** properties.
99+
100+
### To set this compiler option programmatically
101+
102+
1. See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.EnablePREfast%2A>.
103+
104+
## See Also
105+
106+
- [Compiler Options](../../build/reference/compiler-options.md)
107+
- [Setting Compiler Options](../../build/reference/setting-compiler-options.md)

‎docs/error-messages/compiler-warnings/TOC.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
## [Compiler Warning (level 2) C4051](compiler-warning-level-2-c4051.md)
3838
## [Compiler Warning (level 1) C4052](compiler-warning-level-1-c4052.md)
3939
## [Compiler Warning (level 4) C4053](compiler-warning-level-4-c4053.md)
40+
## [Compiler warning (level 1) C4055](compiler-warning-level-1-c4055.md)
4041
## [Compiler Warning (level 2) C4056](compiler-warning-level-2-c4056.md)
4142
## [Compiler Warning (level 4) C4057](compiler-warning-level-4-c4057.md)
4243
## [Compiler Warning (level 4) C4061](compiler-warning-level-4-c4061.md)
Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,49 @@
1-
# Compiler Warning (level 1) C4055
2-
3-
'conversion' : from data pointer 'type1' to function pointer 'type2'
4-
1+
---
2+
title: "Compiler Warning (level 1) C4052 | Microsoft Docs"
3+
ms.custom: ""
4+
ms.date: "11/04/2016"
5+
ms.technology: ["cpp-tools"]
6+
ms.topic: "reference"
7+
f1_keywords: ["C4055"]
8+
dev_langs: ["C++"]
9+
helpviewer_keywords: ["C4055"]
10+
ms.assetid: f9955421-16ab-46e5-8f9d-bf1639a519ef
11+
author: "corob-msft"
12+
ms.author: "corob"
13+
ms.workload: ["cplusplus"]
14+
---
15+
# Compiler Warning (level 1) C4055
16+
17+
> '*conversion*' : from data pointer '*type1*' to function pointer '*type2*'
18+
19+
## Remarks
20+
521
**Obsolete:** This warning is not generated by Visual Studio 2017 and later versions.
622

7-
A data pointer is cast (possibly incorrectly) to a function pointer. This is a level 1 warning under /Za and a level 4 warning under /Ze.
8-
9-
The following sample generates C4055:
10-
11-
```C
12-
// C4055.c
13-
// compile with: /Za /W1 /c
14-
typedef int (*PFUNC)();
15-
int *pi;
16-
PFUNC f() {
17-
return (PFUNC)pi; // C4055
18-
}
19-
```
20-
21-
Under /Ze, this is a level 4 warning.
22-
23-
```C
24-
// C4055b.c
25-
// compile with: /W4 /c
26-
typedef int (*PFUNC)();
27-
int *pi;
28-
PFUNC f() {
29-
return (PFUNC)pi; // C4055
30-
}
31-
```
23+
A data pointer is cast (possibly incorrectly) to a function pointer. This is a level 1 warning under /Za and a level 4 warning under /Ze.
24+
25+
## Example
26+
27+
The following sample generates C4055:
28+
29+
```C
30+
// C4055.c
31+
// compile with: /Za /W1 /c
32+
typedef int (*PFUNC)();
33+
int *pi;
34+
PFUNC f() {
35+
return (PFUNC)pi; // C4055
36+
}
37+
```
38+
39+
Under /Ze, this is a level 4 warning.
40+
41+
```C
42+
// C4055b.c
43+
// compile with: /W4 /c
44+
typedef int (*PFUNC)();
45+
int *pi;
46+
PFUNC f() {
47+
return (PFUNC)pi; // C4055
48+
}
49+
```

‎docs/error-messages/compiler-warnings/compiler-warnings-c4000-through-c4199.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ The articles in this section of the documentation explain a subset of the warnin
6565
|Compiler warning (level 1) C4051|type conversion; possible loss of data|
6666
|Compiler warning (level 4) C4052|function declarations different; one contains variable arguments|
6767
|Compiler warning (level 4) C4053|one void operand for '?:'|
68+
|[Compiler warning (level 1) C4055](compiler-warning-level-1-c4055.md)|'conversion' : from data pointer '*type1*' to function pointer '*type2*'|
6869
|[Compiler Warning (level 2) C4056](../../error-messages/compiler-warnings/compiler-warning-level-2-c4056.md)|overflow in floating-point constant arithmetic|
6970
|Compiler warning (level 4) C4057|'operator': 'identifier1' differs in indirection to slightly different base types from 'identifier2'|
7071
|Compiler warning C4060|switch statement contains no 'case' or 'default' labels|

‎docs/ide/vcpp-directories-property-page.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "VC++ Directories Property Page | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "03/09/2018"
4+
ms.date: "04/26/2018"
55
ms.reviewer: ""
66
ms.suite: ""
77
ms.technology: ["cpp-ide"]
@@ -94,7 +94,7 @@ Directories to search for WinRT library files for use in Universal Windows Platf
9494
Directories in which to search for source files to use for IntelliSense.
9595

9696
**Exclude Directories**<br/>
97-
Directories not to search when checking for build dependencies.
97+
Before each compilation, Visual Studio queries the timestamp on all files to determine whether any have been modified since the previous compilation. If your project has large stable libraries, you can potentially speed up build times by excluding those directories from the timestamp check.
9898

9999
## Sharing the Settings
100100

‎docs/linux/cmake-linux-project.md‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,15 @@ cmake -E capabilities
9898

9999
In the output, look for “serverMode”:true. Note that even when you compile CMake from source as described below you should check the capabilities when done. Your Linux system may have limitations that prevent server mode from being enabled.
100100

101-
To get started building from source in the shell for your Linux system make sure your package manager is up to date, and that you have git and cmake available. First, clone the CMake sources:
101+
To get started building from source in the shell for your Linux system make sure your package manager is up to date, and that you have git and cmake available. First, clone the CMake sources from our repo where we use for Visual Studio's CMake support:
102102

103103
```cmd
104104
sudo apt-get update
105105
sudo apt-get install -y git cmake
106-
git clone https://github.com/Kitware/CMake.git
106+
git clone https://github.com/Microsoft/CMake.git
107107
cd CMake
108108
```
109109

110-
Next, make sure you are on a supported release of CMake for Visual Studio. We are actively tracking CMake development, but we cannot guarantee we support the latest. To build CMake 3.9.0 (for example), first run:
111-
112-
```cmd
113-
git checkout tags/v3.9.0
114-
```
115-
116110
Next, run the following commands:
117111

118112
```cmd
@@ -132,4 +126,4 @@ cmake -E capabilities
132126

133127
## See Also
134128
[Working with Project Properties](../ide/working-with-project-properties.md)
135-
[CMake Tools for Visual C++](../ide/cmake-tools-for-visual-cpp.md)
129+
[CMake Tools for Visual C++](../ide/cmake-tools-for-visual-cpp.md)

0 commit comments

Comments
 (0)