ruby-changes:49715
From: shyouhei <ko1@a...>
Date: Mon, 15 Jan 2018 11:51:22 +0900 (JST)
Subject: [ruby-changes:49715] shyouhei:r61831 (trunk): more support for NORETURN
shyouhei 2018-01-15 11:35:20 +0900 (Mon, 15 Jan 2018) New Revision: 61831 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61831 Log: more support for NORETURN Before this NORETURN was checked only for __attribute__ or __declspec, but nowadays other ways are there to tell compilers that a function never returns. Take them into account. Modified files: trunk/include/ruby/defines.h Index: include/ruby/defines.h =================================================================== --- include/ruby/defines.h (revision 61830) +++ include/ruby/defines.h (revision 61831) @@ -29,10 +29,6 @@ extern "C" { https://github.com/ruby/ruby/blob/trunk/include/ruby/defines.h#L29 #ifndef PUREFUNC # define PUREFUNC(x) x #endif -#define NORETURN_STYLE_NEW 1 -#ifndef NORETURN -# define NORETURN(x) x -#endif #ifndef DEPRECATED # define DEPRECATED(x) x #endif @@ -390,6 +386,17 @@ void rb_ia64_flushrs(void); https://github.com/ruby/ruby/blob/trunk/include/ruby/defines.h#L386 #define RUBY_ALIGNOF(x) ((size_t)offsetof(struct { char f1; type f2; }, f2)) #endif +#define NORETURN_STYLE_NEW 1 +#ifdef NORETURN +/* OK, take that definition */ +#elif defined(__cplusplus) && (__cplusplus >= 201103L) +#define NORETURN(x) [[ noreturn ]] x +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) +#define NORETURN(x) _Noreturn x +#else +#define NORETURN(x) x +#endif + RUBY_SYMBOL_EXPORT_END #if defined(__cplusplus) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/