[libcxx-commits] [libcxx] [libc++] Fix missing and incorrect push/pop macros (PR #79204)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jan 24 05:59:29 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
+}}
----------------
ldionne wrote:
Great point, I can actually support C++03 that way. Done.
https://github.com/llvm/llvm-project/pull/79204
More information about the libcxx-commits
mailing list