[libc][memfunctions] Explicit error when platform in not supported
authorGuillaume Chatelet <gchatelet@google.com>
Tue, 18 Jul 2023 16:32:04 +0000 (16:32 +0000)
committerGuillaume Chatelet <gchatelet@google.com>
Wed, 19 Jul 2023 08:45:04 +0000 (08:45 +0000)
Reviewed By: JonChesterfield, jhuber6

Differential Revision: https://reviews.llvm.org/D155597

libc/src/string/memory_utils/bcmp_implementations.h
libc/src/string/memory_utils/memcmp_implementations.h
libc/src/string/memory_utils/memcpy_implementations.h
libc/src/string/memory_utils/memmove_implementations.h
libc/src/string/memory_utils/memset_implementations.h

index bfd5201..c595752 100644 (file)
 #elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
 #include "src/string/memory_utils/riscv/bcmp_implementations.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_BCMP inline_bcmp_riscv
-#else
-// We may want to error instead of defaulting to suboptimal implementation.
+#elif defined(LIBC_TARGET_ARCH_IS_ARM) || defined(LIBC_TARGET_ARCH_IS_GPU)
 #include "src/string/memory_utils/generic/byte_per_byte.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_BCMP inline_bcmp_byte_per_byte
+#else
+#error "Unsupported architecture"
 #endif
 
 namespace __llvm_libc {
index e18e640..5b91b49 100644 (file)
 #elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
 #include "src/string/memory_utils/riscv/memcmp_implementations.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP inline_memcmp_riscv
-#else
-// We may want to error instead of defaulting to suboptimal implementation.
+#elif defined(LIBC_TARGET_ARCH_IS_ARM) || defined(LIBC_TARGET_ARCH_IS_GPU)
 #include "src/string/memory_utils/generic/byte_per_byte.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP inline_memcmp_byte_per_byte
+#else
+#error "Unsupported architecture"
 #endif
 
 namespace __llvm_libc {
index 657fbac..90f57b9 100644 (file)
 #elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
 #include "src/string/memory_utils/riscv/memcpy_implementations.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMCPY inline_memcpy_riscv
-#else
-// We may want to error instead of defaulting to suboptimal implementation.
+#elif defined(LIBC_TARGET_ARCH_IS_ARM) || defined(LIBC_TARGET_ARCH_IS_GPU)
 #include "src/string/memory_utils/generic/byte_per_byte.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMCPY inline_memcpy_byte_per_byte
+#else
+#error "Unsupported architecture"
 #endif
 
 namespace __llvm_libc {
index 78ae7a8..da21e1c 100644 (file)
 #elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
 #include "src/string/memory_utils/riscv/memmove_implementations.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMMOVE inline_memmove_riscv
-#else
-// We may want to error instead of defaulting to suboptimal implementation.
+#elif defined(LIBC_TARGET_ARCH_IS_ARM) || defined(LIBC_TARGET_ARCH_IS_GPU)
 #include "src/string/memory_utils/generic/byte_per_byte.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMMOVE inline_memmove_byte_per_byte
+#else
+#error "Unsupported architecture"
 #endif
 
 namespace __llvm_libc {
index 37ceff9..ee8b97d 100644 (file)
 #elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
 #include "src/string/memory_utils/riscv/memset_implementations.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMSET inline_memset_riscv
-#else
-// We may want to error instead of defaulting to suboptimal implementation.
+#elif defined(LIBC_TARGET_ARCH_IS_ARM) || defined(LIBC_TARGET_ARCH_IS_GPU)
 #include "src/string/memory_utils/generic/byte_per_byte.h"
 #define LIBC_SRC_STRING_MEMORY_UTILS_MEMSET inline_memset_byte_per_byte
+#else
+#error "Unsupported architecture"
 #endif
 
 namespace __llvm_libc {