diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-07-17 22:27:52 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-07-17 22:27:52 +0000 |
commit | 0fe8b0ea8f551b2604898263caabd51ae39c2752 (patch) | |
tree | 5bfc927f545e00c00e2fc5aaea51c8b0a60c406f /gc.c | |
parent | 8cb45af0d8d378822ad77d99b6e74f97159b1d27 (diff) | |
download | ruby-0fe8b0ea8f551b2604898263caabd51ae39c2752.tar.gz |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -49,7 +49,9 @@ # 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> |