ruby-changes:61189
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Mon, 11 May 2020 09:24:36 +0900 (JST)
Subject: [ruby-changes:61189] dca234a5dc (master): mv include/ruby/{3,impl}
https://git.ruby-lang.org/ruby.git/commit/?id=dca234a5dc From dca234a5dc9d5bb39c906d833c43305ce95508fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Mon, 4 May 2020 15:26:12 +0900 Subject: mv include/ruby/{3,impl} Devs do not love "3". diff --git a/include/ruby/3/anyargs.h b/include/ruby/3/anyargs.h deleted file mode 100644 index d85a49b..0000000 --- a/include/ruby/3/anyargs.h +++ /dev/null @@ -1,375 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/#L0 -#ifndef RUBY3_ANYARGS_H /*-*-C++-*-vi:se ft=cpp:*/ -#define RUBY3_ANYARGS_H -/** - * @file - * @author Ruby developers <ruby-core@r...> - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - * @warning Symbols prefixed with either `RUBY3` or `ruby3` are - * implementation details. Don't take them as canon. They could - * rapidly appear then vanish. The name (path) of this header file - * is also an implementation detail. Do not expect it to persist - * at the place it is now. Developers are free to move it anywhere - * anytime at will. - * @note To ruby-core: remember that this header can be possibly - * recursively included from extension libraries written in C++. - * Do not expect for instance `__VA_ARGS__` is always available. - * We assume C99 for ruby itself but we don't assume languages of - * extension libraries. They could be written in C++98. - * @brief Function overloads to issue warnings around #ANYARGS. - * - * For instance ::rb_define_method takes a pointer to #ANYARGS -ed functions, - * which in fact varies 18 different prototypes. We still need to preserve - * #ANYARGS for storages but why not check the consistencies if possible. With - * those complex macro overlays defined in this header file, use of a function - * pointer gets checked against the corresponding arity argument. - * - * ### Q&A ### - * - * - Q: Where did the magic number "18" came from in the description above? - * - * - A: Count the case branch of `vm_method.c:call_cfunc_invoker_func()`. Note - * also that the 18 branches has lasted for at least 25 years. See also - * commit 200e0ee2fd3c1c006c528874a88f684447215524. - * - * - Q: What is this `__weakref__` thing? - * - * - A: That is a kind of function overloading mechanism that GCC provides. In - * this case for instance `rb_define_method_00` is an alias of - * ::rb_define_method, with a strong type. - * - * - Q: What is this `__transparent_union__` thing? - * - * A: That is another kind of function overloading mechanism that GCC - * provides. In this case the attributed function pointer is either - * `VALUE(*)(int,VALUE*,VALUE)` or `VALUE(*)(int,const VALUE*,VALUE)`. - * - * This is better than `void*` or #ANYARGS because we can reject all other - * possibilities than the two. - * - * - Q: What does this #rb_define_method macro mean? - * - * - A: It selects appropriate alias of the ::rb_define_method function, - * depending on the last (arity) argument. - * - * - Q: Why the special case for ::rb_f_notimplement ? - * - * - A: Function pointer to ::rb_f_notimplement is special cased in - * `vm_method.c:rb_add_method_cfunc()`. That should be handled by the - * `__builtin_choose_expr` chain inside of #rb_define_method macro - * expansion. In order to do so, comparison like - * `(func == rb_f_notimplement)` is inappropriate for - * `__builtin_choose_expr`'s expression (which must be a compile-time - * integer constant but the address of ::rb_f_notimplement is not fixed - * until the linker). Instead we are using - * `__builtin_types_compatible_p`, and in doing so we need to distinguish - * ::rb_f_notimplement from others, by type. - */ -#include "ruby/3/attr/maybe_unused.h" -#include "ruby/3/attr/nonnull.h" -#include "ruby/3/attr/weakref.h" -#include "ruby/3/cast.h" -#include "ruby/3/config.h" -#include "ruby/3/has/attribute.h" -#include "ruby/3/intern/class.h" -#include "ruby/3/intern/vm.h" -#include "ruby/3/method.h" -#include "ruby/3/value.h" -#include "ruby/backward/2/stdarg.h" - -#if defined(__cplusplus) -# include "ruby/backward/cxxanyargs.hpp" - -#elif defined(_WIN32) || defined(__CYGWIN__) -# /* Skip due to [Bug #16134] */ - -#elif ! RUBY3_HAS_ATTRIBUTE(transparent_union) -# /* :TODO: improve here, please find a way to support. */ - -#elif ! defined(HAVE_VA_ARGS_MACRO) -# /* :TODO: improve here, please find a way to support. */ - -#else -# /** @cond INTERNAL_MACRO */ -# if ! defined(HAVE_BUILTIN___BUILTIN_TYPES_COMPATIBLE_P) -# define RUBY3_CFUNC_IS_rb_f_notimplement(f) 0 -# else -# define RUBY3_CFUNC_IS_rb_f_notimplement(f) \ - __builtin_types_compatible_p( \ - __typeof__(f), \ - __typeof__(rb_f_notimplement)) -# endif - -# if ! defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P) -# define RUBY3_ANYARGS_DISPATCH(expr, truthy, falsy) (falsy) -# else -# define RUBY3_ANYARGS_DISPATCH(expr, truthy, falsy) \ - __builtin_choose_expr( \ - __builtin_choose_expr( \ - __builtin_constant_p(expr), \ - (expr), 0), \ - (truthy), (falsy)) -# endif - -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_m2(n) RUBY3_ANYARGS_DISPATCH((n) == -2, rb_define_singleton_method_m2, rb_define_singleton_method_m3) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_m1(n) RUBY3_ANYARGS_DISPATCH((n) == -1, rb_define_singleton_method_m1, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_m2(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_00(n) RUBY3_ANYARGS_DISPATCH((n) == 0, rb_define_singleton_method_00, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_m1(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_01(n) RUBY3_ANYARGS_DISPATCH((n) == 1, rb_define_singleton_method_01, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_00(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_02(n) RUBY3_ANYARGS_DISPATCH((n) == 2, rb_define_singleton_method_02, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_01(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_03(n) RUBY3_ANYARGS_DISPATCH((n) == 3, rb_define_singleton_method_03, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_02(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_04(n) RUBY3_ANYARGS_DISPATCH((n) == 4, rb_define_singleton_method_04, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_03(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_05(n) RUBY3_ANYARGS_DISPATCH((n) == 5, rb_define_singleton_method_05, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_04(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_06(n) RUBY3_ANYARGS_DISPATCH((n) == 6, rb_define_singleton_method_06, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_05(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_07(n) RUBY3_ANYARGS_DISPATCH((n) == 7, rb_define_singleton_method_07, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_06(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_08(n) RUBY3_ANYARGS_DISPATCH((n) == 8, rb_define_singleton_method_08, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_07(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_09(n) RUBY3_ANYARGS_DISPATCH((n) == 9, rb_define_singleton_method_09, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_08(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_10(n) RUBY3_ANYARGS_DISPATCH((n) == 10, rb_define_singleton_method_10, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_09(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_11(n) RUBY3_ANYARGS_DISPATCH((n) == 11, rb_define_singleton_method_11, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_10(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_12(n) RUBY3_ANYARGS_DISPATCH((n) == 12, rb_define_singleton_method_12, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_11(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_13(n) RUBY3_ANYARGS_DISPATCH((n) == 13, rb_define_singleton_method_13, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_12(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_14(n) RUBY3_ANYARGS_DISPATCH((n) == 14, rb_define_singleton_method_14, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_13(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_15(n) RUBY3_ANYARGS_DISPATCH((n) == 15, rb_define_singleton_method_15, RUBY3_ANYARGS_DISPATCH_rb_define_singleton_method_14(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_protected_method_m2(n) RUBY3_ANYARGS_DISPATCH((n) == -2, rb_define_protected_method_m2, rb_define_protected_method_m3) -# define RUBY3_ANYARGS_DISPATCH_rb_define_protected_method_m1(n) RUBY3_ANYARGS_DISPATCH((n) == -1, rb_define_protected_method_m1, RUBY3_ANYARGS_DISPATCH_rb_define_protected_method_m2(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_protected_method_00(n) RUBY3_ANYARGS_DISPATCH((n) == 0, rb_define_protected_method_00, RUBY3_ANYARGS_DISPATCH_rb_define_protected_method_m1(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_protected_method_01(n) RUBY3_ANYARGS_DISPATCH((n) == 1, rb_define_protected_method_01, RUBY3_ANYARGS_DISPATCH_rb_define_protected_method_00(n)) -# define RUBY3_ANYARGS_DISPATCH_rb_define_protected_method_02(n) RUBY3_ANYARGS_DISPAT (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/