Skip to content

Commit 41d118f

Browse files
authored
Remove metadata comments and fix formatting in docs
1 parent 780f600 commit 41d118f

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

docs/code-quality/c26132.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
---
2-
# Required metadata
3-
# For more information, see https://review.learn.microsoft.com/en-us/help/platform/learn-editor-add-metadata?branch=main
4-
# For valid values of ms.service, ms.prod, and ms.topic, see https://review.learn.microsoft.com/en-us/help/platform/metadata-taxonomies?branch=main
5-
62
title: Warning C26132
73
description: Documentation on static analysis warning C26132
8-
author: Rastaban # GitHub alias
9-
ms.author: philc # Microsoft alias
4+
author: Rastaban
5+
ms.author: philc
106
ms.service: visual-cpp
117
ms.topic: article
128
ms.date: 02/11/2025
@@ -21,13 +17,12 @@ Warning C26132 is issued when the analyzer detects that the lock that is annotat
2117

2218
In the following example, C26132 is emitted when `data` is used.
2319

24-
> warning C26132: Variable 'data' should be protected by 'customLock01', but '(&customLock01)->cs' is held instead. Possible annotation mismatch.
25-
2620
The variable `data` is annotated to be protected by `customLock01`, but the locking function `CustomLockAcquire` is annotated to acquire the related lock `customLock01->cs`.
2721

2822
```cpp
2923
#include <sal.h>
30-
struct CustomLock {
24+
struct CustomLock
25+
{
3126
int cs; // "Critical Section" lock
3227
};
3328

@@ -48,11 +43,12 @@ void Initialize(_Guarded_by_(customLock01) int* data)
4843
}
4944
```
5045
51-
In this example the `Initialize` function is thread safe and behaves as designed, but that design is not correctly reflected in the concurrency SAL annotations. This is fixed by adjusting the annotations on the custom locking functions to use `criticalSection` rather than `criticalSection->cs`. This could also be fixed by changing the `_Guarded_by_` annotation from `customLock01` to `customLock01.cs`.
46+
In this example, the `Initialize` function is thread-safe and behaves as designed, but that design is not correctly reflected in the concurrency SAL annotations. This is fixed by adjusting the annotations on the custom locking functions to use `criticalSection` rather than `criticalSection->cs`. This could also be fixed by changing the `_Guarded_by_` annotation from `customLock01` to `customLock01.cs`.
5247
5348
```cpp
5449
#include <sal.h>
55-
struct CustomLock {
50+
struct CustomLock
51+
{
5652
int cs; // "Critical Section" lock
5753
};
5854

docs/code-quality/c26133.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
---
2-
# Required metadata
3-
# For more information, see https://review.learn.microsoft.com/en-us/help/platform/learn-editor-add-metadata?branch=main
4-
# For valid values of ms.service, ms.prod, and ms.topic, see https://review.learn.microsoft.com/en-us/help/platform/metadata-taxonomies?branch=main
5-
62
title: Warning C26133
73
description: Documentation on static analysis warning C26133
8-
author: Rastaban # GitHub alias
9-
ms.author: philc # Microsoft alias
4+
author: Rastaban
5+
ms.author: philc
106
ms.service: visual-cpp
117
ms.topic: article
128
ms.date: 02/11/2025
@@ -26,7 +22,8 @@ In the following example, C26133 is emitted when `DoTaskWithCustomLock` is calle
2622
```cpp
2723
#include <sal.h>
2824

29-
struct CustomLock {
25+
struct CustomLock
26+
{
3027
int cs; // "Critical Section"
3128
};
3229

@@ -48,12 +45,13 @@ void DoTask()
4845
}
4946
```
5047
51-
In this example the `DoTask` function is thread safe and behaves as designed, but that design is not correctly reflected in the concurrency SAL annotations. This is fixed by adjusting the annotations on the custom locking functions to use `criticalSection` rather than `criticalSection->cs`. This could also be fixed by changing the `_Requires_lock_held_` annotation from `customLock01` to `customLock01.cs`.
48+
In this example, the `DoTask` function is thread-safe and behaves as designed, but that design is not correctly reflected in the concurrency SAL annotations. This is fixed by adjusting the annotations on the custom locking functions to use `criticalSection` rather than `criticalSection->cs`. This could also be fixed by changing the `_Requires_lock_held_` annotation from `customLock01` to `customLock01.cs`.
5249
5350
```cpp
5451
#include <sal.h>
5552
56-
struct CustomLock {
53+
struct CustomLock
54+
{
5755
int cs; // "Critical Section"
5856
};
5957

0 commit comments

Comments
 (0)