[前][次][番号順一覧][スレッド一覧]

ruby-changes:74257

From: Nobuyoshi <ko1@a...>
Date: Wed, 26 Oct 2022 18:57:47 +0900 (JST)
Subject: [ruby-changes:74257] a14611cd54 (master): Fix -Wundef warnings

https://git.ruby-lang.org/ruby.git/commit/?id=a14611cd54

From a14611cd54d2ac02daad5ccfe99fc3ec9b0818bd Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 26 Oct 2022 10:53:10 +0900
Subject: 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 @@ https://github.com/ruby/ruby/blob/trunk/ccan/check_type/check_type.h#L44
  *		 ((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) https://github.com/ruby/ruby/blob/trunk/ccan/container_of/container_of.h#L112
  *		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) https://github.com/ruby/ruby/blob/trunk/ccan/container_of/container_of.h#L131
  * 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 https://github.com/ruby/ruby/blob/trunk/ccan/list/list.h#L770
 	(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 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/intern/gc.h#L26
 # include <stddef.h>                       /* size_t */
 #endif
 
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
 # include <sys/types.h>                    /* 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 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/memory_view.h#L16
 # include <stddef.h>                       /* size_t */
 #endif
 
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
 # include <sys/types.h>                    /* 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 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/util.h#L19
 # include <stddef.h>                       /* size_t */
 #endif
 
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
 # include <sys/types.h>                    /* 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) https://github.com/ruby/ruby/blob/trunk/vm.c#L4031
     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) {
-- 
cgit v1.2.3


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]