[compiler-rt][hwasan] Check for SANITIZER_POSIX before including sanitizer_posix.h

Rather than throwing an error. This way we can still use files like
hwasan_dynamic_shadow.cpp for other platforms without leading to a
preprocessor error.

Differential Revision: https://reviews.llvm.org/D106979
This commit is contained in:
Leonard Chan 2021-07-28 11:09:22 -07:00
parent 993220a99c
commit 321a04bf62
1 changed files with 3 additions and 4 deletions

View File

@ -20,10 +20,7 @@
#include "sanitizer_platform_limits_posix.h"
#include "sanitizer_platform_limits_solaris.h"
#if !SANITIZER_POSIX
// Make it hard to accidentally use any of functions declared in this file:
#error This file should only be included on POSIX
#endif
#if SANITIZER_POSIX
namespace __sanitizer {
@ -126,4 +123,6 @@ void DecorateMapping(uptr addr, uptr size, const char *name);
} // namespace __sanitizer
#endif // SANITIZER_POSIX
#endif // SANITIZER_POSIX_H