From becf78ae30c94081fdb661409b6a7f8d90427dbc Mon Sep 17 00:00:00 2001 From: Taojunshen Date: Tue, 26 Oct 2021 01:44:38 +0800 Subject: [PATCH] 10/25/2021 AM Publish (#3859) * draft * updates * draft content * Change incorrect link for logical AND This commit changes the link for logical AND from incorrectly linking to the bitwise AND to the correct logical AND. * draft * acrolinx and add to toc * rename existing file back to original filename * tech review * fix code sample (#3676) * fix code sample * acrolinx Co-authored-by: TylerMSFT * Update fsanitize.md * Add mention in asan-building and add fsanitize-coverage options. * Expand /fsanitize=fuzzer description. Unify table format used on page. * Reference fsanitize-coverage.md in toc + full option lists. * Fix warnings * every relevant edge * Add OneFuzz mention * Fix mistaken deletion in chrono.md * Fpcontract docs (#3691) * Update fp-specify-floating-point-behavior.md Add details on /fp:contract flag * Update float-control.md Update float_control pragma behavior with respect to contractions. * small update * Update fenv-access.md * Update fp-contract.md * Update predefined-macros.md * fix typo and PR comments * leave definition of contractions * Add /fp:contract to the main list * fix line break * Add link to fp:contract * Add reference to fp:contract * Call out changes by compiler version. Co-authored-by: 3836425+corob-msft@users.noreply.github.com * Edit pass for i18n, grammar, and style * Respond to feedback * Add LibFuzzer link, consistency fixes * add new classes: ambiguous_local_time & nonexistent_local_time * acrolinx * fix links * finish descriptions * fix more links * smoothing out * proofing * add some better linking * tune description * update descriptions * needed to update local-info-struct.md to reflect changes to descriptions for nonexistent and ambiguous * add chrono functions * rounding out duration links * Add documentation for IntelliSense linter for C++ (#3821) * Add first draft of linter check documentation * WIP overview. Signed-off-by: Kyle Reed * Update toc. First draft of the linter overview. * Add screenshots, move files, code samples are stand-alone. Signed-off-by: Kyle Reed * Style and Acrolinx grammar checker pass * Add missing Options cues for checks * Update to use latest option names Co-authored-by: 3836425+corob-msft@users.noreply.github.com * connecting duration up to it's non-member pieces and doing some general updates * fix links * cleanup * Split out VS2019 content for linter (#3824) * Update working-with-project-properties.md * cleanup * cleanup * cleanup * cleanup * cleanup * cleanup * cleanup * fix function signature * fix line ending * remove duplicate * Address /profile issues per Paddy McD (#3834) * Fixed documentation that destroy dialogs * Update void-cpp for cpp-docs 3441 Reported in MicrosoftDocs/cpp-docs/issues/3441 Clarify kinds of class member where you can't use `void*`. Fix styles. Acrolinx a few things. * More clarity on void pointers to members * zoned_traits (#3831) * add zoned_traits * draft clock_cast and clock_time_conversion * first draft * draft * draft * fix heading * cleanup * add tzdb and tzdb-list * draft * draft * pull examples * draft cleanup * acrolinx * draft cleanup * draft cleanup * incorp tech review * tech review * cleanup * cleanup * acrolinx * fix casing * add example descriptions * wording * last adjustments * wording Co-authored-by: TylerMSFT * Update 16.1 conformance per J Emmett * Update docs/error-messages/compiler-errors-2/compiler-error-c2666.md * Fix typo in page title * Fix TOC schema before VS2022 changes * Address 3449 typo in /analyze * Address 3462 add C5033 warning * Include link update * Typo * Add TOC entry * Update how-to-marshal-callbacks-and-delegates-by-using-cpp-interop.md typo: underlaying -> underlying * Fix typo in toc for tzdb_list * fix github issue #3469 (#3852) Co-authored-by: TylerMSFT * remove constexpr, prevent machine translation of code elements, and bring closer to current doc style (#3854) * remove constexpr * add remark * acrolinx * update casing * cleanup Co-authored-by: TylerMSFT * VS2022 update for what's new content * Acrolinx update * Fix validation, links, typos * Revert a styling quirk on headers * Validation error fix * Acrolinx and validation fixes * Conformance fix updates Co-authored-by: Colin Robertson Co-authored-by: TylerMSFT Co-authored-by: Weston McNamara Co-authored-by: Tyler Whitney Co-authored-by: Steve Wishnousky Co-authored-by: Gautham Beeraka <58992211+Gautham-Beeraka1@users.noreply.github.com> Co-authored-by: Kyle Reed Co-authored-by: Chai Wei Jie Co-authored-by: opbld15 Co-authored-by: PRMerger19 Co-authored-by: Laura Brenner <90344170+laurabren@users.noreply.github.com> Co-authored-by: Courtney Wales <62625502+Court72@users.noreply.github.com> Co-authored-by: Andrea Courtright <74212614+v-andreaco@users.noreply.github.com> Co-authored-by: PRMerger15 Co-authored-by: opbld16 Co-authored-by: PRMerger8 Co-authored-by: Anju Del Moral Gonzalez Co-authored-by: opbld17 Co-authored-by: Miya Natsuhara <46756417+mnatsuhara@users.noreply.github.com> Co-authored-by: Kristine Toliver Co-authored-by: PRMerger7 Co-authored-by: Avraham Co-authored-by: Paula Miller --- .../compiler-options-listed-alphabetically.md | 1 + .../compiler-options-listed-by-category.md | 1 + .../fp-specify-floating-point-behavior.md | 63 +- docs/build/reference/fsanitize-coverage.md | 86 + docs/build/reference/fsanitize.md | 26 +- .../std-specify-language-standard-version.md | 4 +- docs/build/toc.yml | 2 + docs/build/vscpp-step-0-installation.md | 2 - docs/build/vscpp-step-1-create.md | 2 - docs/build/vscpp-step-2-build.md | 2 - ...-msbuild-to-create-a-visual-cpp-project.md | 2 +- docs/code-quality/c26478.md | 2 - docs/code-quality/c26812.md | 2 - docs/code-quality/c26814.md | 2 - .../compiler-errors-1/fatal-error-c1047.md | 4 +- .../tool-errors/linker-tools-error-lnk2001.md | 4 +- .../cpp-conformance-improvements-2017.md | 2 +- .../cpp-conformance-improvements-2019.md | 2525 +++++++++++++++++ docs/overview/cpp-conformance-improvements.md | 2521 +--------------- docs/overview/toc.yml | 8 +- .../visual-cpp-language-conformance.md | 6 +- docs/overview/what-s-new-for-cpp-2017.md | 12 +- docs/overview/what-s-new-for-cpp-2019.md | 535 ++++ ...t-s-new-for-visual-cpp-in-visual-studio.md | 499 +--- docs/porting/binary-compat-2015-2017.md | 22 +- ...-of-potential-upgrade-issues-visual-cpp.md | 122 +- docs/porting/porting-third-party-libraries.md | 12 +- docs/porting/toc.yml | 2 +- .../visual-cpp-porting-and-upgrading-guide.md | 26 +- docs/preprocessor/fenv-access.md | 10 +- docs/preprocessor/float-control.md | 38 +- docs/preprocessor/fp-contract.md | 15 +- docs/preprocessor/predefined-macros.md | 2 + docs/sanitizers/asan-building.md | 53 +- docs/standard-library/mutex-class-stl.md | 48 +- 35 files changed, 3543 insertions(+), 3120 deletions(-) create mode 100644 docs/build/reference/fsanitize-coverage.md create mode 100644 docs/overview/cpp-conformance-improvements-2019.md create mode 100644 docs/overview/what-s-new-for-cpp-2019.md diff --git a/docs/build/reference/compiler-options-listed-alphabetically.md b/docs/build/reference/compiler-options-listed-alphabetically.md index 2aea452174c..462eaf975a5 100644 --- a/docs/build/reference/compiler-options-listed-alphabetically.md +++ b/docs/build/reference/compiler-options-listed-alphabetically.md @@ -53,6 +53,7 @@ This table contains an alphabetical list of compiler options. For a list of comp | [`/FR`](fr-fr-create-dot-sbr-file.md)

[`/Fr`](fr-fr-create-dot-sbr-file.md) | Generates browser files. **`/Fr`** is deprecated. | | [`/FS`](fs-force-synchronous-pdb-writes.md) | Forces serialization of all writes to the program database (PDB) file through MSPDBSRV.EXE. | | [`/fsanitize`](fsanitize.md) | Enables compilation of sanitizer instrumentation such as AddressSanitizer. | +| [`/fsanitize-coverage`](fsanitize-coverage.md) | Enables compilation of code coverage instrumentation for libraries such as LibFuzzer. | | [`/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. | | [`/Fx`](fx-merge-injected-code.md) | Merges injected code with source file. | | [`/GA`](ga-optimize-for-windows-application.md) | Optimizes code for Windows application. | diff --git a/docs/build/reference/compiler-options-listed-by-category.md b/docs/build/reference/compiler-options-listed-by-category.md index ec95e10c9b3..8ff74ddebca 100644 --- a/docs/build/reference/compiler-options-listed-by-category.md +++ b/docs/build/reference/compiler-options-listed-by-category.md @@ -169,6 +169,7 @@ This article contains a categorical list of compiler options. For an alphabetica | [`/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. | | [`/FS`](fs-force-synchronous-pdb-writes.md) | Forces writes to the PDB file to be serialized through *MSPDBSRV.EXE*. | | [`/fsanitize`](fsanitize.md) | Enables compilation of sanitizer instrumentation such as AddressSanitizer. | +| [`/fsanitize-coverage`](fsanitize-coverage.md) | Enables compilation of code coverage instrumentation for libraries such as LibFuzzer. | | [`/H`](h-restrict-length-of-external-names.md) | Deprecated. Restricts the length of external (public) names. | | [`/HELP`](help-compiler-command-line-help.md) | Lists the compiler options. | | [`/J`](j-default-char-type-is-unsigned.md) | Changes the default **`char`** type. | diff --git a/docs/build/reference/fp-specify-floating-point-behavior.md b/docs/build/reference/fp-specify-floating-point-behavior.md index ed48ef13ad8..d23d5228430 100644 --- a/docs/build/reference/fp-specify-floating-point-behavior.md +++ b/docs/build/reference/fp-specify-floating-point-behavior.md @@ -12,20 +12,54 @@ Specifies how the compiler treats floating-point expressions, optimizations, and ## Syntax +::: moniker range=">msvc-160" + +**`/fp:contract`** +**`/fp:except`**\[**`-`**]\ +**`/fp:fast`**\ **`/fp:precise`**\ **`/fp:strict`**\ -**`/fp:fast`**\ + +::: moniker-end +::: moniker range="<=msvc-160" + **`/fp:except`**\[**`-`**] +**`/fp:fast`**\ +**`/fp:precise`**\ +**`/fp:strict`**\ + +::: moniker-end ### Arguments +::: moniker range=">msvc-160" + +#### `/fp:contract` + +The **`/fp:contract`** option allows the compiler to generate floating-point contractions when you specify the **`/fp:precise`** and **`/fp:except`** options. A *contraction* is a machine instruction that combines floating-point operations, such as Fused-Multiply-Add (FMA). FMA, defined as a basic operation by IEEE-754, doesn't round the intermediate product before the addition, so the result can differ from separate multiplication and addition operations. Since it's implemented as a single instruction, it can be faster than separate instructions. The speed comes at a cost of bitwise exact results, and an inability to examine the intermediate value. + +By default, the **`/fp:fast`** option enables **`/fp:contract`**. The **`/fp:contract`** option isn't compatible with **`/fp:strict`**. + +The **`/fp:contract`** option is new in Visual Studio 2022. + +::: moniker-end + #### `/fp:precise` By default, the compiler uses **`/fp:precise`** behavior. Under **`/fp:precise`**, the compiler preserves the source expression ordering and rounding properties of floating-point code when it generates and optimizes object code for the target machine. The compiler rounds to source code precision at four specific points during expression evaluation: at assignments, typecasts, when floating-point arguments get passed to a function call, and when a function call returns a floating-point value. Intermediate computations may be performed at machine precision. Typecasts can be used to explicitly round intermediate computations. -The compiler doesn't perform algebraic transformations on floating-point expressions, such as reassociation or distribution, unless it can guarantee the transformation produces a bitwise identical result. Expressions that involve special values (NaN, +infinity, -infinity, -0.0) are processed according to IEEE-754 specifications. For example, `x != x` evaluates to **`true`** if `x` is NaN. Floating-point *contractions*, machine instructions that combine floating-point operations, may be generated under **`/fp:precise`**. +::: moniker range=">msvc-160" + +The compiler doesn't perform algebraic transformations on floating-point expressions, such as reassociation or distribution, unless it can guarantee the transformation produces a bitwise identical result. Expressions that involve special values (NaN, +infinity, -infinity, -0.0) are processed according to IEEE-754 specifications. For example, `x != x` evaluates to **`true`** if `x` is NaN. Floating-point contractions aren't generated by default under **`/fp:precise`**. This behavior is new in Visual Studio 2022. Previous compiler versions could generate contractions by default under **`/fp:precise`**. + +::: moniker-end +::: moniker range="<=msvc-160" + +The compiler doesn't perform algebraic transformations on floating-point expressions, such as reassociation or distribution, unless it can guarantee the transformation produces a bitwise identical result. Expressions that involve special values (NaN, +infinity, -infinity, -0.0) are processed according to IEEE-754 specifications. For example, `x != x` evaluates to **`true`** if `x` is NaN. Floating-point contractions may be generated under **`/fp:precise`**. + +::: moniker-end The compiler generates code intended to run in the [default floating-point environment](#the-default-floating-point-environment). It also assumes the floating-point environment isn't accessed or modified at runtime. That is, it assumes the code doesn't unmask floating-point exceptions, read or write floating-point status registers, or change rounding modes. @@ -49,7 +83,7 @@ Under **`/fp:fast`**, the compiler generates code intended to run in the default #### `/fp:except` -The **`/fp:except`** option generates code to ensures that any unmasked floating-point exceptions are raised at the exact point at which they occur, and that no other floating-point exceptions are raised. By default, the **`/fp:strict`** option enables **`/fp:except`**, and **`/fp:precise`** doesn't. The **`/fp:except`** option isn't compatible with **`/fp:fast`**. The option can be explicitly disabled by us of **`/fp:except-`**. +The **`/fp:except`** option generates code to ensures that any unmasked floating-point exceptions are raised at the exact point at which they occur, and that no other floating-point exceptions are raised. By default, the **`/fp:strict`** option enables **`/fp:except`**, and **`/fp:precise`** doesn't. The **`/fp:except`** option isn't compatible with **`/fp:fast`**. The option can be explicitly disabled by use of **`/fp:except-`**. By itself, **`/fp:except`** doesn't enable any floating-point exceptions. However, it's required for programs to enable floating-point exceptions. For more information on how to enable floating-point exceptions, see [`_controlfp`](../../c-runtime-library/reference/control87-controlfp-control87-2.md). @@ -63,11 +97,26 @@ The [`/Za`](za-ze-disable-language-extensions.md) (ANSI compatibility) option is The compiler provides three pragma directives to override the floating-point behavior specified on the command line: [`float_control`](../../preprocessor/float-control.md), [`fenv_access`](../../preprocessor/fenv-access.md), and [`fp_contract`](../../preprocessor/fp-contract.md). You can use these directives to control floating-point behavior at function-level, not within a function. These directives don't correspond directly to the **`/fp`** options. This table shows how the **`/fp`** options and pragma directives map to each other. For more information, see the documentation for the individual options and pragma directives. -| Option | float_control(precise) | float_control(except) | fenv_access | fp_contract | +::: moniker range=">msvc-160" + +| Option | `float_control(precise, *)` | `float_control(except, *)` | `fenv_access(*)` | `fp_contract(*)` | +|--|--|--|--|--| +| `/fp:fast` | `off` | `off` | `off` | `on` | +| `/fp:precise` | `on` | `off` | `off` | `off`\* | +| `/fp:strict` | `on` | `on` | `on` | `off` | + +\* In versions of Visual Studio before Visual Studio 2022, the **`/fp:precise`** behavior defaulted to `fp_contract(on)`. + +::: moniker-end +::: moniker range=">msvc-160" + +| Option | `float_control(precise, *)` | `float_control(except, *)` | `fenv_access(*)` | `fp_contract(*)` | |--|--|--|--|--| -| `/fp:fast` | off | off | off | on | -| `/fp:precise` | on | off | off | on | -| `/fp:strict` | on | on | on | off | +| `/fp:fast` | `off` | `off` | `off` | `on` | +| `/fp:precise` | `on` | `off` | `off` | `on` | +| `/fp:strict` | `on` | `on` | `on` | `off` | + +::: moniker-end ### The default floating point environment diff --git a/docs/build/reference/fsanitize-coverage.md b/docs/build/reference/fsanitize-coverage.md new file mode 100644 index 00000000000..8232ceb89d7 --- /dev/null +++ b/docs/build/reference/fsanitize-coverage.md @@ -0,0 +1,86 @@ +--- +description: "Learn more about the /fsanitize-coverage (Configure sanitizer coverage) compiler option." +title: "/fsanitize-coverage (Configure sanitizer coverage)" +ms.date: 09/15/2021 +f1_keywords: ["/fsanitize-coverage", "-fsanitize-coverage", "/fsanitize-coverage=inline-8bit-counters", "/fsanitize-coverage=edge", "/fsanitize-coverage=trace-cmp", "/fsanitize-coverage=trace-div", "/fno-sanitize-coverage=inline-8bit-counters", "/fno-sanitize-coverage=edge", "/fno-sanitize-coverage=trace-cmp", "/fno-sanitize-coverage=trace-div"] +helpviewer_keywords: ["/fsanitize-coverage [C++]", "sanitizer compiler option [C++]", "/fsanitize-coverage=inline-8bit-counters", "/fsanitize-coverage=edge", "/fsanitize-coverage=trace-cmp", "/fsanitize-coverage=trace-div", "/fno-sanitize-coverage=inline-8bit-counters", "/fno-sanitize-coverage=edge", "/fno-sanitize-coverage=trace-cmp", "/fno-sanitize-coverage=trace-div"] +--- +# `/fsanitize-coverage` (Configure sanitizer coverage) + +The **`/fsanitize-coverage`** compiler options instruct the compiler to add various kinds of instrumentation points where user-defined functions are called. These options are useful for fuzzing scenarios that use **`/fsanitize=fuzzer`**, like OneFuzz. For more information, see the [OneFuzz documentation](https://www.microsoft.com/en-us/research/project/project-onefuzz/) and [OneFuzz GitHub project](https://github.com/microsoft/onefuzz). + +## Syntax + +> **`/fsanitize-coverage=edge`**\ +> **`/fsanitize-coverage=inline-8bit-counters`**\ +> **`/fsanitize-coverage=trace-cmp`**\ +> **`/fsanitize-coverage=trace-div`**\ +> **`/fno-sanitize-coverage=edge`**\ +> **`/fno-sanitize-coverage=inline-8bit-counters`**\ +> **`/fno-sanitize-coverage=trace-cmp`**\ +> **`/fno-sanitize-coverage=trace-div`** + +## Remarks + +The experimental **`/fsanitize-coverage`** compiler options offer code coverage support and various options to modify which compiler-provided instrumentation is generated. All these options are automatically set when the [`/fsanitize=fuzzer`](fsanitize.md) option is specified. The **`/fsanitize=fuzzer`** option requires the same instrumentation points and callbacks mentioned in these options. + +The **`/fsanitize-coverage`** options don't allow comma-separated syntax, for example: **`/fsanitize-coverage=edge,inline-8bit-counters,trace-cmp,trace-div`**. Specify these options individually. + +The **`/fsanitize-coverage`** options are available beginning in Visual Studio 2022 version 17.0. + +### Code coverage + +The **`/fsanitize-coverage=edge`** compiler option enables code coverage instrumentation along all non-redundant edges. Use **`/fno-sanitize-coverage=edge`** to disable this option if it's already provided or implied by another option. + +### Inline counters + +The **`/fsanitize-coverage=inline-8bit-counters`** compiler option instructs the compiler to add an inline counter increment on every relevant edge. This option also adds a call to `extern "C" void __sanitizer_cov_8bit_counters_init(uint8_t *start, uint8_t *stop)` that you must implement. The arguments correspond to the start and end of an array that contains all the 8-bit counters created. Use **`/fno-sanitize-coverage=inline-8bit-counters`** to disable this option if it's already provided or implied by another option. + +### Trace comparisons + +The **`/fsanitize-coverage=trace-cmp`** compiler option instructs the compiler to insert calls to the following functions: + +```C +// Before each comparison instruction of the stated size. +void __sanitizer_cov_trace_cmp1(uint8_t Arg1, uint8_t Arg2); +void __sanitizer_cov_trace_cmp2(uint16_t Arg1, uint16_t Arg2); +void __sanitizer_cov_trace_cmp4(uint32_t Arg1, uint32_t Arg2); +void __sanitizer_cov_trace_cmp8(uint64_t Arg1, uint64_t Arg2); + +// Before each comparison instruction of the stated size, if one of the operands (Arg1) is constant. +void __sanitizer_cov_trace_const_cmp1(uint8_t Arg1, uint8_t Arg2); +void __sanitizer_cov_trace_const_cmp2(uint16_t Arg1, uint16_t Arg2); +void __sanitizer_cov_trace_const_cmp4(uint32_t Arg1, uint32_t Arg2); +void __sanitizer_cov_trace_const_cmp8(uint64_t Arg1, uint64_t Arg2); +``` + +Use **`/fno-sanitize-coverage=trace-cmp`** to disable this option if it's already provided or implied by another option. + +### Trace divisions + +The **`/fsanitize-coverage=trace-div`** compiler option instructs the compiler to insert calls to the following functions: + +```C +// Before a division instruction of the stated size. +void __sanitizer_cov_trace_div4(uint32_t Val); +void __sanitizer_cov_trace_div8(uint64_t Val); +``` + +Use **`/fno-sanitize-coverage=trace-div`** to disable this option if it's already provided or implied by another option. + +### To set the advanced compiler options + +1. Open your project's **Property Pages** dialog box. + +1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page. + +1. Modify the **Additional Options** property to set **/fsanitize-coverage** options. + +1. Choose **OK** or **Apply** to save your changes. + +## See also + +[MSVC compiler options](compiler-options.md)\ +[MSVC compiler command-line syntax](compiler-command-line-syntax.md)\ +[`/fsanitize` (Enable Sanitizers)](fsanitize.md)\ +[AddressSanitizer build and language reference](../../sanitizers/asan-building.md) diff --git a/docs/build/reference/fsanitize.md b/docs/build/reference/fsanitize.md index eeb828ebfe2..e4a146577b2 100644 --- a/docs/build/reference/fsanitize.md +++ b/docs/build/reference/fsanitize.md @@ -1,27 +1,30 @@ --- description: "Learn more about the /fsanitize (enable sanitizers) compiler option" title: "/fsanitize (Enable sanitizers)" -ms.date: 02/24/2021 -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"] +ms.date: 09/15/2021 +f1_keywords: ["/fsanitize", "-fsanitize", "/fsanitize=address", "/fsanitize=fuzzer", "/fsanitize-address-use-after-return", "-fsanitize-address-use-after-return", "/fno-sanitize-address-vcasan-lib", "-fno-sanitize-address-vcasan-lib"] helpviewer_keywords: ["/fsanitize [C++]", "-fsanitize=address [C++]", "address sanitizer compiler option [C++]", "/fsanitize-address-use-after-return", "/fno-sanitize-address-vcasan-lib"] --- # `/fsanitize` (Enable sanitizers) -Use the **`/fsanitize`** compiler options to enable sanitizers. As of Visual Studio 2019 16.9, the only supported sanitizer is [AddressSanitizer](../../sanitizers/asan.md). +Use the **`/fsanitize`** compiler options to enable sanitizers. ## Syntax > **`/fsanitize=address`**\ +> **`/fsanitize=fuzzer`**\ > **`/fsanitize-address-use-after-return`**\ > **`/fno-sanitize-address-vcasan-lib`** ## Remarks -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). +The **`/fsanitize=address`** compiler option enables [AddressSanitizer](../../sanitizers/asan.md), a powerful compiler and runtime technology to uncover [hard-to-find bugs](../../sanitizers/asan.md#error-types). Support for the **`/fsanitize=address`** option is available starting in Visual Studio 2019 version 16.9. -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). +The **`/fsanitize=fuzzer`** compiler option enables experimental support for [LibFuzzer](https://releases.llvm.org/3.8.0/docs/LibFuzzer.html). LibFuzzer is a coverage-guided fuzzing library that can be used to find bugs and crashes caused by user-provided input. We recommended you use **`/fsanitize=address`** with LibFuzzer. This option is useful for fuzzing tools such as OneFuzz. For more information, see the [OneFuzz documentation](https://www.microsoft.com/en-us/research/project/project-onefuzz/) and [OneFuzz GitHub project](https://github.com/microsoft/onefuzz). Support for the **`/fsanitize=fuzzer`** option is available starting in Visual Studio 2022 version 17.0. + +The **`/fsanitize`** option doesn't allow comma-separated syntax, for example: **`/fsanitize=address,fuzzer`**. These options must be specified individually. -The **`/fsanitize`** options are available beginning in Visual Studio 2019 version 16.9. +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). ### To set the **`/fsanitize=address`** compiler option in the Visual Studio development environment @@ -33,6 +36,16 @@ The **`/fsanitize`** options are available beginning in Visual Studio 2019 versi 1. Choose **OK** or **Apply** to save your changes. +### To set the **`/fsanitize=fuzzer`** compiler option in the Visual Studio development environment + +1. Open your project's **Property Pages** dialog box. + +1. Select the **Configuration Properties** > **C/C++** > **General** property page. + +1. Modify the **Enable Fuzzer** property. To enable it, choose **Yes (/fsanitize=fuzzer)**. + +1. Choose **OK** or **Apply** to save your changes. + ### To set the advanced compiler options 1. Open your project's **Property Pages** dialog box. @@ -52,6 +65,7 @@ The **`/fsanitize`** options are available beginning in Visual Studio 2019 versi [MSVC compiler options](compiler-options.md)\ [MSVC compiler command-line syntax](compiler-command-line-syntax.md)\ [`/INFERASANLIBS` (Use inferred sanitizer libs)](./inferasanlibs.md)\ +[`/fsanitize-coverage` (Configure sanitizer coverage)](fsanitize-coverage.md)\ [AddressSanitizer overview](../../sanitizers/asan.md)\ [AddressSanitizer known issues](../../sanitizers/asan-known-issues.md)\ [AddressSanitizer build and language reference](../../sanitizers/asan-building.md) diff --git a/docs/build/reference/std-specify-language-standard-version.md b/docs/build/reference/std-specify-language-standard-version.md index d305e2f28f8..9fa24310b7f 100644 --- a/docs/build/reference/std-specify-language-standard-version.md +++ b/docs/build/reference/std-specify-language-standard-version.md @@ -1,7 +1,7 @@ --- title: "/std (Specify Language Standard Version)" description: "The MSVC compiler option /std specifies the C or C++ language standard supported by the compiler." -ms.date: 06/14/2021 +ms.date: 10/22/2021 f1_keywords: ["/std", "-std", "/std:c++14", "/std:c++17", "/std:c11", "/std:c17", "VC.Project.VCCLCompilerTool.CppLanguageStandard"] --- # `/std` (Specify Language Standard Version) @@ -51,7 +51,7 @@ The **`/std:c++20`** option disables compiler and standard library support for f **`/std:c++latest`**\ The **`/std:c++latest`** option enables all currently implemented compiler and standard library features proposed for the next draft standard, as well as some in-progress and experimental features. This option is available starting in Visual Studio 2015 Update 3. -Depending on the MSVC compiler version or update level, C++17 or C++20 features may not be fully implemented or fully conforming when you specify the **`/std:c++latest`** option. For an overview of C++ language conformance in Visual C++ by release version, see [Microsoft C/C++ language conformance](../../overview/visual-cpp-language-conformance.md). +Depending on the MSVC compiler version or update level, C++17, C++20, or proposed C++23 features may not be fully implemented or fully conforming when you specify the **`/std:c++latest`** option. We recommend you use the latest version of Visual Studio for maximum standards conformance. For an overview of C++ language and library conformance in Visual C++ by release version, see [Microsoft C/C++ language conformance](../../overview/visual-cpp-language-conformance.md). In versions of Visual Studio 2019 before version 16.11, **`/std:c++latest`** is required to enable all the compiler and standard library features of C++20. diff --git a/docs/build/toc.yml b/docs/build/toc.yml index 127c19fe656..2a6e186b5e6 100644 --- a/docs/build/toc.yml +++ b/docs/build/toc.yml @@ -563,6 +563,8 @@ items: href: ../build/reference/fs-force-synchronous-pdb-writes.md - name: /fsanitize (Enable sanitizers) href: ../build/reference/fsanitize.md + - name: /fsanitize-coverage (Configure sanitizer coverage) + href: ../build/reference/fsanitize-coverage.md - name: /GA (Optimize for Windows application) href: ../build/reference/ga-optimize-for-windows-application.md - name: /Gd, /Gr, /Gv, /Gz (Calling convention) diff --git a/docs/build/vscpp-step-0-installation.md b/docs/build/vscpp-step-0-installation.md index ab35617c382..0fc6e1e719e 100644 --- a/docs/build/vscpp-step-0-installation.md +++ b/docs/build/vscpp-step-0-installation.md @@ -188,5 +188,3 @@ When Visual Studio is running, you're ready to continue to the next step. > [!div class="nextstepaction"] > [Create a C++ project](vscpp-step-1-create.md) - -