[libc-commits] [PATCH] D75393: [libc] Add a convenience type spec for _Noreturn.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Sat Feb 29 00:03:54 PST 2020


sivachandra updated this revision to Diff 247426.
sivachandra added a comment.

Add a macro to define _Noreturn to [[noreturn]] for C++ compilations.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75393/new/

https://reviews.llvm.org/D75393

Files:
  libc/include/__llvm-libc-common.h
  libc/spec/spec.td


Index: libc/spec/spec.td
===================================================================
--- libc/spec/spec.td
+++ libc/spec/spec.td
@@ -48,6 +48,9 @@
 def VoidPtr : PtrType<VoidType>;
 def SizeTType : NamedType<"size_t">;
 
+// _Noreturn is really not a type, but it is convenient to treat it as a type.
+def NoReturn : NamedType<"_Noreturn void">;
+
 class Macro<string name> {
   string Name = name;
 }
Index: libc/include/__llvm-libc-common.h
===================================================================
--- libc/include/__llvm-libc-common.h
+++ libc/include/__llvm-libc-common.h
@@ -17,6 +17,9 @@
 #undef __END_C_DECLS
 #define __END_C_DECLS }
 
+#undef _Noreturn
+#define _Noreturn [[noreturn]]
+
 #else // not __cplusplus
 
 #undef __BEGIN_C_DECLS


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75393.247426.patch
Type: text/x-patch
Size: 766 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200229/84007984/attachment.bin>


More information about the libc-commits mailing list