From 689c6c0bdaef4cfaa1c184150db98786bb758a28 Mon Sep 17 00:00:00 2001 From: guwirth Date: Mon, 12 Aug 2024 17:12:55 +0200 Subject: [PATCH] add new VS 2022 rules (v17.9): - C5262 - C5266 - C5267 - C5301 - C5302 - C6030 - C6065 - C6392 - C6393 - C6394 - C6395 - C6396 - C6397 - C6398 - C26459 - C26479 - C26831 - C26832 - C26833 - C26835 - C26837 - C26861 - C26862 - C26863 - C26864 --- .../src/main/resources/compiler-vc.xml | 1574 ++++++++++------- .../vc/CxxCompilerVcRuleRepositoryTest.java | 2 +- cxx-sensors/src/tools/vc_createrules.py | 11 + 3 files changed, 943 insertions(+), 644 deletions(-) diff --git a/cxx-sensors/src/main/resources/compiler-vc.xml b/cxx-sensors/src/main/resources/compiler-vc.xml index 413f6915df..cef4686b73 100644 --- a/cxx-sensors/src/main/resources/compiler-vc.xml +++ b/cxx-sensors/src/main/resources/compiler-vc.xml @@ -1,4 +1,8 @@ + CustomRuleTemplate @@ -94,15 +98,15 @@ C1257 - C1257: 'Plugin-name': Initialization Failure + C1257: 'plugin-name': Initialization Failure The Code Analysis tool reports this error when there's an internal error in the plugin, not in the code being analyzed.

Microsoft Documentation

C1257

]]> -
+ CRITICAL -
+ C1258 C1258: Failed to save XML Log file 'filename' @@ -111,9 +115,9 @@

The Code Analysis tool reports this error when there's an internal error in the plugin, not in the code being analyzed.

Microsoft Documentation

C1258

]]> - + CRITICAL -
+ C1259 C1259: A fatal error was issued by a plugin @@ -122,9 +126,9 @@

The Code Analysis tool reports this error when there's an internal error in the plugin, not in the code being analyzed.

Microsoft Documentation

C1259

]]> - + CRITICAL -
+ C1260 C1260: The plugins 'plugin-1' and 'plugin-2' share the same id @@ -139,7 +143,7 @@ C4001 - C4001: nonstandard extension 'single line comment' was used + C4001: Nonstandard extension 'single line comment' was used Single-line comments are standard in C++ and standard in C starting with C99. @@ -151,7 +155,7 @@ Under strict ANSI compatibility (C4007

]]>
@@ -206,7 +210,7 @@ Under strict ANSI compatibility (C4019

]]> @@ -272,7 +276,7 @@ Under strict ANSI compatibility (/Zg to generate function prototypes, the compiler issues this warning and comments out the formal parameter in the generated prototype.

@@ -437,7 +441,7 @@ Under strict ANSI compatibility (dllexport attributes.

@@ -448,7 +452,7 @@ Under strict ANSI compatibility (C4052

]]> @@ -536,7 +540,7 @@ Under strict ANSI compatibility (C4062.

+

The specified enumerator identifier has no associated handler in a switch statement that has a default case. The missing case might be an oversight, or it may not be an issue. Whether the missing case is an issue in practice depends on if the default case handles the enumerator. For a related warning on unused enumerators in switch statements that have no default case, see C4062.

Microsoft Documentation

C4061

]]> @@ -591,10 +595,10 @@ Under strict ANSI compatibility (C4061.

+

The enumerator identifier doesn't have a case handler associated with it in a switch statement, and there's no default label that can catch it. The missing case may be an oversight, and is a potential error in your code. For a related warning on unused enumerators in switch statements that have a default case, see C4061.

Microsoft Documentation

C4062

]]> @@ -602,7 +606,7 @@ Under strict ANSI compatibility (pragma. Be sure the pragma is allowed by the compiler you are using.

@@ -635,7 +639,7 @@ Under strict ANSI compatibility (#pragma init_seg.

@@ -646,7 +650,7 @@ Under strict ANSI compatibility (#pragma init_seg, is reserved by Microsoft. Code in this area may be executed before initialization of the C run-time library.

@@ -657,7 +661,7 @@ Under strict ANSI compatibility (#pragma init_seg uses an unrecognized section name. The compiler ignores the pragma command.

@@ -668,7 +672,7 @@ Under strict ANSI compatibility (#pragma alloc_text must be a string or an identifier. The compiler ignores the pragma if a valid identifier is not found.

@@ -712,7 +716,7 @@ Under strict ANSI compatibility (C4091

]]> @@ -822,7 +826,7 @@ Under strict ANSI compatibility (void has a return statement that returns a value. The compiler assumes the function returns a value of type int.

@@ -866,7 +870,7 @@ Under strict ANSI compatibility (#line directive specifies an integer parameter that is outside the allowable range.

@@ -954,7 +958,7 @@ Under strict ANSI compatibility (C4133

]]> @@ -1141,10 +1145,10 @@ Under strict ANSI compatibility (C4141

]]> @@ -1152,7 +1156,7 @@ Under strict ANSI compatibility (__based keyword instead.

@@ -1174,7 +1178,7 @@ Under strict ANSI compatibility (switch statement. The associated case statements will be offered Boolean values.

@@ -1185,7 +1189,7 @@ Under strict ANSI compatibility (C4150

]]> @@ -1218,7 +1222,7 @@ Under strict ANSI compatibility (intrinsic function. The compiler ignores the invalid function name.

@@ -1350,7 +1354,7 @@ Under strict ANSI compatibility (if statement, the HRESULT will be converted to a bool unless you explicitly test for the variable as an HRESULT. This warning is off by default.

+

When an HRESULT is used in an if statement, the HRESULT is converted to a bool unless you explicitly test for the variable as an HRESULT.

Microsoft Documentation

C4165

]]> @@ -1372,7 +1376,7 @@ Under strict ANSI compatibility (C4174

]]> @@ -1427,7 +1431,7 @@ Under strict ANSI compatibility (component pragma, you must generate browse information during compilation (/FR).

@@ -1438,7 +1442,7 @@ Under strict ANSI compatibility (volatile, or a cast of an r-value type to some type that is qualified with volatile. According to the C standard (6.5.3), properties associated with qualified types are meaningful only for l-value expressions.

@@ -1603,7 +1607,7 @@ Under strict ANSI compatibility (/Za).

@@ -1625,7 +1629,7 @@ Under strict ANSI compatibility (/Za).

@@ -1636,7 +1640,7 @@ Under strict ANSI compatibility (delete operator. The value is ignored.

@@ -1691,7 +1695,7 @@ Under strict ANSI compatibility (/Ze), function declarations have file scope.

@@ -1702,7 +1706,7 @@ Under strict ANSI compatibility (/Za) does not. Use double to maintain compatibility.

@@ -1757,7 +1761,7 @@ Under strict ANSI compatibility (/Za) does not. Use double to maintain compatibility.

@@ -1768,10 +1772,10 @@ Under strict ANSI compatibility (C4218

]]> @@ -1790,7 +1794,7 @@ Under strict ANSI compatibility (/Ze), you can.

+

In standard C, you can't convert a nonlvalue array to a pointer. With the default Microsoft extensions (/Ze), you can.

Microsoft Documentation

C4223

]]> @@ -1812,7 +1816,7 @@ Under strict ANSI compatibility (/Za).

@@ -1823,7 +1827,7 @@ Under strict ANSI compatibility (/Ze).

@@ -1856,7 +1860,7 @@ Under strict ANSI compatibility (/Za), this causes an error.

@@ -1889,7 +1893,7 @@ Under strict ANSI compatibility (/Tc.

@@ -1900,7 +1904,7 @@ Under strict ANSI compatibility (C4235

]]> @@ -1933,7 +1937,7 @@ Under strict ANSI compatibility (/Za), you cannot change the access to a nested class. Under the default Microsoft extensions (/Ze), you can, with this warning.

@@ -1966,7 +1970,7 @@ Under strict ANSI compatibility (__int64 to a variable of type unsigned int). A possible loss of data may have occurred.

+

An integer type is converted to a smaller integer type.

Microsoft Documentation

C4244

]]> @@ -1999,7 +2003,7 @@ Under strict ANSI compatibility (__declspec(dllexport).

+

This warning happens if a class is marked with __declspec(dllexport) or __declspec(dllimport) and a nonstatic data member that is a member of the class or a member of one of its base classes, has a type that is a class type that isn't marked with __declspec(dllexport) or __declspec(dllimport). See Example.

Microsoft Documentation

C4251

]]> @@ -2032,7 +2036,7 @@ Under strict ANSI compatibility (C4255

]]> @@ -2065,7 +2069,7 @@ Under strict ANSI compatibility ( + C4258: 'variable': definition from the for loop is ignored; the definition from the enclosing scope is used" Under /Ze and /Zc:forScope, variables defined in a for loop go out of scope after the for loop ends. This warning occurs if a variable with the same name as the loop variable, but defined in the enclosing loop, is used again in the scope containing the for loop.

@@ -2076,10 +2080,10 @@ Under strict ANSI compatibility (C4263

]]> @@ -2087,7 +2091,7 @@ Under strict ANSI compatibility (C4263.

@@ -2098,7 +2102,7 @@ Under strict ANSI compatibility (C4266

]]> @@ -2120,7 +2124,7 @@ Under strict ANSI compatibility (__clrcall calling convention, and the compiler issues this warning if you attempt to import a function marked __clrcall.

@@ -2164,7 +2168,7 @@ Under strict ANSI compatibility (dllimport.

@@ -2186,7 +2190,7 @@ Under strict ANSI compatibility (__stdcall calling convention, you must give a prototype so the compiler can create the function's decorated name. Since function has no prototype, the compiler, when creating the decorated name, assumes the function has no parameters.

@@ -2211,8 +2215,7 @@ Under strict ANSI compatibility (#import, an identifier in the typelib you are importing is attempting to declare an identifier identifier. However, this is already a valid symbol.

+

The #import is attempting to import an identifier into the translation unit. However, there's already a symbol with that name. Use the #import rename attribute to assign an alias to the symbol in the type library.

Microsoft Documentation

C4278

]]> @@ -2242,10 +2245,10 @@ Under strict ANSI compatibility (C4282

]]> @@ -2253,7 +2256,7 @@ Under strict ANSI compatibility (C4281 shows that operator-> calls itself through type.

@@ -2264,7 +2267,7 @@ Under strict ANSI compatibility (/Ze and /Zc:forscope-, a variable declared in a for loop was used after the for-loop scope. A Microsoft extension to the C++ language allows this variable to remain in scope, and C4288 reminds you that the first declaration of the variable is not used.

@@ -2308,10 +2311,10 @@ Under strict ANSI compatibility (/Ze and /Zc:forScope-, a variable declared in a for loop was used after the for-loop scope.

+

When /Ze and /Zc:forScope- are used in a build, a variable declared in a for loop was used after the for-loop scope.

Microsoft Documentation

C4289

]]> @@ -2330,7 +2333,7 @@ Under strict ANSI compatibility (new is used for which there is no placement delete.

@@ -2341,7 +2344,7 @@ Under strict ANSI compatibility (__declspec(nothrow) attribute, and the definition contains one or more throw statements. To resolve C4297, do not attempt to throw exceptions in functions that are declared __declspec(nothrow), noexcept(true) or throw(). Alternatively, remove the noexcept, throw(), or __declspec(nothrow) specification.

@@ -2385,7 +2388,7 @@ Under strict ANSI compatibility (C4306

]]> @@ -2418,7 +2421,7 @@ Under strict ANSI compatibility (Rules for Using Pointers.

@@ -2473,7 +2476,7 @@ Under strict ANSI compatibility (__declspec(align) value.

+

Padding was added at the end of a structure because you specified an alignment specifier, such as __declspec(align).

Microsoft Documentation

C4324

]]> @@ -2528,7 +2531,7 @@ Under strict ANSI compatibility (/Za, main did not return an int.

@@ -2550,10 +2553,10 @@ Under strict ANSI compatibility (align keyword of the __declspec modifier is not allowed on an enum.

+

Use of the alignment specifiers on enum isn't allowed. This pattern includes the use of the align __declspec modifier.

Microsoft Documentation

C4329

]]> @@ -2561,7 +2564,7 @@ Under strict ANSI compatibility (C4334

]]> @@ -2586,7 +2589,7 @@ Under strict ANSI compatibility (C4335

]]> @@ -2594,7 +2597,7 @@ Under strict ANSI compatibility (#import directive. However, the type library contained a reference to another type library that was not referenced with #import. This other .tlb file was found by the compiler.

@@ -2605,7 +2608,7 @@ Under strict ANSI compatibility (the #import directive caused a type library to be implicitly imported.

@@ -2616,10 +2619,10 @@ Under strict ANSI compatibility (C4339

]]> @@ -2627,7 +2630,7 @@ Under strict ANSI compatibility (typename keyword is required if a dependent name is to be treated as a type. For code that works the same in all versions of Visual C++, add typename to the declaration.

@@ -2682,7 +2685,7 @@ Under strict ANSI compatibility (__noop.

@@ -2715,10 +2718,10 @@ Under strict ANSI compatibility (C4355

]]> @@ -2726,7 +2729,7 @@ Under strict ANSI compatibility (align.

+

The alignment specified for a type is less than the alignment of the type of one of its data members. For more information, see align.

Microsoft Documentation

C4359

]]> @@ -2781,10 +2784,10 @@ Under strict ANSI compatibility (C4365

]]> @@ -2803,10 +2806,10 @@ Under strict ANSI compatibility (C4368

]]> @@ -2814,7 +2817,7 @@ Under strict ANSI compatibility (C4371

]]> @@ -2839,7 +2842,7 @@ Under strict ANSI compatibility (const or volatile qualifier from the parameters of the virtual method. This means the compiler must bind a function reference to the method in either the base or derived class.

+

Your application contains a method in a derived class that overrides a virtual method in a base class. The parameters in the overriding method differ by a const or volatile qualifier from the parameters of the virtual method.

Microsoft Documentation

C4373

]]> @@ -2858,7 +2861,7 @@ Under strict ANSI compatibility (C4383

]]> @@ -2947,10 +2950,10 @@ Under strict ANSI compatibility (make_public pragma was applied incorrectly.

+

A pragma directive that must be applied at a global scope, was found in a different scope.

Microsoft Documentation

C4384

]]> @@ -2958,7 +2961,7 @@ Under strict ANSI compatibility (C4392

]]> @@ -3013,7 +3016,7 @@ Under strict ANSI compatibility (literal data member was also specified as const. Since a literal data member implies const, you do not need to add const to the declaration.

@@ -3024,10 +3027,10 @@ Under strict ANSI compatibility (appdomain __declspec modifier is compiled to MSIL (not to native), and export tables (export __declspec modifier) are not supported for managed functions.

+

A function marked with the appdomain __declspec modifier is compiled to MSIL (not native), and export tables (export __declspec modifier) aren't supported for managed functions.

Microsoft Documentation

C4394

]]> @@ -3035,7 +3038,7 @@ Under strict ANSI compatibility (initonly (C++/CLI) data member. C4395 warns that the initonly data member cannot be modified by the function.

@@ -3046,7 +3049,7 @@ Under strict ANSI compatibility ( + C4396: "name": the inline specifier cannot be used when a friend declaration refers to a specialization of a function template A specialization of a function template cannot specify any of the inline specifiers. The compiler issues warning C4396 and ignores the inline specifier.

@@ -3068,7 +3071,7 @@ Under strict ANSI compatibility (constand volatilequalifiers will not work with variables of common language runtime types.

@@ -3102,7 +3105,7 @@ Under strict ANSI compatibility (/RTCv (vector new/delete checking) and when no vector form is found. In this case, the non-vector form is used.

@@ -3256,7 +3259,7 @@ Under strict ANSI compatibility (Static constructors.

@@ -3300,7 +3303,7 @@ Under strict ANSI compatibility (Compiler Warnings That Are Off by Default for more information.

@@ -3333,7 +3336,7 @@ Under strict ANSI compatibility (__clrcall. To resolve this warning, remove the __cdecl or __stdcall calling convention.

@@ -3344,7 +3347,7 @@ Under strict ANSI compatibility (__clrcall calling convention. The compiler used __clrcall.

@@ -3366,7 +3369,7 @@ Under strict ANSI compatibility (sealed.

@@ -3564,7 +3567,7 @@ Under strict ANSI compatibility (using keyword) to be outdated. Access declarations may not be supported by future versions of C++.

@@ -3740,7 +3743,7 @@ Under strict ANSI compatibility (using keyword) to be outdated. Access declarations may not be supported by future versions of C++.

@@ -3751,7 +3754,7 @@ Under strict ANSI compatibility (C4532

]]> @@ -3828,7 +3831,7 @@ Under strict ANSI compatibility (C3180 for more information.

@@ -3872,7 +3875,7 @@ Under strict ANSI compatibility (array.

@@ -3938,7 +3941,7 @@ Under strict ANSI compatibility (abstract functions should itself be marked as abstract.

@@ -4205,7 +4208,7 @@ Under strict ANSI compatibility ( + C4581: Deprecated behavior: '"string1"' replaced with 'string2' to process attribute This error can be generated as a result of compiler conformance work that was done for Visual Studio 2005: parameter checking for Visual C++ attributes.

@@ -4216,7 +4219,7 @@ Under strict ANSI compatibility (
C4596

]]> INFO -
+ C4597 - C4597: undefined behavior: offsetof applied to a member of a virtual base + C4597: Undefined behavior: offsetof applied to a member of a virtual base Using offsetof(T, m) where m refers to a static data member or a member function results in C4597.

Microsoft Documentation

C4597

]]> -
+ INFO
C4600 - C4600: #pragma 'macro name' : expected a valid non-empty string + C4600: #pragma 'macro name': expected a valid non-empty string You cannot specify an empty string when you push or pop a macro name with either the pop_macro or push_macro.

@@ -4260,7 +4263,7 @@ Under strict ANSI compatibility (pop_macro for a particular macro, you must first have passed that macro name to push_macro.

@@ -4271,7 +4274,7 @@ Under strict ANSI compatibility (warning pragma.

@@ -4315,7 +4318,7 @@ Under strict ANSI compatibility (warning. To resolve the error, use a valid warning specifier.

@@ -4359,7 +4362,7 @@ Under strict ANSI compatibility (warning pragma cannot be reassigned. The pragma was ignored.

@@ -4370,7 +4373,7 @@ Under strict ANSI compatibility (/Ze. This warning will be followed by an error.

@@ -4491,7 +4494,7 @@ Under strict ANSI compatibility (/Za, the compiler warns when it detects a digraph.

@@ -4502,7 +4505,7 @@ Under strict ANSI compatibility (return statement was found in a function that is marked with the noreturn __declspec modifier. The return statement was ignored.

@@ -4645,7 +4648,7 @@ Under strict ANSI compatibility (noreturn __declspec modifier should have a void return type.

@@ -4656,7 +4659,7 @@ Under strict ANSI compatibility (/Yu) option was inconsistent with the options specified when the precompiled header was created. This compilation used the option specified when the precompiled header was created.

@@ -4700,7 +4703,7 @@ Under strict ANSI compatibility (comment for passing a linker option.

@@ -4744,7 +4747,7 @@ Under strict ANSI compatibility (C4672

]]> @@ -4822,7 +4825,7 @@ Under strict ANSI compatibility (default interface was not specified for a class that was marked with the coclass attribute. In order for an object to be useful, it must implement an interface.

@@ -4888,7 +4891,7 @@ Under strict ANSI compatibility (source interface was not specified for a class.

@@ -4899,7 +4902,7 @@ Under strict ANSI compatibility (in or out. The parameter defaults to in.

@@ -4921,7 +4924,7 @@ Under strict ANSI compatibility (emitidl attribute was popped one more time that it was pushed.

@@ -4987,7 +4990,7 @@ Under strict ANSI compatibility (C4694

]]>
INFO -
+ C4698 C4698: 'feature' is for evaluation purposes only and is subject to change or removal in future updates @@ -5037,12 +5040,12 @@ Under strict ANSI compatibility (C4698

]]> - + INFO
C4700 - C4700: uninitialized local variable 'name' used + C4700: Uninitialized local variable 'name' used The local variable name has been used, that is, read from, before it has been assigned a value. In C and C++, local variables aren't initialized by default. Uninitialized variables can contain any value, and their use leads to undefined behavior. Warning C4700 almost always indicates a bug that can cause unpredictable results or crashes in your program.

@@ -5064,7 +5067,7 @@ Under strict ANSI compatibility ( + C4727: PCH named pch_file with same timestamp found in obj_file_1 and obj_file_2 C4727 occurs when compiling multiple compilands with /Yc, and where the compiler was able to mark all .obj files with the same .pch timestamp.

@@ -5240,7 +5243,7 @@ Under strict ANSI compatibility (
/Od compiler option used.

@@ -5251,7 +5254,7 @@ Under strict ANSI compatibility (__m64 and float/double types. Because the MMX and floating-point registers share the same physical register space (cannot be used simultaneously), using __m64 and float/double types in the same function can result in data corruption, possibly causing an exception.

@@ -5262,7 +5265,7 @@ Under strict ANSI compatibility (/SAFESEH).

@@ -5284,7 +5287,7 @@ Under strict ANSI compatibility (/volatile compiler option). In particular, it can be useful in locating compiler-generated hardware memory barriers when /volatile:ms is used.

@@ -5394,7 +5397,7 @@ Under strict ANSI compatibility (C4764

]]>
INFO -
+ C4768 C4768: __declspec attributes before linkage specification are ignored @@ -5422,20 +5425,20 @@ Under strict ANSI compatibility ( linkage specification. Previously, the compiler would ignore the attribute, which could have runtime implications.

Microsoft Documentation

C4768

]]> - + INFO
C4770 - C4770: partially validated enum 'symbol' used as index + C4770: Partially validated enum 'symbol' used as index The compiler warns if an enum value is cast or aliased to an integer type, but the result isn't checked for non-negative or excessive values.

Microsoft Documentation

C4770

]]> -
+ INFO -
+ C4772 C4772: #import referenced a type from a missing type library; 'missing-type' used as a placeholder @@ -5449,7 +5452,7 @@ Under strict ANSI compatibility ( @@ -5460,7 +5463,7 @@ Under strict ANSI compatibility (/clr compiler option is specified. Instead, the compiler emits warning C4793 and an explanatory continuation message, and then compiles function into native code. The continuation message contains the reason text that explains why function cannot be compiled to MSIL.

@@ -5493,7 +5496,7 @@ Under strict ANSI compatibility (#pragma data_seg to put a tls variable in a section not starting with .tls$.

@@ -5526,7 +5529,7 @@ Under strict ANSI compatibility (bool and int.

@@ -5559,7 +5562,7 @@ Under strict ANSI compatibility (pack pragma. n is the current pack value.

@@ -5592,7 +5595,7 @@ Under strict ANSI compatibility (conform pragma. value is the current conform value.

@@ -5603,7 +5606,7 @@ Under strict ANSI compatibility (/EHsc.

@@ -5710,21 +5713,21 @@ Under strict ANSI compatibility (C4829

]]> INFO -
+ C4834 - C4834: discarding return value of function with 'nodiscard' attribute + C4834: Discarding return value of function with 'nodiscard' attribute Starting in the C++17 Standard, the [[nodiscard]] attribute specifies that a function's return value isn't intended to be discarded. If a caller discards the return value, the compiler generates warning C4834.

+

Starting in the C++17 Standard, the [[nodiscard]] attribute specifies that a function's return value isn't intended to be discarded. If a caller discards the return value, the compiler generates warning C4834. Although this attribute was introduced in C++17, the compiler respects this attribute and generates warnings related to it when using /std:c++14 and later.

Microsoft Documentation

C4834

]]> -
+ INFO
C4835 - C4835: 'variable' : the initializer for exported data will not be run until managed code is first executed in the host assembly + C4835: 'variable': the initializer for exported data will not be run until managed code is first executed in the host assembly When accessing data between managed components, it is recommended that you not use native C++ import and export mechanisms. Instead, declare your data members inside a managed type and reference the metadata with #using in the client. For more information, see #using Directive.

@@ -5735,7 +5738,7 @@ Under strict ANSI compatibility (C4840

]]>
INFO -
+ C4841 - C4841: non-standard extension used: compound member designator used in offsetof + C4841: Non-standard extension used: compound member designator used in offsetof If you use offsetof(T, m), where m is a compound member designator, the compiler generates a warning when you compile with the /Wall option.

Microsoft Documentation

C4841

]]> -
+ INFO -
+ C4843 C4843: 'type1': An exception handler of reference to array or function type is unreachable @@ -5785,7 +5788,7 @@ Under strict ANSI compatibility (C4843

]]> - + INFO
@@ -5804,7 +5807,7 @@ Under strict ANSI compatibility (C4867

]]> @@ -5823,7 +5826,7 @@ Under strict ANSI compatibility (class, interface, or namespace cannot have a GUID.

@@ -5900,7 +5903,7 @@ Under strict ANSI compatibility (optimize pragma statement.

@@ -5911,7 +5914,7 @@ Under strict ANSI compatibility (#import directive; the compiler concluded that pointer size of the type library is number.

@@ -6010,7 +6013,7 @@ Under strict ANSI compatibility (/fp:strict or fenv_access with OpenMP floating-point reductions, because the sum is computed in a different order. Thus, results can differ from the results without /openmp.

@@ -6065,7 +6068,7 @@ Under strict ANSI compatibility (ObsoleteAttribute class.

@@ -6109,7 +6112,7 @@ Under strict ANSI compatibility (managed and unmanaged pragmas if the source code is not compiled with /clr. This warning is informational.

@@ -6131,7 +6134,7 @@ Under strict ANSI compatibility (ObsoleteAttribute attribute.

@@ -6153,7 +6156,7 @@ Under strict ANSI compatibility (/LTCG:PGUPDATE, the compiler detected an input module that was recompiled after /LTCG:PGINSTRUMENT and has a new function (function) present.

@@ -6175,7 +6178,7 @@ Under strict ANSI compatibility (/clr:safe is specified and your code contains a type that is not verifiable. The /clr:safe compiler option is deprecated in Visual Studio 2015 and unsupported in Visual Studio 2017.

@@ -6186,7 +6189,7 @@ Under strict ANSI compatibility ( + C4962: 'function': Profile-guided optimizations disabled because optimizations caused profile data to become inconsistent" A function was not compiled with /LTCG:PGO, because count (profile) data for the function was unreliable. Redo profiling to regenerate the .pgc file that contains the unreliable profile data for that function.

@@ -6263,7 +6266,7 @@ Under strict ANSI compatibility (
C5208

]]> INFO -
+ C5240 C5240: 'attribute-string': attribute is ignored in this syntactic position @@ -6490,40 +6493,97 @@ Under strict ANSI compatibility (C5240

]]> - + INFO -
+ C5243 C5243: 'type': using incomplete class 'class-name' can cause ODR violation due to ABI limitation The Microsoft C++ ABI in Visual Studio 2019 and earlier versions uses more than one kind of pointer-to-member type. These types have different sizes that depend on the inheritance model used by the class. The C++ standard allows you to declare a pointer-to-member of an incomplete class type. If you declare a variable of pointer-to-member type for an incomplete class, the compiler must use the most general representation. It can lead to a one definition rule, or ODR violation, since the compiler may use a smaller, more specific representation for this pointer-to-member type in other translation units where the complete class type is available.

+

The Microsoft C++ ABI uses more than one kind of pointer-to-member type. These types have different sizes that depend on the inheritance model used by the class. The C++ standard allows you to declare a pointer-to-member of an incomplete class type. If you declare a variable of pointer-to-member type for an incomplete class, the compiler must use the most general representation. It can lead to a one definition rule, or ODR violation, since the compiler may use a smaller, more specific representation for this pointer-to-member type in other translation units where the complete class type is available.

Microsoft Documentation

C5243

]]> -
+ INFO -
+ C5247 - C5247: section 'section-name' is reserved for C++ dynamic initialization + C5247: Section 'section-name' is reserved for C++ dynamic initialization The Microsoft C++ compiler uses reserved section names for internal implementation of features such as C++ dynamic initialization. If your code creates a section with the same name as a reserved section, such as .CRT$XCU, it interferes with the compiler. It may prevent other dynamic initialization and cause undefined behavior.

Microsoft Documentation

C5247

]]> -
+ INFO -
+ C5248 - C5248: section 'section-name' is reserved for C++ dynamic initialization + C5248: Section 'section-name' is reserved for C++ dynamic initialization The Microsoft C++ compiler uses reserved section names for internal implementation of features such as C++ dynamic initialization. If your code inserts a variable in a reserved section, such as .CRT$XCU, it interferes with the compiler. Your variable isn't considered a C++ dynamic initializer. Also, its relative initialization order compared to compiler generated dynamic initializers isn't specified.

Microsoft Documentation

C5248

]]> -
+ + INFO +
+ + C5262 + C5262: Implicit fall-through occurs here + + Implicit fall-through occurs here; are you missing a break statement? Use [[fallthrough]] when a break statement is intentionally omitted between cases.

+

Control flow that implicitly falls between cases of switch statements is a historical source of bugs for both C and C++. While we had the __fallthrough SAL macro, it wasn't useful for the build-compiler diagnostics. Since customers have legacy code that "falls through" on purpose, it isn't viable to give an actionable warning without some way of indicating an intentional fall through. In C++17, the [[fallthrough]] attribute was added to indicate such an instance. The compiler can take this attribute into account and suppress the new warning.

+

Microsoft Documentation

+

C5262

]]> +
+ INFO +
+ + C5266 + C5266: 'const' qualifier on return type has no effect + + The C++ Standard specifies that a top-level const (or volatile) qualification on a function return type is ignored.

+

Microsoft Documentation

+

C5266

]]> +
+ INFO +
+ + C5267 + C5267: Definition of implicit copy constructor/assignment operator for 'type' is deprecated + + Definition of implicit copy constructor/assignment operator for 'type' is deprecated because it has a user-provided assignment operator/copy constructor.

+

The C++ Standard deprecated (but didn't remove) the implicit generation of copy and assignment operators under some conditions. The MSVC compiler still generates the copy and assignment operators under those conditions, but may change its behavior in the future if the standard removes the deprecated behavior. The purpose of this warning is to help future proof your code if the committee decides to remove this functionality.

+

Microsoft Documentation

+

C5267

]]> +
+ INFO +
+ + C5301 + C5301: '#pragma omp for': 'loop-index' increases while loop condition uses 'comparison' + + Along with improved support for OpenMP 3.1, we've added two diagnostics, C5301 and C5302, to improve the developer experience. These diagnostics check that the loop conditions for omp parallel for are correct, based on whether the loop index variable is increasing or decreasing. These checks work for both integral and pointer indices.

+

Microsoft Documentation

+

C5301

]]> +
+ INFO +
+ + C5302 + C5302: '#pragma omp for': 'loop-index' increases while loop condition uses 'comparison' + + Along with improved support for OpenMP 3.1, we've added two diagnostics, C5301 and C5302, to improve the developer experience. These diagnostics check that the loop conditions for omp parallel for are correct, based on whether the loop index variable is increasing or decreasing. These checks work for both integral and pointer indices.

+

Microsoft Documentation

+

C5302

]]> +
INFO
@@ -6564,15 +6624,26 @@ Under strict ANSI compatibility (C6029

]]> CRITICAL
+ + C6030 + C6030: Use attribute [[noreturn]] over __declspec(noreturn) in function 'function-name' + + This warning suggests using the C++11 standard attribute [[noreturn]] in place of the declspec variant __declspec(noreturn). The standard attribute provides better cross-platform support because it doesn't rely on language extensions.

+

Microsoft Documentation

+

C6030

]]> +
+ CRITICAL +
C6031 C6031: Return value ignored: 'called-function' could return unexpected value @@ -6634,13 +6705,24 @@ Under strict ANSI compatibility (C6064

]]> CRITICAL BUG
+ + C6065 + C6065: Missing pointer to 'string type' argument to 'function' that corresponds to argument 'number' + + This warning indicates that there's a mismatch between the format specifiers in a string and the types of the associated parameters. The format specifier indicates that at least one of the mismatched arguments should be a pointer to a counted string such as UNICODE_STRING or ANSI_STRING but it not. This defect can cause crashes, buffer overflows, and potentially incorrect output.

+

Microsoft Documentation

+

C6065

]]> +
+ CRITICAL +
C6066 C6066: Non-pointer passed as parameter(number) when pointer is required in call to 'function' @@ -6669,7 +6751,7 @@ Under strict ANSI compatibility (_When_ annotation. For more information, see Using SAL Annotations to Reduce C/C++ Code Defects.

+

A successful path through the function doesn't set the _Out_ annotated parameter.

Microsoft Documentation

C6101

]]> @@ -6702,10 +6784,10 @@ Under strict ANSI compatibility (C6200

]]> @@ -6717,7 +6799,7 @@ Under strict ANSI compatibility (C6201

]]> @@ -6729,7 +6811,7 @@ Under strict ANSI compatibility (Using SAL Annotations to Reduce C/C++ Code Defects.

+

This warning indicates that allocated memory isn't freed when an exception is thrown. The statement at the end of the path could throw an exception.

Microsoft Documentation

C6211

]]> @@ -6737,10 +6819,10 @@ Under strict ANSI compatibility (C6214

]]> @@ -6748,7 +6830,7 @@ Under strict ANSI compatibility (C6216

]]> @@ -6773,7 +6855,7 @@ Under strict ANSI compatibility (C6217

]]> @@ -6795,7 +6877,7 @@ Under strict ANSI compatibility (C6220

]]> @@ -6806,7 +6888,7 @@ Under strict ANSI compatibility (C6221

]]> @@ -6817,7 +6899,7 @@ Under strict ANSI compatibility (C6225

]]> @@ -6828,7 +6910,7 @@ Under strict ANSI compatibility (C6226

]]> @@ -6836,7 +6918,7 @@ Under strict ANSI compatibility ( +

This warning indicates that a non-zero constant value, other than one, was detected on the left side of a logical-or operation that occurs in a test context. The right side of the logical-or operation isn't evaluated because the resulting expression always evaluates to true. This language feature is referred to as "short-circuit evaluation".

Microsoft Documentation

C6235

]]> @@ -6875,7 +6957,7 @@ Under strict ANSI compatibility ( +

This warning indicates that a constant value of zero was detected on the left side of a logical-and operation that occurs in a test context. The resulting expression always evaluates to false. Therefore, the right side of the logical-AND operation isn't evaluated. This language feature is referred to as "short-circuit evaluation".

Microsoft Documentation

C6237

]]> @@ -6941,7 +7023,7 @@ Under strict ANSI compatibility (C6255

]]> @@ -6974,7 +7056,7 @@ Under strict ANSI compatibility (C6260

]]> @@ -7019,7 +7101,7 @@ Under strict ANSI compatibility (C6270

]]> @@ -7064,10 +7146,10 @@ Under strict ANSI compatibility (C6271

]]> @@ -7078,7 +7160,7 @@ Under strict ANSI compatibility (C6272

]]> @@ -7087,7 +7169,7 @@ Under strict ANSI compatibility (Using SAL Annotations to Reduce C/C++ Code Defects.

+

This warning indicates that the calling function has inconsistently allocated memory by using a function from one family and freed it by using a function from another.

Microsoft Documentation

C6280

]]> @@ -7168,7 +7250,7 @@ Under strict ANSI compatibility (C6283

]]> @@ -7205,7 +7287,7 @@ Under strict ANSI compatibility (C6284

]]> @@ -7235,7 +7317,7 @@ Under strict ANSI compatibility (C6302

]]> @@ -7394,10 +7476,10 @@ Under strict ANSI compatibility (C6303

]]> @@ -7405,7 +7487,7 @@ Under strict ANSI compatibility (C6328

]]> @@ -7646,7 +7729,7 @@ Under strict ANSI compatibility (C6332

]]> @@ -7689,7 +7772,7 @@ Under strict ANSI compatibility (C6340

]]> @@ -7725,7 +7809,7 @@ Under strict ANSI compatibility (C6383

]]> @@ -7734,7 +7818,7 @@ Under strict ANSI compatibility (C6389

]]> - + CRITICAL -
+ C6390 C6390: According to the C++ standard, the value of 'this' is never null @@ -7806,9 +7890,87 @@ Under strict ANSI compatibility (C6390

]]> - + CRITICAL -
+ + + C6392 + C6392: This expression writes the value of the pointer to the stream + + This expression writes the value of the pointer to the stream. If this is intentional, add an explicit cast to 'void *'.

+

Microsoft Documentation

+

C6392

]]> +
+ CRITICAL +
+ + C6393 + C6393: A lookup table of size 365 isn't sufficient to handle leap years + + A leap year bug occurs when software doesn't account for leap year logic, or uses flawed logic. This can affect reliability, availability, or even the security of the affected system.

+

Microsoft Documentation

+

C6393

]]> +
+ CRITICAL +
+ + C6394 + C6394: A lookup table of size 365 isn't sufficient to handle leap years + + A leap year bug occurs when software doesn't account for leap year logic, or uses flawed logic. This can affect reliability, availability, or even the security of the affected system.

+

Microsoft Documentation

+

C6394

]]> +
+ CRITICAL +
+ + C6395 + C6395: %variable% has unsequenced reads and/or writes before C++17 + + %variable% has unsequenced reads and/or writes before C++17; changing the language standard might change the behavior of the code.

+

C++17 made the evaluation order of certain expressions stricter. MSVC complied, which changed the evaluation order for some expressions. Thus, changing the language version might change the observable behavior of the program. This check diagnoses some of the cases where the meaning of the code changes due to switching language versions.

+

Microsoft Documentation

+

C6395

]]> +
+ CRITICAL +
+ + C6396 + C6396: sizeof('integerConstant') always returns the size of the underlying integer type + + This warning indicates where an integral constant is used as a sizeof argument. Such expression always returns the size of the type of the constant. It's better to write sizeof(type) instead. This warning catches common typos in buffer offset calculations.

+

Microsoft Documentation

+

C6396

]]> +
+ CRITICAL +
+ + C6397 + C6397: The address-of operator cannot return null pointer in well-defined code + + The address-of operator returns the address of its operand. This value should never be compared to nullptr.

+

Microsoft Documentation

+

C6397

]]> +
+ CRITICAL +
+ + C6398 + C6398: The address-of a field cannot be null in well-defined code + + The address-of operator returns the address of its operand. This value should never be compared to nullptr.

+

Microsoft Documentation

+

C6398

]]> +
+ CRITICAL +
C6400 C6400: Using 'function name' to perform a case-insensitive compare to constant string 'string name' @@ -7888,10 +8050,10 @@ Under strict ANSI compatibility (Annotation Properties.

+

This warning indicates the use of a pointer-specific SAL annotation on a non-pointer data type.

Microsoft Documentation

C6504

]]> @@ -7899,7 +8061,7 @@ Under strict ANSI compatibility (Using SAL Annotations to reduce code defects.

@@ -8042,7 +8204,7 @@ Under strict ANSI compatibility (C++ Core Guidelines R.3: Warn if a function returns an object that was allocated within the function but has a move constructor. Suggest considering returning it by value instead.

+

To avoid confusion about whether a pointer owns an object, a function that returns a movable object should allocate it on the stack. It should then return the object by value instead of returning a heap-allocated object. If pointer semantics are required, return a smart pointer instead of a raw pointer. For more information, see C++ Core Guidelines R.3: Warn if a function returns an object that was allocated within the function but has a move constructor. Suggest considering returning it by value instead.

Microsoft Documentation

C26402

]]> @@ -8768,7 +8930,7 @@ Under strict ANSI compatibility (ES.63: Don't slice.

+ES.63: Don't slice

Microsoft Documentation

C26437

]]> @@ -8822,7 +8984,7 @@ Under strict ANSI compatibility (CP.44: Remember to name your lock_guards and unique_locks.

+

CP.44: Remember to name your lock_guards and unique_locks

Microsoft Documentation

C26441

]]> @@ -8844,10 +9006,10 @@ Under strict ANSI compatibility (ES.84: Don't (try to) declare a local variable with no name.

Microsoft Documentation

C26444

]]> @@ -8991,7 +9153,7 @@ Under strict ANSI compatibility (C26455

]]> @@ -9009,17 +9171,30 @@ Under strict ANSI compatibility (C++ Core Guideline ES.48.

+

Excerpt from the C++ Core Guideline ES.48:

Microsoft Documentation

C26457

]]> - + + core-guideline + INFO +
+ + C26459 + C26459: You called an STL function with a raw pointer parameter that may be unsafe + + You called an STL function '%function%' with a raw pointer parameter at position '%position%' that may be unsafe - this relies on the caller to check that the passed values are correct. Consider wrapping your range in a gsl::span and pass as a span iterator (stl.1).

+

Out of bound writes are one of the leading causes of remote code execution vulnerabilities. One remedy is to use bounds checked data structures like gsl::span. This warning identifies cases where Standard Template Library (STL) algorithms operate on raw pointers as output ranges. Raw pointers aren't bounds checked. To prevent vulnerabilities, use gsl::span instead.

+

Microsoft Documentation

+

C26459

]]> +
core-guideline INFO
@@ -9084,7 +9259,7 @@ Under strict ANSI compatibility (C++ Core Guidelines Type.3.

+

C++ Core Guidelines Type.3

Microsoft Documentation

C26465

]]> @@ -9096,7 +9271,7 @@ Under strict ANSI compatibility (C++ Core Guidelines Type.2.

+

C++ Core Guidelines Type.2

Microsoft Documentation

C26466

]]> @@ -9122,7 +9297,7 @@ Under strict ANSI compatibility (Type.1: Avoid casts.

+Type.1: Avoid casts

Microsoft Documentation

C26472

]]> @@ -9136,7 +9311,7 @@ Under strict ANSI compatibility (Type.1: Avoid casts.

+Type.1: Avoid casts

Microsoft Documentation

C26473

]]> @@ -9208,12 +9383,25 @@ Under strict ANSI compatibility (C26479

]]> + + core-guideline + INFO + C26481 C26481: Don't use pointer arithmetic Don't use pointer arithmetic. Use span instead (bounds.1). +

Don't use pointer arithmetic. Use span instead (bounds.1).

This check supports the C++ Core Guidelines rule I.13: Do not pass an array as a single pointer. Whenever raw pointers are used in arithmetic operations they should be replaced with safer kinds of buffers, such as span<T> or vector<T>.

Microsoft Documentation

C26481

]]> @@ -9415,7 +9603,7 @@ Under strict ANSI compatibility (C++ Core Guidelines: use constexpr for values that can be computed at compile time.

+

This rule helps to enforce Con.5 from the C++ Core Guidelines: use constexpr for values that can be computed at compile time.

Microsoft Documentation

C26498

]]>
@@ -9426,7 +9614,7 @@ Under strict ANSI compatibility (C26800

]]> @@ -9437,7 +9625,7 @@ Under strict ANSI compatibility (C26810

]]> @@ -9448,7 +9636,7 @@ Under strict ANSI compatibility (C26811

]]> @@ -9474,9 +9662,9 @@ Under strict ANSI compatibility (C26813

]]> - + CRITICAL -
+ C26814 C26814: The const variable 'variable' can be computed at compile time @@ -9494,7 +9682,7 @@ Under strict ANSI compatibility (C26815

]]> @@ -9519,7 +9707,7 @@ Under strict ANSI compatibility (ES.71 notes in the C++ Core Guidelines.

+

For more information, see ES.71 notes in the C++ Core Guidelines.

Microsoft Documentation

C26817

]]> @@ -9553,11 +9741,11 @@ Under strict ANSI compatibility (P.9: Don't waste time or space in the C++ Core Guidelines.

+

This is a potentially expensive copy operation. Consider using a reference unless a copy is required (p.9).

+

For more information, see P.9: Don't waste time or space in the C++ Core Guidelines.

Microsoft Documentation

C26820

]]> @@ -9572,9 +9760,9 @@ Under strict ANSI compatibility (blog post for a comparison. When the analysis engine deduces the value of a pointer to be null and sees that pointer get dereferenced, it will emit a C26822 warning. You can also enable C26823 for a stricter analysis. This check also supports SAL annotations and gsl::not_null to describe invariants of the code (lifetime.1).

Microsoft Documentation

C26822

]]> - + CRITICAL -
+ C26823 C26823: Dereferencing a possibly null pointer 'variable' @@ -9583,9 +9771,9 @@ Under strict ANSI compatibility (blog post for a comparison. When the analysis engine deduces that the value of a pointer might be null and sees that pointer get dereferenced, it will emit a C26823 warning. You can enable C26822 only for a more permissive analysis. This check also supports SAL annotations and gsl::not_null to describe invariants of the code (lifetime.1).

Microsoft Documentation

C26823

]]> - + CRITICAL -
+ C26824 C26824: Postcondition for null pointer 'variable' requires it to be non-null @@ -9594,9 +9782,9 @@ Under strict ANSI compatibility (blog post for a comparison. When the analysis engine sees a null pointer returned from a function that has a contract forbidding such an operation, it will emit a C26824 warning. You can also enable C26825 for a stricter analysis. This check only works on functions annotated using SAL annotations (lifetime.1).

Microsoft Documentation

C26824

]]> - + CRITICAL -
+ C26825 C26825: Postcondition for possibly null pointer 'variable' requires it to be non-null @@ -9605,9 +9793,9 @@ Under strict ANSI compatibility (blog post for a comparison. When the analysis engine sees a potentially null pointer returned from a function that has a contract forbidding such operation, it will emit a C26825 warning. You can enable C26824 only for a more permissive analysis. This check only works on functions annotated using SAL annotations (lifetime.1).

Microsoft Documentation

C26825

]]> - + CRITICAL -
+ C26826 C26826: Don't use C-style variable arguments @@ -9617,9 +9805,9 @@ Under strict ANSI compatibility (F.55: Don't use va_arg arguments in the C++ Core Guidelines.

Microsoft Documentation

C26826

]]> - + CRITICAL -
+ C26827 C26827: Did you forget to initialize an enum, or intend to use another type? @@ -9628,9 +9816,9 @@ Under strict ANSI compatibility (C26827

]]> - + CRITICAL -
+ C26828 C26828: Different enum types have overlapping values @@ -9640,9 +9828,9 @@ Under strict ANSI compatibility (C26828

]]> - + CRITICAL -
+ C26829 C26829: Empty optional 'variable' is unwrapped @@ -9651,9 +9839,9 @@ Under strict ANSI compatibility (C26830, C26859, and C26860 for a stricter analysis.

Microsoft Documentation

C26829

]]> - + CRITICAL -
+ C26830 C26830: Potentially empty optional 'variable' is unwrapped @@ -9662,9 +9850,65 @@ Under strict ANSI compatibility (C26829 only for a more permissive analysis.

Microsoft Documentation

C26830

]]> - + CRITICAL -
+ + + C26831 + C26831: Allocation size might be the result of a numerical overflow + + This warning reports that the size specified for an allocation may be the result of a numerical overflow.

+

Microsoft Documentation

+

C26831

]]> +
+ CRITICAL +
+ + C26832 + C26832: Allocation size is the result of a narrowing conversion that could result in overflow + + This warning reports that the size specified for an allocation may be the result of a narrowing conversion that results in a numerical overflow.

+

Microsoft Documentation

+

C26832

]]> +
+ CRITICAL +
+ + C26833 + C26833: Allocation size might be the result of a numerical overflow before the bound check + + This warning reports that the size specified for an allocation may be the result of a numerical overflow.

+

Microsoft Documentation

+

C26833

]]> +
+ CRITICAL +
+ + C26835 + C26835: RtlCompareMemory returns the number of matching bytes + + C26835: RtlCompareMemory returns the number of matching bytes. Consider replacing this call with RtlEqualMemory.

+

When RtlCompareMemory's return value is treated as a boolean, it evaluates to true when there is at least 1 equal byte before finding a difference. Moreover, comparing the result of RtlCompareMemory to 0 evaluates to false if there is at least 1 matching byte. This behavior may be unexpected because it's different from other comparison functions such as strcmp, making the code harder to understand. To check for equality, consider using RtlEqualMemory instead.

+

Microsoft Documentation

+

C26835

]]> +
+ CRITICAL +
+ + C26837 + C26837: Value for the comparand comp for function func has been loaded from the destination location dest through non-volatile read + + This rule was added in Visual Studio 2022 17.8.

+

Microsoft Documentation

+

C26837

]]> +
+ CRITICAL +
C26859 C26859: Empty optional 'variable' is unwrapped, will throw exception @@ -9673,9 +9917,9 @@ Under strict ANSI compatibility (C26829, C26830, and C26860 for a stricter analysis.

Microsoft Documentation

C26859

]]> - + CRITICAL -
+ C26860 C26860: Potentially empty optional 'variable' is unwrapped, may throw exception @@ -9684,9 +9928,53 @@ Under strict ANSI compatibility (C26829, and C26859 only for a more permissive analysis.

Microsoft Documentation

C26860

]]> - + CRITICAL -
+ + + C26861 + C26861: Field of a date-time object var has been modified without proper leap year checking + + This rule was added in Visual Studio 2022 17.8.

+

Microsoft Documentation

+

C26861

]]> +
+ CRITICAL +
+ + C26862 + C26862: A date-time object var has been created from a different type of date-time object but conversion was incomplete + + This rule was added in Visual Studio 2022 17.8.

+

Microsoft Documentation

+

C26862

]]> +
+ CRITICAL +
+ + C26863 + C26863: Return value from a date-time handling function func is ignored + + This rule was added in Visual Studio 2022 17.8.

+

Microsoft Documentation

+

C26863

]]> +
+ CRITICAL +
+ + C26864 + C26864: Day field of a date-time object var has been modified assuming 365 days per year without proper leap year checking + + This rule was added in Visual Studio 2022 17.8.

+

Microsoft Documentation

+

C26864

]]> +
+ CRITICAL +
C28020 C28020: The expression 'expr' is not true at this call @@ -9904,7 +10192,7 @@ Under strict ANSI compatibility (C28160

]]> @@ -9978,7 +10266,7 @@ Under strict ANSI compatibility (C28196

]]> @@ -10056,7 +10344,7 @@ Under strict ANSI compatibility (C28213

]]> @@ -10375,10 +10663,10 @@ Under strict ANSI compatibility (C28233

]]> @@ -10760,7 +11048,7 @@ Under strict ANSI compatibility (C28308

]]> @@ -10982,7 +11270,7 @@ initialized on input, and is then passed to an API such as VariantClear C33010 - C33010: Unchecked lower bound for enum enum_name used as index + C33010: Unchecked lower bound for enum 'enum' used as index This warning is triggered if an enum is both used as an index into an array and isn't checked on the lower bound.

@@ -11025,4 +11313,4 @@ if the lower bound is checked for its value, but not the upper bound.

CRITICAL
-
\ No newline at end of file + diff --git a/cxx-sensors/src/test/java/org/sonar/cxx/sensors/compiler/vc/CxxCompilerVcRuleRepositoryTest.java b/cxx-sensors/src/test/java/org/sonar/cxx/sensors/compiler/vc/CxxCompilerVcRuleRepositoryTest.java index 9b161faef1..881a36cc3a 100644 --- a/cxx-sensors/src/test/java/org/sonar/cxx/sensors/compiler/vc/CxxCompilerVcRuleRepositoryTest.java +++ b/cxx-sensors/src/test/java/org/sonar/cxx/sensors/compiler/vc/CxxCompilerVcRuleRepositoryTest.java @@ -38,7 +38,7 @@ void createVcRulesTest() { def.define(context); RulesDefinition.Repository repo = context.repository(CxxCompilerVcRuleRepository.KEY); - assertThat(repo.rules()).hasSize(982); + assertThat(repo.rules()).hasSize(1007); } } diff --git a/cxx-sensors/src/tools/vc_createrules.py b/cxx-sensors/src/tools/vc_createrules.py index 8c701a61ca..bce8eb690e 100644 --- a/cxx-sensors/src/tools/vc_createrules.py +++ b/cxx-sensors/src/tools/vc_createrules.py @@ -69,6 +69,14 @@ 'severity': 'INFO', 'type': 'CODE_SMELL', }, + 'https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-c5000-through-c5199' : { + 'severity': 'INFO', + 'type': 'CODE_SMELL', + }, + 'https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-c5200-through-c5399' : { + 'severity': 'INFO', + 'type': 'CODE_SMELL', + }, 'https://learn.microsoft.com/en-us/cpp/code-quality/code-analysis-for-c-cpp-warnings' : { 'severity': 'CRITICAL', 'type': 'CODE_SMELL', @@ -309,6 +317,9 @@ def parse_warning_page(page_source, warning): soup = BeautifulSoup(page_source, 'html.parser') content = soup.find("div", class_="content") + if not content: + return warning + # use header, sometimes only message ID key = warning['key'] warning['name'] = name(content.find('h1'), key, key)