[libc-commits] [PATCH] D76967: [libc][NFC] Ensure internal implementation is in __llvm_libc namespace

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Mar 27 19:51:15 PDT 2020


abrachet created this revision.
abrachet added reviewers: PaulkaToast, sivachandra, gchatelet.
Herald added subscribers: tschuett, MaskRay.

In preparation for D76818 <https://reviews.llvm.org/D76818>.


https://reviews.llvm.org/D76967

Files:
  libc/src/signal/linux/__restore.cpp
  libc/src/string/memory_utils/memcpy_utils.h
  libc/src/threads/linux/thread_utils.h


Index: libc/src/threads/linux/thread_utils.h
===================================================================
--- libc/src/threads/linux/thread_utils.h
+++ libc/src/threads/linux/thread_utils.h
@@ -14,6 +14,8 @@
 #include <stdatomic.h>
 #include <stdint.h>
 
+namespace __llvm_libc {
+
 // The futex data has to be exactly 4 bytes long. However, we use a uint type
 // here as we do not want to use `_Atomic uint32_t` as the _Atomic keyword which
 // is C only. The header stdatomic.h does not define an atomic type
@@ -35,4 +37,6 @@
   static constexpr uint32_t ClearTIDValue = 0xABCD1234;
 };
 
+} // namespace __llvm_libc
+
 #endif // LLVM_LIBC_SRC_THREADS_LINUX_THREAD_UTILS_H
Index: libc/src/string/memory_utils/memcpy_utils.h
===================================================================
--- libc/src/string/memory_utils/memcpy_utils.h
+++ libc/src/string/memory_utils/memcpy_utils.h
@@ -20,14 +20,14 @@
 #define USE_BUILTIN_MEMCPY
 #endif
 
+namespace __llvm_libc {
+
 // This is useful for testing.
 #if defined(LLVM_LIBC_MEMCPY_MONITOR)
 extern "C" void LLVM_LIBC_MEMCPY_MONITOR(char *__restrict,
                                          const char *__restrict, size_t);
 #endif
 
-namespace __llvm_libc {
-
 // Copies `kBlockSize` bytes from `src` to `dst`.
 template <size_t kBlockSize>
 static void Copy(char *__restrict dst, const char *__restrict src) {
Index: libc/src/signal/linux/__restore.cpp
===================================================================
--- libc/src/signal/linux/__restore.cpp
+++ libc/src/signal/linux/__restore.cpp
@@ -13,8 +13,12 @@
 #include "config/linux/syscall.h"
 #include "include/sys/syscall.h"
 
+namespace __llvm_libc {
+
 extern "C" void __restore_rt()
     __attribute__((no_sanitize("thread", "memory", "undefined", "fuzzer"),
                    hidden));
 
 extern "C" void __restore_rt() { __llvm_libc::syscall(SYS_rt_sigreturn); }
+
+} // namespace __llvm_libc


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76967.253280.patch
Type: text/x-patch
Size: 1932 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200328/f5a39d0d/attachment.bin>


More information about the libc-commits mailing list