1 //===-- sanitizer_platform.h ------------------------------------*- C++ -*-===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // Common platform macros.
9 //===----------------------------------------------------------------------===//
11 #ifndef SANITIZER_PLATFORM_H
12 #define SANITIZER_PLATFORM_H
14 #if !defined(__linux__) && !defined(__APPLE__) && !defined(_WIN32)
15 # error "This operating system is not supported"
18 #if defined(__linux__)
19 # define SANITIZER_LINUX 1
21 # define SANITIZER_LINUX 0
24 #if defined(__APPLE__)
25 # define SANITIZER_MAC 1
26 # include <TargetConditionals.h>
28 # define SANITIZER_IOS 1
30 # define SANITIZER_IOS 0
33 # define SANITIZER_MAC 0
34 # define SANITIZER_IOS 0
38 # define SANITIZER_WINDOWS 1
40 # define SANITIZER_WINDOWS 0
43 #if defined(__ANDROID__) || defined(ANDROID)
44 # define SANITIZER_ANDROID 1
46 # define SANITIZER_ANDROID 0
49 #define SANITIZER_POSIX (SANITIZER_LINUX || SANITIZER_MAC)
51 #endif // SANITIZER_PLATFORM_H