[libc] [llvm] [libc] Remove obsolete LIBC_HAS_BUILTIN macro (PR #86554)

Guillaume Chatelet via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 27 07:06:25 PDT 2024


================
@@ -10,16 +10,16 @@
 #define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_GENERIC_BUILTIN_H
 
 #include "src/__support/macros/attributes.h" // LIBC_INLINE
-#include "src/__support/macros/config.h"     // LIBC_HAS_BUILTIN
 #include "src/string/memory_utils/utils.h"   // Ptr, CPtr
 
 #include <stddef.h> // size_t
 
 namespace LIBC_NAMESPACE {
 
-static_assert(LIBC_HAS_BUILTIN(__builtin_memcpy), "Builtin not defined");
-static_assert(LIBC_HAS_BUILTIN(__builtin_memset), "Builtin not defined");
-static_assert(LIBC_HAS_BUILTIN(__builtin_memmove), "Builtin not defined");
+#if !__has_builtin(__builtin_memcpy) || !__has_builtin(__builtin_memset) ||    \
+    !__has_builtin(__builtin_memmove)
+#error "Builtin not defined");
+#endif
----------------
gchatelet wrote:

I'd prefer C++ rather than preprocessor here as well.
```
static_assert(__has_builtin(__builtin_memcpy), "Builtin not defined");
static_assert(__has_builtin(__builtin_memset), "Builtin not defined");
static_assert(__has_builtin(__builtin_memmove), "Builtin not defined");
```

https://github.com/llvm/llvm-project/pull/86554


More information about the llvm-commits mailing list