diff options
author | 2019-02-04 16:55:44 +0000 | |
---|---|---|
committer | 2019-02-04 16:55:44 +0000 | |
commit | 76c648e7a477ffb2a882ad5ffe523269bd9a3f6a (patch) | |
tree | 29d319d598650bab04e4f58e5e8769567e33091e /lib/libcxx/utils/google-benchmark/src/internal_macros.h | |
parent | Import libc++abi 7.0.1. (diff) | |
download | wireguard-openbsd-76c648e7a477ffb2a882ad5ffe523269bd9a3f6a.tar.xz wireguard-openbsd-76c648e7a477ffb2a882ad5ffe523269bd9a3f6a.zip |
Import libc++ 7.0.1.
Diffstat (limited to 'lib/libcxx/utils/google-benchmark/src/internal_macros.h')
-rw-r--r-- | lib/libcxx/utils/google-benchmark/src/internal_macros.h | 79 |
1 files changed, 62 insertions, 17 deletions
diff --git a/lib/libcxx/utils/google-benchmark/src/internal_macros.h b/lib/libcxx/utils/google-benchmark/src/internal_macros.h index ab9dd85c102..b7e9203ff60 100644 --- a/lib/libcxx/utils/google-benchmark/src/internal_macros.h +++ b/lib/libcxx/utils/google-benchmark/src/internal_macros.h @@ -1,36 +1,51 @@ #ifndef BENCHMARK_INTERNAL_MACROS_H_ #define BENCHMARK_INTERNAL_MACROS_H_ -#include "benchmark/macros.h" +#include "benchmark/benchmark.h" + +/* Needed to detect STL */ +#include <cstdlib> + +// clang-format off #ifndef __has_feature #define __has_feature(x) 0 #endif +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif #if defined(__clang__) -#define COMPILER_CLANG + #if !defined(COMPILER_CLANG) + #define COMPILER_CLANG + #endif #elif defined(_MSC_VER) -#define COMPILER_MSVC + #if !defined(COMPILER_MSVC) + #define COMPILER_MSVC + #endif #elif defined(__GNUC__) -#define COMPILER_GCC + #if !defined(COMPILER_GCC) + #define COMPILER_GCC + #endif #endif #if __has_feature(cxx_attributes) -#define BENCHMARK_NORETURN [[noreturn]] + #define BENCHMARK_NORETURN [[noreturn]] #elif defined(__GNUC__) -#define BENCHMARK_NORETURN __attribute__((noreturn)) + #define BENCHMARK_NORETURN __attribute__((noreturn)) #elif defined(COMPILER_MSVC) -#define BENCHMARK_NORETURN __declspec(noreturn) + #define BENCHMARK_NORETURN __declspec(noreturn) #else -#define BENCHMARK_NORETURN + #define BENCHMARK_NORETURN #endif #if defined(__CYGWIN__) -#define BENCHMARK_OS_CYGWIN 1 + #define BENCHMARK_OS_CYGWIN 1 #elif defined(_WIN32) -#define BENCHMARK_OS_WINDOWS 1 + #define BENCHMARK_OS_WINDOWS 1 #elif defined(__APPLE__) -#include "TargetConditionals.h" + #define BENCHMARK_OS_APPLE 1 + #include "TargetConditionals.h" #if defined(TARGET_OS_MAC) #define BENCHMARK_OS_MACOSX 1 #if defined(TARGET_OS_IPHONE) @@ -38,18 +53,48 @@ #endif #endif #elif defined(__FreeBSD__) -#define BENCHMARK_OS_FREEBSD 1 + #define BENCHMARK_OS_FREEBSD 1 +#elif defined(__NetBSD__) + #define BENCHMARK_OS_NETBSD 1 +#elif defined(__OpenBSD__) + #define BENCHMARK_OS_OPENBSD 1 #elif defined(__linux__) -#define BENCHMARK_OS_LINUX 1 + #define BENCHMARK_OS_LINUX 1 #elif defined(__native_client__) -#define BENCHMARK_OS_NACL 1 -#elif defined(EMSCRIPTEN) -#define BENCHMARK_OS_EMSCRIPTEN 1 + #define BENCHMARK_OS_NACL 1 +#elif defined(__EMSCRIPTEN__) + #define BENCHMARK_OS_EMSCRIPTEN 1 +#elif defined(__rtems__) + #define BENCHMARK_OS_RTEMS 1 +#elif defined(__Fuchsia__) +#define BENCHMARK_OS_FUCHSIA 1 +#elif defined (__SVR4) && defined (__sun) +#define BENCHMARK_OS_SOLARIS 1 +#endif + +#if defined(__ANDROID__) && defined(__GLIBCXX__) +#define BENCHMARK_STL_ANDROID_GNUSTL 1 #endif #if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \ && !defined(__EXCEPTIONS) -#define BENCHMARK_HAS_NO_EXCEPTIONS + #define BENCHMARK_HAS_NO_EXCEPTIONS #endif +#if defined(COMPILER_CLANG) || defined(COMPILER_GCC) + #define BENCHMARK_MAYBE_UNUSED __attribute__((unused)) +#else + #define BENCHMARK_MAYBE_UNUSED +#endif + +#if defined(COMPILER_GCC) || __has_builtin(__builtin_unreachable) + #define BENCHMARK_UNREACHABLE() __builtin_unreachable() +#elif defined(COMPILER_MSVC) + #define BENCHMARK_UNREACHABLE() __assume(false) +#else + #define BENCHMARK_UNREACHABLE() ((void)0) +#endif + +// clang-format on + #endif // BENCHMARK_INTERNAL_MACROS_H_ |