• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 Google Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 #ifndef BENCHMARK_MACROS_H_
15 #define BENCHMARK_MACROS_H_
16 
17 #if __cplusplus < 201103L
18 # define BENCHMARK_DISALLOW_COPY_AND_ASSIGN(TypeName)  \
19     TypeName(const TypeName&);                         \
20     TypeName& operator=(const TypeName&)
21 #else
22 # define BENCHMARK_DISALLOW_COPY_AND_ASSIGN(TypeName)  \
23     TypeName(const TypeName&) = delete;                \
24     TypeName& operator=(const TypeName&) = delete
25 #endif
26 
27 #if defined(__GNUC__)
28 # define BENCHMARK_UNUSED __attribute__((unused))
29 # define BENCHMARK_ALWAYS_INLINE __attribute__((always_inline))
30 # define BENCHMARK_NOEXCEPT noexcept
31 #elif defined(_MSC_VER) && !defined(__clang__)
32 # define BENCHMARK_UNUSED
33 # define BENCHMARK_ALWAYS_INLINE __forceinline
34 # define BENCHMARK_NOEXCEPT
35 # define __func__ __FUNCTION__
36 #else
37 # define BENCHMARK_UNUSED
38 # define BENCHMARK_ALWAYS_INLINE
39 # define BENCHMARK_NOEXCEPT
40 #endif
41 
42 #if defined(__GNUC__)
43 # define BENCHMARK_BUILTIN_EXPECT(x, y) __builtin_expect(x, y)
44 #else
45 # define BENCHMARK_BUILTIN_EXPECT(x, y) x
46 #endif
47 
48 #endif  // BENCHMARK_MACROS_H_
49