1 #ifndef BENCHMARK_INTERNAL_MACROS_H_
2 #define BENCHMARK_INTERNAL_MACROS_H_
4 #include "benchmark/benchmark.h"
6 /* Needed to detect STL */
12 #define __has_feature(x) 0
15 #if defined(__clang__)
16 #if defined(__ibmxl__)
17 #if !defined(COMPILER_IBMXL)
18 #define COMPILER_IBMXL
20 #elif !defined(COMPILER_CLANG)
21 #define COMPILER_CLANG
23 #elif defined(_MSC_VER)
24 #if !defined(COMPILER_MSVC)
27 #elif defined(__GNUC__)
28 #if !defined(COMPILER_GCC)
33 #if __has_feature(cxx_attributes)
34 #define BENCHMARK_NORETURN [[noreturn]]
35 #elif defined(__GNUC__)
36 #define BENCHMARK_NORETURN __attribute__((noreturn))
37 #elif defined(COMPILER_MSVC)
38 #define BENCHMARK_NORETURN __declspec(noreturn)
40 #define BENCHMARK_NORETURN
43 #if defined(__CYGWIN__)
44 #define BENCHMARK_OS_CYGWIN 1
46 #define BENCHMARK_OS_WINDOWS 1
47 #if defined(__MINGW32__)
48 #define BENCHMARK_OS_MINGW 1
50 #elif defined(__APPLE__)
51 #define BENCHMARK_OS_APPLE 1
52 #include "TargetConditionals.h"
53 #if defined(TARGET_OS_MAC)
54 #define BENCHMARK_OS_MACOSX 1
55 #if defined(TARGET_OS_IPHONE)
56 #define BENCHMARK_OS_IOS 1
59 #elif defined(__FreeBSD__)
60 #define BENCHMARK_OS_FREEBSD 1
61 #elif defined(__NetBSD__)
62 #define BENCHMARK_OS_NETBSD 1
63 #elif defined(__OpenBSD__)
64 #define BENCHMARK_OS_OPENBSD 1
65 #elif defined(__DragonFly__)
66 #define BENCHMARK_OS_DRAGONFLY 1
67 #elif defined(__linux__)
68 #define BENCHMARK_OS_LINUX 1
69 #elif defined(__native_client__)
70 #define BENCHMARK_OS_NACL 1
71 #elif defined(__EMSCRIPTEN__)
72 #define BENCHMARK_OS_EMSCRIPTEN 1
73 #elif defined(__rtems__)
74 #define BENCHMARK_OS_RTEMS 1
75 #elif defined(__Fuchsia__)
76 #define BENCHMARK_OS_FUCHSIA 1
77 #elif defined (__SVR4) && defined (__sun)
78 #define BENCHMARK_OS_SOLARIS 1
79 #elif defined(__QNX__)
80 #define BENCHMARK_OS_QNX 1
81 #elif defined(__MVS__)
82 #define BENCHMARK_OS_ZOS 1
85 #if defined(__ANDROID__) && defined(__GLIBCXX__)
86 #define BENCHMARK_STL_ANDROID_GNUSTL 1
89 #if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \
90 && !defined(__EXCEPTIONS)
91 #define BENCHMARK_HAS_NO_EXCEPTIONS
94 #if defined(COMPILER_CLANG) || defined(COMPILER_GCC)
95 #define BENCHMARK_MAYBE_UNUSED __attribute__((unused))
97 #define BENCHMARK_MAYBE_UNUSED
102 #endif // BENCHMARK_INTERNAL_MACROS_H_