Skip to content

Commit 60967ae

Browse files
Taojunshenesweet431opbld16Colin Robertsonopbld17
authored
12/13/2021 AM Publish (#3992)
* Add gray border * LinkFix: cpp-docs-pr (2021-11) * Clarify C4146 per VCSig list (#3923) * Clarify C4146 per VCSig list * Fix link issues. * Update enable CMake Presets * fix rel links * fix github 3528 * acrolinx * change order of example * Add version info to NMAKE macro functions * Bulk fix entity `&amp;` part 3 * threshhold test * Eliminate even more `&amp;` entities * Minimum Viable Phix * Once more into the `&amp;` breech * Add Visual Studio 2022 Platform Toolset Version * Add /fpcvt compiler option docs (#3886) * Add /fpcvt compiler option docs * Fix copypasta error * Update fp conversion intrinsics, too. * Replace deleted table row * Acrolinx pass * Fix TOC issues * Add useful links to intrinsics * Updates per John Morgan, plus acrolink * Update version info * Clean up rvalue reference article * Fix to `/fpcvt` per John Morgan email * Reformat WeakRef class document. * Update Advanced prop page and C1107 * Remove unrelated change. * Minimizing entity form of & (#3916) * Initial pass minimizing on &gt; entities (#3919) * Initial pass on &gt; entities * Fix everything. * Try without `&lt;` entities in title/desc * Clean up pass * Update docs/atl-mfc-shared/reference/cfiletime-class.md Co-authored-by: Tracey Torble <[email protected]> * Update tn026-ddx-and-ddv-routines.md `DoDialogExchange` -> `DoDataExchange` * Fix incorrect import example * github fix 3544 * GITHUB FIX FOR #3549 * Add UWP to list of unsupported ASAN features. * Fix misnamed mt.exe options. Acrolinx all. * Attempt fpcvt simplification per John Morgan. * Fix cpp-docs 3546 * Address complaint in cpp-docs 3554 (#3950) * Add section on CMake partial activation * 17.1 Update warnings, fix cpp-docs 3563 (#3954) * 17.1 Update warnings, fix cpp-docs 3563 * fix date * Add `/Zc:externC` compiler option doc, fix 1594 * Tweaks. * Fix links, header syntax issues * Fix issues in XML Docs reference * Make list match apparently intended style * Fix broken link. * Add docs for new check Signed-off-by: Kyle Reed <[email protected]> * fix toc * remove .md from toc title * Revert "Add docs for new linter check" * update runtime spelling * Bulk fix: remove HTML entities from yml headers (#3962) * Style and content fixes in cpp language docs * Changing confusing wording about C++ exceptions * Bulk fix HTML entities in H1 (#3966) * Fix lt-gt entity pairs * Bulk fix of `&lt;`-`&gt;` pairs in H1 headings * Oops, deleted initial `#` * Fix two more H1 issues * update with existing .openpublishing.publish.config.json * C++ tutorial landing page, attempt 2 * Revert redirection of get-started index.yml file * Fix typo * Bulk fix `&lt;`, `&gt;`, and `.period;` entities * operatoroperator * `/hotpatch`: No jump to the first instruction * Update Acrolinx for main branch * Change learn about item type * Add get started TOC * fix over machine translation problems (#3977) * fix over machine translation problems * acrolinx and misses * markdown fixes Co-authored-by: TylerMSFT <[email protected]> * Make the grammar bot happy * Fix things that look like parameters. (#3978) * Fix things that look like parameters. * Acrolinxy * Misc fixes * Other fixes * Fix typos * Acrolinx some more * [17.0] Update links to download Visual Studio (#3981) * Update links to download Visual Studio * Remove VS 2019 reference * Address cpp-docs 3565 * Also cpp-docs 439 * cpp-docs 947 * cpp-docs 1002 * accuratized * cpp-docs 1035 * Twhitney named modules (#3960) * draft * draft * draft * fix links * cleanup * added some more info * add some see also references * cleanup pass * remove text about overloads * tech review * little better wording * a little more word smithing * fix link * acrolinx * readthrough pass * Readthrough to test building the project * acrolinx * rename media file Co-authored-by: TylerMSFT <[email protected]> * cpp-docs 1305 * cpp-docs 1324 * address github issue #3524 and add code escape to prevent over machine translation * missed a couple escapes * couple more code escapes * one more escape * Address cpp-docs 3583: LNK1107 clarity * Tweaks * tweak formatting * Expand on fix for cpp-docs 1035 (#3986) * Expand of fix for cpp-docs 1035 * Mention overloads. * Grammar and formatting fixes * add summary of what will learn in module * [17.1p2] Add docs for comparison/bitwise c++ linter check. (#3964) * Revert "Revert "Add docs for new linter check"" This reverts commit e56971f. * PR feedback Signed-off-by: Kyle Reed <[email protected]> Co-authored-by: Erika <[email protected]> Co-authored-by: opbld16 <[email protected]> Co-authored-by: Colin Robertson <[email protected]> Co-authored-by: opbld17 <[email protected]> Co-authored-by: Christopher McClister <[email protected]> Co-authored-by: PRMerger16 <[email protected]> Co-authored-by: Laura Brenner <[email protected]> Co-authored-by: opbld15 <[email protected]> Co-authored-by: TylerMSFT <[email protected]> Co-authored-by: PRMerger18 <[email protected]> Co-authored-by: PRMerger4 <[email protected]> Co-authored-by: PRMerger6 <[email protected]> Co-authored-by: MohammadHadi Attarieh <[email protected]> Co-authored-by: PRMerger15 <[email protected]> Co-authored-by: PRMerger10 <[email protected]> Co-authored-by: Haig MacGregor <[email protected]> Co-authored-by: Tracey Torble <[email protected]> Co-authored-by: Waiting <[email protected]> Co-authored-by: roxk <[email protected]> Co-authored-by: Tyler Whitney <[email protected]> Co-authored-by: branh <[email protected]> Co-authored-by: John Ellison <[email protected]> Co-authored-by: PRMerger8 <[email protected]> Co-authored-by: PRMerger17 <[email protected]> Co-authored-by: Sam Freed <[email protected]> Co-authored-by: Colin Cooper <[email protected]> Co-authored-by: Paula Miller <[email protected]> Co-authored-by: Kyle Reed <[email protected]> Co-authored-by: Hannes Harnisch <[email protected]> Co-authored-by: Anna Huff <[email protected]> Co-authored-by: Ying Hua <[email protected]> Co-authored-by: Alex Guteniev <[email protected]> Co-authored-by: Dennis Rea <[email protected]> Co-authored-by: PRMerger3 <[email protected]> Co-authored-by: PRMerger Service account 2 <[email protected]>
1 parent df29e3b commit 60967ae

10 files changed

+221
-128
lines changed

docs/build/cmake-projects-in-visual-studio.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ When you **open a folder** containing a *`CMakeLists.txt`* file, the following t
3838

3939
- In the background, Visual Studio starts to index the source files to enable IntelliSense, browsing information, refactoring, and so on. As you work, Visual Studio monitors changes in the editor and also on disk to keep its index in sync with the sources.
4040

41+
> [!NOTE]
42+
> Starting in Visual Studio 2022 version 17.1 Preview 2, if your folder doesn't contain a root `CMakeLists.txt` you'll be prompted whether you'd like to enable CMake integration or not. For more information, see [CMake partial activation](#cmake-partial-activation).
43+
4144
Once CMake cache generation has succeeded, you can also view your projects organized logically by targets. Choose **Targets view** from the dropdown in the **Solution Explorer** toolbar:
4245

4346
![CMake targets view button.](media/cmake-targets-view.png)
@@ -144,6 +147,19 @@ Visual Studio allows you to debug a process running on a remote Linux system or
144147

145148
![A screenshot of the Attach to Process menu](media/attach-to-process.png)
146149

150+
## <a name="cmake-partial-activation"></a> CMake partial activation
151+
152+
Starting in Visual Studio 2022 version 17.1 Preview 2, CMake functionality won't be enabled automatically if your root folder doesn't contain a `CMakeLists.txt` file. Instead, a dialog will prompt you on whether you'd like to enable CMake functionality for your project. If you decline, CMake cache generation won't start and CMake configurations (from `CMakeSettings.json` or `CMakePresets.json`) won't appear in the configuration dropdown. If you accept, you'll be taken to a workspace-level configuration file, `CMakeWorkspaceSettings.json` (stored in the `.vs` directory), to specify the folders you'd like to enable CMake for. (These folders contain your root `CMakeLists.txt` files).
153+
154+
The accepted properties are:
155+
156+
| Property | Description |
157+
|--|--|
158+
| `enableCMake` | Enable Visual Studio's integration for this workspace. |
159+
| `sourceDirectory` | A string or array of strings specifying the directory or directories with `CMakeLists.txt`. Macros (such as `${workspaceRoot}`) are allowed. Relative paths are relative to the workspace root. Directories outside of the current workspace will be ignored. |
160+
161+
You can reach `CMakeWorkspaceSettings.json` through the **Project** > **CMake Workspace Settings** menu command at any time, even if CMake functionality is currently disabled.
162+
147163
## Open an existing cache
148164

149165
When you open an existing CMake cache file (*`CMakeCache.txt`*), Visual Studio doesn't try to manage your cache and build tree for you. Your custom or preferred tools have complete control over how CMake configures your project.

docs/cpp/import-export-module.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Non-exported names are not visible to code that imports the module:
4545
```cpp
4646
//MyProgram.cpp
4747

48-
import module ModuleA;
48+
import ModuleA;
4949

5050
int main() {
5151
Bar::f(); // OK

docs/cpp/structured-exception-handling-c-cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Destroying TestClass!
119119
Executing SEH __except block
120120
```
121121

122-
If you use **`/EHa`** to compile the code, the `TestClass` destructor executes whether the exception was thrown by using `std::throw` or by using SEH to trigger the exception. That is, whether `CPPEX` is defined or not. The output looks like this:
122+
If you use **`/EHa`** to compile the code, the `TestClass` destructor executes whether an exception was thrown using a standard C++ `throw` expression or by using SEH. That is, whether `CPPEX` is defined or not. The output looks like this:
123123

124124
```Output
125125
Throwing C++ exception

docs/cpp/tutorial-named-modules-cpp.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
---
22
title: "Named modules tutorial in C++"
3-
ms.date: "12/9/2021"
3+
ms.date: "12/10/2021"
44
ms.topic: "tutorial"
55
helpviewer_keywords: ["modules [C++]", "modules [C++], named modules tutorial"]
66
description: Named modules in C++20 provide a modern alternative to header files.
77
---
88
# Named modules tutorial (C++)
99

10-
This tutorial introduces the basics of creating C++20 modules. Modules are a new way to componentize C++ programs, replacing the venerable header file. You'll learn how modules are an improvement on header files and build an app that shows how to create and consume modules, module partitions, and module implementation files.
10+
This tutorial introduces the basics of creating C++20 modules. Modules are a new way to componentize C++ programs, replacing the venerable header file. You'll learn how modules are an improvement on header files and build an app that shows how to create and consume a module.
11+
12+
In this tutorial, you learn how to:
13+
14+
- Create and import a module
15+
- Create a primary module interface unit
16+
- Create a module partition file
17+
- Create a module unit implementation file
1118

1219
## Prerequisites
1320

docs/error-messages/compiler-errors-1/compiler-error-c2382.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: Compiler Error C2382"
33
title: "Compiler Error C2382"
4-
ms.date: 12/09/2021
4+
ms.date: 12/10/2021
55
f1_keywords: ["C2382"]
66
helpviewer_keywords: ["C2382"]
77
ms.assetid: 4d4436f9-d0d6-4bd0-b8ec-767b89adfb2f
@@ -10,7 +10,15 @@ ms.assetid: 4d4436f9-d0d6-4bd0-b8ec-767b89adfb2f
1010

1111
> '*function*' : redefinition; different exception specifications
1212
13-
This error indicates that a function overload was attempted only on the [exception specification](../../cpp/exception-specifications-throw-cpp.md). Don't change the exception specification in a declaration or definition of the function.
13+
This error indicates that a function overload was attempted only on the [exception specification](../../cpp/exception-specifications-throw-cpp.md).
14+
15+
## Remarks
16+
17+
By default, the compiler considers a `noexcept` specification to be equivalent to a `throw()` or `throw(some_type)` specification. Under [`/Za`](../../build/reference/za-ze-disable-language-extensions.md), this check is more strict.
18+
19+
To resolve this issue, change all declarations and definitions of the function (or the specific function overload) to use the same exception specification.
20+
21+
## Example
1422

1523
The following sample generates C2382:
1624

@@ -21,3 +29,7 @@ void f1(void) noexcept {}
2129
void f1(void) {} // C2382
2230
void f2(void) throw() {} // OK
2331
```
32+
33+
## See also
34+
35+
[`/Za` (Disable language extensions)](../../build/reference/za-ze-disable-language-extensions.md)
Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
---
2-
description: "Learn more about: Linker Tools Error LNK1107"
3-
title: "Linker Tools Error LNK1107"
4-
ms.date: "11/04/2016"
2+
description: "Learn more about: Linker tools error LNK1107"
3+
title: "Linker tools error LNK1107"
4+
ms.date: 12/10/2021
55
f1_keywords: ["LNK1107"]
66
helpviewer_keywords: ["LNK1107"]
7-
ms.assetid: a37a893d-5efa-4eba-8f40-6c5518b4b9d0
87
---
9-
# Linker Tools Error LNK1107
8+
# Linker tools error LNK1107
109

11-
invalid or corrupt file: cannot read at location
10+
> invalid or corrupt file: cannot read at location *address*
1211
13-
The tool could not read the file. Recreate the file.
12+
The tool couldn't read the file. The file may be corrupt, or have an unexpected file type.
1413

15-
LNK1107 could also occur if you attempt to pass a module (.dll or .netmodule extension created with [/clr:noAssembly](../../build/reference/clr-common-language-runtime-compilation.md) or [/NOASSEMBLY](../../build/reference/noassembly-create-a-msil-module.md)) to the linker; pass the .obj file instead.
14+
## Remarks
1615

17-
If you compile the following sample:
16+
LNK1107 can occur if a file passed to the linker or related tools is corrupt. To resolve this issue, rebuild the file.
17+
18+
LNK1107 can also occur if your build process puts an unexpected file type in the list of files passed to the tool. The linker and related tools expect to work on specific file types. For example, the linker can use object files, library files, compiled resources, and manifests to create an executable. It can't create an executable by using source files or DLLs. To resolve this issue, verify that your build process passes only the expected file types to the tool. For example, pass *`.obj`*, *`.lib`*, and *`.res`* files, not *`.cpp`*, *`.h`*, *`.dll`*, or *`.rc`* files.
19+
20+
LNK1107 can also occur if you attempt to pass a .NET executable module (A *`.dll`* or *`.netmodule`* file created with [`/clr:noAssembly`](../../build/reference/clr-common-language-runtime-compilation.md) or [`/NOASSEMBLY`](../../build/reference/noassembly-create-a-msil-module.md)) to the linker. To resolve this issue, pass the *`.obj`* file instead.
21+
22+
## Example
23+
24+
Compile this sample by using **`cl /clr /LD LNK1107.cpp`**:
1825

1926
```cpp
2027
// LNK1107.cpp
@@ -25,4 +32,4 @@ public:
2532
};
2633
```
2734
28-
and then specify **link LNK1107.dll** on the command line, you will get LNK1107. To resolve the error, specify **link LNK1107.obj** instead.
35+
If you then specify **`link LNK1107.dll`** on the command line, you'll get LNK1107. To resolve the error, specify **`link LNK1107.obj`** instead.

docs/ide/cpp-linter-overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ When you change the check severity level, it changes how the problem is shown in
4646

4747
## Known issues
4848

49-
::: moniker range=">=msvc-170"
49+
::: moniker range="msvc-170"
5050

51-
- The **Comparison/Bitwise Precedence** check isn't available in the initial release of Visual Studio 2022, even though you can configure it in the Options dialog.
51+
- The **Comparison/Bitwise Precedence** check isn't available in the initial release of Visual Studio 2022, even though you can configure it in the Options dialog. It's available starting in Visual Studio 2022 version 17.1.
5252

5353
::: moniker-end
5454
::: moniker range="msvc-160"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: lnt-comparison-bitwise-precedence
3+
description: "Reference for Visual Studio C++ IntelliSense Linter check lnt-comparison-bitwise-precedence."
4+
ms.date: 09/29/2021
5+
f1_keywords: ["lnt-comparison-bitwise-precedence"]
6+
helpviewer_keywords: ["lnt-comparison-bitwise-precedence"]
7+
monikerRange: ">=msvc-160"
8+
---
9+
# `lnt-comparison-bitwise-precedence`
10+
11+
The comparison operator has a higher precedence than the bitwise operator.
12+
13+
The comparison operator will be evaluated first. The result will be implicitly cast to an integer and used as an operand in the bitwise operation. Parentheses are needed to force the expected order of operations.
14+
15+
The `lnt-comparison-bitwise-precedence` check is controlled by the **Comparison/Bitwise Precedence** setting in the C/C++ Code Style options. For information on how to change this setting, see [Configure the linter](cpp-linter-overview.md#configure-the-linter).
16+
17+
## Examples
18+
19+
```cpp
20+
bool is_flag_set(unsigned value, unsigned flag)
21+
{
22+
return value & flag == flag; // Flagged: `flag == flag` is evaluated first.
23+
// Then `value & (int)true` is evaluated which
24+
// returns an incorrect result in most cases.
25+
}
26+
```
27+
28+
```cpp
29+
bool is_flag_set(unsigned value, unsigned flag)
30+
{
31+
return (value & flag) == flag; // Correct
32+
}
33+
```
34+
35+
## How to fix the issue
36+
37+
The fix the linter suggests is to add parentheses around the bitwise operation so it will be evaluated first.
38+
39+
## See also
40+
41+
[IntelliSense code linter for C++ overview](cpp-linter-overview.md)

docs/ide/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ items:
2424
href: ../ide/lnt-arithmetic-overflow.md
2525
- name: lnt-assignment-equality
2626
href: ../ide/lnt-assignment-equality.md
27+
- name: lnt-comparison-bitwise-precedence
28+
href: ../ide/lnt-comparison-bitwise-precedence.md
2729
- name: lnt-integer-float-division
2830
href: ../ide/lnt-integer-float-division.md
2931
- name: lnt-logical-bitwise-mismatch

0 commit comments

Comments
 (0)