commit f5dbc5392dde3045eb1424fb5fbade6fe9f297bc Author: Dimitry Andric Date: 2026-02-25T20:21:07+01:00 devel/catch: fix build with clang 21 With clang 21 devel/catch fails to build, with errors similar to: /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_stringref.h:95:32: error: identifier '_sr' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator] 95 | constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { | ~~~~~~~~~~~~^~~ | operator""_sr /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/include/internal/catch_stringref.h:100:28: error: identifier '_catch_sr' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator] 100 | constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { | ~~~~~~~~~~~~^~~~~~~~~ | operator""_catch_sr /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/projects/SelfTest/IntrospectiveTests/String.tests.cpp:144:33: error: identifier '_sr' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator] 144 | using Catch::operator"" _sr; | ~~~~~~~~~~~^~~ | operator""_sr and later: /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/projects/SelfTest/UsageTests/ToStringVariant.tests.cpp:13:14: error: function 'operator=' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn] 13 | MyType1& operator=(MyType1 const&) { throw 3; } | ^ /wrkdirs/usr/ports/devel/catch/work/Catch2-2.13.10/projects/SelfTest/UsageTests/ToStringVariant.tests.cpp:18:14: error: function 'operator=' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn] 18 | MyType2& operator=(MyType2 const&) { throw 4; } | ^ The former can be fixed by removing the space between the identifier and the double quotes, the latter by declaring the functions with [[noreturn]]. PR: 293446 MFH: 2026Q1 diff --git a/devel/catch/files/patch-include_internal_catch__approx.cpp b/devel/catch/files/patch-include_internal_catch__approx.cpp new file mode 100644 index 000000000000..a552a75312a2 --- /dev/null +++ b/devel/catch/files/patch-include_internal_catch__approx.cpp @@ -0,0 +1,15 @@ +--- include/internal/catch_approx.cpp.orig 2022-10-16 09:02:17 UTC ++++ include/internal/catch_approx.cpp +@@ -73,10 +73,10 @@ namespace literals { + } // end namespace Detail + + namespace literals { +- Detail::Approx operator "" _a(long double val) { ++ Detail::Approx operator ""_a(long double val) { + return Detail::Approx(val); + } +- Detail::Approx operator "" _a(unsigned long long val) { ++ Detail::Approx operator ""_a(unsigned long long val) { + return Detail::Approx(val); + } + } // end namespace literals diff --git a/devel/catch/files/patch-include_internal_catch__approx.h b/devel/catch/files/patch-include_internal_catch__approx.h new file mode 100644 index 000000000000..4ac587fd402d --- /dev/null +++ b/devel/catch/files/patch-include_internal_catch__approx.h @@ -0,0 +1,13 @@ +--- include/internal/catch_approx.h.orig 2022-10-16 09:02:17 UTC ++++ include/internal/catch_approx.h +@@ -118,8 +118,8 @@ namespace literals { + } // end namespace Detail + + namespace literals { +- Detail::Approx operator "" _a(long double val); +- Detail::Approx operator "" _a(unsigned long long val); ++ Detail::Approx operator ""_a(long double val); ++ Detail::Approx operator ""_a(unsigned long long val); + } // end namespace literals + + template<> diff --git a/devel/catch/files/patch-include_internal_catch__stringref.h b/devel/catch/files/patch-include_internal_catch__stringref.h new file mode 100644 index 000000000000..cf80b6057a02 --- /dev/null +++ b/devel/catch/files/patch-include_internal_catch__stringref.h @@ -0,0 +1,17 @@ +--- include/internal/catch_stringref.h.orig 2022-10-16 09:02:17 UTC ++++ include/internal/catch_stringref.h +@@ -92,12 +92,12 @@ namespace Catch { + auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; + + +- constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { ++ constexpr auto operator ""_sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { + return StringRef( rawChars, size ); + } + } // namespace Catch + +-constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { ++constexpr auto operator ""_catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { + return Catch::StringRef( rawChars, size ); + } + diff --git a/devel/catch/files/patch-projects_SelfTest_IntrospectiveTests_String.tests.cpp b/devel/catch/files/patch-projects_SelfTest_IntrospectiveTests_String.tests.cpp new file mode 100644 index 000000000000..34e1af72ce42 --- /dev/null +++ b/devel/catch/files/patch-projects_SelfTest_IntrospectiveTests_String.tests.cpp @@ -0,0 +1,11 @@ +--- projects/SelfTest/IntrospectiveTests/String.tests.cpp.orig 2022-10-16 09:02:17 UTC ++++ projects/SelfTest/IntrospectiveTests/String.tests.cpp +@@ -141,7 +141,7 @@ TEST_CASE("StringRef at compilation time", "[Strings][ + STATIC_REQUIRE(sr1.size() == 3); + STATIC_REQUIRE(sr1.isNullTerminated()); + +- using Catch::operator"" _sr; ++ using Catch::operator""_sr; + constexpr auto sr2 = ""_sr; + STATIC_REQUIRE(sr2.empty()); + STATIC_REQUIRE(sr2.size() == 0); diff --git a/devel/catch/files/patch-projects_SelfTest_UsageTests_ToStringVariant.tests.cpp b/devel/catch/files/patch-projects_SelfTest_UsageTests_ToStringVariant.tests.cpp new file mode 100644 index 000000000000..7da71b26f779 --- /dev/null +++ b/devel/catch/files/patch-projects_SelfTest_UsageTests_ToStringVariant.tests.cpp @@ -0,0 +1,17 @@ +--- projects/SelfTest/UsageTests/ToStringVariant.tests.cpp.orig 2022-10-16 09:02:17 UTC ++++ projects/SelfTest/UsageTests/ToStringVariant.tests.cpp +@@ -10,12 +10,12 @@ struct MyType1 { + struct MyType1 { + MyType1() = default; + [[noreturn]] MyType1(MyType1 const&) { throw 1; } +- MyType1& operator=(MyType1 const&) { throw 3; } ++ [[noreturn]] MyType1& operator=(MyType1 const&) { throw 3; } + }; + struct MyType2 { + MyType2() = default; + [[noreturn]] MyType2(MyType2 const&) { throw 2; } +- MyType2& operator=(MyType2 const&) { throw 4; } ++ [[noreturn]] MyType2& operator=(MyType2 const&) { throw 4; } + }; + + TEST_CASE( "variant", "[toString][variant][approvals]")