[InstCombine] Signed saturation patterns
[llvm-complete.git] / utils / benchmark / src / internal_macros.h
blobf2d54bfcbd9dde9d87b4d6a800ea620f9e815feb
1 #ifndef BENCHMARK_INTERNAL_MACROS_H_
2 #define BENCHMARK_INTERNAL_MACROS_H_
4 #include "benchmark/benchmark.h"
6 #ifndef __has_feature
7 #define __has_feature(x) 0
8 #endif
10 #if defined(__clang__)
11 #if !defined(COMPILER_CLANG)
12 #define COMPILER_CLANG
13 #endif
14 #elif defined(_MSC_VER)
15 #if !defined(COMPILER_MSVC)
16 #define COMPILER_MSVC
17 #endif
18 #elif defined(__GNUC__)
19 #if !defined(COMPILER_GCC)
20 #define COMPILER_GCC
21 #endif
22 #endif
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)
30 #else
31 #define BENCHMARK_NORETURN
32 #endif
34 #if defined(__CYGWIN__)
35 #define BENCHMARK_OS_CYGWIN 1
36 #elif defined(_WIN32)
37 #define BENCHMARK_OS_WINDOWS 1
38 #if defined(__MINGW32__)
39 #define BENCHMARK_OS_MINGW 1
40 #endif
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
48 #endif
49 #endif
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
68 #endif
70 #if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \
71 && !defined(__EXCEPTIONS)
72 #define BENCHMARK_HAS_NO_EXCEPTIONS
73 #endif
75 #if defined(COMPILER_CLANG) || defined(COMPILER_GCC)
76 #define BENCHMARK_MAYBE_UNUSED __attribute__((unused))
77 #else
78 #define BENCHMARK_MAYBE_UNUSED
79 #endif
81 #endif // BENCHMARK_INTERNAL_MACROS_H_