Skip to content

Commit dfd7acc

Browse files
authored
Merge pull request MicrosoftDocs#4565 from corob-msft/learn/corob/ca-acrolinx-3
Fix Code Analysis warning publishing issues
2 parents 9734613 + 87fcae7 commit dfd7acc

28 files changed

+183
-113
lines changed

docs/code-quality/c26138.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
description: "Learn more about: Warning C26138"
33
title: Warning C26138
44
ms.date: 01/14/2019
5-
f1_keywords: ["C26138"]
5+
f1_keywords: ["C26138", "SUSPENDED_WITH_LOCK"]
66
helpviewer_keywords: ["C26138"]
7-
author: sunnychatterjee
8-
ms.author: sunnych
97
---
108
# Warning C26138
119

1210
> Suspending a coroutine while holding lock '*lock*'.
1311
12+
## Remarks
13+
1414
Warning C26138 warns when a coroutine is suspended while holding a lock. In general, we can't know how long will a coroutine remain in the suspended state so this pattern may result in longer critical sections than expected.
1515

16+
Code analysis name: `SUSPENDED_WITH_LOCK`
17+
1618
## Examples
1719

1820
The following code will generate C26138.

docs/code-quality/c26433.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ title: Warning C26433
44
ms.date: 01/18/2017
55
f1_keywords: ["C26433", "OVERRIDE_EXPLICITLY"]
66
helpviewer_keywords: ["C26433"]
7-
dev_langs: ["C++"]
87
---
98
# Warning C26433
109

11-
Function should be marked with `override`
10+
> Function should be marked with `override`
1211
1312
## C++ Core Guidelines
1413

@@ -24,6 +23,8 @@ The rule doesn't flag functions explicitly marked as `final`, which is itself a
2423

2524
Warnings show up on function definitions, not declarations. It may be confusing, since definitions don't have virtual specifiers, but the warning is still correct.
2625

26+
Code analysis name: `OVERRIDE_EXPLICITLY`
27+
2728
## Example: Implicit overriding
2829

2930
```cpp

docs/code-quality/c26435.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ title: Warning C26435
44
ms.date: 01/18/2017
55
f1_keywords: ["C26435", "SINGLE_VIRTUAL_SPECIFICATION"]
66
helpviewer_keywords: ["C26435"]
7-
dev_langs: ["C++"]
87
---
98
# Warning C26435
109

@@ -25,6 +24,8 @@ To improve readability, the kind of virtual behavior should be stated clearly an
2524
- This rule skips destructors since they have special rules regarding virtuality.
2625
- Warnings show up on function definitions, not declarations. It may be confusing, since definitions don't have virtual specifiers, but the warning is still appropriate.
2726

27+
Code analysis name: `SINGLE_VIRTUAL_SPECIFICATION`
28+
2829
## Example: Redundant specifier
2930

3031
```cpp

docs/code-quality/c26443.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ title: Warning C26443
33
ms.date: 01/18/2017
44
f1_keywords: ["C26443", "NO_EXPLICIT_DTOR_OVERRIDE"]
55
helpviewer_keywords: ["C26443"]
6-
dev_langs: ["C++"]
76
description: Warning C26443 Rule concerning overriding destructors
87
---
98
# Warning C26443
109

11-
"Overriding destructor should not use explicit 'override' or 'virtual' specifiers."
10+
> Overriding destructor should not use explicit 'override' or 'virtual' specifiers.
1211
1312
This warning was removed in Visual Studio 16.8 to reflect [changes to C.128 in the C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines/pull/1448).
1413

@@ -24,6 +23,8 @@ The current consensus on the Core Guidelines is to exclude destructors from the
2423
- Destructors can still use the 'final' specifier because of its special semantics.
2524
- Warnings show up on function definitions, not declarations. It may be confusing, since definitions don't have virtual specifiers, but the warning is still appropriate.
2625

26+
Code analysis name: `NO_EXPLICIT_DTOR_OVERRIDE`
27+
2728
## Example: Explicit 'override'
2829

2930
```cpp

docs/code-quality/c26444.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ title: Warning C26444
44
ms.date: 01/18/2017
55
f1_keywords: ["C26444", "NO_UNNAMED_RAII_OBJECTS"]
66
helpviewer_keywords: ["C26444"]
7-
dev_langs: ["C++"]
87
---
98
# Warning C26444
109

11-
Avoid unnamed objects with custom construction and destruction.
10+
> Avoid unnamed objects with custom construction and destruction.
1211
1312
## C++ Core Guidelines
1413

@@ -23,6 +22,8 @@ Unnamed (that is, temporary) objects with non-trivial behavior may point to eith
2322
- The logic skips temporaries if they're used in higher-level expressions. One example is temporaries that are passed as arguments or used to invoke a function.
2423
- The standard library implementation may have different versions of destruction logic for some types (for example, containers). This can produce noisy warnings on debug builds because it's customary to ignore iterators returned from calls like [`std::vector::insert`](../standard-library/vector-class.md#insert). While such warnings aren't actionable in most cases, they're legitimate in pointing to the place where some non-obvious work is done in temporary objects.
2524

25+
Code analysis name: `NO_UNNAMED_RAII_OBJECTS`
26+
2627
## Example: Ignored call result
2728

2829
```cpp

docs/code-quality/c26450.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,21 @@
22
description: "Learn more about: Arithmetic overflow: '%operator%' operation causes overflow at compile time. Use a wider type to store the operands"
33
title: Warning C26450
44
ms.date: 01/08/2017
5-
f1_keywords: ["C26450"]
5+
f1_keywords: ["C26450", "RESULT_OF_ARITHMETIC_OPERATION_PROVABLY_LOSSY"]
66
helpviewer_keywords: ["C26450"]
7-
dev_langs: ["C++"]
87
---
9-
# Arithmetic overflow: '%operator%' operation causes overflow at compile time. Use a wider type to store the operands
8+
# Warning C26450
9+
10+
>Arithmetic overflow: '*operator*' operation causes overflow at compile time. Use a wider type to store the operands (io.1)
11+
12+
## Remarks
1013

1114
This warning indicates that an arithmetic operation was provably lossy at compile time. It can be asserted when the operands are all compile-time constants. Currently, we check left shift, multiplication, addition, and subtraction operations for such overflows.
1215

1316
Warning C4307 is a similar check in the Microsoft C++ compiler.
1417

18+
Code analysis name: `RESULT_OF_ARITHMETIC_OPERATION_PROVABLY_LOSSY`
19+
1520
## Example 1
1621

1722
```cpp

docs/code-quality/c26451.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22
title: Warning C26451
33
description: "Describes the causes of MSVC code analysis warning C26451, and shows how to fix it."
44
ms.date: 07/15/2020
5-
f1_keywords: ["C26451"]
5+
f1_keywords: ["C26451", "RESULT_OF_ARITHMETIC_OPERATION_CAST_TO_LARGER_SIZE"]
66
helpviewer_keywords: ["C26451"]
7-
dev_langs: ["C++"]
87
---
98
# Warning C26451
109

11-
> Arithmetic overflow: Using operator '*operator*' on a *size-a* byte value and then casting the result to a *size-b* byte value. Cast the value to the wider type before calling operator '*operator*' to avoid overflow
10+
> Arithmetic overflow: Using operator '*operator*' on a *size-a* byte value and then casting the result to a *size-b* byte value. Cast the value to the wider type before calling operator '*operator*' to avoid overflow (io.2)
1211
1312
This warning indicates incorrect behavior that results from integral promotion rules and types larger than the ones in which arithmetic is typically performed.
1413

1514
## Remarks
1615

1716
Code analysis detects when an integral value gets shifted left, multiplied, added, or subtracted, and the result gets cast to a wider integral type. If the operation overflows the narrower integral type, then data is lost. You can prevent this loss by casting the value to a wider type before the arithmetic operation.
1817

18+
Code analysis name: `RESULT_OF_ARITHMETIC_OPERATION_CAST_TO_LARGER_SIZE`
19+
1920
## Example 1
2021

2122
The following code generates this warning:

docs/code-quality/c26452.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@
22
title: Warning C26452
33
description: "Describes causes of MSVC Code analysis warning C26452, and how to fix the issue."
44
ms.date: 07/15/2020
5-
f1_keywords: ["C26452"]
5+
f1_keywords: ["C26452", "SHIFT_COUNT_NEGATIVE_OR_TOO_BIG"]
66
helpviewer_keywords: ["C26452"]
7-
dev_langs: ["C++"]
87
---
98
# Warning C26452
109

11-
> Arithmetic overflow: Left shift count is negative or greater than or equal to the operand size, which is undefined behavior
10+
> Arithmetic overflow: Left shift count is negative or greater than or equal to the operand size, which is undefined behavior (io.3)
11+
12+
## Remarks
1213

1314
This warning indicates the shift count is negative, or greater than or equal to the number of bits in the shifted operand. Either case results in undefined behavior.
14-
C4293 is a similar check in the Microsoft C++ compiler.
15+
16+
Warning C4293 is a similar check in the Microsoft C++ compiler.
17+
18+
Code analysis name: `SHIFT_COUNT_NEGATIVE_OR_TOO_BIG`
1519

1620
## Example
1721

docs/code-quality/c26453.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22
title: Warning C26453
33
description: "Describes the causes of MSVC code analysis warning C26453, and shows how to fix it."
44
ms.date: 07/15/2020
5-
f1_keywords: ["C26453"]
5+
f1_keywords: ["C26453", "LEFTSHIFT_NEGATIVE_SIGNED_NUMBER"]
66
helpviewer_keywords: ["C26453"]
7-
dev_langs: ["C++"]
87
---
98
# Warning C26453
109

11-
> Arithmetic overflow: Left shift of a negative signed number is undefined behavior
10+
> Arithmetic overflow: Left shift of a negative signed number is undefined behavior (io.4)
11+
12+
## Remarks
1213

1314
This warning indicates the code left shifts a negative signed integral value, which is non-portable and triggers implementation defined behavior.
1415

16+
Code analysis name: `LEFTSHIFT_NEGATIVE_SIGNED_NUMBER`
17+
1518
## Example
1619

1720
```cpp

docs/code-quality/c26454.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
---
2-
description: "Learn more about: Arithmetic overflow: '%operator%' operation produces a negative unsigned result at compile time"
2+
description: "Learn more about: Arithmetic overflow: 'operator' operation produces a negative unsigned result at compile time"
33
title: Warning C26454
44
ms.date: 01/08/2017
5-
f1_keywords: ["C26454"]
5+
f1_keywords: ["C26454", "RESULT_OF_ARITHMETIC_OPERATION_NEGATIVE_UNSIGNED"]
66
helpviewer_keywords: ["C26454"]
7-
dev_langs: ["C++"]
87
---
9-
# Arithmetic overflow: '%operator%' operation produces a negative unsigned result at compile time
8+
# Warning C26454
109

11-
This warning indicates that the subtraction operation produces a negative result that was evaluated in an unsigned context, which can result in unintended overflows.
10+
> Arithmetic overflow: '*operator*' operation produces a negative unsigned result at compile time
11+
12+
## Remarks
13+
14+
This warning indicates that the subtraction operation produces a negative result that was evaluated in an unsigned context, which can result in unintended overflows.
15+
16+
Code analysis name: `RESULT_OF_ARITHMETIC_OPERATION_NEGATIVE_UNSIGNED`
1217

1318
## Example
1419

0 commit comments

Comments
 (0)