1// Copyright 2019 The Marl Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#include "marl/sanitizers.h"
16
17#ifndef MARL_USE_FIBER_STACK_GUARDS
18#if !defined(NDEBUG) && !ADDRESS_SANITIZER_ENABLED
19#define MARL_USE_FIBER_STACK_GUARDS 1
20#else
21#define MARL_USE_FIBER_STACK_GUARDS 0
22#endif
23#endif // MARL_USE_FIBER_STACK_GUARDS
24
25#if MARL_USE_FIBER_STACK_GUARDS && ADDRESS_SANITIZER_ENABLED
26#warning "ASAN can raise spurious failures when using mmap() allocated stacks"
27#endif
28
29#if defined(_WIN32)
30#include "osfiber_windows.h"
31#elif defined(MARL_FIBERS_USE_UCONTEXT)
32#include "osfiber_ucontext.h"
33#else
34#include "osfiber_asm.h"
35#endif
36