From: Giacomo Travaglini Date: Tue, 17 Jul 2018 09:42:06 +0000 (+0100) Subject: base: Fix ucontext compilation error for macOS X-Git-Tag: v19.0.0.0~1973 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=25f467ed78f7bf4a4523969b7e35ae770340bb94;p=gem5.git base: Fix ucontext compilation error for macOS ucontext functions (like getcontext, setcontext etc) have been marked as deprecated and are hence hidden in latest macOS releases. This patch uncovers them; warnings wil be produced but compilation won't fail since -Wno-error=deprecated-declarations flag is currently used. Change-Id: Ic10e6f77a38875828b1891eaed2f0626ecffff67 Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/11729 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- diff --git a/src/base/fiber.hh b/src/base/fiber.hh index b9f0683a5..5f7285b29 100644 --- a/src/base/fiber.hh +++ b/src/base/fiber.hh @@ -30,7 +30,16 @@ #ifndef __BASE_FIBER_HH__ #define __BASE_FIBER_HH__ +// ucontext functions (like getcontext, setcontext etc) have been marked +// as deprecated and are hence hidden in latest macOS releases. +// By defining _XOPEN_SOURCE we make them available at compilation time. +#if defined(__APPLE__) && defined(__MACH__) +#define _XOPEN_SOURCE 600 #include +#undef _XOPEN_SOURCE +#else +#include +#endif #include #include