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

ruby-changes:51780

From: tenderlove <ko1@a...>
Date: Wed, 18 Jul 2018 07:27:57 +0900 (JST)
Subject: [ruby-changes:51780] tenderlove:r63992 (trunk): Include the alternative malloc header instead of malloc.h

tenderlove	2018-07-18 07:27:52 +0900 (Wed, 18 Jul 2018)

  New Revision: 63992

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63992

  Log:
    Include the alternative malloc header instead of malloc.h
    
    This commit fixes a build error on systems that have
    `malloc_usable_size` but also enable jemalloc via `--with-jemalloc`.
    For example, Ubuntu Precise defines `malloc_usable_size` in malloc.h, so
    gc.c will include malloc.h.  This definition conflicts with jemalloc's
    definition, so the following error occurs:
    
    ```
    compiling gc.c
    compiling hash.c
    In file included from gc.c:50:0:
    /usr/include/malloc.h:152:15: error: conflicting types for 'malloc_usable_size'
    /usr/include/jemalloc/jemalloc.h:45:8: note: previous declaration of 'malloc_usable_size' was here
    cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
    cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
    cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
    cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
    ```
    
    Since jemalloc always defines `malloc_usable_size`, this patch just
    includes the jemalloc header instead of malloc.h if it's available.

  Modified files:
    trunk/gc.c
Index: gc.c
===================================================================
--- gc.c	(revision 63991)
+++ gc.c	(revision 63992)
@@ -49,7 +49,9 @@ https://github.com/ruby/ruby/blob/trunk/gc.c#L49
 # endif
 #endif
 #ifdef HAVE_MALLOC_USABLE_SIZE
-# ifdef HAVE_MALLOC_H
+# ifdef RUBY_ALTERNATIVE_MALLOC_HEADER
+#  include RUBY_ALTERNATIVE_MALLOC_HEADER
+# elif HAVE_MALLOC_H
 #  include <malloc.h>
 # elif defined(HAVE_MALLOC_NP_H)
 #  include <malloc_np.h>

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

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