libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

internal_macros.h (2220B)


      1 #ifndef BENCHMARK_INTERNAL_MACROS_H_
      2 #define BENCHMARK_INTERNAL_MACROS_H_
      3 
      4 #include "benchmark/benchmark.h"
      5 
      6 /* Needed to detect STL */
      7 #include <cstdlib>
      8 
      9 // clang-format off
     10 
     11 #ifndef __has_feature
     12 #define __has_feature(x) 0
     13 #endif
     14 
     15 #if defined(__clang__)
     16   #if !defined(COMPILER_CLANG)
     17     #define COMPILER_CLANG
     18   #endif
     19 #elif defined(_MSC_VER)
     20   #if !defined(COMPILER_MSVC)
     21     #define COMPILER_MSVC
     22   #endif
     23 #elif defined(__GNUC__)
     24   #if !defined(COMPILER_GCC)
     25     #define COMPILER_GCC
     26   #endif
     27 #endif
     28 
     29 #if __has_feature(cxx_attributes)
     30   #define BENCHMARK_NORETURN [[noreturn]]
     31 #elif defined(__GNUC__)
     32   #define BENCHMARK_NORETURN __attribute__((noreturn))
     33 #elif defined(COMPILER_MSVC)
     34   #define BENCHMARK_NORETURN __declspec(noreturn)
     35 #else
     36   #define BENCHMARK_NORETURN
     37 #endif
     38 
     39 #if defined(__CYGWIN__)
     40   #define BENCHMARK_OS_CYGWIN 1
     41 #elif defined(_WIN32)
     42   #define BENCHMARK_OS_WINDOWS 1
     43   #if defined(__MINGW32__)
     44     #define BENCHMARK_OS_MINGW 1
     45   #endif
     46 #elif defined(__APPLE__)
     47   #define BENCHMARK_OS_APPLE 1
     48   #include "TargetConditionals.h"
     49   #if defined(TARGET_OS_MAC)
     50     #define BENCHMARK_OS_MACOSX 1
     51     #if defined(TARGET_OS_IPHONE)
     52       #define BENCHMARK_OS_IOS 1
     53     #endif
     54   #endif
     55 #elif defined(__FreeBSD__)
     56   #define BENCHMARK_OS_FREEBSD 1
     57 #elif defined(__NetBSD__)
     58   #define BENCHMARK_OS_NETBSD 1
     59 #elif defined(__OpenBSD__)
     60   #define BENCHMARK_OS_OPENBSD 1
     61 #elif defined(__linux__)
     62   #define BENCHMARK_OS_LINUX 1
     63 #elif defined(__native_client__)
     64   #define BENCHMARK_OS_NACL 1
     65 #elif defined(__EMSCRIPTEN__)
     66   #define BENCHMARK_OS_EMSCRIPTEN 1
     67 #elif defined(__rtems__)
     68   #define BENCHMARK_OS_RTEMS 1
     69 #elif defined(__Fuchsia__)
     70 #define BENCHMARK_OS_FUCHSIA 1
     71 #elif defined (__SVR4) && defined (__sun)
     72 #define BENCHMARK_OS_SOLARIS 1
     73 #endif
     74 
     75 #if defined(__ANDROID__) && defined(__GLIBCXX__)
     76 #define BENCHMARK_STL_ANDROID_GNUSTL 1
     77 #endif
     78 
     79 #if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \
     80      && !defined(__EXCEPTIONS)
     81   #define BENCHMARK_HAS_NO_EXCEPTIONS
     82 #endif
     83 
     84 #if defined(COMPILER_CLANG) || defined(COMPILER_GCC)
     85   #define BENCHMARK_MAYBE_UNUSED __attribute__((unused))
     86 #else
     87   #define BENCHMARK_MAYBE_UNUSED
     88 #endif
     89 
     90 // clang-format on
     91 
     92 #endif  // BENCHMARK_INTERNAL_MACROS_H_