[1/2] misc/sys/cdefs.h: Add _Noreturn macro for pre-C11 compilers

Message ID 1403539946-436-1-git-send-email-will.newton@linaro.org
State Accepted
Headers show

Commit Message

Will Newton June 23, 2014, 4:12 p.m.
From: Paul Eggert <eggert@cs.ucla.edu>

2014-03-28  Paul Eggert  <eggert@cs.ucla.edu>

	* misc/sys/cdefs.h (_Noreturn): New macro, for pre-C11 compilers.
---
 misc/sys/cdefs.h | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Roland McGrath June 23, 2014, 4:59 p.m. | #1
I think that's fine.

Patch

diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 4d958ea..a5c3224 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -382,6 +382,14 @@ 
 # define __glibc_likely(cond)	(cond)
 #endif
 
+#if !defined _Noreturn && __STDC_VERSION__ < 201112 && !__GNUC_PREREQ (4,7)
+# if __GNUC_PREREQ (2,8)
+#  define _Noreturn __attribute__ ((__noreturn__))
+# else
+#  define _Noreturn
+# endif
+#endif
+
 #include <bits/wordsize.h>
 
 #if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH