1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Workaround for implicit declaration of function 'madvise' on Solaris

On Solaris, madvise(3C) is NOT defined for SUS (XPG4v2) or later,
but MADV_* macros are defined when __EXTENSIONS__ is defined.
This may cause compile error on Solaris 10 with GCC when
"-Werror=implicit-function-declaration" and "-D_XOPEN_SOURCE=600"
are added by configure.
This commit is contained in:
Naohisa Goto 2021-11-29 23:46:48 +09:00
parent 67a1e22589
commit 8287d2f23c
2 changed files with 9 additions and 0 deletions

View file

@ -1107,6 +1107,7 @@ main()
RUBY_APPEND_OPTIONS(CXXFLAGS, -U_XOPEN_SOURCE)
])
])
AC_CHECK_TYPES([caddr_t],[],[],[@%:@include <sys/types.h>])
],
[haiku*], [
LIBS="$LIBS" # m lib is include in root

8
cont.c
View file

@ -16,6 +16,14 @@
#include <sys/mman.h>
#endif
// On Solaris, madvise() is NOT declared for SUS (XPG4v2) or later,
// but MADV_* macros are defined when __EXTENSIONS__ is defined.
#if defined(__sun) && defined(HAVE_CADDR_T) && \
(defined(MADV_FREE) || defined(MADV_DONTNEED))
#include <sys/types.h>
extern int madvise(caddr_t, size_t, int);
#endif
#include COROUTINE_H
#include "eval_intern.h"