Home | History | Annotate | Download | only in sanitizer_common
      1 //===-- sanitizer_platform.h ------------------------------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // Common platform macros.
     11 //===----------------------------------------------------------------------===//
     12 
     13 #ifndef SANITIZER_PLATFORM_H
     14 #define SANITIZER_PLATFORM_H
     15 
     16 #if !defined(__linux__) && !defined(__APPLE__) && !defined(_WIN32)
     17 # error "This operating system is not supported"
     18 #endif
     19 
     20 #if defined(__linux__)
     21 # define SANITIZER_LINUX   1
     22 #else
     23 # define SANITIZER_LINUX   0
     24 #endif
     25 
     26 #if defined(__APPLE__)
     27 # define SANITIZER_MAC     1
     28 #else
     29 # define SANITIZER_MAC     0
     30 #endif
     31 
     32 #if defined(_WIN32)
     33 # define SANITIZER_WINDOWS 1
     34 #else
     35 # define SANITIZER_WINDOWS 0
     36 #endif
     37 
     38 #if defined(__ANDROID__) || defined(ANDROID)
     39 # define SANITIZER_ANDROID 1
     40 #else
     41 # define SANITIZER_ANDROID 0
     42 #endif
     43 
     44 #define SANITIZER_POSIX (SANITIZER_LINUX || SANITIZER_MAC)
     45 
     46 #endif // SANITIZER_PLATFORM_H
     47