diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-28 06:58:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-28 06:58:19 +0000 |
commit | 9e75488ac81f2e2f39336f34bd9c5360fdbdddb7 (patch) | |
tree | 943e908437fb3ba74c2856509b6cdaba34f8bc54 /internal.h | |
parent | b03a92c4ce1f9bbc2d211d868f2a40b0cfdb6d4a (diff) | |
download | ruby-9e75488ac81f2e2f39336f34bd9c5360fdbdddb7.tar.gz |
internal.h: RB_OBJ_BUILTIN_TYPE
* internal.h (RB_OBJ_BUILTIN_TYPE): special-const safe
BUILTIN_TYPE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r-- | internal.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/internal.h b/internal.h index 116654ef91..c7e80aa978 100644 --- a/internal.h +++ b/internal.h @@ -1682,6 +1682,24 @@ do { \ } \ } while (0) +#define RB_OBJ_BUILTIN_TYPE(obj) rb_obj_builtin_type(obj) +#define OBJ_BUILTIN_TYPE(obj) RB_OBJ_BUILTIN_TYPE(obj) +#ifdef __GNUC__ +#define rb_obj_builtin_type(obj) \ +__extension__({ \ + VALUE arg_obj = (obj); \ + RB_SPECIAL_CONST_P(arg_obj) ? -1 : \ + RB_BUILTIN_TYPE(arg_obj); \ + }) +#else +static inline int +rb_obj_builtin_type(VALUE obj) +{ + return RB_SPECIAL_CONST_P(obj) ? -1 : + RB_BUILTIN_TYPE(obj); +} +#endif + #if defined(__cplusplus) #if 0 { /* satisfy cc-mode */ |