[libcxx-commits] [libcxx] [libc++] Fix missing and incorrect push/pop macros (PR #79204)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 23 14:55:08 PST 2024
================
@@ -162,4 +163,25 @@
#define refresh SYSTEM_RESERVED_NAME
#include <{header}>
+
+// Note: We can't include test_macros.h in this test so we use the libc++ version macro.
+#ifndef _LIBCPP_CXX03_LANG
+
+# define STRINGIFY_IMPL(x) #x
+# define STRINGIFY(x) STRINGIFY_IMPL(x)
+
+// This is written to work in C++11 constexpr rules
+static constexpr bool is_equal(char const* s1, char const* s2) {{
+ return s1[0] == 0 && s2[0] == 0 ? true : // Either both are at the end, or
+ s1[0] != 0 && s2[0] != 0 && // neither is at the end, and
+ s1[0] == s2[0] && is_equal(s1 + 1, s2 + 1); // their contents are equal
+}}
----------------
philnik777 wrote:
Can't we just do `return __builtin_strcmp(s1, s2)`, since this is libc++-internal anyways?
https://github.com/llvm/llvm-project/pull/79204
More information about the libcxx-commits
mailing list