2015-03-07 01:35:00 +08:00
|
|
|
#ifndef BENCHMARK_INTERNAL_MACROS_H_
|
|
|
|
#define BENCHMARK_INTERNAL_MACROS_H_
|
|
|
|
|
2017-07-05 06:31:47 +08:00
|
|
|
#include "benchmark/benchmark.h"
|
2015-03-07 01:35:00 +08:00
|
|
|
|
2018-06-05 18:36:26 +08:00
|
|
|
/* Needed to detect STL */
|
|
|
|
#include <cstdlib>
|
|
|
|
|
2018-06-01 18:14:19 +08:00
|
|
|
// clang-format off
|
|
|
|
|
2015-03-07 01:35:00 +08:00
|
|
|
#ifndef __has_feature
|
2016-10-08 02:35:03 +08:00
|
|
|
#define __has_feature(x) 0
|
2015-03-07 01:35:00 +08:00
|
|
|
#endif
|
|
|
|
|
2016-09-03 13:54:58 +08:00
|
|
|
#if defined(__clang__)
|
2020-10-21 23:39:54 +08:00
|
|
|
#if defined(__ibmxl__)
|
|
|
|
#if !defined(COMPILER_IBMXL)
|
|
|
|
#define COMPILER_IBMXL
|
|
|
|
#endif
|
|
|
|
#elif !defined(COMPILER_CLANG)
|
2018-01-12 09:22:45 +08:00
|
|
|
#define COMPILER_CLANG
|
|
|
|
#endif
|
2016-09-03 13:54:58 +08:00
|
|
|
#elif defined(_MSC_VER)
|
2018-01-12 09:22:45 +08:00
|
|
|
#if !defined(COMPILER_MSVC)
|
|
|
|
#define COMPILER_MSVC
|
|
|
|
#endif
|
2016-09-03 13:54:58 +08:00
|
|
|
#elif defined(__GNUC__)
|
2018-01-12 09:22:45 +08:00
|
|
|
#if !defined(COMPILER_GCC)
|
|
|
|
#define COMPILER_GCC
|
|
|
|
#endif
|
2016-09-03 13:54:58 +08:00
|
|
|
#endif
|
|
|
|
|
2016-09-03 14:13:20 +08:00
|
|
|
#if __has_feature(cxx_attributes)
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_NORETURN [[noreturn]]
|
2015-03-07 01:35:00 +08:00
|
|
|
#elif defined(__GNUC__)
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_NORETURN __attribute__((noreturn))
|
2016-09-03 14:13:20 +08:00
|
|
|
#elif defined(COMPILER_MSVC)
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_NORETURN __declspec(noreturn)
|
2015-03-07 01:35:00 +08:00
|
|
|
#else
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_NORETURN
|
2015-03-07 01:35:00 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__CYGWIN__)
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_OS_CYGWIN 1
|
2015-03-07 01:35:00 +08:00
|
|
|
#elif defined(_WIN32)
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_OS_WINDOWS 1
|
2022-02-02 17:16:19 +08:00
|
|
|
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
|
|
|
#define BENCHMARK_OS_WINDOWS_WIN32 1
|
|
|
|
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
|
|
|
#define BENCHMARK_OS_WINDOWS_RT 1
|
|
|
|
#endif
|
2018-09-19 18:52:05 +08:00
|
|
|
#if defined(__MINGW32__)
|
|
|
|
#define BENCHMARK_OS_MINGW 1
|
|
|
|
#endif
|
2015-03-07 01:35:00 +08:00
|
|
|
#elif defined(__APPLE__)
|
2018-03-23 19:45:15 +08:00
|
|
|
#define BENCHMARK_OS_APPLE 1
|
2018-01-12 09:22:45 +08:00
|
|
|
#include "TargetConditionals.h"
|
2017-01-25 03:31:14 +08:00
|
|
|
#if defined(TARGET_OS_MAC)
|
|
|
|
#define BENCHMARK_OS_MACOSX 1
|
|
|
|
#if defined(TARGET_OS_IPHONE)
|
|
|
|
#define BENCHMARK_OS_IOS 1
|
|
|
|
#endif
|
|
|
|
#endif
|
2015-03-07 01:35:00 +08:00
|
|
|
#elif defined(__FreeBSD__)
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_OS_FREEBSD 1
|
2017-11-18 00:46:08 +08:00
|
|
|
#elif defined(__NetBSD__)
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_OS_NETBSD 1
|
2018-05-02 18:26:43 +08:00
|
|
|
#elif defined(__OpenBSD__)
|
|
|
|
#define BENCHMARK_OS_OPENBSD 1
|
2020-10-13 04:41:49 +08:00
|
|
|
#elif defined(__DragonFly__)
|
|
|
|
#define BENCHMARK_OS_DRAGONFLY 1
|
2015-03-07 01:35:00 +08:00
|
|
|
#elif defined(__linux__)
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_OS_LINUX 1
|
2017-02-11 18:31:40 +08:00
|
|
|
#elif defined(__native_client__)
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_OS_NACL 1
|
2018-05-03 16:34:26 +08:00
|
|
|
#elif defined(__EMSCRIPTEN__)
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_OS_EMSCRIPTEN 1
|
2017-07-07 06:59:13 +08:00
|
|
|
#elif defined(__rtems__)
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_OS_RTEMS 1
|
2018-02-15 05:17:12 +08:00
|
|
|
#elif defined(__Fuchsia__)
|
|
|
|
#define BENCHMARK_OS_FUCHSIA 1
|
2018-03-02 19:53:58 +08:00
|
|
|
#elif defined (__SVR4) && defined (__sun)
|
|
|
|
#define BENCHMARK_OS_SOLARIS 1
|
2019-02-19 21:05:55 +08:00
|
|
|
#elif defined(__QNX__)
|
|
|
|
#define BENCHMARK_OS_QNX 1
|
2020-10-21 23:39:54 +08:00
|
|
|
#elif defined(__MVS__)
|
|
|
|
#define BENCHMARK_OS_ZOS 1
|
2015-03-07 01:35:00 +08:00
|
|
|
#endif
|
|
|
|
|
2018-06-05 18:36:26 +08:00
|
|
|
#if defined(__ANDROID__) && defined(__GLIBCXX__)
|
|
|
|
#define BENCHMARK_STL_ANDROID_GNUSTL 1
|
|
|
|
#endif
|
|
|
|
|
2016-12-06 01:24:09 +08:00
|
|
|
#if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \
|
|
|
|
&& !defined(__EXCEPTIONS)
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_HAS_NO_EXCEPTIONS
|
2016-12-06 01:24:09 +08:00
|
|
|
#endif
|
|
|
|
|
2017-11-23 00:33:52 +08:00
|
|
|
#if defined(COMPILER_CLANG) || defined(COMPILER_GCC)
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_MAYBE_UNUSED __attribute__((unused))
|
2017-11-23 00:33:52 +08:00
|
|
|
#else
|
2018-01-12 09:22:45 +08:00
|
|
|
#define BENCHMARK_MAYBE_UNUSED
|
2017-11-23 00:33:52 +08:00
|
|
|
#endif
|
|
|
|
|
2018-06-01 18:14:19 +08:00
|
|
|
// clang-format on
|
|
|
|
|
2016-10-08 02:35:03 +08:00
|
|
|
#endif // BENCHMARK_INTERNAL_MACROS_H_
|