[libc-commits] [PATCH] D115028: [libc] More resilient arch dependent include selection

Guillaume Chatelet via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Dec 3 01:10:57 PST 2021


gchatelet updated this revision to Diff 391576.
gchatelet added a comment.

- Fix reordered include


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115028/new/

https://reviews.llvm.org/D115028

Files:
  libc/src/string/memory_utils/elements.h
  libc/src/string/memory_utils/elements_aarch64.h
  libc/src/string/memory_utils/elements_x86.h


Index: libc/src/string/memory_utils/elements_x86.h
===================================================================
--- libc/src/string/memory_utils/elements_x86.h
+++ libc/src/string/memory_utils/elements_x86.h
@@ -11,7 +11,9 @@
 
 #include "src/__support/architectures.h"
 
-#if defined(LLVM_LIBC_ARCH_X86)
+#if !defined(LLVM_LIBC_ARCH_X86)
+#error "Invalid include"
+#endif
 
 #include <stddef.h> // size_t
 #include <stdint.h> // uint8_t, uint16_t, uint32_t, uint64_t
@@ -177,6 +179,4 @@
 } // namespace x86
 } // namespace __llvm_libc
 
-#endif // defined(LLVM_LIBC_ARCH_X86)
-
 #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_ELEMENTS_X86_H
Index: libc/src/string/memory_utils/elements_aarch64.h
===================================================================
--- libc/src/string/memory_utils/elements_aarch64.h
+++ libc/src/string/memory_utils/elements_aarch64.h
@@ -11,7 +11,9 @@
 
 #include "src/__support/architectures.h"
 
-#if defined(LLVM_LIBC_ARCH_AARCH64)
+#if !defined(LLVM_LIBC_ARCH_AARCH64)
+#error "Invalid include"
+#endif
 
 #include <src/string/memory_utils/elements.h>
 #include <stddef.h> // size_t
@@ -119,6 +121,4 @@
 } // namespace aarch64
 } // namespace __llvm_libc
 
-#endif // defined(LLVM_LIBC_ARCH_AARCH64)
-
 #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_ELEMENTS_AARCH64_H
Index: libc/src/string/memory_utils/elements.h
===================================================================
--- libc/src/string/memory_utils/elements.h
+++ libc/src/string/memory_utils/elements.h
@@ -657,7 +657,10 @@
 } // namespace scalar
 } // namespace __llvm_libc
 
+#if defined(LLVM_LIBC_ARCH_AARCH64)
 #include <src/string/memory_utils/elements_aarch64.h>
+#elif defined(LLVM_LIBC_ARCH_X86)
 #include <src/string/memory_utils/elements_x86.h>
+#endif
 
 #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_ELEMENTS_H


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115028.391576.patch
Type: text/x-patch
Size: 1830 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20211203/b54354ee/attachment.bin>


More information about the libc-commits mailing list