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 *) \
* ((char *)(mbr_ptr) - offsetof(enclosing_type, mbr))))
*/
#if HAVE_TYPEOF
#if defined(HAVE_TYPEOF) && HAVE_TYPEOF
#define ccan_check_type(expr, type) \
((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;
* }
*/
#if HAVE_TYPEOF
#if defined(HAVE_TYPEOF) && HAVE_TYPEOF
#define ccan_container_of_var(member_ptr, container_var, member) \
ccan_container_of(member_ptr, typeof(*container_var), member)
#else
@ -131,7 +131,7 @@ static inline char *container_of_or_null_(void *member_ptr, size_t offset)
* structure memory layout.
*
*/
#if HAVE_TYPEOF
#if defined(HAVE_TYPEOF) && HAVE_TYPEOF
#define ccan_container_off_var(var, member) \
ccan_container_off(typeof(*var), member)
#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_check_type(var->member, struct ccan_list_node))
#if HAVE_TYPEOF
#if defined(HAVE_TYPEOF) && HAVE_TYPEOF
#define ccan_list_typeof(var) typeof(var)
#else
#define ccan_list_typeof(var) void *

View File

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

View File

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

View File

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

2
vm.c
View File

@ -4031,7 +4031,7 @@ Init_vm_objects(void)
vm->loading_table = st_init_strtable();
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),
PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (vm->shape_list == MAP_FAILED) {