summaryrefslogtreecommitdiff
path: root/libc/src/string/memory_utils
diff options
context:
space:
mode:
authorPetr Hosek <phosek@google.com>2024-07-11 12:35:22 -0700
committerGitHub <noreply@github.com>2024-07-11 12:35:22 -0700
commit3f30effe1bd81fa1b039218a9bfe79c3b03fafad (patch)
treef3f9bbaca2e1088607359c74c4c696742383c032 /libc/src/string/memory_utils
parent2d7e136fc0e31207b962397250bc1581203c8d59 (diff)
[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)
This is a part of #97655.
Diffstat (limited to 'libc/src/string/memory_utils')
-rw-r--r--libc/src/string/memory_utils/aarch64/inline_bcmp.h5
-rw-r--r--libc/src/string/memory_utils/aarch64/inline_memcmp.h4
-rw-r--r--libc/src/string/memory_utils/aarch64/inline_memcpy.h4
-rw-r--r--libc/src/string/memory_utils/aarch64/inline_memmove.h4
-rw-r--r--libc/src/string/memory_utils/aarch64/inline_memset.h5
-rw-r--r--libc/src/string/memory_utils/generic/aligned_access.h4
-rw-r--r--libc/src/string/memory_utils/generic/builtin.h7
-rw-r--r--libc/src/string/memory_utils/generic/byte_per_byte.h4
-rw-r--r--libc/src/string/memory_utils/inline_bcmp.h5
-rw-r--r--libc/src/string/memory_utils/inline_bzero.h5
-rw-r--r--libc/src/string/memory_utils/inline_memcmp.h4
-rw-r--r--libc/src/string/memory_utils/inline_memcpy.h4
-rw-r--r--libc/src/string/memory_utils/inline_memmem.h5
-rw-r--r--libc/src/string/memory_utils/inline_memmove.h5
-rw-r--r--libc/src/string/memory_utils/inline_memset.h4
-rw-r--r--libc/src/string/memory_utils/inline_strcmp.h5
-rw-r--r--libc/src/string/memory_utils/inline_strstr.h5
-rw-r--r--libc/src/string/memory_utils/op_aarch64.h13
-rw-r--r--libc/src/string/memory_utils/op_builtin.h7
-rw-r--r--libc/src/string/memory_utils/op_generic.h11
-rw-r--r--libc/src/string/memory_utils/op_riscv.h7
-rw-r--r--libc/src/string/memory_utils/op_x86.h13
-rw-r--r--libc/src/string/memory_utils/riscv/inline_bcmp.h5
-rw-r--r--libc/src/string/memory_utils/riscv/inline_memcmp.h5
-rw-r--r--libc/src/string/memory_utils/riscv/inline_memcpy.h5
-rw-r--r--libc/src/string/memory_utils/riscv/inline_memmove.h5
-rw-r--r--libc/src/string/memory_utils/riscv/inline_memset.h5
-rw-r--r--libc/src/string/memory_utils/utils.h5
-rw-r--r--libc/src/string/memory_utils/x86_64/inline_bcmp.h5
-rw-r--r--libc/src/string/memory_utils/x86_64/inline_memcmp.h4
-rw-r--r--libc/src/string/memory_utils/x86_64/inline_memcpy.h4
-rw-r--r--libc/src/string/memory_utils/x86_64/inline_memmove.h4
-rw-r--r--libc/src/string/memory_utils/x86_64/inline_memset.h5
33 files changed, 109 insertions, 73 deletions
diff --git a/libc/src/string/memory_utils/aarch64/inline_bcmp.h b/libc/src/string/memory_utils/aarch64/inline_bcmp.h
index b80b57818763..93196415f266 100644
--- a/libc/src/string/memory_utils/aarch64/inline_bcmp.h
+++ b/libc/src/string/memory_utils/aarch64/inline_bcmp.h
@@ -9,6 +9,7 @@
#define LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_BCMP_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE
+#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/string/memory_utils/op_aarch64.h"
#include "src/string/memory_utils/op_generic.h"
@@ -16,7 +17,7 @@
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[maybe_unused]] LIBC_INLINE BcmpReturnType inline_bcmp_aarch64(CPtr p1,
CPtr p2,
@@ -65,6 +66,6 @@ namespace LIBC_NAMESPACE {
return aarch64::Bcmp<32>::loop_and_tail(p1, p2, count);
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_BCMP_H
diff --git a/libc/src/string/memory_utils/aarch64/inline_memcmp.h b/libc/src/string/memory_utils/aarch64/inline_memcmp.h
index d0e0bd7cf025..84f5a4123079 100644
--- a/libc/src/string/memory_utils/aarch64/inline_memcmp.h
+++ b/libc/src/string/memory_utils/aarch64/inline_memcmp.h
@@ -14,7 +14,7 @@
#include "src/string/memory_utils/op_generic.h"
#include "src/string/memory_utils/utils.h" // MemcmpReturnType
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[maybe_unused]] LIBC_INLINE MemcmpReturnType
inline_memcmp_generic_gt16(CPtr p1, CPtr p2, size_t count) {
@@ -66,6 +66,6 @@ LIBC_INLINE MemcmpReturnType inline_memcmp_aarch64(CPtr p1, CPtr p2,
else
return inline_memcmp_generic_gt16(p1, p2, count);
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMCMP_H
diff --git a/libc/src/string/memory_utils/aarch64/inline_memcpy.h b/libc/src/string/memory_utils/aarch64/inline_memcpy.h
index ea1a03f4fa0b..2b34b675d8af 100644
--- a/libc/src/string/memory_utils/aarch64/inline_memcpy.h
+++ b/libc/src/string/memory_utils/aarch64/inline_memcpy.h
@@ -14,7 +14,7 @@
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[maybe_unused]] LIBC_INLINE void
inline_memcpy_aarch64(Ptr __restrict dst, CPtr __restrict src, size_t count) {
@@ -43,6 +43,6 @@ inline_memcpy_aarch64(Ptr __restrict dst, CPtr __restrict src, size_t count) {
return builtin::Memcpy<64>::loop_and_tail(dst, src, count);
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMCPY_H
diff --git a/libc/src/string/memory_utils/aarch64/inline_memmove.h b/libc/src/string/memory_utils/aarch64/inline_memmove.h
index ca28655c9168..def82373fbfb 100644
--- a/libc/src/string/memory_utils/aarch64/inline_memmove.h
+++ b/libc/src/string/memory_utils/aarch64/inline_memmove.h
@@ -16,7 +16,7 @@
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
LIBC_INLINE void inline_memmove_aarch64(Ptr dst, CPtr src, size_t count) {
static_assert(aarch64::kNeon, "aarch64 supports vector types");
@@ -48,6 +48,6 @@ LIBC_INLINE void inline_memmove_aarch64(Ptr dst, CPtr src, size_t count) {
}
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMMOVE_H
diff --git a/libc/src/string/memory_utils/aarch64/inline_memset.h b/libc/src/string/memory_utils/aarch64/inline_memset.h
index 91512acce6fc..a2c05534aa33 100644
--- a/libc/src/string/memory_utils/aarch64/inline_memset.h
+++ b/libc/src/string/memory_utils/aarch64/inline_memset.h
@@ -9,13 +9,14 @@
#define LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMSET_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE
+#include "src/__support/macros/config.h"
#include "src/string/memory_utils/op_aarch64.h"
#include "src/string/memory_utils/op_generic.h"
#include "src/string/memory_utils/utils.h" // Ptr, CPtr
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[maybe_unused]] LIBC_INLINE static void
inline_memset_aarch64(Ptr dst, uint8_t value, size_t count) {
@@ -56,6 +57,6 @@ inline_memset_aarch64(Ptr dst, uint8_t value, size_t count) {
}
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMSET_H
diff --git a/libc/src/string/memory_utils/generic/aligned_access.h b/libc/src/string/memory_utils/generic/aligned_access.h
index b6ece816756c..7e480b8a1c2b 100644
--- a/libc/src/string/memory_utils/generic/aligned_access.h
+++ b/libc/src/string/memory_utils/generic/aligned_access.h
@@ -20,7 +20,7 @@
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[maybe_unused]] LIBC_INLINE uint32_t load32_aligned(CPtr ptr, size_t offset,
size_t alignment) {
@@ -202,6 +202,6 @@ inline_memcmp_aligned_access_64bit(CPtr p1, CPtr p2, size_t count) {
return inline_memcmp_byte_per_byte(p1, p2, count, offset);
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_GENERIC_ALIGNED_ACCESS_H
diff --git a/libc/src/string/memory_utils/generic/builtin.h b/libc/src/string/memory_utils/generic/builtin.h
index ba4f4b898408..5670a4e61056 100644
--- a/libc/src/string/memory_utils/generic/builtin.h
+++ b/libc/src/string/memory_utils/generic/builtin.h
@@ -10,11 +10,12 @@
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_GENERIC_BUILTIN_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE
-#include "src/string/memory_utils/utils.h" // Ptr, CPtr
+#include "src/__support/macros/config.h"
+#include "src/string/memory_utils/utils.h" // Ptr, CPtr
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
#if !__has_builtin(__builtin_memcpy) || !__has_builtin(__builtin_memset) || \
!__has_builtin(__builtin_memmove)
@@ -36,6 +37,6 @@ inline_memset_builtin(Ptr dst, uint8_t value, size_t count, size_t offset = 0) {
__builtin_memset(dst + offset, value, count);
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_GENERIC_BUILTIN_H
diff --git a/libc/src/string/memory_utils/generic/byte_per_byte.h b/libc/src/string/memory_utils/generic/byte_per_byte.h
index 9515398794df..eab5964bfe16 100644
--- a/libc/src/string/memory_utils/generic/byte_per_byte.h
+++ b/libc/src/string/memory_utils/generic/byte_per_byte.h
@@ -18,7 +18,7 @@
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[maybe_unused]] LIBC_INLINE void
inline_memcpy_byte_per_byte(Ptr dst, CPtr src, size_t count,
@@ -73,6 +73,6 @@ inline_memcmp_byte_per_byte(CPtr p1, CPtr p2, size_t count, size_t offset = 0) {
return MemcmpReturnType::zero();
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_GENERIC_BYTE_PER_BYTE_H
diff --git a/libc/src/string/memory_utils/inline_bcmp.h b/libc/src/string/memory_utils/inline_bcmp.h
index 69aa2acf75be..14cf16ebb6b6 100644
--- a/libc/src/string/memory_utils/inline_bcmp.h
+++ b/libc/src/string/memory_utils/inline_bcmp.h
@@ -10,6 +10,7 @@
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_BCMP_H
#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h" // LIBC_TARGET_ARCH_IS_
#include <stddef.h> // size_t
@@ -30,7 +31,7 @@
#error "Unsupported architecture"
#endif
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[gnu::flatten]] LIBC_INLINE int inline_bcmp(const void *p1, const void *p2,
size_t count) {
@@ -38,7 +39,7 @@ namespace LIBC_NAMESPACE {
reinterpret_cast<CPtr>(p1), reinterpret_cast<CPtr>(p2), count));
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#undef LIBC_SRC_STRING_MEMORY_UTILS_BCMP
diff --git a/libc/src/string/memory_utils/inline_bzero.h b/libc/src/string/memory_utils/inline_bzero.h
index d760baca9d0f..4a92e8b57a68 100644
--- a/libc/src/string/memory_utils/inline_bzero.h
+++ b/libc/src/string/memory_utils/inline_bzero.h
@@ -10,11 +10,12 @@
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_BZERO_H
#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
#include "src/string/memory_utils/inline_memset.h"
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[gnu::flatten]] LIBC_INLINE static void inline_bzero(Ptr dst, size_t count) {
inline_memset(dst, 0, count);
@@ -24,6 +25,6 @@ namespace LIBC_NAMESPACE {
inline_bzero(reinterpret_cast<Ptr>(dst), count);
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_BZERO_H
diff --git a/libc/src/string/memory_utils/inline_memcmp.h b/libc/src/string/memory_utils/inline_memcmp.h
index 1fdc13973c64..82216265c23b 100644
--- a/libc/src/string/memory_utils/inline_memcmp.h
+++ b/libc/src/string/memory_utils/inline_memcmp.h
@@ -31,7 +31,7 @@
#error "Unsupported architecture"
#endif
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[gnu::flatten]] LIBC_INLINE int inline_memcmp(const void *p1, const void *p2,
size_t count) {
@@ -39,7 +39,7 @@ namespace LIBC_NAMESPACE {
reinterpret_cast<CPtr>(p1), reinterpret_cast<CPtr>(p2), count));
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#undef LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP
diff --git a/libc/src/string/memory_utils/inline_memcpy.h b/libc/src/string/memory_utils/inline_memcpy.h
index c88fd55eff64..7a77e7743813 100644
--- a/libc/src/string/memory_utils/inline_memcpy.h
+++ b/libc/src/string/memory_utils/inline_memcpy.h
@@ -38,7 +38,7 @@
#error "Unsupported architecture"
#endif
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[gnu::flatten]] LIBC_INLINE void
inline_memcpy(void *__restrict dst, const void *__restrict src, size_t count) {
@@ -46,6 +46,6 @@ inline_memcpy(void *__restrict dst, const void *__restrict src, size_t count) {
reinterpret_cast<CPtr>(src), count);
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMCPY_H
diff --git a/libc/src/string/memory_utils/inline_memmem.h b/libc/src/string/memory_utils/inline_memmem.h
index eaddee57aef5..15e3d633985d 100644
--- a/libc/src/string/memory_utils/inline_memmem.h
+++ b/libc/src/string/memory_utils/inline_memmem.h
@@ -10,10 +10,11 @@
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMMEM_H
#include "src/__support/macros/attributes.h"
+#include "src/__support/macros/config.h"
#include <stddef.h>
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
template <typename Comp>
LIBC_INLINE constexpr static void *
@@ -39,6 +40,6 @@ inline_memmem(const void *haystack, size_t haystack_len, const void *needle,
return nullptr;
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMMEM_H
diff --git a/libc/src/string/memory_utils/inline_memmove.h b/libc/src/string/memory_utils/inline_memmove.h
index 3cbc3e0b0a52..85d0159701ec 100644
--- a/libc/src/string/memory_utils/inline_memmove.h
+++ b/libc/src/string/memory_utils/inline_memmove.h
@@ -9,6 +9,7 @@
#ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMMOVE_H
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMMOVE_H
+#include "src/__support/macros/config.h"
#include <stddef.h> // size_t, ptrdiff_t
#if defined(LIBC_TARGET_ARCH_IS_X86)
@@ -42,7 +43,7 @@
#error "Unsupported architecture"
#endif
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
LIBC_INLINE constexpr bool inline_memmove_no_small_size(void *, const void *,
size_t) {
@@ -67,6 +68,6 @@ LIBC_INLINE void inline_memmove(void *dst, const void *src, size_t count) {
inline_memmove_follow_up(dst, src, count);
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif /* LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMMOVE_H */
diff --git a/libc/src/string/memory_utils/inline_memset.h b/libc/src/string/memory_utils/inline_memset.h
index 1c07c1ca4bff..858e983f0093 100644
--- a/libc/src/string/memory_utils/inline_memset.h
+++ b/libc/src/string/memory_utils/inline_memset.h
@@ -34,13 +34,13 @@
#error "Unsupported architecture"
#endif
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
LIBC_INLINE static void inline_memset(void *dst, uint8_t value, size_t count) {
LIBC_SRC_STRING_MEMORY_UTILS_MEMSET(reinterpret_cast<Ptr>(dst), value, count);
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#undef LIBC_SRC_STRING_MEMORY_UTILS_MEMSET
diff --git a/libc/src/string/memory_utils/inline_strcmp.h b/libc/src/string/memory_utils/inline_strcmp.h
index 2bcd56ad3d6b..281d5b14c6cb 100644
--- a/libc/src/string/memory_utils/inline_strcmp.h
+++ b/libc/src/string/memory_utils/inline_strcmp.h
@@ -9,9 +9,10 @@
#ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRCMP_H
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRCMP_H
+#include "src/__support/macros/config.h"
#include <stddef.h>
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
template <typename Comp>
LIBC_INLINE constexpr int inline_strcmp(const char *left, const char *right,
@@ -39,6 +40,6 @@ LIBC_INLINE constexpr int inline_strncmp(const char *left, const char *right,
*reinterpret_cast<const unsigned char *>(right));
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRCMP_H
diff --git a/libc/src/string/memory_utils/inline_strstr.h b/libc/src/string/memory_utils/inline_strstr.h
index f0f8e2bbf896..9c99e920b4b5 100644
--- a/libc/src/string/memory_utils/inline_strstr.h
+++ b/libc/src/string/memory_utils/inline_strstr.h
@@ -9,11 +9,12 @@
#ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRSTR_H
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRSTR_H
+#include "src/__support/macros/config.h"
#include "src/string/memory_utils/inline_memmem.h"
#include "src/string/string_utils.h"
#include <stddef.h>
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
template <typename Comp>
LIBC_INLINE constexpr char *inline_strstr(const char *haystack,
@@ -24,6 +25,6 @@ LIBC_INLINE constexpr char *inline_strstr(const char *haystack,
return static_cast<char *>(result);
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRSTR_H
diff --git a/libc/src/string/memory_utils/op_aarch64.h b/libc/src/string/memory_utils/op_aarch64.h
index 6a2013b2a8fa..1090ea2617f0 100644
--- a/libc/src/string/memory_utils/op_aarch64.h
+++ b/libc/src/string/memory_utils/op_aarch64.h
@@ -13,6 +13,7 @@
#ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_AARCH64_H
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_AARCH64_H
+#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h"
#if defined(LIBC_TARGET_ARCH_IS_AARCH64)
@@ -25,7 +26,8 @@
#include <arm_neon.h>
#endif //__ARM_NEON
-namespace LIBC_NAMESPACE::aarch64 {
+namespace LIBC_NAMESPACE_DECL {
+namespace aarch64 {
LIBC_INLINE_VAR constexpr bool kNeon = LLVM_LIBC_IS_DEFINED(__ARM_NEON);
@@ -170,9 +172,11 @@ template <size_t Size> struct Bcmp {
}
};
-} // namespace LIBC_NAMESPACE::aarch64
+} // namespace aarch64
+} // namespace LIBC_NAMESPACE_DECL
-namespace LIBC_NAMESPACE::generic {
+namespace LIBC_NAMESPACE_DECL {
+namespace generic {
///////////////////////////////////////////////////////////////////////////////
// Specializations for uint16_t
@@ -264,7 +268,8 @@ LIBC_INLINE MemcmpReturnType cmp<uint8x16x2_t>(CPtr p1, CPtr p2,
}
return MemcmpReturnType::zero();
}
-} // namespace LIBC_NAMESPACE::generic
+} // namespace generic
+} // namespace LIBC_NAMESPACE_DECL
#endif // LIBC_TARGET_ARCH_IS_AARCH64
diff --git a/libc/src/string/memory_utils/op_builtin.h b/libc/src/string/memory_utils/op_builtin.h
index 75dd4de53a47..d7c1b1f87011 100644
--- a/libc/src/string/memory_utils/op_builtin.h
+++ b/libc/src/string/memory_utils/op_builtin.h
@@ -16,9 +16,11 @@
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_BUILTIN_H
#include "src/__support/CPP/type_traits.h"
+#include "src/__support/macros/config.h"
#include "src/string/memory_utils/utils.h"
-namespace LIBC_NAMESPACE::builtin {
+namespace LIBC_NAMESPACE_DECL {
+namespace builtin {
///////////////////////////////////////////////////////////////////////////////
// Memcpy
@@ -151,6 +153,7 @@ template <size_t Size> struct Memcmp {
}
};
-} // namespace LIBC_NAMESPACE::builtin
+} // namespace builtin
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_BUILTIN_H
diff --git a/libc/src/string/memory_utils/op_generic.h b/libc/src/string/memory_utils/op_generic.h
index efaff80b7e4d..89bbea8a2bdd 100644
--- a/libc/src/string/memory_utils/op_generic.h
+++ b/libc/src/string/memory_utils/op_generic.h
@@ -27,6 +27,7 @@
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
#include "src/__support/endian.h"
+#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT64
#include "src/string/memory_utils/op_builtin.h"
@@ -38,14 +39,15 @@ static_assert((UINTPTR_MAX == 4294967295U) ||
(UINTPTR_MAX == 18446744073709551615UL),
"We currently only support 32- or 64-bit platforms");
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
// Compiler types using the vector attributes.
using generic_v128 = uint8_t __attribute__((__vector_size__(16)));
using generic_v256 = uint8_t __attribute__((__vector_size__(32)));
using generic_v512 = uint8_t __attribute__((__vector_size__(64)));
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
-namespace LIBC_NAMESPACE::generic {
+namespace LIBC_NAMESPACE_DECL {
+namespace generic {
// We accept three types of values as elements for generic operations:
// - scalar : unsigned integral types,
@@ -578,6 +580,7 @@ LIBC_INLINE MemcmpReturnType cmp<uint8_t>(CPtr p1, CPtr p2, size_t offset) {
template <>
LIBC_INLINE MemcmpReturnType cmp_neq<uint8_t>(CPtr p1, CPtr p2, size_t offset);
-} // namespace LIBC_NAMESPACE::generic
+} // namespace generic
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_GENERIC_H
diff --git a/libc/src/string/memory_utils/op_riscv.h b/libc/src/string/memory_utils/op_riscv.h
index 313d55e644cb..2d211de0facf 100644
--- a/libc/src/string/memory_utils/op_riscv.h
+++ b/libc/src/string/memory_utils/op_riscv.h
@@ -12,6 +12,7 @@
#ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_RISCV_H
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_RISCV_H
+#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h"
#if defined(LIBC_TARGET_ARCH_IS_ANY_RISCV)
@@ -19,7 +20,8 @@
#include "src/__support/common.h"
#include "src/string/memory_utils/op_generic.h"
-namespace LIBC_NAMESPACE::generic {
+namespace LIBC_NAMESPACE_DECL {
+namespace generic {
///////////////////////////////////////////////////////////////////////////////
// Specializations for uint16_t
@@ -78,7 +80,8 @@ LIBC_INLINE MemcmpReturnType cmp_neq<uint64_t>(CPtr p1, CPtr p2,
return cmp_neq_uint64_t(a, b);
}
-} // namespace LIBC_NAMESPACE::generic
+} // namespace generic
+} // namespace LIBC_NAMESPACE_DECL
#endif // LIBC_TARGET_ARCH_IS_ANY_RISCV
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_RISCV_H
diff --git a/libc/src/string/memory_utils/op_x86.h b/libc/src/string/memory_utils/op_x86.h
index 2d9cebbb0496..cf9667283818 100644
--- a/libc/src/string/memory_utils/op_x86.h
+++ b/libc/src/string/memory_utils/op_x86.h
@@ -12,6 +12,7 @@
#ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_X86_H
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_X86_H
+#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h"
#if defined(LIBC_TARGET_ARCH_IS_X86)
@@ -37,7 +38,8 @@
#define _mm_movemask_epi8(A) 0
#endif
-namespace LIBC_NAMESPACE::x86 {
+namespace LIBC_NAMESPACE_DECL {
+namespace x86 {
// A set of constants to check compile time features.
LIBC_INLINE_VAR constexpr bool K_SSE2 = LLVM_LIBC_IS_DEFINED(__SSE2__);
@@ -55,9 +57,11 @@ struct Memcpy {
}
};
-} // namespace LIBC_NAMESPACE::x86
+} // namespace x86
+} // namespace LIBC_NAMESPACE_DECL
-namespace LIBC_NAMESPACE::generic {
+namespace LIBC_NAMESPACE_DECL {
+namespace generic {
///////////////////////////////////////////////////////////////////////////////
// Specializations for uint16_t
@@ -314,7 +318,8 @@ LIBC_INLINE MemcmpReturnType cmp_neq<__m512i>(CPtr p1, CPtr p2, size_t offset) {
#pragma GCC diagnostic pop
-} // namespace LIBC_NAMESPACE::generic
+} // namespace generic
+} // namespace LIBC_NAMESPACE_DECL
#endif // LIBC_TARGET_ARCH_IS_X86
diff --git a/libc/src/string/memory_utils/riscv/inline_bcmp.h b/libc/src/string/memory_utils/riscv/inline_bcmp.h
index d66f0a7b225e..4bdde27cd16b 100644
--- a/libc/src/string/memory_utils/riscv/inline_bcmp.h
+++ b/libc/src/string/memory_utils/riscv/inline_bcmp.h
@@ -9,13 +9,14 @@
#define LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_BCMP_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE
+#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h" // LIBC_TARGET_ARCH_IS_RISCV64
#include "src/string/memory_utils/generic/aligned_access.h"
#include "src/string/memory_utils/utils.h" // Ptr, CPtr
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[maybe_unused]] LIBC_INLINE BcmpReturnType inline_bcmp_riscv(CPtr p1, CPtr p2,
size_t count) {
@@ -28,6 +29,6 @@ namespace LIBC_NAMESPACE {
#endif
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_BCMP_H
diff --git a/libc/src/string/memory_utils/riscv/inline_memcmp.h b/libc/src/string/memory_utils/riscv/inline_memcmp.h
index 0b28ad92235c..ca834952d331 100644
--- a/libc/src/string/memory_utils/riscv/inline_memcmp.h
+++ b/libc/src/string/memory_utils/riscv/inline_memcmp.h
@@ -9,13 +9,14 @@
#define LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMCMP_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE
+#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h" // LIBC_TARGET_ARCH_IS_RISCV64
#include "src/string/memory_utils/generic/aligned_access.h"
#include "src/string/memory_utils/utils.h" // Ptr, CPtr
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[maybe_unused]] LIBC_INLINE MemcmpReturnType
inline_memcmp_riscv(CPtr p1, CPtr p2, size_t count) {
@@ -28,6 +29,6 @@ inline_memcmp_riscv(CPtr p1, CPtr p2, size_t count) {
#endif
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMCMP_H
diff --git a/libc/src/string/memory_utils/riscv/inline_memcpy.h b/libc/src/string/memory_utils/riscv/inline_memcpy.h
index 05531c8b7597..8eb87e0f38ce 100644
--- a/libc/src/string/memory_utils/riscv/inline_memcpy.h
+++ b/libc/src/string/memory_utils/riscv/inline_memcpy.h
@@ -9,13 +9,14 @@
#define LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMCPY_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE
+#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h" // LIBC_TARGET_ARCH_IS_RISCV64
#include "src/string/memory_utils/generic/aligned_access.h"
#include "src/string/memory_utils/utils.h" // Ptr, CPtr
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[maybe_unused]] LIBC_INLINE void
inline_memcpy_riscv(Ptr __restrict dst, CPtr __restrict src, size_t count) {
@@ -28,6 +29,6 @@ inline_memcpy_riscv(Ptr __restrict dst, CPtr __restrict src, size_t count) {
#endif
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMCPY_H
diff --git a/libc/src/string/memory_utils/riscv/inline_memmove.h b/libc/src/string/memory_utils/riscv/inline_memmove.h
index 1a95a8ebba07..28de4c240260 100644
--- a/libc/src/string/memory_utils/riscv/inline_memmove.h
+++ b/libc/src/string/memory_utils/riscv/inline_memmove.h
@@ -9,19 +9,20 @@
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMMOVE_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE
+#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h" // LIBC_TARGET_ARCH_IS_RISCV64
#include "src/string/memory_utils/generic/byte_per_byte.h"
#include "src/string/memory_utils/utils.h" // Ptr, CPtr
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[maybe_unused]] LIBC_INLINE void
inline_memmove_riscv(Ptr __restrict dst, CPtr __restrict src, size_t count) {
return inline_memmove_byte_per_byte(dst, src, count);
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMMOVE_H
diff --git a/libc/src/string/memory_utils/riscv/inline_memset.h b/libc/src/string/memory_utils/riscv/inline_memset.h
index b9b8a188aff6..d6ab523f1641 100644
--- a/libc/src/string/memory_utils/riscv/inline_memset.h
+++ b/libc/src/string/memory_utils/riscv/inline_memset.h
@@ -9,13 +9,14 @@
#define LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMSET_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE
+#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h" // LIBC_TARGET_ARCH_IS_RISCV64
#include "src/string/memory_utils/generic/aligned_access.h"
#include "src/string/memory_utils/utils.h" // Ptr, CPtr
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
LIBC_INLINE static void inline_memset_riscv(Ptr dst, uint8_t value,
size_t count) {
@@ -28,6 +29,6 @@ LIBC_INLINE static void inline_memset_riscv(Ptr dst, uint8_t value,
#endif
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMSET_H
diff --git a/libc/src/string/memory_utils/utils.h b/libc/src/string/memory_utils/utils.h
index cb1fd899b6c6..5e5fe593cce7 100644
--- a/libc/src/string/memory_utils/utils.h
+++ b/libc/src/string/memory_utils/utils.h
@@ -14,12 +14,13 @@
#include "src/__support/CPP/type_traits.h"
#include "src/__support/endian.h"
#include "src/__support/macros/attributes.h" // LIBC_INLINE
+#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h"
#include <stddef.h> // size_t
#include <stdint.h> // intptr_t / uintptr_t / INT32_MAX / INT32_MIN
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
// Returns the number of bytes to substract from ptr to get to the previous
// multiple of alignment. If ptr is already aligned returns 0.
@@ -349,6 +350,6 @@ LIBC_INLINE void prefetch_to_local_cache(CPtr dst) {
__builtin_prefetch(dst, /*read*/ 0, /*max locality*/ 3);
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_UTILS_H
diff --git a/libc/src/string/memory_utils/x86_64/inline_bcmp.h b/libc/src/string/memory_utils/x86_64/inline_bcmp.h
index 58eaedbbe015..49fe08fb0501 100644
--- a/libc/src/string/memory_utils/x86_64/inline_bcmp.h
+++ b/libc/src/string/memory_utils/x86_64/inline_bcmp.h
@@ -9,13 +9,14 @@
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_BCMP_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE
+#include "src/__support/macros/config.h"
#include "src/string/memory_utils/op_generic.h"
#include "src/string/memory_utils/op_x86.h"
#include "src/string/memory_utils/utils.h" // Ptr, CPtr
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[maybe_unused]] LIBC_INLINE BcmpReturnType
inline_bcmp_generic_gt16(CPtr p1, CPtr p2, size_t count) {
@@ -88,6 +89,6 @@ inline_bcmp_x86_avx512bw_gt16(CPtr p1, CPtr p2, size_t count) {
#endif
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_BCMP_H
diff --git a/libc/src/string/memory_utils/x86_64/inline_memcmp.h b/libc/src/string/memory_utils/x86_64/inline_memcmp.h
index 6a315adcd566..7fd101227c88 100644
--- a/libc/src/string/memory_utils/x86_64/inline_memcmp.h
+++ b/libc/src/string/memory_utils/x86_64/inline_memcmp.h
@@ -15,7 +15,7 @@
#include "src/string/memory_utils/op_x86.h"
#include "src/string/memory_utils/utils.h" // MemcmpReturnType
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
[[maybe_unused]] LIBC_INLINE MemcmpReturnType
inline_memcmp_generic_gt16(CPtr p1, CPtr p2, size_t count) {
@@ -89,6 +89,6 @@ LIBC_INLINE MemcmpReturnType inline_memcmp_x86(CPtr p1, CPtr p2, size_t count) {
#endif
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMCMP_H
diff --git a/libc/src/string/memory_utils/x86_64/inline_memcpy.h b/libc/src/string/memory_utils/x86_64/inline_memcpy.h
index 507b3e25199e..59a360811f11 100644
--- a/libc/src/string/memory_utils/x86_64/inline_memcpy.h
+++ b/libc/src/string/memory_utils/x86_64/inline_memcpy.h
@@ -26,7 +26,7 @@
#error LLVM_LIBC_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE is deprecated use LIBC_COPT_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE=0 instead.
#endif // LLVM_LIBC_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace x86 {
@@ -222,6 +222,6 @@ inline_memcpy_x86_maybe_interpose_repmovsb(Ptr __restrict dst,
}
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMCPY_H
diff --git a/libc/src/string/memory_utils/x86_64/inline_memmove.h b/libc/src/string/memory_utils/x86_64/inline_memmove.h
index 879b36eaa673..d81e833598f7 100644
--- a/libc/src/string/memory_utils/x86_64/inline_memmove.h
+++ b/libc/src/string/memory_utils/x86_64/inline_memmove.h
@@ -16,7 +16,7 @@
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
LIBC_INLINE bool inline_memmove_small_size_x86(Ptr dst, CPtr src,
size_t count) {
@@ -115,6 +115,6 @@ LIBC_INLINE void inline_memmove_follow_up_x86(Ptr dst, CPtr src, size_t count) {
}
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMMOVE_H
diff --git a/libc/src/string/memory_utils/x86_64/inline_memset.h b/libc/src/string/memory_utils/x86_64/inline_memset.h
index 584efcbea4be..9f8e584d2bbb 100644
--- a/libc/src/string/memory_utils/x86_64/inline_memset.h
+++ b/libc/src/string/memory_utils/x86_64/inline_memset.h
@@ -9,13 +9,14 @@
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMSET_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE
+#include "src/__support/macros/config.h"
#include "src/string/memory_utils/op_generic.h"
#include "src/string/memory_utils/op_x86.h"
#include "src/string/memory_utils/utils.h" // Ptr, CPtr
#include <stddef.h> // size_t
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace x86 {
// Size of one cache line for software prefetching
LIBC_INLINE_VAR constexpr size_t K_ONE_CACHELINE_SIZE = 64;
@@ -104,6 +105,6 @@ inline_memset_x86(Ptr dst, uint8_t value, size_t count) {
align_to_next_boundary<32>(dst, count);
return generic::Memset<uint256_t>::loop_and_tail(dst, value, count);
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMSET_H