Home | History | Annotate | Download | only in src
      1 #ifndef BENCHMARK_INTERNAL_MACROS_H_
      2 #define BENCHMARK_INTERNAL_MACROS_H_
      3 
      4 #include "benchmark/macros.h"
      5 
      6 #ifndef __has_feature
      7 #define __has_feature(x) 0
      8 #endif
      9 
     10 #if defined(__clang__)
     11 #define COMPILER_CLANG
     12 #elif defined(_MSC_VER)
     13 #define COMPILER_MSVC
     14 #elif defined(__GNUC__)
     15 #define COMPILER_GCC
     16 #endif
     17 
     18 #if __has_feature(cxx_attributes)
     19 #define BENCHMARK_NORETURN [[noreturn]]
     20 #elif defined(__GNUC__)
     21 #define BENCHMARK_NORETURN __attribute__((noreturn))
     22 #elif defined(COMPILER_MSVC)
     23 #define BENCHMARK_NORETURN __declspec(noreturn)
     24 #else
     25 #define BENCHMARK_NORETURN
     26 #endif
     27 
     28 #if defined(__CYGWIN__)
     29 #define BENCHMARK_OS_CYGWIN 1
     30 #elif defined(_WIN32)
     31 #define BENCHMARK_OS_WINDOWS 1
     32 #elif defined(__APPLE__)
     33 #include "TargetConditionals.h"
     34   #if defined(TARGET_OS_MAC)
     35     #define BENCHMARK_OS_MACOSX 1
     36     #if defined(TARGET_OS_IPHONE)
     37       #define BENCHMARK_OS_IOS 1
     38     #endif
     39   #endif
     40 #elif defined(__FreeBSD__)
     41 #define BENCHMARK_OS_FREEBSD 1
     42 #elif defined(__linux__)
     43 #define BENCHMARK_OS_LINUX 1
     44 #elif defined(__native_client__)
     45 #define BENCHMARK_OS_NACL 1
     46 #elif defined(EMSCRIPTEN)
     47 #define BENCHMARK_OS_EMSCRIPTEN 1
     48 #endif
     49 
     50 #if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \
     51      && !defined(__EXCEPTIONS)
     52 #define BENCHMARK_HAS_NO_EXCEPTIONS
     53 #endif
     54 
     55 #endif  // BENCHMARK_INTERNAL_MACROS_H_
     56