diff options
author | 卜部昌平 <[email protected]> | 2020-01-28 11:43:33 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2020-01-28 15:42:57 +0900 |
commit | 01825e8bffde9f4517e60878f8a829f91c361d68 (patch) | |
tree | 2502a1b380f618a788079b8a0774dab0d3ef7843 /include/ruby/ruby.h | |
parent | ab33b3d6915fe40734cdeaac5f2104fa8792c8a9 (diff) |
template metaprogramming instead of macros
C++ (and myself) hates macros. If we could do the same thing in both
preprocessor and template, we shall choose template. This particular
part of the ruby header is one of such situations.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2864
Diffstat (limited to 'include/ruby/ruby.h')
-rw-r--r-- | include/ruby/ruby.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index e96ac40747..9b3a2bcf81 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -2654,12 +2654,8 @@ void ruby_sig_finalize(void); RUBY_SYMBOL_EXPORT_END #if defined(__cplusplus) -#if 0 -{ /* satisfy cc-mode */ -#endif -} /* extern "C" { */ -extern "C++" { -#endif +#include "backward/cxxanyargs.hpp" +#else #if defined(HAVE_BUILTIN___BUILTIN_TYPES_COMPATIBLE_P) # define rb_f_notimplement_p(f) __builtin_types_compatible_p(__typeof__(f),__typeof__(rb_f_notimplement)) @@ -2937,6 +2933,8 @@ RB_METHOD_DEFINITION_DECL(rb_define_global_function, (1,2), (const char *name), #endif +#endif /* __cplusplus */ + #if defined(RUBY_DEVEL) && RUBY_DEVEL && (!defined(__cplusplus) || defined(RB_METHOD_DEFINITION_DECL)) # define RUBY_METHOD_FUNC(func) (func) #else @@ -2944,8 +2942,6 @@ RB_METHOD_DEFINITION_DECL(rb_define_global_function, (1,2), (const char *name), #endif #ifdef __cplusplus -#include "backward/cxxanyargs.hpp" - #if 0 { /* satisfy cc-mode */ #endif |