Revert "[Scudo] Make -fsanitize=scudo use standalone. Migrate tests."
This reverts commit 6911114d8cbed06a8a809c34ae07f4e3e89ab252.
Broke the QEMU sanitizer bots due to a missing header dependency. This
actually needs to be fixed on the bot-side, but for now reverting this
patch until I can fix up the bot.
GitOrigin-RevId: f7c5c0d87b8ae5e55006fd3a31994cd68d64f102
diff --git a/wrappers_cpp.cpp b/wrappers_cpp.cpp
index 0601179..adb1041 100644
--- a/wrappers_cpp.cpp
+++ b/wrappers_cpp.cpp
@@ -23,27 +23,6 @@
enum class align_val_t : size_t {};
} // namespace std
-// It's not valid for a non-throwing non-noreturn operator new to return
-// nullptr. In these cases, just terminate.
-#define CHECK_ALIGN_NORETURN(align) \
- do { \
- scudo::uptr alignment = static_cast<scudo::uptr>(align); \
- if (UNLIKELY(!scudo::isPowerOfTwo(alignment))) { \
- scudo::reportAlignmentNotPowerOfTwo(alignment); \
- } \
- } while (0)
-
-#define CHECK_ALIGN(align) \
- do { \
- scudo::uptr alignment = static_cast<scudo::uptr>(align); \
- if (UNLIKELY(!scudo::isPowerOfTwo(alignment))) { \
- if (Allocator.canReturnNull()) { \
- return nullptr; \
- } \
- scudo::reportAlignmentNotPowerOfTwo(alignment); \
- } \
- } while (0)
-
INTERFACE WEAK void *operator new(size_t size) {
return Allocator.allocate(size, scudo::Chunk::Origin::New);
}
@@ -59,24 +38,20 @@
return Allocator.allocate(size, scudo::Chunk::Origin::NewArray);
}
INTERFACE WEAK void *operator new(size_t size, std::align_val_t align) {
- CHECK_ALIGN_NORETURN(align);
return Allocator.allocate(size, scudo::Chunk::Origin::New,
static_cast<scudo::uptr>(align));
}
INTERFACE WEAK void *operator new[](size_t size, std::align_val_t align) {
- CHECK_ALIGN_NORETURN(align);
return Allocator.allocate(size, scudo::Chunk::Origin::NewArray,
static_cast<scudo::uptr>(align));
}
INTERFACE WEAK void *operator new(size_t size, std::align_val_t align,
std::nothrow_t const &) NOEXCEPT {
- CHECK_ALIGN(align);
return Allocator.allocate(size, scudo::Chunk::Origin::New,
static_cast<scudo::uptr>(align));
}
INTERFACE WEAK void *operator new[](size_t size, std::align_val_t align,
std::nothrow_t const &) NOEXCEPT {
- CHECK_ALIGN(align);
return Allocator.allocate(size, scudo::Chunk::Origin::NewArray,
static_cast<scudo::uptr>(align));
}