util: Add a NORETURN macro
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 17 Aug 2017 00:16:45 +0000 (17:16 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 4 Dec 2017 17:21:09 +0000 (09:21 -0800)
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
configure.ac
meson.build
src/util/macros.h

index 475155a96e46464d671e98302afc7f7c34594198..a4564d23f4cf0504316760e1d89d61c7aa6de070 100644 (file)
@@ -250,6 +250,7 @@ AX_GCC_FUNC_ATTRIBUTE([visibility])
 AX_GCC_FUNC_ATTRIBUTE([warn_unused_result])
 AX_GCC_FUNC_ATTRIBUTE([weak])
 AX_GCC_FUNC_ATTRIBUTE([alias])
+AX_GCC_FUNC_ATTRIBUTE([noreturn])
 
 AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes)
 
index f227bc3e018dc39f9f79f112e97ef089c7ccfb86..ddc4a44eb6feb36c9f4e446b15f07fa71387c587 100644 (file)
@@ -479,6 +479,10 @@ if cc.compiles('int foo(void) { return 0; } int bar(void) __attribute__((alias("
                name : '__attribute__((alias(...)))')
   pre_args += '-DHAVE_FUNC_ATTRIBUTE_ALIAS'
 endif
+if cc.compiles('int foo(void) __attribute__((__noreturn__));',
+               name : '__attribute__((__noreturn__))')
+  pre_args += '-DHAVE_FUNC_ATTRIBUTE_NORETURN'
+endif
 
 # TODO: this is very incomplete
 if ['linux', 'cygwin'].contains(host_machine.system())
index aa36253217c6d4f2feff7ec1dbbff05d97dcf211..d6e37053b15ed7c3513d72bda5d0e69fa41cfb37 100644 (file)
@@ -171,6 +171,12 @@ do {                       \
 #define ATTRIBUTE_RETURNS_NONNULL
 #endif
 
+#ifdef HAVE_FUNC_ATTRIBUTE_NORETURN
+#define NORETURN __attribute__((__noreturn__))
+#else
+#define NORETURN
+#endif
+
 #ifdef __cplusplus
 /**
  * Macro function that evaluates to true if T is a trivially