Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:00:52

0001 // Copyright 2017 The Abseil Authors.
0002 //
0003 // Licensed under the Apache License, Version 2.0 (the "License");
0004 // you may not use this file except in compliance with the License.
0005 // You may obtain a copy of the License at
0006 //
0007 //      https://www.apache.org/licenses/LICENSE-2.0
0008 //
0009 // Unless required by applicable law or agreed to in writing, software
0010 // distributed under the License is distributed on an "AS IS" BASIS,
0011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0012 // See the License for the specific language governing permissions and
0013 // limitations under the License.
0014 //
0015 // This file is intended solely for spinlock.h.
0016 // It provides ThreadSanitizer annotations for custom mutexes.
0017 // See <sanitizer/tsan_interface.h> for meaning of these annotations.
0018 
0019 #ifndef ABSL_BASE_INTERNAL_TSAN_MUTEX_INTERFACE_H_
0020 #define ABSL_BASE_INTERNAL_TSAN_MUTEX_INTERFACE_H_
0021 
0022 #include "absl/base/config.h"
0023 
0024 // ABSL_INTERNAL_HAVE_TSAN_INTERFACE
0025 // Macro intended only for internal use.
0026 //
0027 // Checks whether LLVM Thread Sanitizer interfaces are available.
0028 // First made available in LLVM 5.0 (Sep 2017).
0029 #ifdef ABSL_INTERNAL_HAVE_TSAN_INTERFACE
0030 #error "ABSL_INTERNAL_HAVE_TSAN_INTERFACE cannot be directly set."
0031 #endif
0032 
0033 #if defined(ABSL_HAVE_THREAD_SANITIZER) && defined(__has_include)
0034 #if __has_include(<sanitizer/tsan_interface.h>)
0035 #define ABSL_INTERNAL_HAVE_TSAN_INTERFACE 1
0036 #endif
0037 #endif
0038 
0039 #ifdef ABSL_INTERNAL_HAVE_TSAN_INTERFACE
0040 #include <sanitizer/tsan_interface.h>
0041 
0042 #define ABSL_TSAN_MUTEX_CREATE __tsan_mutex_create
0043 #define ABSL_TSAN_MUTEX_DESTROY __tsan_mutex_destroy
0044 #define ABSL_TSAN_MUTEX_PRE_LOCK __tsan_mutex_pre_lock
0045 #define ABSL_TSAN_MUTEX_POST_LOCK __tsan_mutex_post_lock
0046 #define ABSL_TSAN_MUTEX_PRE_UNLOCK __tsan_mutex_pre_unlock
0047 #define ABSL_TSAN_MUTEX_POST_UNLOCK __tsan_mutex_post_unlock
0048 #define ABSL_TSAN_MUTEX_PRE_SIGNAL __tsan_mutex_pre_signal
0049 #define ABSL_TSAN_MUTEX_POST_SIGNAL __tsan_mutex_post_signal
0050 #define ABSL_TSAN_MUTEX_PRE_DIVERT __tsan_mutex_pre_divert
0051 #define ABSL_TSAN_MUTEX_POST_DIVERT __tsan_mutex_post_divert
0052 
0053 #else
0054 
0055 #define ABSL_TSAN_MUTEX_CREATE(...)
0056 #define ABSL_TSAN_MUTEX_DESTROY(...)
0057 #define ABSL_TSAN_MUTEX_PRE_LOCK(...)
0058 #define ABSL_TSAN_MUTEX_POST_LOCK(...)
0059 #define ABSL_TSAN_MUTEX_PRE_UNLOCK(...)
0060 #define ABSL_TSAN_MUTEX_POST_UNLOCK(...)
0061 #define ABSL_TSAN_MUTEX_PRE_SIGNAL(...)
0062 #define ABSL_TSAN_MUTEX_POST_SIGNAL(...)
0063 #define ABSL_TSAN_MUTEX_PRE_DIVERT(...)
0064 #define ABSL_TSAN_MUTEX_POST_DIVERT(...)
0065 
0066 #endif
0067 
0068 #endif  // ABSL_BASE_INTERNAL_TSAN_MUTEX_INTERFACE_H_