Add infrastructure for clang static lock checking (#2492)

Co-authored-by: Takeshi Nakatani <ggtakec@gmail.com>
This commit is contained in:
Andrew Gaul 2024-07-13 06:18:43 +05:30 committed by GitHub
parent db80fa2eb0
commit 03651a30ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -51,8 +51,20 @@ extern std::string instance_name;
//------------------------------------------------------------------- //-------------------------------------------------------------------
#define S3FS_FUNCATTR_WEAK __attribute__ ((weak,unused)) #define S3FS_FUNCATTR_WEAK __attribute__ ((weak,unused))
// empty annotation to indicate lock requirement //-------------------------------------------------------------------
#define REQUIRES(...) // For clang -Wthread-safety
//-------------------------------------------------------------------
#if defined(__clang__)
#define THREAD_ANNOTATION_ATTRIBUTE(x) __attribute__((x))
#else
#define THREAD_ANNOTATION_ATTRIBUTE(x) // no-op
#endif
#define GUARDED_BY(x) \
THREAD_ANNOTATION_ATTRIBUTE(guarded_by(x))
#define REQUIRES(...) \
THREAD_ANNOTATION_ATTRIBUTE(requires_capability(__VA_ARGS__))
#endif // S3FS_COMMON_H_ #endif // S3FS_COMMON_H_