diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-08 22:20:05 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-08 22:20:05 +0000 |
commit | 2cb362b51f7f6db41a30138b145299fbcfd4ff1b (patch) | |
tree | 493151170438b2ed75c966d03aba4e19d7ea96de /include | |
parent | a8e1070d9d888ac09a26d0f71a69ea6584d109d6 (diff) | |
download | ruby-2cb362b51f7f6db41a30138b145299fbcfd4ff1b.tar.gz |
* include/ruby/{defines,ruby}.h: need to define function attributes
alternatives in defines.h instead of ruby.h, because they are used
in oniguruma.h and the header used without including ruby.h at
encoding library sources.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r-- | include/ruby/defines.h | 40 | ||||
-rw-r--r-- | include/ruby/ruby.h | 38 |
2 files changed, 40 insertions, 38 deletions
diff --git a/include/ruby/defines.h b/include/ruby/defines.h index b4d75294d4..74678c34ab 100644 --- a/include/ruby/defines.h +++ b/include/ruby/defines.h @@ -22,6 +22,46 @@ extern "C" { #include RUBY_EXTCONF_H #endif +/* function attributes */ +#ifndef CONSTFUNC +# define CONSTFUNC(x) x +#endif +#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 +#ifndef DEPRECATED_BY +# define DEPRECATED_BY(n,x) DEPRECATED(x) +#endif +#ifndef DEPRECATED_TYPE +# define DEPRECATED_TYPE(mesg, decl) decl +#endif +#ifndef NOINLINE +# define NOINLINE(x) x +#endif + +/* likely */ +#if __GNUC__ >= 3 +#define RB_LIKELY(x) (__builtin_expect(!!(x), 1)) +#define RB_UNLIKELY(x) (__builtin_expect(!!(x), 0)) +#else /* __GNUC__ >= 3 */ +#define RB_LIKELY(x) (x) +#define RB_UNLIKELY(x) (x) +#endif /* __GNUC__ >= 3 */ + +#ifdef __GNUC__ +#define PRINTF_ARGS(decl, string_index, first_to_check) \ + decl __attribute__((format(printf, string_index, first_to_check))) +#else +#define PRINTF_ARGS(decl, string_index, first_to_check) decl +#endif + /* AC_INCLUDES_DEFAULT */ #include <stdio.h> #ifdef HAVE_SYS_TYPES_H diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index c83c83406b..c7b1f41a7f 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -35,28 +35,6 @@ extern "C" { #include "defines.h" -#define NORETURN_STYLE_NEW 1 -#ifndef CONSTFUNC -# define CONSTFUNC(x) x -#endif -#ifndef PUREFUNC -# define PUREFUNC(x) x -#endif -#ifndef NORETURN -# define NORETURN(x) x -#endif -#ifndef DEPRECATED -# define DEPRECATED(x) x -#endif -#ifndef DEPRECATED_BY -# define DEPRECATED_BY(n,x) DEPRECATED(x) -#endif -#ifndef DEPRECATED_TYPE -# define DEPRECATED_TYPE(mesg, decl) decl -#endif -#ifndef NOINLINE -# define NOINLINE(x) x -#endif #ifndef ASSUME # ifdef UNREACHABLE # define ASSUME(x) (RB_LIKELY(!!(x)) ? (void)0 : UNREACHABLE) @@ -68,22 +46,6 @@ extern "C" { # define UNREACHABLE ((void)0) /* unreachable */ #endif -/* likely */ -#if __GNUC__ >= 3 -#define RB_LIKELY(x) (__builtin_expect(!!(x), 1)) -#define RB_UNLIKELY(x) (__builtin_expect(!!(x), 0)) -#else /* __GNUC__ >= 3 */ -#define RB_LIKELY(x) (x) -#define RB_UNLIKELY(x) (x) -#endif /* __GNUC__ >= 3 */ - -#ifdef __GNUC__ -#define PRINTF_ARGS(decl, string_index, first_to_check) \ - decl __attribute__((format(printf, string_index, first_to_check))) -#else -#define PRINTF_ARGS(decl, string_index, first_to_check) decl -#endif - #define RUBY_MACRO_SELECT(base, n) TOKEN_PASTE(base, n) #ifdef HAVE_INTRINSICS_H |