From a14611cd54d2ac02daad5ccfe99fc3ec9b0818bd Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 26 Oct 2022 10:53:10 +0900 Subject: [PATCH] Fix -Wundef warnings --- ccan/check_type/check_type.h | 2 +- ccan/container_of/container_of.h | 4 ++-- ccan/list/list.h | 2 +- include/ruby/internal/intern/gc.h | 2 +- include/ruby/memory_view.h | 2 +- include/ruby/util.h | 2 +- vm.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ccan/check_type/check_type.h b/ccan/check_type/check_type.h index e795ad71d0..659e1a5a83 100644 --- a/ccan/check_type/check_type.h +++ b/ccan/check_type/check_type.h @@ -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) diff --git a/ccan/container_of/container_of.h b/ccan/container_of/container_of.h index b30c347d57..872bb6ea6e 100644 --- a/ccan/container_of/container_of.h +++ b/ccan/container_of/container_of.h @@ -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 diff --git a/ccan/list/list.h b/ccan/list/list.h index 91787bfdb3..30b2af04e9 100644 --- a/ccan/list/list.h +++ b/ccan/list/list.h @@ -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 * diff --git a/include/ruby/internal/intern/gc.h b/include/ruby/internal/intern/gc.h index e7b8008729..ae79498cf3 100644 --- a/include/ruby/internal/intern/gc.h +++ b/include/ruby/internal/intern/gc.h @@ -26,7 +26,7 @@ # include /* size_t */ #endif -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include /* ssize_t */ #endif diff --git a/include/ruby/memory_view.h b/include/ruby/memory_view.h index 83931038a0..1ddca2d46f 100644 --- a/include/ruby/memory_view.h +++ b/include/ruby/memory_view.h @@ -16,7 +16,7 @@ # include /* size_t */ #endif -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include /* ssize_t */ #endif diff --git a/include/ruby/util.h b/include/ruby/util.h index f0ea874322..e8727a3200 100644 --- a/include/ruby/util.h +++ b/include/ruby/util.h @@ -19,7 +19,7 @@ # include /* size_t */ #endif -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include /* ssize_t */ #endif diff --git a/vm.c b/vm.c index 7f7ae3a6d6..0077522317 100644 --- a/vm.c +++ b/vm.c @@ -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) {