Skip to content

Commit

Permalink
Fix attribute use on Clang
Browse files Browse the repository at this point in the history
  • Loading branch information
BenHuddleston committed Apr 2, 2019
1 parent da2dd53 commit e1d60cc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions folly/CPortability.h
Expand Up @@ -122,10 +122,17 @@

#if FOLLY_SANITIZE
/**
* GCC 8.2.0 and Clang 6.0 both support the no_sanitize attribute, however,
* GCC 7.3.0 does not. Check for alternative attributes if no_sanitize is not
* available.
* GCC 8.2.0 asupports the no_sanitize attribute, however, GCC 7.3.0 does not.
* Check for alternative attributes if no_sanitize is not available. For Clang,
* we should use the __no_sanitize__ attribute.
*/
#if defined(__clang__)
#if __has_attribute(__no_sanitize__)
#define FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER \
__attribute__((__no_sanitize__("address")))
#endif // __has_attribute(__no_sanitize__)
#elif defined(__GNUC__)

#if defined(__has_cpp_attribute)

#if __has_cpp_attribute(no_sanitize)
Expand All @@ -148,6 +155,7 @@
#error __has_cpp_attribute was not found, cannot determine which attributes to\
use.
#endif // defined(__has_cpp_attribute)
#endif
#else // FOLLY_SANITIZE
#define FOLLY_DISABLE_UNDEFINED_BEHAVIOR_SANITIZER
#define FOLLY_DISABLE_NONNULL_SANITIZER
Expand Down

0 comments on commit e1d60cc

Please sign in to comment.