diff --git a/docs/build/reference/analyze-code-analysis.md b/docs/build/reference/analyze-code-analysis.md index aa495ab414d..e2f0739798b 100644 --- a/docs/build/reference/analyze-code-analysis.md +++ b/docs/build/reference/analyze-code-analysis.md @@ -1,7 +1,7 @@ --- title: "/analyze (Code analysis)" description: "The Microsoft C++ compiler /analyze option syntax and usage." -ms.date: 05/21/2021 +ms.date: 10/19/2021 f1_keywords: ["VC.Project.VCCLCompilerTool.EnablePREfast", "/analyze", "VC.Project.VCCLCompilerTool.PREfastAdditionalOptions", "VC.Project.VCCLCompilerTool.PREfastAdditionalPlugins"] helpviewer_keywords: ["/analyze compiler option [C++]", "-analyze compiler option [C++]", "analyze compiler option [C++]"] ms.assetid: 81da536a-e030-4bd4-be18-383927597d08 @@ -73,7 +73,7 @@ Ruleset options: **`/analyze`**\[**`-`**]\ Turns on code analysis. Use **`/analyze-`** to explicitly turn off analysis. **`/analyze-`** is the default behavior. -By default, analysis output goes to the console or the Visual Studio Output window like other error messages. Code analysis also creates a log file named *`filename.nativeanalysis.xml`*, where *`filename`* is the name of the analyzed source file. +By default, analysis output goes to the console or the Visual Studio Output window like other error messages. Code analysis also creates a log file named *`filename.nativecodeanalysis.xml`*, where *`filename`* is the name of the analyzed source file. **`/analyze:only`**\ By default, the compiler compiles the code to generate object files before code analysis runs. The **`/analyze:only`** option makes the compiler skip the code generation pass, and does code analysis directly. Compiler errors still prevent code analysis from running. However, the compiler won't report other warnings that it might find during the code generation pass. If the program isn't free of code-generation warnings, analysis results might be unreliable. We recommend you use this option only if the code passes code-generation syntax checks without errors or warnings. diff --git a/docs/build/reference/og-global-optimizations.md b/docs/build/reference/og-global-optimizations.md index f1fd19d541e..b098037fcc1 100644 --- a/docs/build/reference/og-global-optimizations.md +++ b/docs/build/reference/og-global-optimizations.md @@ -1,7 +1,7 @@ --- title: "/Og (Global Optimizations)" description: "Describes the deprecated MSVC compiler option /Og, formerly used to enable global optimizations." -ms.date: 07/08/2020 +ms.date: 10/19/2021 f1_keywords: ["VC.Project.VCCLCompilerTool.GlobalOptimizations", "/og"] helpviewer_keywords: ["-Og compiler option [C++]", "global optimizations compiler option [C++]", "automatic register allocation", "/Og compiler option [C++]", "loop structures, optimizing", "common subexpression elimination", "Og compiler option [C++]"] ms.assetid: d10630cc-b9cf-4e97-bde3-8d7ee79e9435 @@ -34,7 +34,7 @@ The following optimizations are available under **`/Og`**: - Automatic register allocation - This optimization allows the compiler to store frequently used variables and subexpressions in registers; the **`register`** keyword is ignored. + This optimization allows the compiler to store frequently used variables and subexpressions in registers. The **`register`** keyword is ignored by default, and causes a diagnostic under **`/std:c++17`** or later. - Loop optimization @@ -62,7 +62,7 @@ The following optimizations are available under **`/Og`**: > [!NOTE] > You can enable or disable global optimization on a function-by-function basis using the `optimize` pragma together with the `g` option. -For related information, see [`/Oi` (Generate intrinsic functions)](oi-generate-intrinsic-functions.md) and [`/Ox`(Enable most speed optimizations)](ox-full-optimization.md). +For related information, see [`/Oi` (Generate intrinsic functions)](oi-generate-intrinsic-functions.md) and [`/Ox` (Enable most speed optimizations)](ox-full-optimization.md). ### To set this compiler option in the Visual Studio development environment diff --git a/docs/c-language/register-storage-class-specifier.md b/docs/c-language/register-storage-class-specifier.md index b5b8fc4ce42..39c506ca318 100644 --- a/docs/c-language/register-storage-class-specifier.md +++ b/docs/c-language/register-storage-class-specifier.md @@ -1,18 +1,18 @@ --- -description: "Learn more about: register Storage-Class Specifier" -title: "register Storage-Class Specifier" -ms.date: "11/04/2016" +description: "Learn more about: register storage-class specifier" +title: "register storage-class specifier" +ms.date: 10/19/2021 helpviewer_keywords: ["register variables", "register storage class"] ms.assetid: 7577bf48-88ec-4191-873c-ef4217a4034e --- -# register Storage-Class Specifier +# `register` storage-class specifier **Microsoft Specific** -The Microsoft C/C++ compiler does not honor user requests for register variables. However, for portability all other semantics associated with the **`register`** keyword are honored by the compiler. For example, you cannot apply the unary address-of operator (**&**) to a register object nor can the **`register`** keyword be used on arrays. +The Microsoft C/C++ compiler doesn't honor user requests for register variables. However, for portability all other semantics associated with the **`register`** keyword are honored by the compiler. For example, you can't apply the unary address-of operator (**`&`**) to a register object nor can the **`register`** keyword be used on arrays. **END Microsoft Specific** ## See also -[Storage-Class Specifiers for Internal-Level Declarations](../c-language/storage-class-specifiers-for-internal-level-declarations.md) +[Storage-class specifiers for internal-level declarations](../c-language/storage-class-specifiers-for-internal-level-declarations.md) diff --git a/docs/cpp/storage-classes-cpp.md b/docs/cpp/storage-classes-cpp.md index 6b811993651..1ca1029099d 100644 --- a/docs/cpp/storage-classes-cpp.md +++ b/docs/cpp/storage-classes-cpp.md @@ -1,7 +1,7 @@ --- title: "Storage classes (C++)" description: "In C++, the static, extern and thread_local keywords specify the lifetime, linkage, and memory location of a variable or function." -ms.date: "12/11/2019" +ms.date: 10/19/2021 f1_keywords: ["thread_local_cpp", "static_cpp", "register_cpp"] helpviewer_keywords: ["storage classes [C++], basic concepts"] ms.assetid: f10e1c56-6249-4eb6-b08f-09ab1eef1992 @@ -10,15 +10,17 @@ ms.assetid: f10e1c56-6249-4eb6-b08f-09ab1eef1992 A *storage class* in the context of C++ variable declarations is a type specifier that governs the lifetime, linkage, and memory location of objects. A given object can have only one storage class. Variables defined within a block have automatic storage unless otherwise specified using the **`extern`**, **`static`**, or **`thread_local`** specifiers. Automatic objects and variables have no linkage; they are not visible to code outside the block. Memory is allocated for them automatically when execution enters the block and de-allocated when the block is exited. -**Notes** +## Notes -1. The [mutable](../cpp/mutable-data-members-cpp.md) keyword may be considered a storage class specifier. However, it is only available in the member list of a class definition. +- The [`mutable`](../cpp/mutable-data-members-cpp.md) keyword may be considered a storage class specifier. However, it is only available in the member list of a class definition. -1. **Visual Studio 2010 and later:** The **`auto`** keyword is no longer a C++ storage-class specifier, and the **`register`** keyword is deprecated. **Visual Studio 2017 version 15.7 and later:** (available in [`/std:c++17`](../build/reference/std-specify-language-standard-version.md) mode and later): The **`register`** keyword is removed from the C++ language. +- **Visual Studio 2010 and later:** The **`auto`** keyword is no longer a C++ storage-class specifier, and the **`register`** keyword is deprecated. **Visual Studio 2017 version 15.7 and later:** (available in [`/std:c++17`](../build/reference/std-specify-language-standard-version.md) mode and later): The **`register`** keyword is removed from the C++ language. Its use causes a diagnostic message: -```cpp - register int val; // warning C5033: 'register' is no longer a supported storage class -``` + ```cpp + // c5033.cpp + // compile by using: cl /c /std:c++17 c5033.cpp + register int value; // warning C5033: 'register' is no longer a supported storage class + ``` ## `static` @@ -186,7 +188,7 @@ On Windows, **`thread_local`** is functionally equivalent to [`__declspec(threa ## register -**Visual Studio 2017 version 15.3 and later** (available in [`/std:c++17`](../build/reference/std-specify-language-standard-version.md) mode and later): The **`register`** keyword is no longer a supported storage class. The keyword is still reserved in the standard for future use. +**Visual Studio 2017 version 15.3 and later** (available in [`/std:c++17`](../build/reference/std-specify-language-standard-version.md) mode and later): The **`register`** keyword is no longer a supported storage class. Its use causes a diagnostic. The keyword is still reserved in the standard for future use. ```cpp register int val; // warning C5033: 'register' is no longer a supported storage class diff --git a/docs/error-messages/compiler-warnings/c5033.md b/docs/error-messages/compiler-warnings/c5033.md new file mode 100644 index 00000000000..d60b67afabf --- /dev/null +++ b/docs/error-messages/compiler-warnings/c5033.md @@ -0,0 +1,37 @@ +--- +title: "Compiler warning C5033" +description: Describes the causes and fixes for compiler warning C5033. +ms.date: 05/03/2021 +f1_keywords: ["C5033"] +helpviewer_keywords: ["C5033"] +--- +# Compiler warning (level 1) C5033 + +> '*storage-class-keyword*' is no longer a supported storage class + +The **`auto`** and **`register`** storage class keywords have been deprecated or removed from the C++ language. + +## Remarks + +**Visual Studio 2010 and later:** In C++11, the **`auto`** keyword is no longer a C++ storage-class specifier, and the **`register`** keyword is deprecated. + +**Visual Studio 2017 version 15.7 and later:** (available in [`/std:c++17`](../../build/reference/std-specify-language-standard-version.md) mode and later): The **`register`** keyword is removed from the C++ language in C++17 and later standards. + +The C++ standard defines an original and a revised meaning for the **`auto`** keyword. Before C++11, the **`auto`** keyword declares a variable in the *automatic* storage class; that is, a variable that has a local lifetime. Starting in C++11, the **`auto`** keyword declares a variable whose type is deduced from the initialization expression in its declaration. For backward compatibility, you can use the [`/Zc:auto`](../../build/reference/zc-auto-deduce-variable-type.md) compiler option to control the meaning of the **`auto`** keyword. + +The **`register`** keyword was originally meant as a suggestion to the compiler to place a variable in a register. The keyword was routinely ignored by compilers. Instead, compilers control whether variables are placed in registers to satisfy calling conventions and optimization levels. The **`register`** keyword is reserved in the standard for future use. + +## Example + +```cpp +// c5033.cpp +// compile by using: cl /c /std:c++17 c5033.cpp + +register int value; // warning C5033: 'register' is no longer a supported storage class +``` + +To fix this issue, remove the **`register`** storage-class specifier keyword. + +## See also + +[Storage class](../../cpp/storage-classes-cpp.md) diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4710.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4710.md index 74100e6eb46..d2cc5e90759 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4710.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4710.md @@ -1,19 +1,19 @@ --- description: "Learn more about: Compiler Warning (level 4) C4710" title: "Compiler Warning (level 4) C4710" -ms.date: "11/04/2016" +ms.date: 10/19/2021 f1_keywords: ["C4710"] helpviewer_keywords: ["C4710"] ms.assetid: 76381ec7-3fc1-4bee-9a0a-c2c8307b92e2 --- # Compiler Warning (level 4) C4710 -'function' : function not inlined +> '*function*' : function not inlined -The given function was selected for inline expansion, but the compiler did not perform the inlining. +The specified function was marked for inline expansion, but the compiler didn't inline the function. -Inlining is performed at the compiler's discretion. The **`inline`** keyword, like the **`register`** keyword, is used as a hint for the compiler. The compiler uses heuristics to determine if it should inline a particular function to speed up the code when compiling for speed, or if it should inline a particular function to make the code smaller when compiling for space. The compiler will only inline very small functions when compiling for space. +Inlining is done at the compiler's discretion. The **`inline`** keyword, like the deprecated (and, in C++17 and later standards, removed) **`register`** keyword, is used as a hint for the compiler. The compiler uses heuristics to determine if it should inline a particular function to speed up the code when it optimizes for speed, or if it should inline a particular function to make the code smaller when it optimizes for space. The compiler inlines only the smallest functions when compiling for space. -In some cases, the compiler will not inline a particular function for mechanical reasons. See [C4714](../../error-messages/compiler-warnings/compiler-warning-level-4-c4714.md) for a list of reasons the compiler may not inline a function. +In some cases, the compiler doesn't inline a particular function for mechanical reasons. See [C4714](../../error-messages/compiler-warnings/compiler-warning-level-4-c4714.md) for a list of reasons the compiler may not inline a function. -This warning is off by default. See [Compiler Warnings That Are Off by Default](../../preprocessor/compiler-warnings-that-are-off-by-default.md) for more information. +This warning is off by default. For more information, see [Compiler warnings that are off by default](../../preprocessor/compiler-warnings-that-are-off-by-default.md). diff --git a/docs/error-messages/compiler-warnings/compiler-warnings-c4800-through-c4999.md b/docs/error-messages/compiler-warnings/compiler-warnings-c4800-through-c4999.md index 789841e658a..1eed5e7eadb 100644 --- a/docs/error-messages/compiler-warnings/compiler-warnings-c4800-through-c4999.md +++ b/docs/error-messages/compiler-warnings/compiler-warnings-c4800-through-c4999.md @@ -1,9 +1,9 @@ --- title: "Compiler warnings C4800 Through C5999" description: "Table of Microsoft C/C++ compiler warnings C4800 through C5999." -ms.date: 08/09/2021 -f1_keywords: ["C4808", "C4809", "C4825", "C4827", "C4837", "C4842", "C4844", "C4845", "C4846", "C4847", "C4848", "C4854", "C4855", "C4856", "C4857", "C4872", "C4880", "C4881", "C4882", "C4916", "C4921", "C4934", "C4954", "C4955", "C4963", "C4966", "C4970", "C4971", "C4973", "C4974", "C4981", "C4987", "C4988", "C4989", "C4990", "C4991", "C4992", "C4998", "C5022", "C5023", "C5024", "C5025", "C5026", "C5027", "C5028", "C5029", "C5030", "C5031", "C5032", "C5033", "C5034", "C5035", "C5036", "C5039", "C5040", "C5041", "C5042", "C5043", "C5044", "C5047", "C5048", "C5049", "C5051", "C5052", "C5053", "C5054", "C5055", "C5056", "C5057", "C5058", "C5059", "C5060", "C5061", "C5062", "C5063", "C5100", "C5101", "C5102", "C5103", "C5104", "C5106", "C5107", "C5108", "C5200", "C5201", "C5202", "C5203", "C5204", "C5205", "C5206", "C5207", "C5209", "C5210", "C5211", "C5212", "C5213", "C5214", "C5215", "C5216", "C5217", "C5218", "C5219", "C5220", "C5221", "C5222", "C5223", "C5224", "C5225", "C5226", "C5227", "C5228", "C5229", "C5230", "C5231", "C5232", "C5233", "C5234", "C5235", "C5236", "C5237", "C5238", "C5239", "C5240", "C5241", "C5242", "C5244", "C5245", "C5246", "C5249", "C5250"] -helpviewer_keywords: ["C4808", "C4809", "C4825", "C4827", "C4837", "C4842", "C4844", "C4845", "C4846", "C4847", "C4848", "C4854", "C4855", "C4856", "C4857", "C4872", "C4880", "C4881", "C4882", "C4916", "C4921", "C4934", "C4954", "C4955", "C4963", "C4966", "C4970", "C4971", "C4973", "C4974", "C4981", "C4987", "C4988", "C4989", "C4990", "C4991", "C4992", "C4998", "C5022", "C5023", "C5024", "C5025", "C5026", "C5027", "C5028", "C5029", "C5030", "C5031", "C5032", "C5033", "C5034", "C5035", "C5036", "C5039", "C5040", "C5041", "C5042", "C5043", "C5044", "C5047", "C5048", "C5049", "C5051", "C5052", "C5053", "C5054", "C5055", "C5056", "C5057", "C5058", "C5059", "C5060", "C5061", "C5062", "C5063", "C5100", "C5101", "C5102", "C5103", "C5104", "C5106", "C5107", "C5108", "C5200", "C5201", "C5202", "C5203", "C5204", "C5205", "C5206", "C5207", "C5209", "C5210", "C5211", "C5212", "C5213", "C5214", "C5215", "C5216", "C5217", "C5218", "C5219", "C5220", "C5221", "C5222", "C5223", "C5224", "C5225", "C5226", "C5227", "C5228", "C5229", "C5230", "C5231", "C5232", "C5233", "C5234", "C5235", "C5236", "C5237", "C5238", "C5239", "C5240", "C5241", "C5242", "C5244", "C5245", "C5246", "C5249", "C5250"] +ms.date: 10/19/2021 +f1_keywords: ["C4808", "C4809", "C4825", "C4827", "C4837", "C4842", "C4844", "C4845", "C4846", "C4847", "C4848", "C4854", "C4855", "C4856", "C4857", "C4872", "C4880", "C4881", "C4882", "C4916", "C4921", "C4934", "C4954", "C4955", "C4963", "C4966", "C4970", "C4971", "C4973", "C4974", "C4981", "C4987", "C4988", "C4989", "C4990", "C4991", "C4992", "C4998", "C5022", "C5023", "C5024", "C5025", "C5026", "C5027", "C5028", "C5029", "C5030", "C5031", "C5032", "C5034", "C5035", "C5036", "C5039", "C5040", "C5041", "C5042", "C5043", "C5044", "C5047", "C5048", "C5049", "C5051", "C5052", "C5053", "C5054", "C5055", "C5056", "C5057", "C5058", "C5059", "C5060", "C5061", "C5062", "C5063", "C5100", "C5101", "C5102", "C5103", "C5104", "C5106", "C5107", "C5108", "C5200", "C5201", "C5202", "C5203", "C5204", "C5205", "C5206", "C5207", "C5209", "C5210", "C5211", "C5212", "C5213", "C5214", "C5215", "C5216", "C5217", "C5218", "C5219", "C5220", "C5221", "C5222", "C5223", "C5224", "C5225", "C5226", "C5227", "C5228", "C5229", "C5230", "C5231", "C5232", "C5233", "C5234", "C5235", "C5236", "C5237", "C5238", "C5239", "C5240", "C5241", "C5242", "C5244", "C5245", "C5246", "C5249", "C5250"] +helpviewer_keywords: ["C4808", "C4809", "C4825", "C4827", "C4837", "C4842", "C4844", "C4845", "C4846", "C4847", "C4848", "C4854", "C4855", "C4856", "C4857", "C4872", "C4880", "C4881", "C4882", "C4916", "C4921", "C4934", "C4954", "C4955", "C4963", "C4966", "C4970", "C4971", "C4973", "C4974", "C4981", "C4987", "C4988", "C4989", "C4990", "C4991", "C4992", "C4998", "C5022", "C5023", "C5024", "C5025", "C5026", "C5027", "C5028", "C5029", "C5030", "C5031", "C5032", "C5034", "C5035", "C5036", "C5039", "C5040", "C5041", "C5042", "C5043", "C5044", "C5047", "C5048", "C5049", "C5051", "C5052", "C5053", "C5054", "C5055", "C5056", "C5057", "C5058", "C5059", "C5060", "C5061", "C5062", "C5063", "C5100", "C5101", "C5102", "C5103", "C5104", "C5106", "C5107", "C5108", "C5200", "C5201", "C5202", "C5203", "C5204", "C5205", "C5206", "C5207", "C5209", "C5210", "C5211", "C5212", "C5213", "C5214", "C5215", "C5216", "C5217", "C5218", "C5219", "C5220", "C5221", "C5222", "C5223", "C5224", "C5225", "C5226", "C5227", "C5228", "C5229", "C5230", "C5231", "C5232", "C5233", "C5234", "C5235", "C5236", "C5237", "C5238", "C5239", "C5240", "C5241", "C5242", "C5244", "C5245", "C5246", "C5249", "C5250"] --- # Compiler warnings C4800 through C5999 @@ -141,7 +141,7 @@ The articles in this section of the documentation explain a subset of the warnin | Compiler warning (level 3) C5030 | attribute '*attribute-name*' is not recognized | | Compiler warning (level 4) C5031 | `#pragma warning(pop)`: likely mismatch, popping warning state pushed in different file | | Compiler warning (level 4) C5032 | detected `#pragma warning(push)` with no corresponding `#pragma warning(pop)` | -| Compiler warning (level 1) C5033 | '*storage-class*' is no longer a supported storage class | +| [Compiler warning (level 1) C5033](c5033.md) | '*storage-class*' is no longer a supported storage class | | Compiler warning C5034 | use of intrinsic '*intrinsic*' causes function *function-name* to be compiled as guest code | | Compiler warning C5035 | use of feature '*feature*' causes function *function-name* to be compiled as guest code | | Compiler warning (level 1) C5036 | varargs function pointer conversion when compiling with `/hybrid:x86arm64` '*type1*' to '*type2*' | diff --git a/docs/error-messages/toc.yml b/docs/error-messages/toc.yml index 2bb7407359e..c125a6fdfdd 100644 --- a/docs/error-messages/toc.yml +++ b/docs/error-messages/toc.yml @@ -4283,6 +4283,8 @@ items: href: compiler-warnings/compiler-warning-level-1-c4997.md - name: Compiler warning (level 1) C4999 href: compiler-warnings/compiler-warning-level-1-c4999.md + - name: Compiler warning (level 1) C5033 + href: compiler-warnings/c5033.md - name: Compiler warning C5037 href: compiler-warnings/c5037.md - name: Compiler warning C5038