diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-03-18 14:19:19 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-03-18 14:19:19 +0000 |
commit | d96b0c14fbd9932015c15737ca215f58ac3fe1b5 (patch) | |
tree | 1059824ad1d5d74d9af2cd6ab4476bb2de0983d3 /llvm/lib/Fuzzer/FuzzerLoop.cpp | |
parent | 902b61ed04200d9b0f20758a8bd92c547c734950 (diff) | |
download | bcm5719-llvm-d96b0c14fbd9932015c15737ca215f58ac3fe1b5.tar.gz bcm5719-llvm-d96b0c14fbd9932015c15737ca215f58ac3fe1b5.zip |
[Fuzzer] Guard no_sanitize_memory attributes behind __has_feature.
Otherwise GCC fails to build it because it doesn't know the attribute.
llvm-svn: 263787
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerLoop.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp index 3bc5f93f409..7f3ffd0a4fe 100644 --- a/llvm/lib/Fuzzer/FuzzerLoop.cpp +++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp @@ -20,6 +20,14 @@ #endif #endif +#define NO_SANITIZE_MEMORY +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) +#undef NO_SANITIZE_MEMORY +#define NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory)) +#endif +#endif + extern "C" { // Re-declare some of the sanitizer functions as "weak" so that // libFuzzer can be linked w/o the sanitizers and sanitizer-coverage @@ -92,7 +100,7 @@ void Fuzzer::DumpCurrentUnit(const char *Prefix) { {CurrentUnitData, CurrentUnitData + CurrentUnitSize}, Prefix); } -__attribute__((no_sanitize_memory)) +NO_SANITIZE_MEMORY void Fuzzer::DeathCallback() { if (!CurrentUnitSize) return; Printf("DEATH:\n"); @@ -134,7 +142,7 @@ void Fuzzer::InterruptCallback() { _Exit(0); // Stop right now, don't perform any at-exit actions. } -__attribute__((no_sanitize_memory)) +NO_SANITIZE_MEMORY void Fuzzer::AlarmCallback() { assert(Options.UnitTimeoutSec > 0); if (!CurrentUnitSize) |