From 01825e8bffde9f4517e60878f8a829f91c361d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Tue, 28 Jan 2020 11:43:33 +0900 Subject: 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. --- include/ruby/ruby.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'include/ruby/ruby.h') 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 -- cgit v1.2.3