Skip to content

Commit 5531848

Browse files
Merge pull request #4476 from MicrosoftDocs/main638151032331631518sync_temp
For protected CLA branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 3090dc5 + fcf9691 commit 5531848

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

docs/code-quality/c6030.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: Warning C6030
3+
description: "Describes C++ Code Analysis warning C6030 and how to resolve it."
4+
ms.date: 03/10/2023
5+
f1_keywords: ["C6030", "USE_ATTRIBUTE_NORETURN", "__WARNING_USE_ATTRIBUTE_NORETURN"]
6+
helpviewer_keywords: ["C6030"]
7+
---
8+
9+
# Warning C6030
10+
11+
> Use attribute [[noreturn]] over __declspec(noreturn) in function '*function-name*'
12+
13+
## Remarks
14+
15+
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.
16+
17+
This warning is off by default and isn't part of the `All Rules` rule set. To enable this warning, it must be added to the rule set file being used.
18+
19+
This check is available in Visual Studio 2022 version 17.0 and later versions.
20+
Code analysis name: `USE_ATTRIBUTE_NORETURN`
21+
22+
## Example
23+
24+
The following code generates C6030:
25+
26+
```cpp
27+
__declspec(noreturn) void TerminateApplication();
28+
29+
```
30+
31+
Fix the issue by using the `[[noreturn]]` attribute:
32+
33+
```cpp
34+
[[ noreturn ]] void TerminateApplication();
35+
36+
```
37+
38+
## See also
39+
40+
[Use Rule Sets to Specify the C++ Rules to Run](./using-rule-sets-to-specify-the-cpp-rules-to-run.md)

0 commit comments

Comments
 (0)