benchmark
1.6.1
Toggle main menu visibility
Loading...
Searching...
No Matches
internal_macros.h
1
#ifndef BENCHMARK_INTERNAL_MACROS_H_
2
#define BENCHMARK_INTERNAL_MACROS_H_
3
4
#include "benchmark/benchmark.h"
5
6
/* Needed to detect STL */
7
#include <cstdlib>
8
9
// clang-format off
10
11
#ifndef __has_feature
12
#define __has_feature(x) 0
13
#endif
14
15
#if defined(__clang__)
16
#if defined(__ibmxl__)
17
#if !defined(COMPILER_IBMXL)
18
#define COMPILER_IBMXL
19
#endif
20
#elif !defined(COMPILER_CLANG)
21
#define COMPILER_CLANG
22
#endif
23
#elif defined(_MSC_VER)
24
#if !defined(COMPILER_MSVC)
25
#define COMPILER_MSVC
26
#endif
27
#elif defined(__GNUC__)
28
#if !defined(COMPILER_GCC)
29
#define COMPILER_GCC
30
#endif
31
#endif
32
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)
39
#else
40
#define BENCHMARK_NORETURN
41
#endif
42
43
#if defined(__CYGWIN__)
44
#define BENCHMARK_OS_CYGWIN 1
45
#elif defined(_WIN32)
46
#define BENCHMARK_OS_WINDOWS 1
47
#if defined(__MINGW32__)
48
#define BENCHMARK_OS_MINGW 1
49
#endif
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
57
#endif
58
#endif
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
83
#endif
84
85
#if defined(__ANDROID__) && defined(__GLIBCXX__)
86
#define BENCHMARK_STL_ANDROID_GNUSTL 1
87
#endif
88
89
#if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \
90
&& !defined(__EXCEPTIONS)
91
#define BENCHMARK_HAS_NO_EXCEPTIONS
92
#endif
93
94
#if defined(COMPILER_CLANG) || defined(COMPILER_GCC)
95
#define BENCHMARK_MAYBE_UNUSED __attribute__((unused))
96
#else
97
#define BENCHMARK_MAYBE_UNUSED
98
#endif
99
100
// clang-format on
101
102
#endif
// BENCHMARK_INTERNAL_MACROS_H_
src
internal_macros.h
Generated by
1.17.0