Skip to content

Commit 6ed44d9

Browse files
authored
Merge pull request #3433 from MicrosoftDocs/master
3/8/2021 AM Publish
2 parents c0c9cda + c075243 commit 6ed44d9

File tree

99 files changed

+2997
-129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+2997
-129
lines changed

docs/_breadcrumb/toc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
- name: Code analysis
5959
tocHref: /cpp/code-quality/
6060
topicHref: /cpp/code-quality/index
61+
- name: Code sanitizers
62+
tocHref: /cpp/sanitizers/
63+
topicHref: /cpp/sanitizers/index
6164
- name: C++ language
6265
tocHref: /cpp/cpp/
6366
topicHref: /cpp/cpp/index

docs/build/cmakesettings-reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ The `configurations` array contains all the configurations for a CMake project.
2525

2626
A `configuration` has these properties:
2727

28-
- `addressSanitizerEnabled`: if **`true`** compiles the program with Address Sanitizer (Experimental on Windows). On Linux, compile with -fno-omit-frame-pointer and compiler optimization level -Os or -Oo for best results.
29-
- `addressSanitizerRuntimeFlags`: runtime flags passed to AddressSanitizer via the ASAN_OPTIONS environment variable. Format: flag1=value:flag2=value2.
28+
- `addressSanitizerEnabled`: if **`true`** compiles the program with [AddressSanitizer](../sanitizers/asan.md). On Linux, compile with -fno-omit-frame-pointer and compiler optimization level -Os or -Oo for best results.
29+
- `addressSanitizerRuntimeFlags`: runtime flags passed to [AddressSanitizer](../sanitizers/asan.md) via the ASAN_OPTIONS environment variable. Format: flag1=value:flag2=value2.
3030
- `buildCommandArgs`: specifies native build switches passed to CMake after --build --. For example, passing -v when using the Ninja generator forces Ninja to output command lines. See [Ninja command line arguments](#ninja) for more information on Ninja commands.
3131
- `buildRoot`: specifies the directory in which CMake generates build scripts for the chosen generator. Maps to **-DCMAKE_BINARY_DIR** switch and specifies where *CMakeCache.txt* will be created. If the folder does not exist, it is created. Supported macros include `${workspaceRoot}`, `${workspaceHash}`, `${projectFile}`, `${projectDir}`, `${thisFile}`, `${thisFileDir}`, `${name}`, `${generator}`, `${env.VARIABLE}`.
3232
- `cacheGenerationCommand`: specifies a command line tool and arguments, for example *gencache.bat debug* to generate the cache. The command is run from the shell in the specified environment for the configuration when the user explicitly requests regeneration, or a CMakeLists.txt or CMakeSettings.json file is modified.

docs/build/reference/compiler-options-listed-alphabetically.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ This table contains an alphabetical list of compiler options. For a list of comp
4949
| [`/Fp`](fp-name-dot-pch-file.md) | Specifies a precompiled header file name. |
5050
| [`/FR`](fr-fr-create-dot-sbr-file.md)<br /><br /> [`/Fr`](fr-fr-create-dot-sbr-file.md) | Generates browser files. **`/Fr`** is deprecated. |
5151
| [`/FS`](fs-force-synchronous-pdb-writes.md) | Forces serialization of all writes to the program database (PDB) file through MSPDBSRV.EXE. |
52+
| [`/fsanitize`](fsanitize.md) | Enables compilation of sanitizer instrumentation such as AddressSanitizer. |
5253
| [`/FU`](fu-name-forced-hash-using-file.md) | Forces the use of a file name as if it had been passed to the [`#using`](../../preprocessor/hash-using-directive-cpp.md) directive. |
5354
| [`/Fx`](fx-merge-injected-code.md) | Merges injected code with source file. |
5455
| [`/GA`](ga-optimize-for-windows-application.md) | Optimizes code for Windows application. |

docs/build/reference/compiler-options-listed-by-category.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ This article contains a categorical list of compiler options. For an alphabetica
155155
| [`/errorReport`](errorreport-report-internal-compiler-errors.md) | Deprecated. Error reporting is controlled by [Windows Error Reporting (WER)](/windows/win32/wer/windows-error-reporting) settings. |
156156
| [`/FC`](fc-full-path-of-source-code-file-in-diagnostics.md) | Displays the full path of source code files passed to *cl.exe* in diagnostic text. |
157157
| [`/FS`](fs-force-synchronous-pdb-writes.md) | Forces writes to the PDB file to be serialized through *MSPDBSRV.EXE*. |
158+
| [`/fsanitize`](fsanitize.md) | Enables compilation of sanitizer instrumentation such as AddressSanitizer. |
158159
| [`/H`](h-restrict-length-of-external-names.md) | Deprecated. Restricts the length of external (public) names. |
159160
| [`/HELP`](help-compiler-command-line-help.md) | Lists the compiler options. |
160161
| [`/J`](j-default-char-type-is-unsigned.md) | Changes the default **`char`** type. |

docs/build/reference/fsanitize.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
description: "Learn more about the /fsanitize (enable sanitizers) compiler option"
3+
title: "/fsanitize (Enable sanitizers)"
4+
ms.date: 02/24/2021
5+
f1_keywords: ["/fsanitize", "-fsanitize", "/fsanitize=address", "/fsanitize-address-use-after-return", "-fsanitize-address-use-after-return", "/fno-sanitize-address-vcasan-lib", "-fno-sanitize-address-vcasan-lib"]
6+
helpviewer_keywords: ["/fsanitize [C++]", "-fsanitize=address [C++]", "address sanitizer compiler option [C++]", "/fsanitize-address-use-after-return", "/fno-sanitize-address-vcasan-lib"]
7+
---
8+
# `/fsanitize` (Enable sanitizers)
9+
10+
Use the **`/fsanitize`** compiler options to enable sanitizers. As of Visual Studio 2019 16.9, the only supported sanitizer is [AddressSanitizer](../../sanitizers/asan.md).
11+
12+
## Syntax
13+
14+
> **`/fsanitize=address`**\
15+
> **`/fsanitize-address-use-after-return`**\
16+
> **`/fno-sanitize-address-vcasan-lib`**
17+
18+
## Remarks
19+
20+
The **`/fsanitize=address`** compiler option enables [AddressSanitizer](../../sanitizers/asan.md), a powerful compiler and runtime technology to light up [hard-to-find bugs](../../sanitizers/asan.md#error-types).
21+
22+
The **`/fsanitize-address-use-after-return`** and **`/fno-sanitize-address-vcasan-lib`** compiler options, and the [`/INFERASANLIBS` (Use inferred sanitizer libs)](./inferasanlibs.md) and **`/INFERASANLIBS:NO`** linker options offer support for advanced users. For more information, see [AddressSanitizer build and language reference](../../sanitizers/asan-building.md).
23+
24+
The **`/fsanitize`** options are available beginning in Visual Studio 2019 version 16.9.
25+
26+
### To set the **`/fsanitize=address`** compiler option in the Visual Studio development environment
27+
28+
1. Open your project's **Property Pages** dialog box.
29+
30+
1. Select the **Configuration Properties** > **C/C++** > **General** property page.
31+
32+
1. Modify the **Enable Address Sanitizer** property. To enable it, choose **Yes (/fsanitize=address)**.
33+
34+
1. Choose **OK** or **Apply** to save your changes.
35+
36+
### To set the advanced compiler options
37+
38+
1. Open your project's **Property Pages** dialog box.
39+
40+
1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.
41+
42+
1. Modify the **Additional Options** property to set **/fsanitize-address-use-after-return** or **/fno-sanitize-address-vcasan-lib**.
43+
44+
1. Choose **OK** or **Apply** to save your changes.
45+
46+
### To set this compiler option programmatically
47+
48+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalOptions%2A>.
49+
50+
## See also
51+
52+
[MSVC compiler options](compiler-options.md)\
53+
[MSVC compiler command-line syntax](compiler-command-line-syntax.md)\
54+
[`/INFERASANLIBS` (Use inferred sanitizer libs)](./inferasanlibs.md)\
55+
[AddressSanitizer overview](../../sanitizers/asan.md)\
56+
[AddressSanitizer known issues](../../sanitizers/asan-known-issues.md)\
57+
[AddressSanitizer build and language reference](../../sanitizers/asan-building.md)

docs/build/reference/inferasanlibs.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
description: "Learn more about the /INFERASANLIBS (Use inferred sanitizer libs) linker option"
3+
title: "/INFERASANLIBS (Use inferred sanitizer libs)"
4+
ms.date: 03/01/2021
5+
f1_keywords: ["/INFERASANLIBS", "/INFERASANLIBS:NO"]
6+
helpviewer_keywords: ["/INFERASANLIBS [C++]", "address sanitizer [C++] linker option"]
7+
---
8+
# `/INFERASANLIBS` (Use inferred sanitizer libs)
9+
10+
Use the **`/INFERASANLIBS`** linker option to enable or disable linking to the default AddressSanitizer libraries. As of Visual Studio 2019 16.9, the only supported sanitizer is [AddressSanitizer](../../sanitizers/asan.md).
11+
12+
## Syntax
13+
14+
> **`/INFERASANLIBS`**\[**`:NO`**]
15+
16+
## Remarks
17+
18+
The **`/INFERASANLIBS`** linker option enables the default [AddressSanitizer](../../sanitizers/asan.md) libraries. This option is enabled by default.
19+
20+
The **`/INFERASANLIBS`** and **`/INFERASANLIBS:NO`** linker options offer support for advanced users. For more information, see [AddressSanitizer build and language reference](../../sanitizers/asan-building.md).
21+
22+
The **`/INFERASANLIBS`** option is available beginning in Visual Studio 2019 version 16.9.
23+
24+
### To set the **`/INFERASANLIBS`** linker option in the Visual Studio development environment
25+
26+
1. Open your project's **Property Pages** dialog box.
27+
28+
1. Select the **Configuration Properties** > **Linker** > **Command Line** property page.
29+
30+
1. Modify the **Additional Options** property. To enable default libraries, enter **/INFERASANLIBS** in the edit box. To disable default libraries, enter **/INFERASANLIBS:NO** instead.
31+
32+
1. Choose **OK** or **Apply** to save your changes.
33+
34+
### To set this linker option programmatically
35+
36+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.AdditionalOptions%2A>.
37+
38+
## See also
39+
40+
[MSVC linker reference](linking.md)\
41+
[MSVC linker options](linker-options.md)\
42+
[`/fsanitize` (Enable sanitizers)](./fsanitize.md)\
43+
[AddressSanitizer overview](../../sanitizers/asan.md)\
44+
[AddressSanitizer known issues](../../sanitizers/asan-known-issues.md)\
45+
[AddressSanitizer build and language reference](../../sanitizers/asan-building.md)

docs/build/reference/linker-options.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ You can use the [comment](../../preprocessor/comment-c-cpp.md) pragma to specify
7272
|[/IMPLIB](implib-name-import-library.md)|Overrides the default import library name.|
7373
|[/INCLUDE](include-force-symbol-references.md)|Forces symbol references.|
7474
|[/INCREMENTAL](incremental-link-incrementally.md)|Controls incremental linking.|
75+
|[/INFERASANLIBS](inferasanlibs.md)|Uses inferred sanitizer libraries.|
7576
|[/INTEGRITYCHECK](integritycheck-require-signature-check.md)|Specifies that the module requires a signature check at load time.|
7677
|[/KEYCONTAINER](keycontainer-specify-a-key-container-to-sign-an-assembly.md)|Specifies a key container to sign an assembly.|
7778
|[/KEYFILE](keyfile-specify-key-or-key-pair-to-sign-an-assembly.md)|Specifies a key or key pair to sign an assembly.|

docs/build/reference/unicode-support-in-the-compiler-and-linker.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
description: "Learn more about: Unicode Support in the Compiler and Linker"
2+
description: "Learn more about: Unicode support in the compiler and linker"
33
title: "Unicode Support in the Compiler and Linker"
4-
ms.date: "12/15/2017"
4+
ms.date: 03/07/2021
55
f1_keywords: ["VC.Project.VCLinkerTool.UseUnicodeResponseFiles", "VC.Project.VCLibrarianTool.UseUnicodeResponseFiles", "VC.Project.VCCLCompilerTool.UseUnicodeResponseFiles", "VC.Project.VCXDCMakeTool.UseUnicodeResponseFiles"]
66
helpviewer_keywords: ["Unicode, Visual C++"]
77
---
8-
# Unicode Support in the Compiler and Linker
8+
# Unicode support in the compiler and linker
99

10-
Most Visual C++ build tools support Unicode inputs and outputs.
10+
Most Microsoft C/C++ (MSVC) build tools support Unicode inputs and outputs.
1111

1212
## Filenames
1313

@@ -25,17 +25,21 @@ Unicode can be input into a source code file in the following encodings:
2525

2626
- UTF-8 with BOM
2727

28+
In the Visual Studio IDE, you can save files in several encoding formats, including Unicode ones. Save them in the **Save File As** dialog by using the dropdown on the **Save** button. Select **Save with Encoding** in the dropdown. Then, in the **Advanced Save Options** dialog, select an encoding from the dropdown list. Choose **OK** to save the file.
29+
2830
## Output
2931

3032
During compilation, the compiler outputs diagnostics to the console in UTF-16. The characters that can be displayed at your console depend on the console window properties. Compiler output redirected to a file is in the current ANSI console codepage.
3133

32-
## Linker response files and .DEF files
34+
## Linker response files and `.DEF` files
35+
36+
Response files and *`.DEF`* files can be either UTF-16 or UTF-8 with a BOM, or ANSI.
3337

34-
Response files and DEF files can be either UTF-16 with a BOM, or ANSI.
38+
## `.asm` and `.cod` dumps
3539

36-
## .asm and .cod dumps
40+
*`.asm`* and *`.cod`* dumps are in ANSI by default for compatibility with MASM. Use [`/FAu`](fa-fa-listing-file.md) to output UTF-8.
3741

38-
.asm and .cod dumps are in ANSI by default for compatibility with MASM. Use [/FAu](fa-fa-listing-file.md) to output UTF-8. Note that if you specify **/FAs**, the intermingled source will just be directly printed and may look garbled, for example if source code is UTF-8 and you didn't specify **/FAsu**.
42+
If you specify **`/FAs`**, the intermingled source gets printed directly. It may look garbled, for example, when the source code is UTF-8 and you didn't specify **`/FAsu`**.
3943

4044
## See also
4145

docs/build/toc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@
339339
href: ../build/configuring-programs-for-windows-xp.md
340340
- name: Code analysis for C/C++
341341
href: ../code-quality/
342+
- name: "Code sanitizers for C/C++"
343+
href: ../sanitizers/
342344
- name: Compiler and build tools reference
343345
expanded: false
344346
items:
@@ -560,6 +562,8 @@
560562
href: ../build/reference/fp-specify-floating-point-behavior.md
561563
- name: /FS (Force synchronous PDB writes)
562564
href: ../build/reference/fs-force-synchronous-pdb-writes.md
565+
- name: /fsanitize (Enable sanitizers)
566+
href: ../build/reference/fsanitize.md
563567
- name: /GA (Optimize for Windows application)
564568
href: ../build/reference/ga-optimize-for-windows-application.md
565569
- name: /Gd, /Gr, /Gv, /Gz (Calling convention)
@@ -939,6 +943,8 @@
939943
href: ../build/reference/ignore-ignore-specific-warnings.md
940944
- name: /IGNOREIDL (Don't process attributes into MIDL)
941945
href: ../build/reference/ignoreidl-don-t-process-attributes-into-midl.md
946+
- name: /INFERASANLIBS (Use inferred sanitizer libs)
947+
href: ../build/reference/inferasanlibs.md
942948
- name: /IMPLIB (Name import library)
943949
href: ../build/reference/implib-name-import-library.md
944950
- name: /INCLUDE (Force symbol references)

docs/c-runtime-library/c-run-time-library-reference.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
---
22
title: "C runtime library reference"
33
description: "Links to information and reference for the Microsoft C runtime library functions."
4-
ms.date: "10/05/2020"
4+
ms.date: "3/5/2021"
55
f1_keywords: ["c.runtime"]
66
helpviewer_keywords: ["CRT", "runtime libraries", "CRT, reference"]
7-
ms.assetid: a503e11c-8dca-4846-84fb-025a826c32b8
87
---
9-
# C runtime Library Reference
8+
# Microsoft C runtime library (CRT) reference
109

11-
The Microsoft runtime library provides routines for programming for the Microsoft Windows operating system. These routines automate many common programming tasks that are not provided by the C and C++ languages.
10+
The Microsoft runtime library provides routines for programming the Microsoft Windows operating system. These routines automate many common programming tasks that are not provided by the C and C++ languages.
1211

1312
Sample programs are included in the individual reference topics for most routines in the library.
1413

1514
## In This Section
1615

17-
[C Runtime libraries](crt-library-features.md)\
18-
Discusses the .lib files that comprise the C runtime libraries.
19-
2016
[Universal C runtime routines by category](run-time-routines-by-category.md)\
2117
Provides links to the runtime library by category.
2218

@@ -41,6 +37,9 @@ Provides links to the C runtime library functions, organized by function family.
4137
[Language and country/region strings](locale-names-languages-and-country-region-strings.md)\
4238
Describes how to use the `setlocale` function to set the language and Country/Region strings.
4339

40+
[C runtime (CRT) and C++ Standard Library `.lib` files](crt-library-features.md)\
41+
Discusses the `.lib` files that make up the C runtime libraries and their associated compiler options and preprocessor directives.
42+
4443
## Related Sections
4544

4645
[Debug routines](debug-routines.md)\

0 commit comments

Comments
 (0)