1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
usa 2016-05-08 22:20:05 +00:00
parent a8e1070d9d
commit 2cb362b51f
3 changed files with 47 additions and 38 deletions

View file

@ -1,3 +1,10 @@
Mon May 9 07:18:06 2016 NAKAMURA Usaku <usa@ruby-lang.org>
* 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.
Mon May 9 06:30:12 2016 NAKAMURA Usaku <usa@ruby-lang.org>
* include/ruby/ruby.h (CONSTFUNC, PUREFUNC): fixed build errors on

View file

@ -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

View file

@ -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