зеркало из https://github.com/github/ruby.git
Avoid the pointer hack in RCLASS_EXT
... because GCC 13 warns it. ``` In file included from class.c:24: In function ‘RCLASS_SET_ALLOCATOR’, inlined from ‘class_alloc’ at class.c:251:5, inlined from ‘rb_module_s_alloc’ at class.c:1045:17: internal/class.h:159:43: warning: array subscript 0 is outside array bounds of ‘rb_classext_t[0]’ {aka ‘struct rb_classext_struct[]’} [-Warray-bounds=] 159 | RCLASS_EXT(klass)->as.class.allocator = allocator; | ^ ``` https://rubyci.s3.amazonaws.com/arch/ruby-master/log/20231015T030003Z.log.html.gz
This commit is contained in:
Родитель
985b0244da
Коммит
591336a0f2
|
@ -85,7 +85,12 @@ struct RClass {
|
|||
// Assert that classes can be embedded in size_pools[2] (which has 160B slot size)
|
||||
STATIC_ASSERT(sizeof_rb_classext_t, sizeof(struct RClass) + sizeof(rb_classext_t) <= 4 * RVALUE_SIZE);
|
||||
|
||||
#define RCLASS_EXT(c) ((rb_classext_t *)((char *)(c) + sizeof(struct RClass)))
|
||||
struct RClass_and_rb_classext_t {
|
||||
struct RClass rclass;
|
||||
rb_classext_t classext;
|
||||
};
|
||||
|
||||
#define RCLASS_EXT(c) (&((struct RClass_and_rb_classext_t*)(c))->classext)
|
||||
#define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl)
|
||||
#define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
|
||||
#define RCLASS_IVPTR(c) (RCLASS_EXT(c)->iv_ptr)
|
||||
|
|
Загрузка…
Ссылка в новой задаче