include/rtl/string.hxx | 10 +++++----- include/rtl/ustring.hxx | 8 ++++---- include/unotools/weakref.hxx | 2 +- sal/qa/rtl/strings/test_ostring_stringliterals.cxx | 7 +------ sal/qa/rtl/strings/test_oustring_stringliterals.cxx | 11 +++-------- sc/qa/unit/ucalc_formula2.cxx | 10 +--------- vcl/unx/gtk3/customcellrenderer.cxx | 6 ++---- 7 files changed, 17 insertions(+), 37 deletions(-)
New commits: commit 5a40abc86b94c0be5b4a252c6ab5b0b0df6e520d Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Sun Sep 24 12:16:36 2023 +0300 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Fri Sep 29 16:45:08 2023 +0200 Drop some newly obsolete __cplusplus version checks ...after 1eef07805021b7ca26a1a8894809b6d995747ba1 "Bump baseline to C++20". Which revealed that at least for VS 2019 16.11.30 (but not for at least VS 2022 17.7.4), in /clr mode (e.g., when compiling cli_ure/source/climaker/climaker_app.cxx), the -std:c++20 is effectively ignored, and compilation of such source files failed with > include\rtl/string.hxx(191): error C2955: 'rtl::OStringLiteral': use of class template requires template argument list > include\rtl/string.hxx(88): note: see declaration of 'rtl::OStringLiteral' > include\rtl/string.hxx(191): error C7592: a non-type template-parameter of type 'rtl::OStringLiteral' requires at least '/std:c++20' > include\rtl/string.hxx(397): error C2955: 'rtl::OStringLiteral': use of class template requires template argument list > include\rtl/string.hxx(88): note: see declaration of 'rtl::OStringLiteral' etc. To work around that, keep the 27d1f3ac016d77d3c907cebedca558308f366855 "O[U]String literals (unusable for now, C++20 only)" functionality disabled when compiling /clr sources (i.e., where _MANAGED is defined) for that old compiler. Change-Id: If62ceef5f8e55a828b880f197111fe387e4953fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157205 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx index eb7f137a203c..72b046e26a0b 100644 --- a/include/rtl/string.hxx +++ b/include/rtl/string.hxx @@ -186,7 +186,7 @@ private: rtl_String* pData; }; -#if __cplusplus >= 202002L +#if !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED) namespace detail { @@ -396,7 +396,7 @@ public: /// @endcond #endif -#if defined LIBO_INTERNAL_ONLY && __cplusplus >= 202002L +#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED) // For operator ""_tstr: template<OStringLiteral L> constexpr OString(detail::OStringHolder<L> const & holder): pData(const_cast<rtl_String *>(&holder.literal.str)) {} @@ -472,12 +472,12 @@ public: /** Release the string data. */ -#if defined LIBO_INTERNAL_ONLY && __cplusplus >= 202002L +#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED) constexpr #endif ~OString() { -#if defined LIBO_INTERNAL_ONLY && __cplusplus >= 202002L +#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED) if (std::is_constant_evaluated()) { //TODO: We would want to // @@ -2393,7 +2393,7 @@ using ::rtl::OStringHash; using ::rtl::OStringLiteral; #endif -#if defined LIBO_INTERNAL_ONLY && __cplusplus >= 202002L +#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED) template< #if defined RTL_STRING_UNITTEST diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index 34d4fd8f5be5..764ad026bdff 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -440,7 +440,7 @@ public: /// @endcond #endif -#if defined LIBO_INTERNAL_ONLY && __cplusplus >= 202002L +#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED) // For operator ""_tstr: template<OStringLiteral L> OUString(detail::OStringHolder<L> const & holder) { pData = nullptr; @@ -545,12 +545,12 @@ public: /** Release the string data. */ -#if defined LIBO_INTERNAL_ONLY && __cplusplus >= 202002L +#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED) constexpr #endif ~OUString() { -#if defined LIBO_INTERNAL_ONLY && __cplusplus >= 202002L +#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED) if (std::is_constant_evaluated()) { //TODO: We would want to // @@ -3590,7 +3590,7 @@ using ::rtl::OUStringChar; using ::rtl::Concat2View; #endif -#if defined LIBO_INTERNAL_ONLY && __cplusplus >= 202002L +#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED) template< #if defined RTL_STRING_UNITTEST diff --git a/include/unotools/weakref.hxx b/include/unotools/weakref.hxx index 14ee6d424f62..0cab7d0e9b2a 100644 --- a/include/unotools/weakref.hxx +++ b/include/unotools/weakref.hxx @@ -115,7 +115,7 @@ public: @return hard reference or null, if the weakly referenced interface has gone */ rtl::Reference<interface_type> SAL_CALL get() const -#if __cplusplus >= 202002L && !(defined __clang__ && __clang_major__ <= 15) +#if !(defined __clang__ && __clang_major__ <= 15) requires(!cppu::detail::isUnoInterfaceType<interface_type>) #endif { diff --git a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx index 1017106e2800..28755316ed8f 100644 --- a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx +++ b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx @@ -119,10 +119,7 @@ void test::ostring::StringLiterals::testcall( const char str[] ) void test::ostring::StringLiterals::checkConstexprCtor() { -#if __cplusplus >= 202002L - static constinit -#endif - rtl::OString s(dummy); + static constinit rtl::OString s(dummy); CPPUNIT_ASSERT_EQUAL(oslInterlockedCount(0x40000000), s.pData->refCount); // SAL_STRING_STATIC_FLAG (sal/rtl/strimp.hxx) CPPUNIT_ASSERT_EQUAL(sal_Int32(5), s.getLength()); @@ -276,14 +273,12 @@ void test::ostring::StringLiterals::checkBuffer() } void test::ostring::StringLiterals::checkOstr() { -#if __cplusplus >= 202002L CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ""_ostr.getLength()); CPPUNIT_ASSERT_EQUAL(sal_Int32(6), "foobar"_ostr.getLength()); CPPUNIT_ASSERT_EQUAL(sal_Int32(7), "foo\0bar"_ostr.getLength()); CPPUNIT_ASSERT_EQUAL(""_ostr, rtl::OString(""_tstr)); CPPUNIT_ASSERT_EQUAL("foobar"_ostr, rtl::OString("foobar"_tstr)); CPPUNIT_ASSERT_EQUAL("foo\0bar"_ostr, rtl::OString("foo\0bar"_tstr)); -#endif } #undef CONST_CTOR_USED diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx index d530e2e65a18..a7041c75959b 100644 --- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx +++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx @@ -122,10 +122,7 @@ void test::oustring::StringLiterals::testcall( const char str[] ) void test::oustring::StringLiterals::checkConstexprCtor() { -#if __cplusplus >= 202002L - static constinit -#endif - rtl::OUString s(dummy); + static constinit rtl::OUString s(dummy); CPPUNIT_ASSERT_EQUAL(oslInterlockedCount(0x40000000), s.pData->refCount); // SAL_STRING_STATIC_FLAG (sal/rtl/strimp.hxx) CPPUNIT_ASSERT_EQUAL(sal_Int32(5), s.getLength()); @@ -417,13 +414,13 @@ void test::oustring::StringLiterals::checkEmbeddedNul() { CPPUNIT_ASSERT(s.startsWith(a)); CPPUNIT_ASSERT(s.startsWith(p)); CPPUNIT_ASSERT(s.startsWith(u"foo\0hidden")); - // For Clang against libstdc++ with C++20 and greater, this would hit not-yet-fixed + // For Clang against libstdc++, this would hit not-yet-fixed // <https://github.com/llvm/llvm-project/issues/24502> "eagerly-instantiated entities whose // templates are defined after the first point of instantiation don't get instantiated at all" // (see the mailing list thread starting at // <https://gcc.gnu.org/pipermail/libstdc++/2021-November/053548.html> "std::basic_string<_Tp> // constructor point of instantiation woes?"): -#if !(defined __clang__ && defined __GLIBCXX__ && __cplusplus >= 202002L) +#if !(defined __clang__ && defined __GLIBCXX__) CPPUNIT_ASSERT(!s.startsWith(u"foo\0hidden"s)); #endif CPPUNIT_ASSERT(!s.startsWith(u"foo\0hidden"sv)); @@ -434,7 +431,6 @@ void test::oustring::StringLiterals::checkEmbeddedNul() { } void test::oustring::StringLiterals::checkOstr() { -#if __cplusplus >= 202002L CPPUNIT_ASSERT_EQUAL(sal_Int32(0), u""_ustr.getLength()); CPPUNIT_ASSERT_EQUAL(sal_Int32(6), u"foobar"_ustr.getLength()); CPPUNIT_ASSERT_EQUAL(sal_Int32(7), u"foo\0bar"_ustr.getLength()); @@ -443,7 +439,6 @@ void test::oustring::StringLiterals::checkOstr() { // Unlike in a OString context, the below "foo\0bar"_tstr in a OUString context would trigger // the assert(c!='\0') in Copy in sal/rtl/strtmpl.hxx: // CPPUNIT_ASSERT_EQUAL(u"foo\0bar"_ustr, rtl::OUString("foo\0bar"_tstr)); -#endif } } // namespace diff --git a/sc/qa/unit/ucalc_formula2.cxx b/sc/qa/unit/ucalc_formula2.cxx index 3b068348685a..eb0a38b38c47 100644 --- a/sc/qa/unit/ucalc_formula2.cxx +++ b/sc/qa/unit/ucalc_formula2.cxx @@ -3632,15 +3632,7 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testTdf97369) auto lExpectedinE = [=](SCROW) { return SHIFT1 + SHIFT2; }; columnTest(4, "=SUM(A$1:C$1)", lExpectedinE); - auto lExpectedinF = - [ -#if defined _MSC_VER && !defined __clang__ && __cplusplus <= 201703L - // see <https://developercommunity2.visualstudio.com/t/ - // Lambdas-require-capturing-constant-value/907628> "Lambdas require capturing constant - // values" - ROW_RANGE -#endif - ](SCROW n) { return ((2 * n + 1 - ROW_RANGE) * ROW_RANGE) / 2.0; }; + auto lExpectedinF = [](SCROW n) { return ((2 * n + 1 - ROW_RANGE) * ROW_RANGE) / 2.0; }; columnTest(5, "=SUM(A1:A10)", lExpectedinF); auto lExpectedinG = [](SCROW n) { return ((n + 1) * n) / 2.0; }; diff --git a/vcl/unx/gtk3/customcellrenderer.cxx b/vcl/unx/gtk3/customcellrenderer.cxx index 7632c7641538..a6559f99ce99 100644 --- a/vcl/unx/gtk3/customcellrenderer.cxx +++ b/vcl/unx/gtk3/customcellrenderer.cxx @@ -26,14 +26,12 @@ enum }; } -#if defined __clang__ && __cplusplus >= 202002L && GLIB_MAJOR_VERSION == 2 \ - && GLIB_MINOR_VERSION < 68 +#if defined __clang__ && GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 68 #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-volatile" #endif G_DEFINE_TYPE(CustomCellRenderer, custom_cell_renderer, GTK_TYPE_CELL_RENDERER_TEXT) -#if defined __clang__ && __cplusplus >= 202002L && GLIB_MAJOR_VERSION == 2 \ - && GLIB_MINOR_VERSION < 68 +#if defined __clang__ && GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 68 #pragma clang diagnostic pop #endif