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 <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/11729
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
#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 <ucontext.h>
+#undef _XOPEN_SOURCE
+#else
+#include <ucontext.h>
+#endif
#include <cstddef>
#include <cstdint>