Elliott Hughes | 2faa5f1 | 2012-01-30 14:42:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Carl Shapiro | 6c21dc1 | 2011-06-20 15:20:52 -0700 | [diff] [blame] | 16 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_RUNTIME_BASE_MACROS_H_ |
| 18 | #define ART_RUNTIME_BASE_MACROS_H_ |
Carl Shapiro | 6c21dc1 | 2011-06-20 15:20:52 -0700 | [diff] [blame] | 19 | |
Carl Shapiro | 12eb78e | 2011-06-24 14:51:06 -0700 | [diff] [blame] | 20 | #include <stddef.h> // for size_t |
Mark Salyzyn | 47a4cc7 | 2014-05-22 16:27:06 -0700 | [diff] [blame] | 21 | #include <unistd.h> // for TEMP_FAILURE_RETRY |
| 22 | |
| 23 | // bionic and glibc both have TEMP_FAILURE_RETRY, but eg Mac OS' libc doesn't. |
| 24 | #ifndef TEMP_FAILURE_RETRY |
| 25 | #define TEMP_FAILURE_RETRY(exp) ({ \ |
| 26 | decltype(exp) _rc; \ |
| 27 | do { \ |
| 28 | _rc = (exp); \ |
| 29 | } while (_rc == -1 && errno == EINTR); \ |
| 30 | _rc; }) |
| 31 | #endif |
Carl Shapiro | 12eb78e | 2011-06-24 14:51:06 -0700 | [diff] [blame] | 32 | |
Brian Carlstrom | 7a00a3c | 2012-01-25 18:38:03 -0800 | [diff] [blame] | 33 | #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) |
Shih-wei Liao | 24782c6 | 2012-01-08 12:46:11 -0800 | [diff] [blame] | 34 | |
Ian Rogers | 6fac447 | 2014-02-25 17:01:10 -0800 | [diff] [blame] | 35 | // C++11 final and override keywords that were introduced in GCC version 4.7. |
Ian Rogers | 9758f79 | 2014-03-13 09:02:55 -0700 | [diff] [blame] | 36 | #if defined(__clang__) || GCC_VERSION >= 40700 |
Ian Rogers | 6fac447 | 2014-02-25 17:01:10 -0800 | [diff] [blame] | 37 | #define OVERRIDE override |
| 38 | #define FINAL final |
| 39 | #else |
| 40 | #define OVERRIDE |
| 41 | #define FINAL |
| 42 | #endif |
| 43 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 44 | // Declare a friend relationship in a class with a test. Used rather that FRIEND_TEST to avoid |
| 45 | // globally importing gtest/gtest.h into the main ART header files. |
| 46 | #define ART_FRIEND_TEST(test_set_name, individual_test)\ |
| 47 | friend class test_set_name##_##individual_test##_Test |
| 48 | |
Zheng Xu | ad4450e | 2015-04-17 18:48:56 +0800 | [diff] [blame^] | 49 | // Declare a friend relationship in a class with a typed test. |
| 50 | #define ART_FRIEND_TYPED_TEST(test_set_name, individual_test)\ |
| 51 | template<typename T> ART_FRIEND_TEST(test_set_name, individual_test) |
| 52 | |
| 53 | |
Ian Rogers | cf7f191 | 2014-10-22 22:06:39 -0700 | [diff] [blame] | 54 | // DISALLOW_COPY_AND_ASSIGN disallows the copy and operator= functions. It goes in the private: |
| 55 | // declarations in a class. |
Ian Rogers | 3eaa852 | 2014-11-04 13:20:30 -0800 | [diff] [blame] | 56 | #if !defined(DISALLOW_COPY_AND_ASSIGN) |
Carl Shapiro | 6c21dc1 | 2011-06-20 15:20:52 -0700 | [diff] [blame] | 57 | #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ |
Ian Rogers | cf7f191 | 2014-10-22 22:06:39 -0700 | [diff] [blame] | 58 | TypeName(const TypeName&) = delete; \ |
| 59 | void operator=(const TypeName&) = delete |
Ian Rogers | 3eaa852 | 2014-11-04 13:20:30 -0800 | [diff] [blame] | 60 | #endif |
Carl Shapiro | 6c21dc1 | 2011-06-20 15:20:52 -0700 | [diff] [blame] | 61 | |
Ian Rogers | cf7f191 | 2014-10-22 22:06:39 -0700 | [diff] [blame] | 62 | // A macro to disallow all the implicit constructors, namely the default constructor, copy |
| 63 | // constructor and operator= functions. |
Carl Shapiro | 6c21dc1 | 2011-06-20 15:20:52 -0700 | [diff] [blame] | 64 | // |
Ian Rogers | cf7f191 | 2014-10-22 22:06:39 -0700 | [diff] [blame] | 65 | // This should be used in the private: declarations for a class that wants to prevent anyone from |
| 66 | // instantiating it. This is especially useful for classes containing only static methods. |
Carl Shapiro | 6c21dc1 | 2011-06-20 15:20:52 -0700 | [diff] [blame] | 67 | #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ |
Ian Rogers | cf7f191 | 2014-10-22 22:06:39 -0700 | [diff] [blame] | 68 | TypeName() = delete; \ |
Carl Shapiro | 6c21dc1 | 2011-06-20 15:20:52 -0700 | [diff] [blame] | 69 | DISALLOW_COPY_AND_ASSIGN(TypeName) |
| 70 | |
Ian Rogers | cf7f191 | 2014-10-22 22:06:39 -0700 | [diff] [blame] | 71 | // A macro to disallow new and delete operators for a class. It goes in the private: declarations. |
| 72 | #define DISALLOW_ALLOCATION() \ |
| 73 | public: \ |
Andreas Gampe | 65b798e | 2015-04-06 09:35:22 -0700 | [diff] [blame] | 74 | NO_RETURN ALWAYS_INLINE void operator delete(void*, size_t) { UNREACHABLE(); } \ |
Ian Rogers | cf7f191 | 2014-10-22 22:06:39 -0700 | [diff] [blame] | 75 | private: \ |
| 76 | void* operator new(size_t) = delete |
| 77 | |
Carl Shapiro | a2e18e1 | 2011-06-21 18:57:55 -0700 | [diff] [blame] | 78 | // The arraysize(arr) macro returns the # of elements in an array arr. |
| 79 | // The expression is a compile-time constant, and therefore can be |
| 80 | // used in defining new arrays, for example. If you use arraysize on |
| 81 | // a pointer by mistake, you will get a compile-time error. |
| 82 | // |
| 83 | // One caveat is that arraysize() doesn't accept any array of an |
| 84 | // anonymous type or a type defined inside a function. In these rare |
Carl Shapiro | d2bdb57 | 2011-06-22 11:45:37 -0700 | [diff] [blame] | 85 | // cases, you have to use the unsafe ARRAYSIZE_UNSAFE() macro below. This is |
Carl Shapiro | a2e18e1 | 2011-06-21 18:57:55 -0700 | [diff] [blame] | 86 | // due to a limitation in C++'s template system. The limitation might |
| 87 | // eventually be removed, but it hasn't happened yet. |
| 88 | |
| 89 | // This template function declaration is used in defining arraysize. |
| 90 | // Note that the function doesn't need an implementation, as we only |
| 91 | // use its type. |
| 92 | template <typename T, size_t N> |
| 93 | char (&ArraySizeHelper(T (&array)[N]))[N]; |
| 94 | |
| 95 | #define arraysize(array) (sizeof(ArraySizeHelper(array))) |
| 96 | |
Carl Shapiro | d2bdb57 | 2011-06-22 11:45:37 -0700 | [diff] [blame] | 97 | // ARRAYSIZE_UNSAFE performs essentially the same calculation as arraysize, |
| 98 | // but can be used on anonymous types or types defined inside |
| 99 | // functions. It's less safe than arraysize as it accepts some |
| 100 | // (although not all) pointers. Therefore, you should use arraysize |
| 101 | // whenever possible. |
| 102 | // |
| 103 | // The expression ARRAYSIZE_UNSAFE(a) is a compile-time constant of type |
| 104 | // size_t. |
| 105 | // |
| 106 | // ARRAYSIZE_UNSAFE catches a few type errors. If you see a compiler error |
| 107 | // |
| 108 | // "warning: division by zero in ..." |
| 109 | // |
| 110 | // when using ARRAYSIZE_UNSAFE, you are (wrongfully) giving it a pointer. |
| 111 | // You should only use ARRAYSIZE_UNSAFE on statically allocated arrays. |
| 112 | // |
| 113 | // The following comments are on the implementation details, and can |
| 114 | // be ignored by the users. |
| 115 | // |
| 116 | // ARRAYSIZE_UNSAFE(arr) works by inspecting sizeof(arr) (the # of bytes in |
| 117 | // the array) and sizeof(*(arr)) (the # of bytes in one array |
| 118 | // element). If the former is divisible by the latter, perhaps arr is |
| 119 | // indeed an array, in which case the division result is the # of |
| 120 | // elements in the array. Otherwise, arr cannot possibly be an array, |
| 121 | // and we generate a compiler error to prevent the code from |
| 122 | // compiling. |
| 123 | // |
| 124 | // Since the size of bool is implementation-defined, we need to cast |
| 125 | // !(sizeof(a) & sizeof(*(a))) to size_t in order to ensure the final |
| 126 | // result has type size_t. |
| 127 | // |
| 128 | // This macro is not perfect as it wrongfully accepts certain |
| 129 | // pointers, namely where the pointer size is divisible by the pointee |
| 130 | // size. Since all our code has to go through a 32-bit compiler, |
| 131 | // where a pointer is 4 bytes, this means all pointers to a type whose |
| 132 | // size is 3 or greater than 4 will be (righteously) rejected. |
| 133 | #define ARRAYSIZE_UNSAFE(a) \ |
Elliott Hughes | 362f9bc | 2011-10-17 18:56:41 -0700 | [diff] [blame] | 134 | ((sizeof(a) / sizeof(*(a))) / static_cast<size_t>(!(sizeof(a) % sizeof(*(a))))) |
Carl Shapiro | d2bdb57 | 2011-06-22 11:45:37 -0700 | [diff] [blame] | 135 | |
Elliott Hughes | ff17f1f | 2012-01-24 18:12:29 -0800 | [diff] [blame] | 136 | #define SIZEOF_MEMBER(t, f) sizeof((reinterpret_cast<t*>(4096))->f) |
Carl Shapiro | 59e85cd | 2011-06-21 10:16:23 -0700 | [diff] [blame] | 137 | |
Elliott Hughes | 362f9bc | 2011-10-17 18:56:41 -0700 | [diff] [blame] | 138 | #define OFFSETOF_MEMBER(t, f) \ |
Ian Rogers | 8a01a3a | 2013-05-06 13:25:44 -0700 | [diff] [blame] | 139 | (reinterpret_cast<const char*>(&reinterpret_cast<t*>(16)->f) - reinterpret_cast<const char*>(16)) // NOLINT |
Carl Shapiro | 59e85cd | 2011-06-21 10:16:23 -0700 | [diff] [blame] | 140 | |
Elliott Hughes | 93e74e8 | 2011-09-13 11:07:03 -0700 | [diff] [blame] | 141 | #define OFFSETOF_VOLATILE_MEMBER(t, f) \ |
Elliott Hughes | 398f64b | 2012-03-26 18:05:48 -0700 | [diff] [blame] | 142 | (reinterpret_cast<volatile char*>(&reinterpret_cast<t*>(16)->f) - reinterpret_cast<volatile char*>(16)) // NOLINT |
Elliott Hughes | 93e74e8 | 2011-09-13 11:07:03 -0700 | [diff] [blame] | 143 | |
Brian Carlstrom | b1eba21 | 2013-07-17 18:07:19 -0700 | [diff] [blame] | 144 | #define PACKED(x) __attribute__ ((__aligned__(x), __packed__)) |
Elliott Hughes | 85d1545 | 2011-09-16 17:33:01 -0700 | [diff] [blame] | 145 | |
Elliott Hughes | ff17f1f | 2012-01-24 18:12:29 -0800 | [diff] [blame] | 146 | #define LIKELY(x) __builtin_expect((x), true) |
| 147 | #define UNLIKELY(x) __builtin_expect((x), false) |
Ian Rogers | caab8c4 | 2011-10-12 12:11:18 -0700 | [diff] [blame] | 148 | |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 149 | // Stringify the argument. |
| 150 | #define QUOTE(x) #x |
| 151 | #define STRINGIFY(x) QUOTE(x) |
| 152 | |
Ian Rogers | e8ae0dc | 2013-02-07 10:20:45 -0800 | [diff] [blame] | 153 | #ifndef NDEBUG |
Ian Rogers | 1ffa32f | 2013-02-05 18:29:08 -0800 | [diff] [blame] | 154 | #define ALWAYS_INLINE |
| 155 | #else |
Ian Rogers | e8ae0dc | 2013-02-07 10:20:45 -0800 | [diff] [blame] | 156 | #define ALWAYS_INLINE __attribute__ ((always_inline)) |
Ian Rogers | 1ffa32f | 2013-02-05 18:29:08 -0800 | [diff] [blame] | 157 | #endif |
| 158 | |
Bernhard Rosenkränzer | 4605362 | 2013-12-12 02:15:52 +0100 | [diff] [blame] | 159 | #ifdef __clang__ |
| 160 | /* clang doesn't like attributes on lambda functions */ |
| 161 | #define ALWAYS_INLINE_LAMBDA |
| 162 | #else |
| 163 | #define ALWAYS_INLINE_LAMBDA ALWAYS_INLINE |
| 164 | #endif |
| 165 | |
Andreas Gampe | 8683038 | 2014-12-12 21:41:29 -0800 | [diff] [blame] | 166 | #define NO_INLINE __attribute__ ((noinline)) |
| 167 | |
Anwar Ghuloum | 63937db | 2013-05-24 09:08:32 -0700 | [diff] [blame] | 168 | #if defined (__APPLE__) |
Anwar Ghuloum | 1d9314c | 2013-05-24 10:44:48 -0700 | [diff] [blame] | 169 | #define HOT_ATTR |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 170 | #define COLD_ATTR |
Anwar Ghuloum | 63937db | 2013-05-24 09:08:32 -0700 | [diff] [blame] | 171 | #else |
Anwar Ghuloum | 1d9314c | 2013-05-24 10:44:48 -0700 | [diff] [blame] | 172 | #define HOT_ATTR __attribute__ ((hot)) |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 173 | #define COLD_ATTR __attribute__ ((cold)) |
Anwar Ghuloum | 63937db | 2013-05-24 09:08:32 -0700 | [diff] [blame] | 174 | #endif |
| 175 | |
Ian Rogers | 96faf5b | 2013-08-09 22:05:32 -0700 | [diff] [blame] | 176 | #define PURE __attribute__ ((__pure__)) |
Mathieu Chartier | 4c13a3f | 2014-07-14 14:57:16 -0700 | [diff] [blame] | 177 | #define WARN_UNUSED __attribute__((warn_unused_result)) |
Ian Rogers | 96faf5b | 2013-08-09 22:05:32 -0700 | [diff] [blame] | 178 | |
Ian Rogers | 6a3c1fc | 2014-10-31 00:33:20 -0700 | [diff] [blame] | 179 | // A deprecated function to call to create a false use of the parameter, for example: |
| 180 | // int foo(int x) { UNUSED(x); return 10; } |
| 181 | // to avoid compiler warnings. Going forward we prefer ATTRIBUTE_UNUSED. |
| 182 | template<typename... T> void UNUSED(const T&...) {} |
| 183 | |
| 184 | // An attribute to place on a parameter to a function, for example: |
| 185 | // int foo(int x ATTRIBUTE_UNUSED) { return 10; } |
| 186 | // to avoid compiler warnings. |
| 187 | #define ATTRIBUTE_UNUSED __attribute__((__unused__)) |
| 188 | |
| 189 | // Define that a position within code is unreachable, for example: |
| 190 | // int foo () { LOG(FATAL) << "Don't call me"; UNREACHABLE(); } |
| 191 | // without the UNREACHABLE a return statement would be necessary. |
Ian Rogers | 0714083 | 2014-09-30 15:43:59 -0700 | [diff] [blame] | 192 | #define UNREACHABLE __builtin_unreachable |
Elliott Hughes | c151f90 | 2012-06-21 20:33:21 -0700 | [diff] [blame] | 193 | |
Andreas Gampe | 794ad76 | 2015-02-23 08:12:24 -0800 | [diff] [blame] | 194 | // Add the C++11 noreturn attribute. |
| 195 | #define NO_RETURN [[ noreturn ]] // NOLINT[whitespace/braces] [5] |
| 196 | |
Ian Rogers | fc787ec | 2014-10-09 21:56:44 -0700 | [diff] [blame] | 197 | // The FALLTHROUGH_INTENDED macro can be used to annotate implicit fall-through |
| 198 | // between switch labels: |
| 199 | // switch (x) { |
| 200 | // case 40: |
| 201 | // case 41: |
| 202 | // if (truth_is_out_there) { |
| 203 | // ++x; |
| 204 | // FALLTHROUGH_INTENDED; // Use instead of/along with annotations in |
| 205 | // // comments. |
| 206 | // } else { |
| 207 | // return x; |
| 208 | // } |
| 209 | // case 42: |
| 210 | // ... |
| 211 | // |
| 212 | // As shown in the example above, the FALLTHROUGH_INTENDED macro should be |
| 213 | // followed by a semicolon. It is designed to mimic control-flow statements |
| 214 | // like 'break;', so it can be placed in most places where 'break;' can, but |
| 215 | // only if there are no statements on the execution path between it and the |
| 216 | // next switch label. |
| 217 | // |
| 218 | // When compiled with clang in C++11 mode, the FALLTHROUGH_INTENDED macro is |
| 219 | // expanded to [[clang::fallthrough]] attribute, which is analysed when |
| 220 | // performing switch labels fall-through diagnostic ('-Wimplicit-fallthrough'). |
| 221 | // See clang documentation on language extensions for details: |
| 222 | // http://clang.llvm.org/docs/LanguageExtensions.html#clang__fallthrough |
| 223 | // |
| 224 | // When used with unsupported compilers, the FALLTHROUGH_INTENDED macro has no |
| 225 | // effect on diagnostics. |
| 226 | // |
| 227 | // In either case this macro has no effect on runtime behavior and performance |
| 228 | // of code. |
| 229 | #if defined(__clang__) && __cplusplus >= 201103L && defined(__has_warning) |
| 230 | #if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough") |
| 231 | #define FALLTHROUGH_INTENDED [[clang::fallthrough]] // NOLINT |
| 232 | #endif |
| 233 | #endif |
| 234 | |
| 235 | #ifndef FALLTHROUGH_INTENDED |
| 236 | #define FALLTHROUGH_INTENDED do { } while (0) |
| 237 | #endif |
| 238 | |
Ian Rogers | 719d1a3 | 2014-03-06 12:13:39 -0800 | [diff] [blame] | 239 | // Annotalysis thread-safety analysis support. |
| 240 | #if defined(__SUPPORT_TS_ANNOTATION__) || defined(__clang__) |
| 241 | #define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) |
Elliott Hughes | f834936 | 2012-06-18 15:00:06 -0700 | [diff] [blame] | 242 | #else |
Ian Rogers | 719d1a3 | 2014-03-06 12:13:39 -0800 | [diff] [blame] | 243 | #define THREAD_ANNOTATION_ATTRIBUTE__(x) // no-op |
| 244 | #endif |
Elliott Hughes | f834936 | 2012-06-18 15:00:06 -0700 | [diff] [blame] | 245 | |
Ian Rogers | 719d1a3 | 2014-03-06 12:13:39 -0800 | [diff] [blame] | 246 | #define ACQUIRED_AFTER(...) THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(__VA_ARGS__)) |
| 247 | #define ACQUIRED_BEFORE(...) THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__)) |
| 248 | #define EXCLUSIVE_LOCKS_REQUIRED(...) THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__)) |
| 249 | #define GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x)) |
| 250 | #define GUARDED_VAR THREAD_ANNOTATION_ATTRIBUTE__(guarded) |
| 251 | #define LOCKABLE THREAD_ANNOTATION_ATTRIBUTE__(lockable) |
| 252 | #define LOCK_RETURNED(x) THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x)) |
| 253 | #define LOCKS_EXCLUDED(...) THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(__VA_ARGS__)) |
| 254 | #define NO_THREAD_SAFETY_ANALYSIS THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis) |
Elliott Hughes | f834936 | 2012-06-18 15:00:06 -0700 | [diff] [blame] | 255 | #define PT_GUARDED_BY(x) |
Ian Rogers | 719d1a3 | 2014-03-06 12:13:39 -0800 | [diff] [blame] | 256 | // THREAD_ANNOTATION_ATTRIBUTE__(point_to_guarded_by(x)) |
| 257 | #define PT_GUARDED_VAR THREAD_ANNOTATION_ATTRIBUTE__(point_to_guarded) |
| 258 | #define SCOPED_LOCKABLE THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable) |
| 259 | #define SHARED_LOCKS_REQUIRED(...) THREAD_ANNOTATION_ATTRIBUTE__(shared_locks_required(__VA_ARGS__)) |
Elliott Hughes | f834936 | 2012-06-18 15:00:06 -0700 | [diff] [blame] | 260 | |
Ian Rogers | 719d1a3 | 2014-03-06 12:13:39 -0800 | [diff] [blame] | 261 | #if defined(__clang__) |
| 262 | #define EXCLUSIVE_LOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock_function(__VA_ARGS__)) |
| 263 | #define EXCLUSIVE_TRYLOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock_function(__VA_ARGS__)) |
| 264 | #define SHARED_LOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(shared_lock_function(__VA_ARGS__)) |
| 265 | #define SHARED_TRYLOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock_function(__VA_ARGS__)) |
| 266 | #define UNLOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(unlock_function(__VA_ARGS__)) |
| 267 | #else |
| 268 | #define EXCLUSIVE_LOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock(__VA_ARGS__)) |
| 269 | #define EXCLUSIVE_TRYLOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock(__VA_ARGS__)) |
| 270 | #define SHARED_LOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(shared_lock(__VA_ARGS__)) |
| 271 | #define SHARED_TRYLOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock(__VA_ARGS__)) |
| 272 | #define UNLOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(unlock(__VA_ARGS__)) |
| 273 | #endif |
Elliott Hughes | f834936 | 2012-06-18 15:00:06 -0700 | [diff] [blame] | 274 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 275 | #endif // ART_RUNTIME_BASE_MACROS_H_ |