ruby-changes:49687
From: mame <ko1@a...>
Date: Sat, 13 Jan 2018 20:45:30 +0900 (JST)
Subject: [ruby-changes:49687] mame:r61804 (trunk): internal.h (FLEX_ARY_LEN): Add a macro to define a flexible array
mame 2018-01-13 20:45:25 +0900 (Sat, 13 Jan 2018) New Revision: 61804 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61804 Log: internal.h (FLEX_ARY_LEN): Add a macro to define a flexible array Also, use it in iseq.c. Modified files: trunk/internal.h trunk/iseq.c Index: internal.h =================================================================== --- internal.h (revision 61803) +++ internal.h (revision 61804) @@ -2050,6 +2050,15 @@ rb_obj_builtin_type(VALUE obj) https://github.com/ruby/ruby/blob/trunk/internal.h#L2050 } #endif +/* A macro for defining a flexible array, like: VALUE ary[FLEX_ARY_LEN]; */ +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +# define FLEX_ARY_LEN /* VALUE ary[]; */ +#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) +# define FLEX_ARY_LEN 0 /* VALUE ary[0]; */ +#else +# define FLEX_ARY_LEN 1 /* VALUE ary[1]; */ +#endif + #if defined(__cplusplus) #if 0 { /* satisfy cc-mode */ Index: iseq.c =================================================================== --- iseq.c (revision 61803) +++ iseq.c (revision 61804) @@ -2836,15 +2836,7 @@ struct succ_index_table { https://github.com/ruby/ruby/blob/trunk/iseq.c#L2836 unsigned int rank; uint64_t small_block_ranks; /* 9 bits * 7 = 63 bits */ uint64_t bits[512/64]; - } succ_part[ -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) - /* flexible array member */ -#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) - 0 -#else - 1 -#endif - ]; + } succ_part[FLEX_ARY_LEN]; } succ_index_table; #define imm_block_rank_set(v, i, r) (v) |= (uint64_t)(r) << (7 * (i)) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/