chromium/third_party/google_benchmark/src/src/internal_macros.h

#ifndef BENCHMARK_INTERNAL_MACROS_H_
#define BENCHMARK_INTERNAL_MACROS_H_

/* Needed to detect STL */
#include <cstdlib>

// clang-format off

#ifndef __has_feature
#define __has_feature
#endif

#if defined(__clang__)
  #if defined(__ibmxl__)
    #if !defined(COMPILER_IBMXL)
      #define COMPILER_IBMXL
    #endif
  #elif !defined(COMPILER_CLANG)
    #define COMPILER_CLANG
  #endif
#elif defined(_MSC_VER)
  #if !defined(COMPILER_MSVC)
    #define COMPILER_MSVC
  #endif
#elif defined(__GNUC__)
  #if !defined(COMPILER_GCC)
    #define COMPILER_GCC
  #endif
#endif

#if __has_feature(cxx_attributes)
  #define BENCHMARK_NORETURN
#elif defined(__GNUC__)
  #define BENCHMARK_NORETURN
#elif defined(COMPILER_MSVC)
  #define BENCHMARK_NORETURN
#else
  #define BENCHMARK_NORETURN
#endif

#if defined(__CYGWIN__)
  #define BENCHMARK_OS_CYGWIN
#elif defined(_WIN32)
  #define BENCHMARK_OS_WINDOWS
  // WINAPI_FAMILY_PARTITION is defined in winapifamily.h.
  // We include windows.h which implicitly includes winapifamily.h for compatibility.
  #ifndef NOMINMAX
    #define NOMINMAX
  #endif
  #include <windows.h>
  #if defined(WINAPI_FAMILY_PARTITION)
    #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
      #define BENCHMARK_OS_WINDOWS_WIN32
    #elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
      #define BENCHMARK_OS_WINDOWS_RT
    #endif
  #endif
  #if defined(__MINGW32__)
    #define BENCHMARK_OS_MINGW
  #endif
#elif defined(__APPLE__)
  #define BENCHMARK_OS_APPLE
  #include "TargetConditionals.h"
  #if defined(TARGET_OS_MAC)
    #define BENCHMARK_OS_MACOSX
    #if defined(TARGET_OS_IPHONE)
      #define BENCHMARK_OS_IOS
    #endif
  #endif
#elif defined(__FreeBSD__)
  #define BENCHMARK_OS_FREEBSD
#elif defined(__NetBSD__)
  #define BENCHMARK_OS_NETBSD
#elif defined(__OpenBSD__)
  #define BENCHMARK_OS_OPENBSD
#elif defined(__DragonFly__)
  #define BENCHMARK_OS_DRAGONFLY
#elif defined(__linux__)
  #define BENCHMARK_OS_LINUX
#elif defined(__native_client__)
  #define BENCHMARK_OS_NACL
#elif defined(__EMSCRIPTEN__)
  #define BENCHMARK_OS_EMSCRIPTEN
#elif defined(__rtems__)
  #define BENCHMARK_OS_RTEMS
#elif defined(__Fuchsia__)
#define BENCHMARK_OS_FUCHSIA
#elif defined (__SVR4) && defined (__sun)
#define BENCHMARK_OS_SOLARIS
#elif defined(__QNX__)
#define BENCHMARK_OS_QNX
#elif defined(__MVS__)
#define BENCHMARK_OS_ZOS
#elif defined(__hexagon__)
#define BENCHMARK_OS_QURT
#endif

#if defined(__ANDROID__) && defined(__GLIBCXX__)
#define BENCHMARK_STL_ANDROID_GNUSTL
#endif

#if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \
     && !defined(__EXCEPTIONS)
  #define BENCHMARK_HAS_NO_EXCEPTIONS
#endif

#if defined(COMPILER_CLANG) || defined(COMPILER_GCC)
  #define BENCHMARK_MAYBE_UNUSED
#else
  #define BENCHMARK_MAYBE_UNUSED
#endif

// clang-format on

#endif  // BENCHMARK_INTERNAL_MACROS_H_