Disable thread safety analysis on conditional locks (#2498)

Clang does not support this:

https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#conditional-locks

Co-authored-by: Takeshi Nakatani <ggtakec@gmail.com>
This commit is contained in:
Andrew Gaul 2024-07-15 15:17:47 +09:00 committed by GitHub
parent 77ffe7d634
commit 23efccbe39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

View File

@ -66,6 +66,9 @@ extern std::string instance_name;
#define REQUIRES(...) \ #define REQUIRES(...) \
THREAD_ANNOTATION_ATTRIBUTE(requires_capability(__VA_ARGS__)) THREAD_ANNOTATION_ATTRIBUTE(requires_capability(__VA_ARGS__))
#define NO_THREAD_SAFETY_ANALYSIS \
THREAD_ANNOTATION_ATTRIBUTE(no_thread_safety_analysis)
#endif // S3FS_COMMON_H_ #endif // S3FS_COMMON_H_
/* /*

View File

@ -228,8 +228,8 @@ class S3fsCurl
static bool DestroyGlobalCurl(); static bool DestroyGlobalCurl();
static bool InitShareCurl(); static bool InitShareCurl();
static bool DestroyShareCurl(); static bool DestroyShareCurl();
static void LockCurlShare(CURL* handle, curl_lock_data nLockData, curl_lock_access laccess, void* useptr); static void LockCurlShare(CURL* handle, curl_lock_data nLockData, curl_lock_access laccess, void* useptr) NO_THREAD_SAFETY_ANALYSIS;
static void UnlockCurlShare(CURL* handle, curl_lock_data nLockData, void* useptr); static void UnlockCurlShare(CURL* handle, curl_lock_data nLockData, void* useptr) NO_THREAD_SAFETY_ANALYSIS;
static bool InitCryptMutex(); static bool InitCryptMutex();
static bool DestroyCryptMutex(); static bool DestroyCryptMutex();
static int CurlProgress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow); static int CurlProgress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);

View File

@ -84,7 +84,7 @@ struct CRYPTO_dynlock_value
static std::mutex* s3fs_crypt_mutex = nullptr; static std::mutex* s3fs_crypt_mutex = nullptr;
static void s3fs_crypt_mutex_lock(int mode, int pos, const char* file, int line) __attribute__ ((unused)); static void s3fs_crypt_mutex_lock(int mode, int pos, const char* file, int line) __attribute__ ((unused)) NO_THREAD_SAFETY_ANALYSIS;
static void s3fs_crypt_mutex_lock(int mode, int pos, const char* file, int line) static void s3fs_crypt_mutex_lock(int mode, int pos, const char* file, int line)
{ {
if(s3fs_crypt_mutex){ if(s3fs_crypt_mutex){
@ -109,7 +109,7 @@ static struct CRYPTO_dynlock_value* s3fs_dyn_crypt_mutex(const char* file, int l
return dyndata; return dyndata;
} }
static void s3fs_dyn_crypt_mutex_lock(int mode, struct CRYPTO_dynlock_value* dyndata, const char* file, int line) __attribute__ ((unused)); static void s3fs_dyn_crypt_mutex_lock(int mode, struct CRYPTO_dynlock_value* dyndata, const char* file, int line) __attribute__ ((unused)) NO_THREAD_SAFETY_ANALYSIS;
static void s3fs_dyn_crypt_mutex_lock(int mode, struct CRYPTO_dynlock_value* dyndata, const char* file, int line) static void s3fs_dyn_crypt_mutex_lock(int mode, struct CRYPTO_dynlock_value* dyndata, const char* file, int line)
{ {
if(dyndata){ if(dyndata){