From abc9338d2aadc685bf1fdc42207f309c84f993be Mon Sep 17 00:00:00 2001 From: Lucian Popescu Date: Sat, 3 Oct 2026 14:26:19 +0100 Subject: [PATCH 1/2] Add standard-version ifdefs in rules --- rules/cstddef/src.cpp | 4 ++++ rules/new/src.cpp | 2 ++ rules/string/src.cpp | 2 ++ rules/unique_ptr/src.cpp | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/rules/cstddef/src.cpp b/rules/cstddef/src.cpp index b53725844..aa6fec4f3 100644 --- a/rules/cstddef/src.cpp +++ b/rules/cstddef/src.cpp @@ -4,7 +4,9 @@ #include #include +#if __cplusplus >= 201703L using t1 = std::byte; +#endif typedef size_t t2; typedef size_t *t3; @@ -14,6 +16,7 @@ typedef ssize_t t6; typedef ssize_t *t7; typedef const ssize_t *t8; +#if __cplusplus >= 201703L std::byte f1(const std::byte &a0, unsigned a1) { return operator<<(a0, a1); } std::byte f2(const std::byte &a0, unsigned a1) { return operator>>(a0, a1); } @@ -21,3 +24,4 @@ std::byte f2(const std::byte &a0, unsigned a1) { return operator>>(a0, a1); } std::byte f3(std::byte &a0, unsigned a1) { return operator<<=(a0, a1); } std::byte f4(std::byte &a0, unsigned a1) { return operator>>=(a0, a1); } +#endif diff --git a/rules/new/src.cpp b/rules/new/src.cpp index ea1a12ed0..fe9fd99cc 100644 --- a/rules/new/src.cpp +++ b/rules/new/src.cpp @@ -11,4 +11,6 @@ void *f3(std::size_t a0) { return ::operator new[](a0); } void f4(void *a0) { return ::operator delete[](a0); } +#if __cplusplus >= 201703L template T1 *f5(T1 *a0) { return std::launder(a0); } +#endif diff --git a/rules/string/src.cpp b/rules/string/src.cpp index 276962df8..ea6f3a3a2 100644 --- a/rules/string/src.cpp +++ b/rules/string/src.cpp @@ -23,7 +23,9 @@ std::string &f4(std::string &s, const char *p, std::size_t n) { const char *f5(const std::string &s) { return s.c_str(); } +#if __cplusplus >= 201703L char *f6(std::string &s) { return s.data(); } +#endif std::string f7(const char *s, std::size_t n) { return std::string(s, n); } diff --git a/rules/unique_ptr/src.cpp b/rules/unique_ptr/src.cpp index 8f7c5458a..98cd44181 100644 --- a/rules/unique_ptr/src.cpp +++ b/rules/unique_ptr/src.cpp @@ -9,9 +9,11 @@ template using Init = A; template using t1 = std::unique_ptr; template using t2 = std::unique_ptr; +#if __cplusplus >= 201402L template std::unique_ptr f1(std::size_t n) { return std::make_unique(n); } +#endif template T1 *f2(std::unique_ptr &o) { return o.get(); } @@ -33,10 +35,12 @@ template void f6(std::unique_ptr &o, T1 *p) { template T1 *f7(std::unique_ptr &o) { return o.get(); } +#if __cplusplus >= 201402L template std::unique_ptr f8(Init &&...args) { return std::make_unique(std::forward(args)...); } +#endif template void f9(std::unique_ptr &o) { return o.reset(nullptr); From 0bc4c9f3bc98f6f14ddfcfe6670f4ab37c0fe1bb Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Thu, 8 Oct 2026 12:07:24 +0100 Subject: [PATCH 2/2] fix --- rules/cstddef/src.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/rules/cstddef/src.cpp b/rules/cstddef/src.cpp index 845996ddc..e096a07a7 100644 --- a/rules/cstddef/src.cpp +++ b/rules/cstddef/src.cpp @@ -5,17 +5,7 @@ #if __cplusplus >= 201703L using t1 = std::byte; -#endif - -typedef size_t t2; -typedef size_t *t3; -typedef const size_t *t4; -typedef decltype(sizeof(0)) t5; -typedef ssize_t t6; -typedef ssize_t *t7; -typedef const ssize_t *t8; -#if __cplusplus >= 201703L std::byte f1(const std::byte &a0, unsigned a1) { return operator<<(a0, a1); } std::byte f2(const std::byte &a0, unsigned a1) { return operator>>(a0, a1); }