summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-01-09 19:08:54 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-01-09 21:32:26 +0900
commit661e07c97e1cc742290d045dc5102e5fbdbae6a1 (patch)
tree9e05f167f642e1843a631dc9e6bd437642945d98 /include
parent23fbee0311d34da4f623a828bf0c015a90d8edc9 (diff)
Moved the definition of `rb_define_method_if_constexpr`
Inside the block where `RB_METHOD_DEFINITION_DECL` family are defined.
Diffstat (limited to 'include')
-rw-r--r--include/ruby/intern.h4
-rw-r--r--include/ruby/ruby.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index 2f60fb569e..7854d63764 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -1052,6 +1052,10 @@ extern "C++" {
}
#endif
+#if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P)
+#define rb_define_method_if_constexpr(x, t, f) __builtin_choose_expr(__builtin_choose_expr(__builtin_constant_p(x),(x),0),(t),(f))
+#endif
+
#define RB_UNWRAP_MACRO(...) __VA_ARGS__
#ifdef __cplusplus
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 625636fcdc..ada86dab95 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -2703,7 +2703,6 @@ RB_METHOD_DEFINITION_DECL(rb_define_method, (2,3), (VALUE klass, const char *nam
#ifdef __cplusplus
#define rb_define_method(m, n, f, a) rb_define_method_tmpl<a>::define(m, n, f)
#else
-#define rb_define_method_if_constexpr(x, t, f) __builtin_choose_expr(__builtin_choose_expr(__builtin_constant_p(x),(x),0),(t),(f))
#define rb_define_method_choose_prototype15(n) rb_define_method_if_constexpr((n)==15,rb_define_method15,rb_define_methodm3)
#define rb_define_method_choose_prototype14(n) rb_define_method_if_constexpr((n)==14,rb_define_method14,rb_define_method_choose_prototype15(n))
#define rb_define_method_choose_prototype13(n) rb_define_method_if_constexpr((n)==13,rb_define_method13,rb_define_method_choose_prototype14(n))