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
|
|
|
|
|
|
|
#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__)
|
2016-10-08 02:35:03 +08:00
|
|
|
#define COMPILER_CLANG
|
2016-09-03 13:54:58 +08:00
|
|
|
#elif defined(_MSC_VER)
|
2016-10-08 02:35:03 +08:00
|
|
|
#define COMPILER_MSVC
|
2016-09-03 13:54:58 +08:00
|
|
|
#elif defined(__GNUC__)
|
2016-10-08 02:35:03 +08:00
|
|
|
#define COMPILER_GCC
|
2016-09-03 13:54:58 +08:00
|
|
|
#endif
|
|
|
|
|
2016-09-03 14:13:20 +08:00
|
|
|
#if __has_feature(cxx_attributes)
|
2016-10-08 02:35:03 +08:00
|
|
|
#define BENCHMARK_NORETURN [[noreturn]]
|
2015-03-07 01:35:00 +08:00
|
|
|
#elif defined(__GNUC__)
|
2016-10-08 02:35:03 +08:00
|
|
|
#define BENCHMARK_NORETURN __attribute__((noreturn))
|
2016-09-03 14:13:20 +08:00
|
|
|
#elif defined(COMPILER_MSVC)
|
2016-10-08 02:35:03 +08:00
|
|
|
#define BENCHMARK_NORETURN __declspec(noreturn)
|
2015-03-07 01:35:00 +08:00
|
|
|
#else
|
2016-10-08 02:35:03 +08:00
|
|
|
#define BENCHMARK_NORETURN
|
2015-03-07 01:35:00 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__CYGWIN__)
|
2016-10-08 02:35:03 +08:00
|
|
|
#define BENCHMARK_OS_CYGWIN 1
|
2015-03-07 01:35:00 +08:00
|
|
|
#elif defined(_WIN32)
|
2016-10-08 02:35:03 +08:00
|
|
|
#define BENCHMARK_OS_WINDOWS 1
|
2015-03-07 01:35:00 +08:00
|
|
|
#elif defined(__APPLE__)
|
2017-01-25 03:31:14 +08:00
|
|
|
#include "TargetConditionals.h"
|
|
|
|
#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__)
|
2016-10-08 02:35:03 +08:00
|
|
|
#define BENCHMARK_OS_FREEBSD 1
|
2015-03-07 01:35:00 +08:00
|
|
|
#elif defined(__linux__)
|
2016-10-08 02:35:03 +08:00
|
|
|
#define BENCHMARK_OS_LINUX 1
|
2017-02-11 18:31:40 +08:00
|
|
|
#elif defined(__native_client__)
|
|
|
|
#define BENCHMARK_OS_NACL 1
|
|
|
|
#elif defined(EMSCRIPTEN)
|
|
|
|
#define BENCHMARK_OS_EMSCRIPTEN 1
|
2015-03-07 01:35:00 +08:00
|
|
|
#endif
|
|
|
|
|
2016-12-06 01:24:09 +08:00
|
|
|
#if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \
|
|
|
|
&& !defined(__EXCEPTIONS)
|
|
|
|
#define BENCHMARK_HAS_NO_EXCEPTIONS
|
|
|
|
#endif
|
|
|
|
|
2016-10-08 02:35:03 +08:00
|
|
|
#endif // BENCHMARK_INTERNAL_MACROS_H_
|