Skip to content

Commit 7407042

Browse files
committed
teach gsl::suppress("rule") instead of gsl::suppress(rule)
1 parent ca96f8c commit 7407042

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

docs/code-quality/c26401.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public:
6363
ref_count_--;
6464
if (ref_count_ == 0)
6565
{
66-
[[gsl::suppress(i.11)]]
66+
[[gsl::suppress("i.11")]]
6767
delete this;
6868
}
6969
}

docs/code-quality/c26409.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public:
4949
ref_count_--;
5050
if (ref_count_ == 0)
5151
{
52-
[[gsl::suppress(i.11)]]
52+
[[gsl::suppress("i.11")]]
5353
delete this;
5454
}
5555
}

docs/code-quality/using-the-cpp-core-guidelines-checkers.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ int main()
7474
int arr[10]; // warning C26494
7575
int* p = arr; // warning C26485
7676

77-
[[gsl::suppress(bounds.1)]] // This attribute suppresses Bounds rule #1
77+
[[gsl::suppress("bounds.1", justification : "This attribute suppresses Bounds rules #1")]]
7878
{
7979
int* q = p + 1; // warning C26481 (suppressed)
8080
p = q++; // warning C26481 (suppressed)
@@ -104,7 +104,7 @@ c:\users\username\documents\visual studio 2015\projects\corecheckexample\coreche
104104
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
105105
```
106106

107-
The C++ Core Guidelines are there to help you write better and safer code. However, you might find an instance where a rule or a profile shouldn't be applied. It's easy to suppress it directly in the code. You can use the `[[gsl::suppress]]` attribute to keep C++ Core Check from detecting and reporting any violation of a rule in the following code block. You can mark individual statements to suppress specific rules. You can even suppress the entire bounds profile by writing `[[gsl::suppress(bounds)]]` without including a specific rule number.
107+
The C++ Core Guidelines are there to help you write better and safer code. However, you might find an instance where a rule or a profile shouldn't be applied. It's easy to suppress it directly in the code. You can use the `[[gsl::suppress]]` attribute to keep C++ Core Check from detecting and reporting any violation of a rule in the following code block. You can mark individual statements to suppress specific rules. You can even suppress the entire bounds profile by writing `[[gsl::suppress("bounds")]]` without including a specific rule number.
108108

109109
## Supported rule sets
110110

@@ -197,10 +197,10 @@ The Microsoft C++ compiler has limited support for the `[[gsl::suppress]]` attri
197197

198198
```cpp
199199
// Suppress only warnings from the 'r.11' rule in expression.
200-
[[gsl::suppress(r.11)]] new int;
200+
[[gsl::suppress("r.11")]] new int;
201201

202202
// Suppress all warnings from the 'r' rule group (resource management) in block.
203-
[[gsl::suppress(r)]]
203+
[[gsl::suppress("r")]]
204204
{
205205
new int;
206206
}
@@ -209,7 +209,7 @@ The Microsoft C++ compiler has limited support for the `[[gsl::suppress]]` attri
209209
// For declarations, you might need to use the surrounding block.
210210
// Macros are not expanded inside of attributes.
211211
// Use plain numbers instead of macros from the warnings.h.
212-
[[gsl::suppress(26400)]]
212+
[[gsl::suppress("26400")]]
213213
{
214214
int *p = new int;
215215
}

0 commit comments

Comments
 (0)