Skip to content

Latest commit

 

History

History
40 lines (25 loc) · 1.19 KB

c6030.md

File metadata and controls

40 lines (25 loc) · 1.19 KB
title description ms.date f1_keywords helpviewer_keywords
Warning C6030
Describes C++ Code Analysis warning C6030 and how to resolve it.
03/10/2023
C6030
USE_ATTRIBUTE_NORETURN
__WARNING_USE_ATTRIBUTE_NORETURN
C6030

Warning C6030

Use attribute [[noreturn]] over __declspec(noreturn) in function 'function-name'

Remarks

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.

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.

This check is available in Visual Studio 2022 version 17.0 and later versions. Code analysis name: USE_ATTRIBUTE_NORETURN

Example

The following code generates C6030:

__declspec(noreturn) void TerminateApplication();

Fix the issue by using the [[noreturn]] attribute:

[[ noreturn ]] void TerminateApplication();

See also

Use Rule Sets to Specify the C++ Rules to Run