Implement WG14 N2764 the [[noreturn]] attribute
authorAaron Ballman <aaron@aaronballman.com>
Mon, 14 Feb 2022 14:33:48 +0000 (09:33 -0500)
committerAaron Ballman <aaron@aaronballman.com>
Mon, 14 Feb 2022 14:38:26 +0000 (09:38 -0500)
commit5029dce492b3cf3ac191eda0b5bf268c3acac2e0
treed00225b693ab33a19cdb0dd1db2c9d43d8eaf5fe
parent6398903ac8c141820a84f3063b7956abe1742500
Implement WG14 N2764 the [[noreturn]] attribute

This adds support for http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2764.pdf,
which was adopted at the Feb 2022 WG14 meeting. That paper adds
[[noreturn]] and [[_Noreturn]] to the list of supported attributes in
C2x. These attributes have the same semantics as the [[noreturn]]
attribute in C++.

The [[_Noreturn]] attribute was added as a deprecated feature so that
translation units which include <stdnoreturn.h> do not get an error on
use of [[noreturn]] because the macro expands to _Noreturn. Users can
use -Wno-deprecated-attributes to silence the diagnostic.

Use of <stdnotreturn.h> or the noreturn macro were both deprecated.
Users can define the _CLANG_DISABLE_CRT_DEPRECATION_WARNINGS macro to
suppress the deprecation diagnostics coming from the header file.
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Headers/stdnoreturn.h
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/AST/ast-dump-lambda.cpp
clang/test/Sema/c2x-noreturn.c [new file with mode: 0644]