Replace `PACKED_STRUCT` and `PACKED_STRUCT_UNALIGNED`

This commit is contained in:
Nobuyoshi Nakada 2023-02-08 12:21:58 +09:00
Родитель fefe37f98d
Коммит a56d959ed5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7CD2805BFA3770C6
4 изменённых файлов: 15 добавлений и 13 удалений

5
iseq.h
Просмотреть файл

@ -270,10 +270,11 @@ struct iseq_catch_table_entry {
unsigned int sp;
};
PACKED_STRUCT_UNALIGNED(struct iseq_catch_table {
RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN()
struct iseq_catch_table {
unsigned int size;
struct iseq_catch_table_entry entries[FLEX_ARY_LEN];
});
} RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END();
static inline int
iseq_catch_table_bytes(int n)

Просмотреть файл

@ -652,22 +652,24 @@ rb_mutex_allow_trap(VALUE self, int val)
#define queue_waitq(q) UNALIGNED_MEMBER_PTR(q, waitq)
#define queue_list(q) UNALIGNED_MEMBER_PTR(q, que)
PACKED_STRUCT_UNALIGNED(struct rb_queue {
RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN()
struct rb_queue {
struct ccan_list_head waitq;
rb_serial_t fork_gen;
const VALUE que;
int num_waiting;
});
} RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END();
#define szqueue_waitq(sq) UNALIGNED_MEMBER_PTR(sq, q.waitq)
#define szqueue_list(sq) UNALIGNED_MEMBER_PTR(sq, q.que)
#define szqueue_pushq(sq) UNALIGNED_MEMBER_PTR(sq, pushq)
PACKED_STRUCT_UNALIGNED(struct rb_szqueue {
RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN()
struct rb_szqueue {
struct rb_queue q;
int num_waiting_push;
struct ccan_list_head pushq;
long max;
});
} RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END();
static void
queue_mark(void *ptr)

5
time.c
Просмотреть файл

@ -1754,12 +1754,13 @@ localtimew(wideval_t timew, struct vtm *result)
#define TIME_TZMODE_FIXOFF 2
#define TIME_TZMODE_UNINITIALIZED 3
PACKED_STRUCT_UNALIGNED(struct time_object {
RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN()
struct time_object {
wideval_t timew; /* time_t value * TIME_SCALE. possibly Rational. */
struct vtm vtm;
unsigned int tzmode:3; /* 0:localtime 1:utc 2:fixoff 3:uninitialized */
unsigned int tm_got:1;
});
} RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END();
#define GetTimeval(obj, tobj) ((tobj) = get_timeval(obj))
#define GetNewTimeval(obj, tobj) ((tobj) = get_new_timeval(obj))

Просмотреть файл

@ -2,10 +2,8 @@
#define RUBY_TIMEV_H
#include "ruby/ruby.h"
#if 0
struct vtm {/* dummy for TAGS */};
#endif
PACKED_STRUCT_UNALIGNED(struct vtm {
RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN()
struct vtm {
VALUE year; /* 2000 for example. Integer. */
VALUE subsecx; /* 0 <= subsecx < TIME_SCALE. possibly Rational. */
VALUE utc_offset; /* -3600 as -01:00 for example. possibly Rational. */
@ -18,7 +16,7 @@ PACKED_STRUCT_UNALIGNED(struct vtm {
unsigned int sec:6; /* 0..60 */
unsigned int wday:3; /* 0:Sunday, 1:Monday, ..., 6:Saturday 7:init */
unsigned int isdst:2; /* 0:StandardTime 1:DayLightSavingTime 3:init */
});
} RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END();
#define TIME_SCALE 1000000000