You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> 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