Commit c92fd042 authored by Dan Melnic's avatar Dan Melnic Committed by Facebook Github Bot

Use FOLLY_ATTR_WEAK for the annotate functions

Summary:
Use `FOLLY_ATTR_WEAK` for the annotate functions.

(Note: this ignores all push blocking failures!)

Differential Revision: D10234953

fbshipit-source-id: 534cb1d2d7d6053bc000e4c7ae3c6df16fc7a958
parent a202f9d6
...@@ -95,20 +95,89 @@ ...@@ -95,20 +95,89 @@
#define FOLLY_SANITIZE_THREAD 1 #define FOLLY_SANITIZE_THREAD 1
#endif #endif
/**
* Define a convenience macro to test when ASAN, UBSAN or TSAN sanitizer are
* being used
*/
#if defined(FOLLY_SANITIZE_ADDRESS) || defined(FOLLY_SANITIZE_THREAD)
#define FOLLY_SANITIZE 1
#endif
#if FOLLY_SANITIZE
#define FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER(...) \
__attribute__((no_sanitize(__VA_ARGS__)))
#else
#define FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER(...)
#endif // FOLLY_SANITIZE
/**
* Macro for marking functions as having public visibility.
*/
#if defined(__GNUC__)
#if __GNUC_PREREQ(4, 9)
#define FOLLY_EXPORT [[gnu::visibility("default")]]
#else
#define FOLLY_EXPORT __attribute__((__visibility__("default")))
#endif
#else
#define FOLLY_EXPORT
#endif
// noinline
#ifdef _MSC_VER
#define FOLLY_NOINLINE __declspec(noinline)
#elif defined(__clang__) || defined(__GNUC__)
#define FOLLY_NOINLINE __attribute__((__noinline__))
#else
#define FOLLY_NOINLINE
#endif
// always inline
#ifdef _MSC_VER
#define FOLLY_ALWAYS_INLINE __forceinline
#elif defined(__clang__) || defined(__GNUC__)
#define FOLLY_ALWAYS_INLINE inline __attribute__((__always_inline__))
#else
#define FOLLY_ALWAYS_INLINE inline
#endif
// attribute hidden
#if _MSC_VER
#define FOLLY_ATTR_VISIBILITY_HIDDEN
#elif defined(__clang__) || defined(__GNUC__)
#define FOLLY_ATTR_VISIBILITY_HIDDEN __attribute__((__visibility__("hidden")))
#else
#define FOLLY_ATTR_VISIBILITY_HIDDEN
#endif
// An attribute for marking symbols as weak, if supported
#if FOLLY_HAVE_WEAK_SYMBOLS
#define FOLLY_ATTR_WEAK __attribute__((__weak__))
#else
#define FOLLY_ATTR_WEAK
#endif
// Microsoft ABI version (can be overridden manually if necessary)
#ifndef FOLLY_MICROSOFT_ABI_VER
#ifdef _MSC_VER
#define FOLLY_MICROSOFT_ABI_VER _MSC_VER
#endif
#endif
/* These functions are defined by the TSAN runtime library and allow us to /* These functions are defined by the TSAN runtime library and allow us to
* annotate mutexes appopriately for TSAN. */ * annotate mutexes appopriately for TSAN. */
#ifdef FOLLY_SANITIZE_THREAD #ifdef FOLLY_SANITIZE_THREAD
extern "C" void extern "C" FOLLY_ATTR_WEAK void
AnnotateRWLockCreate(const char* f, int l, const volatile void* addr); AnnotateRWLockCreate(const char* f, int l, const volatile void* addr);
extern "C" void extern "C" FOLLY_ATTR_WEAK void
AnnotateRWLockCreateStatic(const char* f, int l, const volatile void* addr); AnnotateRWLockCreateStatic(const char* f, int l, const volatile void* addr);
extern "C" void extern "C" FOLLY_ATTR_WEAK void
AnnotateRWLockDestroy(const char* f, int l, const volatile void* addr); AnnotateRWLockDestroy(const char* f, int l, const volatile void* addr);
extern "C" void extern "C" FOLLY_ATTR_WEAK void
AnnotateRWLockAcquired(const char* f, int l, const volatile void* addr, long w); AnnotateRWLockAcquired(const char* f, int l, const volatile void* addr, long w);
extern "C" void extern "C" FOLLY_ATTR_WEAK void
AnnotateRWLockReleased(const char* f, int l, const volatile void* addr, long w); AnnotateRWLockReleased(const char* f, int l, const volatile void* addr, long w);
extern "C" void AnnotateBenignRaceSized( extern "C" FOLLY_ATTR_WEAK void AnnotateBenignRaceSized(
const char* f, const char* f,
int l, int l,
const volatile void* addr, const volatile void* addr,
...@@ -172,72 +241,3 @@ extern "C" void AnnotateBenignRaceSized( ...@@ -172,72 +241,3 @@ extern "C" void AnnotateBenignRaceSized(
#define FOLLY_ANNOTATE_RWLOCK_RDLOCK 0L #define FOLLY_ANNOTATE_RWLOCK_RDLOCK 0L
#define FOLLY_ANNOTATE_RWLOCK_WRLOCK 1L #define FOLLY_ANNOTATE_RWLOCK_WRLOCK 1L
/**
* Define a convenience macro to test when ASAN, UBSAN or TSAN sanitizer are
* being used
*/
#if defined(FOLLY_SANITIZE_ADDRESS) || defined(FOLLY_SANITIZE_THREAD)
#define FOLLY_SANITIZE 1
#endif
#if FOLLY_SANITIZE
#define FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER(...) \
__attribute__((no_sanitize(__VA_ARGS__)))
#else
#define FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER(...)
#endif // FOLLY_SANITIZE
/**
* Macro for marking functions as having public visibility.
*/
#if defined(__GNUC__)
#if __GNUC_PREREQ(4, 9)
#define FOLLY_EXPORT [[gnu::visibility("default")]]
#else
#define FOLLY_EXPORT __attribute__((__visibility__("default")))
#endif
#else
#define FOLLY_EXPORT
#endif
// noinline
#ifdef _MSC_VER
#define FOLLY_NOINLINE __declspec(noinline)
#elif defined(__clang__) || defined(__GNUC__)
#define FOLLY_NOINLINE __attribute__((__noinline__))
#else
#define FOLLY_NOINLINE
#endif
// always inline
#ifdef _MSC_VER
#define FOLLY_ALWAYS_INLINE __forceinline
#elif defined(__clang__) || defined(__GNUC__)
#define FOLLY_ALWAYS_INLINE inline __attribute__((__always_inline__))
#else
#define FOLLY_ALWAYS_INLINE inline
#endif
// attribute hidden
#if _MSC_VER
#define FOLLY_ATTR_VISIBILITY_HIDDEN
#elif defined(__clang__) || defined(__GNUC__)
#define FOLLY_ATTR_VISIBILITY_HIDDEN __attribute__((__visibility__("hidden")))
#else
#define FOLLY_ATTR_VISIBILITY_HIDDEN
#endif
// An attribute for marking symbols as weak, if supported
#if FOLLY_HAVE_WEAK_SYMBOLS
#define FOLLY_ATTR_WEAK __attribute__((__weak__))
#else
#define FOLLY_ATTR_WEAK
#endif
// Microsoft ABI version (can be overridden manually if necessary)
#ifndef FOLLY_MICROSOFT_ABI_VER
#ifdef _MSC_VER
#define FOLLY_MICROSOFT_ABI_VER _MSC_VER
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment