From 8287d2f23c06c614d1ae83b6e0dad48bcda622cb Mon Sep 17 00:00:00 2001 From: Naohisa Goto Date: Mon, 29 Nov 2021 23:46:48 +0900 Subject: 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. --- cont.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cont.c') diff --git a/cont.c b/cont.c index 8a56fa6735..2af7971a9a 100644 --- a/cont.c +++ b/cont.c @@ -16,6 +16,14 @@ #include #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 +extern int madvise(caddr_t, size_t, int); +#endif + #include COROUTINE_H #include "eval_intern.h" -- cgit v1.2.1