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

ruby-changes:66202

From: Nobuyoshi <ko1@a...>
Date: Fri, 14 May 2021 09:40:03 +0900 (JST)
Subject: [ruby-changes:66202] 7cf90f99f5 (master): Refix PAGE_SIZE

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

From 7cf90f99f5674fdadc0ff9d8341b315b2490ea26 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 14 May 2021 09:33:20 +0900
Subject: Refix PAGE_SIZE

* honor actually used headers
* include sys/user.h only when `PAGE_SIZE` is not defined
---
 configure.ac | 11 ++++-------
 gc.c         | 11 +++++++----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/configure.ac b/configure.ac
index ac737f6..da65b16 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2732,14 +2732,11 @@ main(int argc, char *argv[]) https://github.com/ruby/ruby/blob/trunk/configure.ac#L2732
     test x$rb_cv_fork_with_pthread = xyes || AC_DEFINE(CANNOT_FORK_WITH_PTHREAD)
 ])
 
-AS_CASE([$target_os],
-    [darwin*], [ac_cv_header_sys_user_h=no], dnl LIST_HEAD conflicts with sys/queue.h
-    [AC_CHECK_HEADERS([sys/user.h])]
-)
-AS_IF([test "x$ac_cv_func_mmap:$ac_cv_header_sys_user_h" = xyes:yes], [
+AC_CHECK_HEADERS([sys/user.h])
+AS_IF([test "x$ac_cv_func_mmap" = xyes], [
     AC_CACHE_CHECK([whether PAGE_SIZE is compile-time const], rb_cv_const_page_size,
-        [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-            @%:@include <sys/user.h>
+	[malloc_headers=`sed -n '/MALLOC_HEADERS_BEGIN/,/MALLOC_HEADERS_END/p' ${srcdir}/gc.c`
+	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$malloc_headers
             typedef char conftest_page[PAGE_SIZE];
         ]], [[]])],
         [rb_cv_const_page_size=yes],
diff --git a/gc.c b/gc.c
index 365210b..8b36b6c 100644
--- a/gc.c
+++ b/gc.c
@@ -32,6 +32,7 @@ https://github.com/ruby/ruby/blob/trunk/gc.c#L32
 #include <stdarg.h>
 #include <stdio.h>
 
+/* MALLOC_HEADERS_BEGIN */
 #ifndef HAVE_MALLOC_USABLE_SIZE
 # ifdef _WIN32
 #  define HAVE_MALLOC_USABLE_SIZE
@@ -54,6 +55,12 @@ https://github.com/ruby/ruby/blob/trunk/gc.c#L55
 # endif
 #endif
 
+#if !defined(PAGE_SIZE) && defined(HAVE_SYS_USER_H)
+/* LIST_HEAD conflicts with sys/queue.h on macOS */
+# include <sys/user.h>
+#endif
+/* MALLOC_HEADERS_END */
+
 #ifdef HAVE_SYS_TIME_H
 # include <sys/time.h>
 #endif
@@ -71,10 +78,6 @@ https://github.com/ruby/ruby/blob/trunk/gc.c#L78
 
 #include <sys/types.h>
 
-#ifdef HAVE_SYS_USER_H
-# include <sys/user.h>
-#endif
-
 #ifdef __EMSCRIPTEN__
 #include <emscripten.h>
 #endif
-- 
cgit v1.1


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

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