summaryrefslogtreecommitdiff
path: root/libc/test/src/string/memory_utils
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2022-12-09 14:30:40 +0000
committerGuillaume Chatelet <gchatelet@google.com>2022-12-13 13:01:11 +0000
commitf52ca0926cf99b513666b4a88a5a67c78048e6f7 (patch)
treec7e7df6553bea542c05dbd2db691fa95bf5d89d2 /libc/test/src/string/memory_utils
parentf354716b052d19b4543617dfe3954503a6827ff8 (diff)
[libc] Add compiler, builtin and feature detection
This is a first step to support GCC. This patch adds support for builtin and feature detection. Differential Revision: https://reviews.llvm.org/D139712
Diffstat (limited to 'libc/test/src/string/memory_utils')
-rw-r--r--libc/test/src/string/memory_utils/CMakeLists.txt5
-rw-r--r--libc/test/src/string/memory_utils/memory_check_utils.h3
2 files changed, 5 insertions, 3 deletions
diff --git a/libc/test/src/string/memory_utils/CMakeLists.txt b/libc/test/src/string/memory_utils/CMakeLists.txt
index a65157175284..c06058e04b7d 100644
--- a/libc/test/src/string/memory_utils/CMakeLists.txt
+++ b/libc/test/src/string/memory_utils/CMakeLists.txt
@@ -9,8 +9,9 @@ add_libc_unittest(
${LIBC_COMPILE_OPTIONS_NATIVE}
-ffreestanding
DEPENDS
- libc.src.string.memory_utils.memory_utils
+ libc.src.__support.compiler_features
libc.src.__support.CPP.array
- libc.src.__support.CPP.span
libc.src.__support.CPP.cstddef
+ libc.src.__support.CPP.span
+ libc.src.string.memory_utils.memory_utils
)
diff --git a/libc/test/src/string/memory_utils/memory_check_utils.h b/libc/test/src/string/memory_utils/memory_check_utils.h
index 19cd01045bcb..4fd565aa0e97 100644
--- a/libc/test/src/string/memory_utils/memory_check_utils.h
+++ b/libc/test/src/string/memory_utils/memory_check_utils.h
@@ -10,13 +10,14 @@
#define LIBC_TEST_SRC_STRING_MEMORY_UTILS_MEMORY_CHECK_UTILS_H
#include "src/__support/CPP/span.h"
+#include "src/__support/compiler_features.h"
#include "src/string/memory_utils/utils.h"
#include <assert.h> // assert
#include <stddef.h> // size_t
#include <stdint.h> // uintxx_t
#include <stdlib.h> // malloc/free
-#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
+#if LLVM_LIBC_HAS_FEATURE(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
#include <sanitizer/asan_interface.h>
#define ASAN_POISON_MEMORY_REGION(addr, size) \
__asan_poison_memory_region((addr), (size))