[PATCH] D119707: [C2x] Implement WG14 N2764 the [[noreturn]] attribute

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 14 05:29:34 PST 2022


aaron.ballman created this revision.
aaron.ballman added reviewers: erichkeane, jyknight, rsmith.
aaron.ballman requested review of this revision.
Herald added a project: clang.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119707

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119707.408385.patch
Type: text/x-patch
Size: 8367 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220214/9f8d7d37/attachment-0001.bin>


More information about the cfe-commits mailing list