Don't redefine RB_OBJ_WRITE

RB_OBJ_WRITE already exists in rgengc.h, so we shouldn't redefine it in
gc.h.
This commit is contained in:
Peter Zhu 2023-01-16 11:50:00 -05:00
parent e3336e0929
commit 4fa7d38324
Notes: git 2023-01-18 13:49:52 +00:00
8 changed files with 3 additions and 11 deletions

View File

@ -43,7 +43,6 @@
/* internal/gc.h */ /* internal/gc.h */
#undef NEWOBJ_OF #undef NEWOBJ_OF
#undef RB_NEWOBJ_OF #undef RB_NEWOBJ_OF
#undef RB_OBJ_WRITE
/* internal/hash.h */ /* internal/hash.h */
#undef RHASH_IFNONE #undef RHASH_IFNONE

View File

@ -9,7 +9,6 @@
* @brief Internal header for Class. * @brief Internal header for Class.
*/ */
#include "id_table.h" /* for struct rb_id_table */ #include "id_table.h" /* for struct rb_id_table */
#include "internal/gc.h" /* for RB_OBJ_WRITE */
#include "internal/serial.h" /* for rb_serial_t */ #include "internal/serial.h" /* for rb_serial_t */
#include "internal/static_assert.h" #include "internal/static_assert.h"
#include "ruby/internal/stdbool.h" /* for bool */ #include "ruby/internal/stdbool.h" /* for bool */

View File

@ -21,7 +21,6 @@ struct rb_objspace; /* in vm_core.h */
#ifdef NEWOBJ_OF #ifdef NEWOBJ_OF
# undef NEWOBJ_OF # undef NEWOBJ_OF
# undef RB_NEWOBJ_OF # undef RB_NEWOBJ_OF
# undef RB_OBJ_WRITE
#endif #endif
#define RVALUE_SIZE (sizeof(struct RBasic) + sizeof(VALUE[RBIMPL_RVALUE_EMBED_LEN_MAX])) #define RVALUE_SIZE (sizeof(struct RBasic) + sizeof(VALUE[RBIMPL_RVALUE_EMBED_LEN_MAX]))
@ -63,9 +62,6 @@ struct rb_objspace; /* in vm_core.h */
#endif #endif
#define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem) #define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
#define RB_OBJ_WRITE(a, slot, b) \
rb_obj_write((VALUE)(a), UNALIGNED_MEMBER_ACCESS((VALUE *)(slot)), \
(VALUE)(b), __FILE__, __LINE__)
// We use SIZE_POOL_COUNT number of shape IDs for transitions out of different size pools // We use SIZE_POOL_COUNT number of shape IDs for transitions out of different size pools
// The next available shapd ID will be the SPECIAL_CONST_SHAPE_ID // The next available shapd ID will be the SPECIAL_CONST_SHAPE_ID

View File

@ -11,7 +11,6 @@
#include "ruby/internal/config.h" #include "ruby/internal/config.h"
#include <stddef.h> /* for size_t */ #include <stddef.h> /* for size_t */
#include "internal/array.h" /* for rb_ary_hidden_new_fill */ #include "internal/array.h" /* for rb_ary_hidden_new_fill */
#include "internal/gc.h" /* for RB_OBJ_WRITE */
#include "ruby/internal/stdbool.h" /* for bool */ #include "ruby/internal/stdbool.h" /* for bool */
#include "ruby/ruby.h" /* for rb_block_call_func_t */ #include "ruby/ruby.h" /* for rb_block_call_func_t */

View File

@ -20,6 +20,7 @@
#endif #endif
#include "ruby/ruby.h" /* for VALUE */ #include "ruby/ruby.h" /* for VALUE */
#include "internal/compilers.h" /* for __has_warning */
#include "internal/imemo.h" /* for RB_IMEMO_TMPBUF_PTR */ #include "internal/imemo.h" /* for RB_IMEMO_TMPBUF_PTR */
#include "internal/warnings.h" /* for COMPILER_WARNING_PUSH */ #include "internal/warnings.h" /* for COMPILER_WARNING_PUSH */

View File

@ -10,7 +10,6 @@
*/ */
#include "ruby/internal/config.h" /* for HAVE_LIBGMP */ #include "ruby/internal/config.h" /* for HAVE_LIBGMP */
#include "ruby/ruby.h" /* for struct RBasic */ #include "ruby/ruby.h" /* for struct RBasic */
#include "internal/gc.h" /* for RB_OBJ_WRITE */
#include "internal/numeric.h" /* for INT_POSITIVE_P */ #include "internal/numeric.h" /* for INT_POSITIVE_P */
#include "ruby_assert.h" /* for assert */ #include "ruby_assert.h" /* for assert */

View File

@ -9,7 +9,6 @@
* @brief Internal header for Struct. * @brief Internal header for Struct.
*/ */
#include "ruby/internal/stdbool.h" /* for bool */ #include "ruby/internal/stdbool.h" /* for bool */
#include "internal/gc.h" /* for RB_OBJ_WRITE */
#include "ruby/ruby.h" /* for struct RBasic */ #include "ruby/ruby.h" /* for struct RBasic */
enum { enum {

View File

@ -905,7 +905,7 @@ rb_queue_initialize(int argc, VALUE *argv, VALUE self)
if ((argc = rb_scan_args(argc, argv, "01", &initial)) == 1) { if ((argc = rb_scan_args(argc, argv, "01", &initial)) == 1) {
initial = rb_to_array(initial); initial = rb_to_array(initial);
} }
RB_OBJ_WRITE(self, &q->que, ary_buf_new()); RB_OBJ_WRITE(self, UNALIGNED_MEMBER_ACCESS(&q->que), ary_buf_new());
ccan_list_head_init(queue_waitq(q)); ccan_list_head_init(queue_waitq(q));
if (argc == 1) { if (argc == 1) {
rb_ary_concat(q->que, initial); rb_ary_concat(q->que, initial);
@ -1178,7 +1178,7 @@ rb_szqueue_initialize(VALUE self, VALUE vmax)
rb_raise(rb_eArgError, "queue size must be positive"); rb_raise(rb_eArgError, "queue size must be positive");
} }
RB_OBJ_WRITE(self, &sq->q.que, ary_buf_new()); RB_OBJ_WRITE(self, UNALIGNED_MEMBER_ACCESS(&sq->q.que), ary_buf_new());
ccan_list_head_init(szqueue_waitq(sq)); ccan_list_head_init(szqueue_waitq(sq));
ccan_list_head_init(szqueue_pushq(sq)); ccan_list_head_init(szqueue_pushq(sq));
sq->max = max; sq->max = max;