From d6d28f2bbe5cd941c4f6b54b953aba297b26eb37 Mon Sep 17 00:00:00 2001 From: Gabor Horvath Date: Wed, 21 Jun 2023 12:03:55 -0700 Subject: [PATCH 1/2] No longer suggest turning off annotation processing for CppCoreChecks --- .../using-the-cpp-core-guidelines-checkers.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/code-quality/using-the-cpp-core-guidelines-checkers.md b/docs/code-quality/using-the-cpp-core-guidelines-checkers.md index 1718eccb480..b7e08cd4414 100644 --- a/docs/code-quality/using-the-cpp-core-guidelines-checkers.md +++ b/docs/code-quality/using-the-cpp-core-guidelines-checkers.md @@ -1,7 +1,7 @@ --- title: Using the C++ Core Guidelines checkers description: "How to set up and use the Microsoft C++ Code Analysis rules for C++ Core Guidelines." -ms.date: 12/16/2020 +ms.date: 06/21/2023 ms.topic: "conceptual" dev_langs: - CPP @@ -231,9 +231,9 @@ You can use the command-line option to temporarily disable all code analysis for Sometimes it's useful to do focused code analysis and still use the Visual Studio IDE. Try the following sample scenario for large projects. It can save build time and make it easier to filter results: -1. In the command shell, set the `esp.extension` and `esp.annotationbuildlevel` environment variables. +1. In the command shell, set the `esp.extension` environment variable. -1. To inherit these variables, open Visual Studio from the command shell. +1. To inherit this variable, open Visual Studio from the command shell. 1. Load your project and open its properties. @@ -269,10 +269,6 @@ You can run the C++ Core Checker only on specified files. Use the same approach ```xml - - true - Ignore - true CppCoreCheck.dll @@ -294,7 +290,7 @@ Code Analysis requires a few environment variables and compiler command-line opt - **Environment variables** - `set esp.extensions=cppcorecheck.dll` This tells the engine to load the C++ Core Guidelines module. - - `set esp.annotationbuildlevel=ignore` This disables the logic that processes SAL annotations. Annotations don't affect code analysis in the C++ Core Guidelines Checker, yet their processing takes time (sometimes a long time). This setting is optional, but highly recommended. + - Old documentation suggested setting the `esp.annotationbuildlevel` environment variable. This is no longer recommended, setting that variable can result in additional false positives. When seeing unexpected results, try removing this variable from your environment. - `set caexcludepath=%include%` We highly recommend that you disable warnings that fire on standard headers. You can add more paths here, for example the path to the common headers in your project. - **Command-line options** From c19da30f880a996d7063f3d9fb3d811096664685 Mon Sep 17 00:00:00 2001 From: Gabor Horvath Date: Mon, 26 Jun 2023 08:35:46 +0200 Subject: [PATCH 2/2] Address review comment. --- docs/code-quality/using-the-cpp-core-guidelines-checkers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/code-quality/using-the-cpp-core-guidelines-checkers.md b/docs/code-quality/using-the-cpp-core-guidelines-checkers.md index b7e08cd4414..995eca97268 100644 --- a/docs/code-quality/using-the-cpp-core-guidelines-checkers.md +++ b/docs/code-quality/using-the-cpp-core-guidelines-checkers.md @@ -290,7 +290,7 @@ Code Analysis requires a few environment variables and compiler command-line opt - **Environment variables** - `set esp.extensions=cppcorecheck.dll` This tells the engine to load the C++ Core Guidelines module. - - Old documentation suggested setting the `esp.annotationbuildlevel` environment variable. This is no longer recommended, setting that variable can result in additional false positives. When seeing unexpected results, try removing this variable from your environment. + - Since Visual Studio 2019 we no longer recommend setting the `esp.annotationbuildlevel` environment variable because setting it can result in false positives. If seeing unexpected results, remove this variable from your environment. - `set caexcludepath=%include%` We highly recommend that you disable warnings that fire on standard headers. You can add more paths here, for example the path to the common headers in your project. - **Command-line options**