1 #ifndef BENCHMARK_INTERNAL_MACROS_H_
2 #define BENCHMARK_INTERNAL_MACROS_H_
4 #include "benchmark/benchmark.h"
7 #define __has_feature(x) 0
10 #if defined(__clang__)
11 #if !defined(COMPILER_CLANG)
12 #define COMPILER_CLANG
14 #elif defined(_MSC_VER)
15 #if !defined(COMPILER_MSVC)
18 #elif defined(__GNUC__)
19 #if !defined(COMPILER_GCC)
24 #if __has_feature(cxx_attributes)
25 #define BENCHMARK_NORETURN [[noreturn]]
26 #elif defined(__GNUC__)
27 #define BENCHMARK_NORETURN __attribute__((noreturn))
28 #elif defined(COMPILER_MSVC)
29 #define BENCHMARK_NORETURN __declspec(noreturn)
31 #define BENCHMARK_NORETURN
34 #if defined(__CYGWIN__)
35 #define BENCHMARK_OS_CYGWIN 1
37 #define BENCHMARK_OS_WINDOWS 1
38 #if defined(__MINGW32__)
39 #define BENCHMARK_OS_MINGW 1
41 #elif defined(__APPLE__)
42 #define BENCHMARK_OS_APPLE 1
43 #include "TargetConditionals.h"
44 #if defined(TARGET_OS_MAC)
45 #define BENCHMARK_OS_MACOSX 1
46 #if defined(TARGET_OS_IPHONE)
47 #define BENCHMARK_OS_IOS 1
50 #elif defined(__FreeBSD__)
51 #define BENCHMARK_OS_FREEBSD 1
52 #elif defined(__NetBSD__)
53 #define BENCHMARK_OS_NETBSD 1
54 #elif defined(__OpenBSD__)
55 #define BENCHMARK_OS_OPENBSD 1
56 #elif defined(__linux__)
57 #define BENCHMARK_OS_LINUX 1
58 #elif defined(__native_client__)
59 #define BENCHMARK_OS_NACL 1
60 #elif defined(__EMSCRIPTEN__)
61 #define BENCHMARK_OS_EMSCRIPTEN 1
62 #elif defined(__rtems__)
63 #define BENCHMARK_OS_RTEMS 1
64 #elif defined(__Fuchsia__)
65 #define BENCHMARK_OS_FUCHSIA 1
66 #elif defined (__SVR4) && defined (__sun)
67 #define BENCHMARK_OS_SOLARIS 1
70 #if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \
71 && !defined(__EXCEPTIONS)
72 #define BENCHMARK_HAS_NO_EXCEPTIONS
75 #if defined(COMPILER_CLANG) || defined(COMPILER_GCC)
76 #define BENCHMARK_MAYBE_UNUSED __attribute__((unused))
78 #define BENCHMARK_MAYBE_UNUSED
81 #endif // BENCHMARK_INTERNAL_MACROS_H_