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

Fix -Wundef warnings

This commit is contained in:
Nobuyoshi Nakada 2022-10-26 10:53:10 +09:00
parent 287eac5e8e
commit a14611cd54
Notes: git 2022-10-26 09:57:47 +00:00
7 changed files with 8 additions and 8 deletions

View file

@ -44,7 +44,7 @@
* ((encl_type *) \ * ((encl_type *) \
* ((char *)(mbr_ptr) - offsetof(enclosing_type, mbr)))) * ((char *)(mbr_ptr) - offsetof(enclosing_type, mbr))))
*/ */
#if HAVE_TYPEOF #if defined(HAVE_TYPEOF) && HAVE_TYPEOF
#define ccan_check_type(expr, type) \ #define ccan_check_type(expr, type) \
((typeof(expr) *)0 != (type *)0) ((typeof(expr) *)0 != (type *)0)

View file

@ -112,7 +112,7 @@ static inline char *container_of_or_null_(void *member_ptr, size_t offset)
* return i; * return i;
* } * }
*/ */
#if HAVE_TYPEOF #if defined(HAVE_TYPEOF) && HAVE_TYPEOF
#define ccan_container_of_var(member_ptr, container_var, member) \ #define ccan_container_of_var(member_ptr, container_var, member) \
ccan_container_of(member_ptr, typeof(*container_var), member) ccan_container_of(member_ptr, typeof(*container_var), member)
#else #else
@ -131,7 +131,7 @@ static inline char *container_of_or_null_(void *member_ptr, size_t offset)
* structure memory layout. * structure memory layout.
* *
*/ */
#if HAVE_TYPEOF #if defined(HAVE_TYPEOF) && HAVE_TYPEOF
#define ccan_container_off_var(var, member) \ #define ccan_container_off_var(var, member) \
ccan_container_off(typeof(*var), member) ccan_container_off(typeof(*var), member)
#else #else

View file

@ -770,7 +770,7 @@ static inline struct ccan_list_node *ccan_list_node_from_off_(void *ptr, size_t
(ccan_container_off_var(var, member) + \ (ccan_container_off_var(var, member) + \
ccan_check_type(var->member, struct ccan_list_node)) ccan_check_type(var->member, struct ccan_list_node))
#if HAVE_TYPEOF #if defined(HAVE_TYPEOF) && HAVE_TYPEOF
#define ccan_list_typeof(var) typeof(var) #define ccan_list_typeof(var) typeof(var)
#else #else
#define ccan_list_typeof(var) void * #define ccan_list_typeof(var) void *

View file

@ -26,7 +26,7 @@
# include <stddef.h> /* size_t */ # include <stddef.h> /* size_t */
#endif #endif
#if HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h> /* ssize_t */ # include <sys/types.h> /* ssize_t */
#endif #endif

View file

@ -16,7 +16,7 @@
# include <stddef.h> /* size_t */ # include <stddef.h> /* size_t */
#endif #endif
#if HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h> /* ssize_t */ # include <sys/types.h> /* ssize_t */
#endif #endif

View file

@ -19,7 +19,7 @@
# include <stddef.h> /* size_t */ # include <stddef.h> /* size_t */
#endif #endif
#if HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h> /* ssize_t */ # include <sys/types.h> /* ssize_t */
#endif #endif

2
vm.c
View file

@ -4031,7 +4031,7 @@ Init_vm_objects(void)
vm->loading_table = st_init_strtable(); vm->loading_table = st_init_strtable();
vm->frozen_strings = st_init_table_with_size(&rb_fstring_hash_type, 10000); vm->frozen_strings = st_init_table_with_size(&rb_fstring_hash_type, 10000);
#if HAVE_MMAP #ifdef HAVE_MMAP
vm->shape_list = (rb_shape_t *)mmap(NULL, rb_size_mul_or_raise(SHAPE_BITMAP_SIZE * 32, sizeof(rb_shape_t), rb_eRuntimeError), vm->shape_list = (rb_shape_t *)mmap(NULL, rb_size_mul_or_raise(SHAPE_BITMAP_SIZE * 32, sizeof(rb_shape_t), rb_eRuntimeError),
PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (vm->shape_list == MAP_FAILED) { if (vm->shape_list == MAP_FAILED) {