1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

internal.h (FLEX_ARY_LEN): Add a macro to define a flexible array

Also, use it in iseq.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2018-01-13 11:45:25 +00:00
parent afcd060a92
commit 7da7716159
2 changed files with 10 additions and 9 deletions

View file

@ -2050,6 +2050,15 @@ rb_obj_builtin_type(VALUE obj)
}
#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 */

10
iseq.c
View file

@ -2836,15 +2836,7 @@ struct succ_index_table {
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))