ruby-changes:59659
From: Nobuyoshi <ko1@a...>
Date: Thu, 9 Jan 2020 21:43:03 +0900 (JST)
Subject: [ruby-changes:59659] 661e07c97e (master): Moved the definition of `rb_define_method_if_constexpr`
https://git.ruby-lang.org/ruby.git/commit/?id=661e07c97e From 661e07c97e1cc742290d045dc5102e5fbdbae6a1 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 9 Jan 2020 19:08:54 +0900 Subject: Moved the definition of `rb_define_method_if_constexpr` Inside the block where `RB_METHOD_DEFINITION_DECL` family are defined. diff --git a/include/ruby/intern.h b/include/ruby/intern.h index 2f60fb5..7854d63 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -1052,6 +1052,10 @@ extern "C++" { https://github.com/ruby/ruby/blob/trunk/include/ruby/intern.h#L1052 } #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 625636f..ada86da 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 https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L2703 #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)) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/