• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef BENCHMARK_INTERNAL_MACROS_H_
2 #define BENCHMARK_INTERNAL_MACROS_H_
3 
4 #include "benchmark/macros.h"
5 
6 #ifndef __has_feature
7 #define __has_feature(x) 0
8 #endif
9 
10 #if defined(__clang__)
11 #define COMPILER_CLANG
12 #elif defined(_MSC_VER)
13 #define COMPILER_MSVC
14 #elif defined(__GNUC__)
15 #define COMPILER_GCC
16 #endif
17 
18 #if __has_feature(cxx_attributes)
19 #define BENCHMARK_NORETURN [[noreturn]]
20 #elif defined(__GNUC__)
21 #define BENCHMARK_NORETURN __attribute__((noreturn))
22 #elif defined(COMPILER_MSVC)
23 #define BENCHMARK_NORETURN __declspec(noreturn)
24 #else
25 #define BENCHMARK_NORETURN
26 #endif
27 
28 #if defined(__CYGWIN__)
29 #define BENCHMARK_OS_CYGWIN 1
30 #elif defined(_WIN32)
31 #define BENCHMARK_OS_WINDOWS 1
32 #elif defined(__APPLE__)
33 // TODO(ericwf) This doesn't actually check that it is a Mac OSX system. Just
34 // that it is an apple system.
35 #define BENCHMARK_OS_MACOSX 1
36 #elif defined(__FreeBSD__)
37 #define BENCHMARK_OS_FREEBSD 1
38 #elif defined(__linux__)
39 #define BENCHMARK_OS_LINUX 1
40 #endif
41 
42 #endif  // BENCHMARK_INTERNAL_MACROS_H_
43